diff --git a/aspects/aspects.gradle b/aspects/aspects.gradle new file mode 100644 index 0000000000..3e3ae8fc6c --- /dev/null +++ b/aspects/aspects.gradle @@ -0,0 +1,5 @@ + +dependencies { + compile project(':spring-security-core'), + "org.springframework:spring-beans:$springVersion" +} \ No newline at end of file diff --git a/build.gradle b/build.gradle index d3a9a4acac..2c3ceb4317 100644 --- a/build.gradle +++ b/build.gradle @@ -22,12 +22,16 @@ configure(javaProjects) { apply url: "$rootDir/gradle/maven.gradle" } - configure(coreModuleProjects) { + apply url: "$rootDir/gradle/bundlor.gradle" // Gives better names in structure101 jar diagram sourceSets.main.classesDir = new File(buildDir, "classes/" + project.name.substring("spring-security".length() + 1)) } +configure (aspectjProjects) { + apply url: "$rootDir/gradle/aspectj.gradle" +} + configurations { antlibs } @@ -142,7 +146,11 @@ def getItestProjects() { } def getCoreModuleProjects() { - javaProjects - sampleProjects - itestProjects + javaProjects - sampleProjects - itestProjects - aspectjProjects +} + +def getAspectjProjects() { + subprojects.findAll {project -> project.name == 'spring-security-aspects' || project.name == 'spring-security-samples-aspectj'} } class UploadDist extends DefaultTask { diff --git a/gradle/aspectj.gradle b/gradle/aspectj.gradle new file mode 100644 index 0000000000..4d239ba55b --- /dev/null +++ b/gradle/aspectj.gradle @@ -0,0 +1,24 @@ +apply id: 'java' + +configurations { + ajtools + aspectpath +} + +dependencies { + ajtools "org.aspectj:aspectjtools:$aspectjVersion" + compile "org.aspectj:aspectjrt:$aspectjVersion" +} + +task compileJava(dependsOn: JavaPlugin.PROCESS_RESOURCES_TASK_NAME, overwrite: true, description: 'Compiles AspectJ Source') << { + println "Running ajc ..." + ant.taskdef(resource: "org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties", classpath: configurations.ajtools.asPath) + ant.iajc(classpath: configurations.compile.asPath, fork: 'true', destDir: sourceSets.main.classesDir.absolutePath, source: sourceCompatibility, target: targetCompatibility, + aspectPath: configurations.aspectpath.asPath, sourceRootCopyFilter: '**/*.java') { + sourceroots { + sourceSets.main.java.srcDirs.each { + pathelement(location: it.absolutePath) + } + } + } +} diff --git a/gradle/bundlor.gradle b/gradle/bundlor.gradle new file mode 100644 index 0000000000..def88dce81 --- /dev/null +++ b/gradle/bundlor.gradle @@ -0,0 +1,35 @@ +import java.util.jar.Manifest +import org.gradle.api.tasks.bundling.GradleManifest + +apply id: 'java' + +configurations { + bundlor +} + +dependencies { + bundlor 'com.springsource.bundlor:com.springsource.bundlor.ant:1.0.0.RELEASE', + 'com.springsource.bundlor:com.springsource.bundlor:1.0.0.RELEASE', + 'com.springsource.bundlor:com.springsource.bundlor.blint:1.0.0.RELEASE' +} + +task bundlor(dependsOn: compileJava) { + onlyIf { + dependsOnTaskDidWork() + } + doFirst { + ant.taskdef(resource: 'com/springsource/bundlor/ant/antlib.xml', classpath: configurations.bundlor.asPath) + File template = new File(projectDir, 'template.mf') + mkdir(buildDir, 'bundlor') + if (template.exists()) { + ant.bundlor(inputPath: sourceSets.main.classesDir, outputPath: "$buildDir/bundlor", manifestTemplatePath: template) { + property(name: 'version', value: "$version") + property(name: 'spring.version', value: "$springVersion") + } + // See GRADLE-395 for support for using an existing manifest + jar.manifest = new GradleManifest(new Manifest(new File("$buildDir/bundlor/META-INF/MANIFEST.MF").newInputStream())) + } + } +} + +jar.dependsOn bundlor diff --git a/gradle/javaprojects.gradle b/gradle/javaprojects.gradle index 7295253b03..ca5f4d9d3f 100644 --- a/gradle/javaprojects.gradle +++ b/gradle/javaprojects.gradle @@ -1,6 +1,3 @@ -import java.util.jar.Manifest -import org.gradle.api.tasks.bundling.GradleManifest - apply id: 'java' springVersion = '3.0.1.RELEASE' @@ -13,7 +10,6 @@ jettyVersion = '6.1.22' hsqlVersion = '1.8.0.10' configurations { - bundlor provided compile.extendsFrom provided } @@ -32,9 +28,6 @@ dependencies { 'org.hamcrest:hamcrest-core:1.1', 'org.hamcrest:hamcrest-library:1.1', "org.springframework:spring-test:$springVersion" - bundlor 'com.springsource.bundlor:com.springsource.bundlor.ant:1.0.0.RELEASE', - 'com.springsource.bundlor:com.springsource.bundlor:1.0.0.RELEASE', - 'com.springsource.bundlor:com.springsource.bundlor.blint:1.0.0.RELEASE' } test { @@ -44,23 +37,3 @@ test { jvmArgs = ['-ea', '-Xms128m', '-Xmx500m', '-XX:MaxPermSize=128m'] } -task bundlor(dependsOn: compileJava) { - onlyIf { - dependsOnTaskDidWork() - } - doFirst { - ant.taskdef(resource: 'com/springsource/bundlor/ant/antlib.xml', classpath: configurations.bundlor.asPath) - File template = new File(projectDir, 'template.mf') - mkdir(buildDir, 'bundlor') - if (template.exists()) { - ant.bundlor(inputPath: sourceSets.main.classesDir, outputPath: "$buildDir/bundlor", manifestTemplatePath: template) { - property(name: 'version', value: "$version") - property(name: 'spring.version', value: "$springVersion") - } - // See GRADLE-395 for support for using an existing manifest - jar.manifest = new GradleManifest(new Manifest(new File("$buildDir/bundlor/META-INF/MANIFEST.MF").newInputStream())) - } - } -} - -jar.dependsOn bundlor \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index fa951f7607..cb36923da0 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,7 +6,8 @@ def String[] modules = [ 'config', 'cas', 'openid', - 'taglibs' + 'taglibs', + 'aspects' ] def String[] samples = [