Working Java8 build!
- Split the AspectJ testcode out of the general testdata project. - Adjusted tests to handle that JDT produces different code to AspectJ. - Modified some tests to work better with javac compiled testdata (which is what happens when building on the command line or build machine)
This commit is contained in:
9
testdata-aspectj/.classpath
Normal file
9
testdata-aspectj/.classpath
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="lib" path="/springloaded/lib/asm-3.2.jar"/>
|
||||
<classpathentry kind="lib" path="/springloaded/lib/asm-tree-3.2.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
18
testdata-aspectj/.project
Normal file
18
testdata-aspectj/.project
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>testdata-aspectj</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.ajdt.core.ajbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.ajdt.ui.ajnature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
40
testdata-aspectj/build.gradle
Normal file
40
testdata-aspectj/build.gradle
Normal file
@@ -0,0 +1,40 @@
|
||||
def aspectjVersion = "1.8.0.M1"
|
||||
|
||||
configurations {
|
||||
aspects
|
||||
ajInpath
|
||||
}
|
||||
|
||||
dependencies {
|
||||
tools "org.aspectj:aspectjtools:$aspectjVersion"
|
||||
compile "org.aspectj:aspectjrt:$aspectjVersion"
|
||||
compile("cglib:cglib:2.2.2") { exclude group: 'asm' } // cglib 2.2.2 depends on asm 3.3
|
||||
compile 'org.ow2.asm:asm:5.0_BETA'
|
||||
compile 'org.ow2.asm:asm-tree:5.0_BETA'
|
||||
compile files("code.jar")
|
||||
}
|
||||
|
||||
compileJava.deleteAllActions()
|
||||
|
||||
task aspectJ(dependsOn: JavaPlugin.PROCESS_RESOURCES_TASK_NAME) {
|
||||
dependsOn configurations.tools.getTaskDependencyFromProjectDependency(true, "compileJava")
|
||||
def srcDirs = sourceSets.main.java.srcDirs
|
||||
srcDirs.each { inputs.dir it }
|
||||
def destDir = sourceSets.main.output.classesDir
|
||||
outputs.dir destDir
|
||||
doLast {
|
||||
ant.taskdef(resource: "org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties", classpath: configurations.tools.asPath)
|
||||
|
||||
ant.iajc(source:sourceCompatibility, target:targetCompatibility, destDir: destDir.absolutePath, maxmem:"512m", fork:"true",
|
||||
aspectPath: configurations.aspects.asPath, inpath:configurations.ajInpath.asPath, sourceRootCopyFilter:"**/.svn/*,**/*.java",classpath:configurations.compile.asPath ){
|
||||
sourceroots {
|
||||
srcDirs.each {
|
||||
if (it.exists()) pathelement location: it.absolutePath
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
compileJava.dependsOn aspectJ
|
||||
|
||||
13
testdata-aspectj/src/main/java/data/AnAspect.java
Normal file
13
testdata-aspectj/src/main/java/data/AnAspect.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package data;
|
||||
|
||||
public aspect AnAspect {
|
||||
|
||||
before(): execution(!static * AspectReceiver.*(..)) {
|
||||
System.out.println("Foo");
|
||||
}
|
||||
|
||||
pointcut boo(String foo,String bar): execution(* *(..)) && args(foo,bar);
|
||||
before(String foo): boo(foo,*) {
|
||||
|
||||
}
|
||||
}
|
||||
15
testdata-aspectj/src/main/java/data/AspectReceiver.java
Normal file
15
testdata-aspectj/src/main/java/data/AspectReceiver.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package data;
|
||||
|
||||
public class AspectReceiver {
|
||||
|
||||
public static void main2() {
|
||||
main(null);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
new AspectReceiver().foo();
|
||||
}
|
||||
|
||||
public void foo() {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user