Skip to content

Commit

Permalink
Move project-specific settings to the corresponding build.gradle files
Browse files Browse the repository at this point in the history
  • Loading branch information
amaembo committed Mar 19, 2021
1 parent e1f9f35 commit 45c6497
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 80 deletions.
78 changes: 0 additions & 78 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,29 +47,6 @@ subprojects {
project(':java5').archivesBaseName = 'annotations-java5'
project(':java8').archivesBaseName = 'annotations'

def jdk5Home = System.getenv("JDK_5")
if (hasProperty("JDK_5")) {
jdk5Home = JDK_5
}
if (jdk5Home == null) {
throw new GradleException('JDK_5 environment variable is not defined. It must point to any JDK that ' +
'is capable to compile with Java 5 target (Any JDK version from 1.5 to 1.8)')
}

configure(project(':module-info')) {
dependencies {
compile project(':common')
}

compileJava {
// Without common sources, compiler complains that exported packages don't exist
source = [sourceSets.main.java, project(':common').sourceSets.main.java]
}

task mainJar(type: Jar) {
}
}

configure([project(':java5'), project(':java8')]) {
dependencies {
compile project(':module-info')
Expand Down Expand Up @@ -161,59 +138,4 @@ configure([project(':java5'), project(':java8')]) {
}
}
}

}

configure(project(':java5')) {
def generatedSourcesDir = "${buildDir}/generated/"

sourceSets {
generated {
java.srcDir generatedSourcesDir
}
}

task generateSrc(type: Copy) {
from project(':common').sourceSets.main.java
into generatedSourcesDir
filter { line -> line.replaceAll(", ElementType.TYPE_USE", "")}
}

compileJava {
options.fork = true
options.forkOptions.executable = "$jdk5Home/bin/javac"
dependsOn(generateSrc)
source sourceSets.generated.java
}

mainJar {
from sourceSets.main.output
}

sourceJar {
dependsOn(generateSrc)
from sourceSets.generated.java
}

javadoc {
source = [sourceSets.generated.java]
}
}

configure(project(':java8')) {

mainJar {
from sourceSets.main.output
from project(':common').sourceSets.main.output
}

sourceJar {
from sourceSets.main.java
from project(':common').sourceSets.main.java
}

javadoc {
source = [sourceSets.main.java, project(':common').sourceSets.main.java]
}
}

45 changes: 44 additions & 1 deletion java5/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2020 JetBrains s.r.o.
* Copyright 2000-2021 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,3 +16,46 @@

sourceCompatibility = 1.5

def jdk5Home = System.getenv("JDK_5")
if (hasProperty("JDK_5")) {
jdk5Home = JDK_5
}
if (jdk5Home == null) {
throw new GradleException('JDK_5 environment variable is not defined. It must point to any JDK that ' +
'is capable to compile with Java 5 target (Any JDK version from 1.5 to 1.8)')
}

def generatedSourcesDir = "${buildDir}/generated/"

sourceSets {
generated {
java.srcDir generatedSourcesDir
}
}

task generateSrc(type: Copy) {
from project(':common').sourceSets.main.java
into generatedSourcesDir
filter { line -> line.replaceAll(", ElementType.TYPE_USE", "")}
}

compileJava {
options.fork = true
options.forkOptions.executable = "$jdk5Home/bin/javac"
dependsOn(generateSrc)
source sourceSets.generated.java
}

mainJar {
from sourceSets.main.output
}

sourceJar {
dependsOn(generateSrc)
from sourceSets.generated.java
}

javadoc {
source = [sourceSets.generated.java]
}

16 changes: 15 additions & 1 deletion java8/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2020 JetBrains s.r.o.
* Copyright 2000-2021 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,3 +15,17 @@
*/

sourceCompatibility = 1.8

mainJar {
from sourceSets.main.output
from project(':common').sourceSets.main.output
}

sourceJar {
from sourceSets.main.java
from project(':common').sourceSets.main.java
}

javadoc {
source = [sourceSets.main.java, project(':common').sourceSets.main.java]
}
12 changes: 12 additions & 0 deletions module-info/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,15 @@
*/

sourceCompatibility = 1.9

dependencies {
compile project(':common')
}

compileJava {
// Without common sources, compiler complains that exported packages don't exist
source = [sourceSets.main.java, project(':common').sourceSets.main.java]
}

task mainJar(type: Jar) {
}

0 comments on commit 45c6497

Please sign in to comment.