瀏覽代碼

SEC-2207: Update Gradle to 1.6

Rob Winch 12 年之前
父節點
當前提交
1705c5d796

+ 2 - 1
aspects/aspects.gradle

@@ -4,5 +4,6 @@ dependencies {
             "org.springframework:spring-beans:$springVersion",
             "org.springframework:spring-context:$springVersion"
 
-    testCompile 'aopalliance:aopalliance:1.0'
+    testCompile 'aopalliance:aopalliance:1.0',
+                "org.springframework:spring-aop:$springVersion"
 }

+ 25 - 8
build.gradle

@@ -1,3 +1,14 @@
+import groovy.text.SimpleTemplateEngine
+
+buildscript {
+    repositories {
+        maven { url "http://repo.springsource.org/plugins-release" }
+    }
+    dependencies {
+        classpath("org.springframework.build.gradle:bundlor-plugin:0.1.2")
+    }
+}
+
 apply plugin: 'base'
 
 description = 'Spring Security'
@@ -9,10 +20,9 @@ allprojects {
     group = 'org.springframework.security'
 
     repositories {
-        maven { url "http://repo.springsource.org/libs-release" }
+        maven { url "http://repo.springsource.org/libs-snapshot" }
+        maven { url "http://repo.springsource.org/plugins-release" }
     }
-
-
 }
 
 // Set up different subproject lists for individual configuration
@@ -35,19 +45,26 @@ configure(coreModuleProjects) {
     // Gives better names in structure101 jar diagram
     sourceSets.main.output.classesDir = new File(buildDir, "classes/" + project.name.substring("spring-security".length() + 1))
     apply plugin: 'bundlor'
-    bundlor.expansions = bundlorProperties
     apply from: "$rootDir/gradle/maven-deployment.gradle"
     apply plugin: 'emma'
-}
 
-task coreBuild {
-    dependsOn coreModuleProjects*.tasks*.matching { task -> task.name == 'build' }
+    bundlor.doFirst {
+        def templateText = file("template.mf").text
+        bundlor.manifestTemplate = new SimpleTemplateEngine().createTemplate(templateText).make(bundlorProperties).toString()
+    }
+
+    bundlor.dependsOn 'compileJava'
 }
 
 configure (aspectjProjects) {
+    apply plugin: 'java'
     apply plugin: 'aspectj'
 }
 
