Previously aspects.gradle used the Gradle conventions for the source and target compatibility. This means that unless the conventions were updated the current JDK would be used for both source and target compatibilty. Since an update to build.gradle changed to configure the compileJava and compileTestJava tasks explicitly spring-aspects has been compiled with JDK 7 compatibility. This commit explicitly uses the source and target compatibility from spring-core to ensure that aspects.gradle is kept up to date. Issue: SPR-10161
79 lines
2.6 KiB
Groovy
79 lines
2.6 KiB
Groovy
// redefine the compileJava and compileTestJava tasks in order to
|
|
// compile sources with ajc instead of javac
|
|
|
|
configurations {
|
|
rt
|
|
ajc
|
|
aspects
|
|
ajInpath
|
|
}
|
|
|
|
// exclude spring-aspects as a module within IDEA until IDEA-64446 is resolved
|
|
tasks.getByName("idea").onlyIf { false }
|
|
tasks.getByName("ideaModule").onlyIf { false }
|
|
|
|
task compileJava(overwrite: true) {
|
|
dependsOn JavaPlugin.PROCESS_RESOURCES_TASK_NAME
|
|
dependsOn configurations.ajc.getTaskDependencyFromProjectDependency(true, "compileJava")
|
|
|
|
def outputDir = project.sourceSets.main.output.classesDir
|
|
|
|
inputs.files(project.sourceSets.main.allSource + project.sourceSets.main.compileClasspath)
|
|
outputs.dir outputDir
|
|
|
|
ext.sourceCompatibility = project(":spring-core").compileJava.sourceCompatibility
|
|
ext.targetCompatibility = project(":spring-core").compileJava.targetCompatibility
|
|
|
|
doLast{
|
|
ant.taskdef(resource: "org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties",
|
|
classpath: configurations.ajc.asPath)
|
|
|
|
ant.iajc(source: sourceCompatibility, target: targetCompatibility,
|
|
maxmem: "1024m", fork: "true", Xlint: "ignore",
|
|
destDir: outputDir.absolutePath,
|
|
aspectPath: configurations.aspects.asPath,
|
|
inpath: configurations.ajInpath.asPath,
|
|
sourceRootCopyFilter: "**/*.java",
|
|
classpath: (sourceSets.main.runtimeClasspath + configurations.rt).asPath) {
|
|
sourceroots {
|
|
sourceSets.main.java.srcDirs.each {
|
|
pathelement(location:it.absolutePath)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
task compileTestJava(overwrite: true) {
|
|
dependsOn JavaPlugin.PROCESS_TEST_RESOURCES_TASK_NAME
|
|
dependsOn configurations.ajc.getTaskDependencyFromProjectDependency(true, "compileTestJava")
|
|
dependsOn jar
|
|
|
|
def outputDir = project.sourceSets.test.output.classesDir
|
|
|
|
inputs.files(project.sourceSets.test.allSource + project.sourceSets.test.compileClasspath)
|
|
outputs.dir outputDir
|
|
|
|
ext.sourceCompatibility = project(":spring-core").compileTestJava.sourceCompatibility
|
|
ext.targetCompatibility = project(":spring-core").compileTestJava.targetCompatibility
|
|
|
|
doLast{
|
|
ant.taskdef(resource: "org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties",
|
|
classpath: configurations.ajc.asPath)
|
|
|
|
ant.iajc(source: sourceCompatibility, target: targetCompatibility,
|
|
maxmem: "1024m", fork: "true", Xlint: "ignore",
|
|
destDir: outputDir.absolutePath,
|
|
aspectPath: jar.archivePath,
|
|
inpath: configurations.ajInpath.asPath,
|
|
classpath: sourceSets.test.runtimeClasspath.asPath + jar.archivePath +
|
|
System.getProperty("path.separator") + configurations.rt.asPath) {
|
|
sourceroots {
|
|
sourceSets.test.java.srcDirs.each {
|
|
pathelement(location:it.absolutePath)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|