- Use recent Gradle 1.0-milestone-8 snapshot - Add initial cut of build.gradle able to compile/test all modules - Update .gitignore - Generate Gradle wrapper scripts - Remove all Eclipse metadata files - Temporarily @Ignore tests that do not pass under Gradle
82 lines
3.3 KiB
Groovy
82 lines
3.3 KiB
Groovy
// Original source: https://raw.github.com/cbeams/gradleplugins/0.9-upgrade/aspectjPlugin/aspectJ.gradle
|
|
// Included locally here to avoid failure when not connected to the network.
|
|
// See http://issues.gradle.org/browse/GRADLE-1768
|
|
apply plugin:'java'
|
|
apply plugin:'eclipse'
|
|
|
|
configurations {
|
|
ajc
|
|
aspects
|
|
ajInpath
|
|
}
|
|
|
|
task compileJava(dependsOn: JavaPlugin.PROCESS_RESOURCES_TASK_NAME, overwrite: true) {
|
|
dependsOn configurations.ajc.getTaskDependencyFromProjectDependency(true, "compileJava")
|
|
inputs.files(project.sourceSets.main.allSource + project.sourceSets.main.compileClasspath)
|
|
outputs.files(project.sourceSets.main.classesDir)
|
|
|
|
doLast{
|
|
ant.taskdef( resource:"org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties", classpath: configurations.ajc.asPath)
|
|
ant.iajc(source:sourceCompatibility, target:targetCompatibility, destDir:sourceSets.main.classesDir.absolutePath, maxmem:"1024m", fork:"true",
|
|
aspectPath:configurations.aspects.asPath, inpath:configurations.ajInpath.asPath, sourceRootCopyFilter:"**/.svn/*,**/*.java",classpath:configurations.compile.asPath,
|
|
Xlint:"ignore"){
|
|
|
|
sourceroots{
|
|
sourceSets.main.java.srcDirs.each{
|
|
pathelement(location:it.absolutePath)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
task compileTestJava(dependsOn: JavaPlugin.PROCESS_TEST_RESOURCES_TASK_NAME, overwrite: true) {
|
|
dependsOn configurations.ajc.getTaskDependencyFromProjectDependency(true, "compileTestJava")
|
|
inputs.files(project.sourceSets.test.allSource + project.sourceSets.test.compileClasspath)
|
|
outputs.files(project.sourceSets.test.classesDir)
|
|
|
|
doLast{
|
|
ant.taskdef( resource:"org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties", classpath: configurations.ajc.asPath)
|
|
ant.iajc(source:sourceCompatibility, target:targetCompatibility, destDir:sourceSets.main.classesDir.absolutePath, maxmem:"1024m", fork:"true",
|
|
aspectPath:configurations.aspects.asPath, inpath:configurations.ajInpath.asPath, sourceRootCopyFilter:"**/.svn/*,**/*.java",classpath:configurations.compile.asPath,
|
|
Xlint:"ignore"){
|
|
|
|
sourceroots{
|
|
sourceSets.main.java.srcDirs.each{
|
|
pathelement(location:it.absolutePath)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
//add aspectj support for eclipse plugin
|
|
eclipseClasspath.withXml { xmlProvider ->
|
|
def classpath = xmlProvider.asNode()
|
|
def xmlparser = new XmlParser()
|
|
|
|
configurations.aspects.files.each{ aspectsLib ->
|
|
classpath.children().findAll{ it['@path'] == aspectsLib.absolutePath }.each {
|
|
def attrs = xmlparser.createNode(it, 'attributes', [:])
|
|
xmlparser.createNode(attrs, 'attribute', [name: 'org.eclipse.ajdt.aspectpath', value: 'true']);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
eclipseProject.withXml { xmlProvider->
|
|
def projectDescription = xmlProvider.asNode()
|
|
def xmlparser = new XmlParser()
|
|
|
|
def builders = projectDescription.buildSpec[0]
|
|
def ajbuilder = xmlparser.createNode(builders, 'buildCommand', [:])
|
|
xmlparser.createNode(ajbuilder, 'name', [:]).setValue('org.eclipse.ajdt.core.ajbuilder')
|
|
xmlparser.createNode(ajbuilder, 'arguments', [:]);
|
|
|
|
def natures = projectDescription.natures[0]
|
|
def ajnature = xmlparser.createNode(null, 'nature', [:])
|
|
ajnature.setValue('org.eclipse.ajdt.ui.ajnature');
|
|
natures.children().add(0, ajnature)
|
|
}
|