+task coreBuild {
+    dependsOn coreModuleProjects*.tasks*.matching { task -> task.name == 'build' }
+}
+
 // Task for creating the distro zip
 
 task dist(type: Zip) {
@@ -82,5 +99,5 @@ artifacts {
 apply from: "$rootDir/gradle/ide-integration.gradle"
 
 task wrapper(type: Wrapper) {
-    gradleVersion = '1.3'
+    gradleVersion = '1.6'
 }

+ 0 - 6
buildSrc/build.gradle

@@ -43,12 +43,6 @@ dependencies{
     compile "emma:emma:2.0.5312"
 }
 
-// Bundlor
-dependencies {
-    compile 'com.springsource.bundlor:com.springsource.bundlor:1.0.0.RELEASE',
-            'com.springsource.bundlor:com.springsource.bundlor.blint:1.0.0.RELEASE'
-}
-
 // Trang
 dependencies {
     compile 'com.thaiopensource:trang:20091111',

+ 16 - 2
buildSrc/src/main/groovy/aspectj/AspectJPlugin.groovy

@@ -9,6 +9,7 @@ import org.gradle.api.tasks.SourceSet
 import org.gradle.api.DefaultTask
 import org.gradle.api.GradleException
 
+import org.gradle.api.plugins.JavaPlugin
 import org.gradle.plugins.ide.eclipse.GenerateEclipseProject
 import org.gradle.plugins.ide.eclipse.GenerateEclipseClasspath
 import org.gradle.plugins.ide.eclipse.EclipsePlugin
@@ -22,6 +23,8 @@ import org.gradle.plugins.ide.eclipse.model.ProjectDependency
 class AspectJPlugin implements Plugin<Project> {
 
     void apply(Project project) {
+        project.plugins.apply(JavaPlugin)
+
         if (!project.hasProperty('aspectjVersion')) {
             throw new GradleException("You must set the property 'aspectjVersion' before applying the aspectj plugin")
         }
@@ -38,18 +41,24 @@ class AspectJPlugin implements Plugin<Project> {
             project.configurations.add('aspectpath')
         }
 
+        project.tasks.compileJava.deleteAllActions()
+
         project.tasks.add(name: 'compileJava', overwrite: true, description: 'Compiles AspectJ Source', type: Ajc) {
+            dependsOn project.configurations*.getTaskDependencyFromProjectDependency(true, "compileJava")
+
             dependsOn project.processResources
             sourceSet = project.sourceSets.main
-            inputs.files(sourceSet.java.srcDirs)
+            inputs.files(sourceSet.allSource)
             outputs.dir(sourceSet.output.classesDir)
             aspectPath = project.configurations.aspectpath
         }
 
+        project.tasks.compileTestJava.deleteAllActions()
+
         project.tasks.add(name: 'compileTestJava', overwrite: true, description: 'Compiles AspectJ Test Source', type: Ajc) {
             dependsOn project.processTestResources, project.compileJava, project.jar
             sourceSet = project.sourceSets.test
-            inputs.files(sourceSet.java.srcDirs)
+            inputs.files(sourceSet.allSource)
             outputs.dir(sourceSet.output.classesDir)
             aspectPath = project.files(project.configurations.aspectpath, project.jar.archivePath)
         }
@@ -90,7 +99,11 @@ class Ajc extends DefaultTask {
 
     @TaskAction
     def compile() {
+        logger.info("="*30)
+        logger.info("="*30)
         logger.info("Running ajc ...")
+        logger.info("classpath: ${sourceSet.compileClasspath.asPath}")
+        logger.info("srcDirs $sourceSet.java.srcDirs")
         ant.taskdef(resource: "org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties", classpath: project.configurations.ajtools.asPath)
         ant.iajc(classpath: sourceSet.compileClasspath.asPath, fork: 'true', destDir: sourceSet.output.classesDir.absolutePath,
                 source: project.convention.plugins.java.sourceCompatibility,
@@ -98,6 +111,7 @@ class Ajc extends DefaultTask {
                 aspectPath: aspectPath.asPath, sourceRootCopyFilter: '**/*.java', showWeaveInfo: 'true') {
             sourceroots {
                 sourceSet.java.srcDirs.each {
+                    logger.info("   sourceRoot $it")
                     pathelement(location: it.absolutePath)
                 }
             }

+ 0 - 150
buildSrc/src/main/groovy/bundlor/BundlorPlugin.groovy

@@ -1,150 +0,0 @@
-package bundlor
-
-import com.springsource.bundlor.ClassPath
-import com.springsource.bundlor.ManifestGenerator
-import com.springsource.bundlor.ManifestWriter
-import com.springsource.bundlor.blint.ManifestValidator
-import com.springsource.bundlor.blint.support.DefaultManifestValidatorContributorsFactory
-import com.springsource.bundlor.blint.support.StandardManifestValidator
-import com.springsource.bundlor.support.DefaultManifestGeneratorContributorsFactory
-import com.springsource.bundlor.support.StandardManifestGenerator
-import com.springsource.bundlor.support.classpath.FileSystemClassPath
-import com.springsource.bundlor.support.manifestwriter.FileSystemManifestWriter
-import com.springsource.bundlor.support.properties.EmptyPropertiesSource
-import com.springsource.bundlor.support.properties.FileSystemPropertiesSource
-import com.springsource.bundlor.support.properties.PropertiesPropertiesSource
-import com.springsource.bundlor.support.properties.PropertiesSource
-import com.springsource.bundlor.util.BundleManifestUtils
-import com.springsource.util.parser.manifest.ManifestContents
-import org.gradle.api.DefaultTask
-import org.gradle.api.GradleException
-import org.gradle.api.Plugin
-import org.gradle.api.Project
-import org.gradle.api.Task
-import org.gradle.api.file.FileCollection
-import org.gradle.api.logging.LogLevel
-import org.gradle.api.tasks.Input
-import org.gradle.api.tasks.InputFile
-import org.gradle.api.tasks.InputFiles
-import org.gradle.api.tasks.Optional
-import org.gradle.api.tasks.OutputDirectory
-import org.gradle.api.tasks.OutputFile
-import org.gradle.api.tasks.TaskAction
-
-/**
- * @author Luke Taylor
- */
-class BundlorPlugin implements Plugin<Project> {
-    void apply(Project project) {
-        Task bundlor = project.tasks.add('bundlor', Bundlor.class)
-        bundlor.setDescription('Generates OSGi manifest using bundlor tool')
-        bundlor.dependsOn(project.classes)
-        project.jar.dependsOn bundlor
-    }
-}
-
-public class Bundlor extends DefaultTask {
-    @InputFile
-    @Optional
-    File manifestTemplate
-
-    @OutputDirectory
-    File bundlorDir = new File("${project.buildDir}/bundlor")
-
-    @OutputFile
-    File manifest = project.file("${bundlorDir}/META-INF/MANIFEST.MF")
-
-    @Input
-    Map<String,String> expansions = [:]
-
-    @InputFile
-    @Optional
-    File osgiProfile
-
-    @InputFiles
-    @Optional
-    FileCollection inputPaths
-
-    @Input
-    boolean failOnWarnings = false
-
-    Bundlor() {
-        manifestTemplate = new File(project.projectDir, 'template.mf')
-
-        if (!manifestTemplate.exists()) {
-            logger.info("No bundlor template for project " + project.name)
-            manifestTemplate = null
-        }
-
-        inputPaths = project.files(project.sourceSets.main.output.classesDir)
-
-        if (manifestTemplate != null) {
-            project.jar.manifest.from manifest
-            project.jar.inputs.files manifest
-        }
-    }
-
-    @TaskAction
-    void createManifest() {
-        if (manifestTemplate == null) {
-            return;
-        }
-
-        logging.captureStandardOutput(LogLevel.INFO)
-
-        project.mkdir(bundlorDir)
-
-        //String inputPath = project.sourceSets.main.classesDir
-
-        List<ClassPath> inputClassPath = [] as List;
-
-        ManifestWriter manifestWriter = new FileSystemManifestWriter(project.file(bundlorDir.absolutePath));
-        ManifestContents mfTemplate = BundleManifestUtils.getManifest(manifestTemplate);
-
-        inputPaths.each {f ->
-            inputClassPath.add(new FileSystemClassPath(f))
-        }
-
-        // Must be a better way of doing this...
-        Properties p = new Properties()
-        expansions.each {entry ->
-            p.setProperty(entry.key, entry.value as String)
-        }
-
-        PropertiesSource expansionProps = new PropertiesPropertiesSource(p)
-        PropertiesSource osgiProfileProps = osgiProfile == null ? new EmptyPropertiesSource() :
-            new FileSystemPropertiesSource(osgiProfile);
-
-        ManifestGenerator manifestGenerator = new StandardManifestGenerator(
-                DefaultManifestGeneratorContributorsFactory.create(expansionProps, osgiProfileProps));
-
-        ManifestContents mf = manifestGenerator.generate(mfTemplate, inputClassPath.toArray(new ClassPath[inputClassPath.size()]));
-
-        try {
-            manifestWriter.write(mf);
-        } finally {
-            manifestWriter.close();
-        }
-
-        ManifestValidator manifestValidator = new StandardManifestValidator(DefaultManifestValidatorContributorsFactory.create());
-
-        List<String> warnings = manifestValidator.validate(mf);
-
-        if (warnings.isEmpty()) {
-            return
-        }
-
-        logger.warn("Bundlor Warnings:");
-        for (String warning : warnings) {
-            logger.warn("    " + warning);
-        }
-
-        if (failOnWarnings) {
-            throw new GradleException("Bundlor returned warnings. Please fix manifest template at " + manifestTemplate.absolutePath + " and try again.")
-        }
-    }
-
-    def inputPath(FileCollection paths) {
-        inputPaths = project.files(inputPaths, paths)
-    }
-}

+ 0 - 1
buildSrc/src/main/resources/META-INF/gradle-plugins/bundlor.properties

@@ -1 +0,0 @@
-implementation-class=bundlor.BundlorPlugin

+ 2 - 9
config/config.gradle

@@ -5,12 +5,6 @@ apply plugin: 'trang'
 
 compileTestJava.dependsOn(':spring-security-core:compileTestJava')
 
-configurations {
-    // GRADLE-1124
-    compile.extendsFrom = []
-    testCompile.extendsFrom groovy
-}
-
 dependencies {
     // NB: Don't add other compile time dependencies to the config module as this breaks tooling
     compile project(':spring-security-core'),
@@ -34,8 +28,6 @@ dependencies {
 
     provided "org.apache.tomcat:tomcat-servlet-api:$servletApiVersion"
 
-    groovy 'org.codehaus.groovy:groovy:1.8.7'
-
     testCompile project(':spring-security-ldap'),
                 project(':spring-security-openid'),
                 project(':spring-security-cas'),
@@ -50,7 +42,8 @@ dependencies {
                 "org.slf4j:jcl-over-slf4j:$slf4jVersion",
                 "org.hibernate.javax.persistence:hibernate-jpa-2.0-api:1.0.1.Final",
                 "org.hibernate:hibernate-entitymanager:4.1.0.Final",
-                powerMockDependencies
+                powerMockDependencies,
+                'org.codehaus.groovy:groovy:1.8.7'
     testCompile('org.openid4java:openid4java-nodeps:0.9.6') {
        exclude group: 'com.google.code.guice', module: 'guice'
     }

+ 9 - 0
config/template.mf

@@ -9,16 +9,21 @@ Ignored-Existing-Headers:
  Import-Package,
  Export-Package
 Import-Template:
+ org.aopalliance.*;version="${aopAllianceRange}",
  org.apache.commons.logging.*;version="${cloggingRange}",
  org.aopalliance.*;version="${aopAllianceRange}";resolution:=optional,
  org.aspectj.*;version="${aspectjRange}";resolution:=optional,
+ org.openid4java.*;version="${openid4javaRange}",
  org.springframework.security.access.*;version="${secRange}",
  org.springframework.security.authentication.*;version="${secRange}",
  org.springframework.security.core.*;version="${secRange}",
  org.springframework.security.crypto.bcrypt.*;version="${secRange}",
  org.springframework.security.crypto.password.*;version="${secRange}",
+ org.springframework.security.crypto.*;version="${secRange}",
  org.springframework.security.util;version="${secRange}",
  org.springframework.security.provisioning;version="${secRange}",
+ org.springframework.security.ldap.*;version="${secRange}",
+ org.springframework.security.openid.*;version="${secRange}";resolution:=optional,
  org.springframework.security.web.*;version="${secRange}";resolution:=optional,
  org.springframework.security.ldap.*;version="${secRange}";resolution:=optional,
  org.springframework.security.openid.*;version="${secRange}";resolution:=optional,
@@ -29,9 +34,13 @@ Import-Template:
  org.springframework.beans.*;version="${springRange}",
  org.springframework.context.*;version="${springRange}",
  org.springframework.core.*;version="${springRange}",
+ org.springframework.http.*;version="${springRange}",
+ org.springframework.ldap.*;version="${springLdapRange}",
+ org.springframework.jdbc.*;version="${springRange}",
  org.springframework.web.*;version="${springRange}",
  org.springframework.util.*;version="${springRange}",
  javax.servlet.*;version="0";resolution:=optional,
  org.openid4java.*;version="${openid4javaRange}",
+ javax.sql.*;version="0";resolution:=optional,
  javax.naming.directory;version="0";resolution:=optional,
  org.w3c.dom;version="0";resolution:=optional

+ 0 - 2
gradle/javaprojects.gradle

@@ -87,7 +87,6 @@ task integrationTest(type: Test, dependsOn: jar) {
     logging.captureStandardOutput(LogLevel.INFO)
     classpath = sourceSets.integrationTest.runtimeClasspath
     maxParallelForks = 1
-    testReport = false
 }
 
 dependencies {
@@ -118,7 +117,6 @@ test {
     jvmArgs = ['-ea', '-Xmx500m']
     maxParallelForks = guessMaxForks()
     logging.captureStandardOutput(LogLevel.INFO)
-    testReport = false
 }
 
 def guessMaxForks() {

二進制
gradle/wrapper/gradle-wrapper.jar


+ 2 - 2
gradle/wrapper/gradle-wrapper.properties

@@ -1,6 +1,6 @@
-#Fri Nov 30 16:30:08 CST 2012
+#Thu Jun 20 11:39:57 CDT 2013
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.3-bin.zip
+distributionUrl=http\://services.gradle.org/distributions/gradle-1.6-bin.zip

+ 2 - 2
gradlew

@@ -61,9 +61,9 @@ while [ -h "$PRG" ] ; do
     fi
 done
 SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/"
+cd "`dirname \"$PRG\"`/" >&-
 APP_HOME="`pwd -P`"
-cd "$SAVED"
+cd "$SAVED" >&-
 
 CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
 

+ 1 - 0
web/template.mf

@@ -37,6 +37,7 @@ Import-Template:
  org.springframework.web.*;version="${springRange}";resolution:=optional,
  org.springframework.web.context.*;version="${springRange}";resolution:=optional,
  org.springframework.web.filter.*;version="${springRange}",
+ org.springframework.web.*;version="${springRange}",
  org.springframework.util;version="${springRange}";resolution:=optional,
  org.w3c.dom;version="0";resolution:=optional,
  org.xml.sax;version="0";resolution:=optional,