|
1 | 1 | description = "Spring Aspects"
|
2 | 2 |
|
3 |
| -// Redefine the compileJava and compileTestJava tasks in order to compile sources with ajc instead of javac |
| 3 | +apply plugin: "io.freefair.aspectj" |
4 | 4 |
|
5 |
| -configurations { |
6 |
| - rt |
7 |
| - ajc |
8 |
| - aspects |
9 |
| - ajInpath |
10 |
| -} |
11 |
| - |
12 |
| -compileJava { |
13 |
| - actions = [] |
14 |
| - dependsOn configurations.ajc.getTaskDependencyFromProjectDependency(true, "compileJava") |
15 |
| - |
16 |
| - def outputDir = project.sourceSets.main.java.outputDir |
17 |
| - inputs.files(project.sourceSets.main.allSource + project.sourceSets.main.compileClasspath) |
18 |
| - outputs.dir outputDir |
19 |
| - |
20 |
| - sourceCompatibility = 1.8 // fixed even when general compatibility level set to e.g. 10 |
21 |
| - targetCompatibility = 1.8 |
22 |
| - |
23 |
| - doLast{ |
24 |
| - // Assemble runtime classpath from folders and JARs that actually exist |
25 |
| - def runtimeClasspath = project.files(sourceSets.main.runtimeClasspath.files.findAll({ it.exists() })) |
26 |
| - |
27 |
| - ant.taskdef(resource: "org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties", |
28 |
| - classpath: configurations.ajc.asPath) |
29 |
| - |
30 |
| - ant.iajc(source: sourceCompatibility, target: targetCompatibility, |
31 |
| - maxmem: "1024m", fork: "true", Xlint: "ignore", |
32 |
| - destDir: outputDir.absolutePath, |
33 |
| - aspectPath: configurations.aspects.asPath, |
34 |
| - inpath: configurations.ajInpath.asPath, |
35 |
| - sourceRootCopyFilter: "**/*.java,**/*.aj", |
36 |
| - classpath: (runtimeClasspath + configurations.rt).asPath) { |
37 |
| - sourceroots { |
38 |
| - sourceSets.main.java.srcDirs.each { |
39 |
| - pathelement(location:it.absolutePath) |
40 |
| - } |
41 |
| - } |
42 |
| - } |
43 |
| - } |
44 |
| -} |
45 |
| - |
46 |
| -compileTestJava { |
47 |
| - actions = [] |
48 |
| - dependsOn configurations.ajc.getTaskDependencyFromProjectDependency(true, "compileTestJava") |
49 |
| - dependsOn jar |
50 |
| - |
51 |
| - def outputDir = project.sourceSets.test.java.outputDir |
52 |
| - inputs.files(project.sourceSets.test.allSource + project.sourceSets.test.compileClasspath) |
53 |
| - outputs.dir outputDir |
54 |
| - |
55 |
| - sourceCompatibility = 1.8 // fixed even when general compatibility level set to e.g. 10 |
56 |
| - targetCompatibility = 1.8 |
| 5 | +sourceSets.main.aspectj.srcDir "src/main/java" |
| 6 | +sourceSets.main.java.srcDirs = files() |
57 | 7 |
|
58 |
| - doLast{ |
59 |
| - // Assemble runtime classpath from folders and JARs that actually exist |
60 |
| - def runtimeClasspath = project.files(sourceSets.test.runtimeClasspath.files.findAll({ it.exists() })) |
61 |
| - |
62 |
| - ant.taskdef(resource: "org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties", |
63 |
| - classpath: configurations.ajc.asPath) |
64 |
| - |
65 |
| - ant.iajc(source: sourceCompatibility, target: targetCompatibility, |
66 |
| - maxmem: "1024m", fork: "true", Xlint: "ignore", |
67 |
| - destDir: outputDir.absolutePath, |
68 |
| - aspectPath: jar.archivePath, |
69 |
| - inpath: configurations.ajInpath.asPath, |
70 |
| - classpath: (runtimeClasspath + project.files(jar.archivePath) + configurations.rt).asPath) { |
71 |
| - sourceroots { |
72 |
| - sourceSets.test.java.srcDirs.each { |
73 |
| - pathelement(location:it.absolutePath) |
74 |
| - } |
75 |
| - } |
76 |
| - } |
77 |
| - } |
78 |
| -} |
| 8 | +sourceSets.test.aspectj.srcDir "src/test/java" |
| 9 | +sourceSets.test.java.srcDirs = files() |
79 | 10 |
|
| 11 | +aspectj.version = aspectjVersion |
80 | 12 |
|
81 | 13 | dependencies {
|
82 |
| - aspects(project(":spring-orm")) |
83 |
| - ajc("org.aspectj:aspectjtools:${aspectjVersion}") |
84 |
| - rt("org.aspectj:aspectjrt:${aspectjVersion}") |
85 |
| - compile("org.aspectj:aspectjweaver:${aspectjVersion}") |
| 14 | + aspect(project(":spring-orm")) |
| 15 | + compile("org.aspectj:aspectjrt:${aspectjVersion}") |
86 | 16 | optional(project(":spring-aop")) // for @Async support
|
87 | 17 | optional(project(":spring-beans")) // for @Configurable support
|
88 | 18 | optional(project(":spring-context")) // for @Enable* support
|
|
0 commit comments