File: aspects.gradle

package info (click to toggle)
libspring-java 4.3.30-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 65,736 kB
  • sloc: java: 566,974; xml: 13,706; sql: 2,313; sh: 87; ruby: 75; jsp: 33; makefile: 29; javascript: 11; python: 4
file content (70 lines) | stat: -rw-r--r-- 2,335 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Redefine the compileJava and compileTestJava tasks in order to compile sources with ajc instead of javac

configurations {
	rt
	ajc
	aspects
	ajInpath
}

compileJava  {
	actions = []
	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

	doLast{
		// Assemble runtime classpath from folders and JARs that actually exist
		def runtimeClasspath = project.files(sourceSets.main.runtimeClasspath.files.findAll({ it.exists() }))

		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,**/*.aj",
				classpath: (runtimeClasspath + configurations.rt).asPath) {
			sourceroots {
				sourceSets.main.java.srcDirs.each {
					pathelement(location:it.absolutePath)
				}
			}
		}
	}
}

compileTestJava  {
	actions = []
	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

	doLast{
		// Assemble runtime classpath from folders and JARs that actually exist
		def runtimeClasspath = project.files(sourceSets.test.runtimeClasspath.files.findAll({ it.exists() }))

		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: (runtimeClasspath + project.files(jar.archivePath) + configurations.rt).asPath) {
			sourceroots {
				sourceSets.test.java.srcDirs.each {
					pathelement(location:it.absolutePath)
				}
			}
		}
	}
}