2
0
Эх сурвалжийг харах

Porting of gradle changes from master.

Luke Taylor 15 жил өмнө
parent
commit
1b0ac9c785

+ 1 - 0
.gitignore

@@ -4,5 +4,6 @@ target/
 .settings/
 build/
 *.log
+*.iml
 .gradle/
 gradle.properties

+ 0 - 1
acl/acl.gradle

@@ -5,7 +5,6 @@ dependencies {
             "net.sf.ehcache:ehcache:$ehcacheVersion",
             "org.springframework:spring-aop:$springVersion",
             "org.springframework:spring-context:$springVersion",
-            "org.springframework:spring-core:$springVersion",
             "org.springframework:spring-tx:$springVersion",
             "org.springframework:spring-jdbc:$springVersion"
 

+ 5 - 0
aspects/aspects.gradle

@@ -0,0 +1,5 @@
+
+dependencies {
+    compile project(':spring-security-core'),
+            "org.springframework:spring-beans:$springVersion"
+}

+ 102 - 171
build.gradle

@@ -1,6 +1,3 @@
-import java.util.jar.Manifest
-import org.gradle.api.tasks.bundling.GradleManifest
-
 apply id: 'base'
 
 allprojects {
@@ -11,127 +8,28 @@ allprojects {
     group = 'org.springframework.security'
 
     repositories {
-        mavenRepo name:'Local', urls:'file:///Users/luke/.m2/repository'
+        mavenRepo name:'Local', urls: "file://" + System.properties['user.home'] + "/.m2/repository"
         mavenCentral()
-//        mavenRepo name:'SpringSource Milestone Repo', urls:'http://repository.springsource.com/maven/bundles/milestone'
+        mavenRepo name: 'SpringSource Milestone Repo', urls: 'http://repository.springsource.com/maven/bundles/milestone'
+        mavenRepo name: 'SpringSource Maven Snapshot Repo', urls: 'http://maven.springframework.org/snapshot/'
+        mavenRepo name: 'SpringSource Enterprise Release', urls: 'http://repository.springsource.com/maven/bundles/release'
+        mavenRepo name: 'SpringSource Enterprise External', urls: 'http://repository.springsource.com/maven/bundles/external'
     }
 }
 
-configure(javaProjects()) {
-    apply id: 'java'
-
-    springVersion = '3.0.1.RELEASE'
-    springLdapVersion = '1.3.0.RELEASE'
-    ehcacheVersion = '1.6.2'
-    aspectjVersion = '1.6.8'
-    apacheDsVersion = '1.5.5'
-    jstlVersion = '1.1.2'
-	jettyVersion = '6.1.22'
-
-    configurations {
-        bundlor
-        provided
-    }
-
-    dependencies {
-        compile     'commons-logging:commons-logging:1.1.1'
-
-        testCompile 'junit:junit:4.7',
-                    'org.mockito:mockito-core:1.7',
-                    'org.jmock:jmock:2.5.1',
-                    'org.jmock:jmock-junit4:2.5.1',
-                    '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.RC1',
-                    'com.springsource.bundlor:com.springsource.bundlor:1.0.0.RC1',
-                    'com.springsource.bundlor:com.springsource.bundlor.blint:1.0.0.RC1'
-    }
-
-    sourceSets {
-        main {
-            compileClasspath = compileClasspath + configurations.provided
-        }
-        test {
-            compileClasspath = compileClasspath + configurations.provided
-            runtimeClasspath = runtimeClasspath + configurations.provided
-        }
-    }
-
-    test {
-        jvmArgs = ['-ea', '-Xms128m', '-Xmx500m', '-XX:MaxPermSize=128m']
-    }
-
-    task bundlor (dependsOn: compileJava) << {
-        if (!dependsOnTaskDidWork()) {
-            return
-        }
-        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
-}
-
-configure(javaProjects()) {
-    apply id: 'maven'
-
-    // Create a source jar for uploading
-    task sourceJar(type: Jar) {
-        classifier = 'sources'
-        from sourceSets.main.java
-    }
-
-    configurations {
-        deployerJars
-    }
-
-    artifacts {
-        archives sourceJar
-    }
-
-    dependencies {
-        deployerJars "org.springframework.build.aws:org.springframework.build.aws.maven:2.0.1.BUILD-SNAPSHOT"
-    }
-
-    uploadArchives {
-        repositories.mavenDeployer {
-            configuration = configurations.deployerJars
-            if (releaseBuild) {
-                // "mavenSyncRepoDir" should be set in properties
-                repository(url: mavenSyncRepoDir)
-            } else {
-                s3credentials = [userName: s3AccessKey, passphrase: s3SecretAccessKey]
-                repository(url: "s3://maven.springframework.org/milestone") {
-                    authentication(s3credentials)
-                }
-                snapshotRepository(url: "s3://maven.springframework.org/snapshot") {
-                    authentication(s3credentials)
-                }
-            }
-        }
-    }
-
-    conf2ScopeMappings.addMapping(1, configurations.provided, "provided")
+configure(javaProjects) {
+    apply url: "$rootDir/gradle/javaprojects.gradle"
+    apply url: "$rootDir/gradle/maven.gradle"
 }
 
-configure(coreModuleProjects()) {
+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))
 }
 
-repositories {
-    // Required for ant s3 task
-    mavenRepo name: "s2.com release", urls: "http://repository.springsource.com/maven/bundles/release"
+configure (aspectjProjects) {
+    apply url: "$rootDir/gradle/aspectj.gradle"
 }
 
 configurations {
@@ -150,12 +48,13 @@ task apidocs(type: Javadoc) {
     title = "Spring Security $version API"
     optionsFile = file("$buildDir/tmp/javadoc.options")
 
-    source coreModuleProjects().collect { project ->
+    source coreModuleProjects.collect {project ->
         project.sourceSets.main.allJava
     }
 
-    classpath = files(coreModuleProjects().collect { project ->
-        project.sourceSets.main.compileClasspath })
+    classpath = files(coreModuleProjects.collect {project ->
+        project.sourceSets.main.compileClasspath
+    })
 }
 
 task apitar(type: Tar, dependsOn: apidocs) {
@@ -174,31 +73,39 @@ task doctar(type: Tar, dependsOn: ':manual:doc') {
     }
 }
 
-def username;
-def password;
-
-task login << {
-    ant.input("Please enter the ssh username for host '$sshHost'", addproperty: "ssh.username")
-    ant.input("Please enter the ssh password '$sshHost'", addproperty: "ssh.password")
-    username = ant.properties['ssh.username']
-    password = ant.properties['ssh.password']
+task login {
+    // add dynamic properties to login task
+    username = null
+    password = null
+    doFirst {
+        ant {
+            input("Please enter the ssh username for host '$sshHost'", addproperty: "ssh.username")
+            input("Please enter the ssh password '$sshHost'", addproperty: "ssh.password")
+        }
+        username = ant.properties['ssh.username']
+        password = ant.properties['ssh.password']
+    }
 }
 
-task uploadApidocs (dependsOn: login) << {
-    ant.scp(file: apitar.archivePath, todir: "$username@$sshHost:$remoteDocsDir", password: password)
-    ant.sshexec(host: sshHost, username: username, password: password, command: "cd $remoteDocsDir && tar -xjf ${apitar.archiveName}")
-    ant.sshexec(host: sshHost, username: username, password: password, command: "rm $remoteDocsDir/${apitar.archiveName}")
+task uploadApidocs(dependsOn: login) << {
+    ant {
+        scp(file: apitar.archivePath, todir: "$login.username@$sshHost:$remoteDocsDir", password: login.password)
+        sshexec(host: sshHost, username: login.username, password: login.password, command: "cd $remoteDocsDir && tar -xjf ${apitar.archiveName}")
+        sshexec(host: sshHost, username: login.username, password: login.password, command: "rm $remoteDocsDir/${apitar.archiveName}")
+    }
 }
 
-task uploadManual (dependsOn: login) << {
-    ant.scp(file: doctar.archivePath, todir: "$username@$sshHost:$remoteDocsDir", password: password)
-    ant.sshexec(host: sshHost, username: username, password: password, command: "cd $remoteDocsDir && tar -xjf ${doctar.archiveName}")
-    ant.sshexec(host: sshHost, username: username, password: password, command: "rm $remoteDocsDir/${doctar.archiveName}")
+task uploadManual(dependsOn: login) << {
+    ant {
+        scp(file: doctar.archivePath, todir: "$login.username@$sshHost:$remoteDocsDir", password: login.password)
+        sshexec(host: sshHost, username: login.username, password: login.password, command: "cd $remoteDocsDir && tar -xjf ${doctar.archiveName}")
+        sshexec(host: sshHost, username: login.username, password: login.password, command: "rm $remoteDocsDir/${doctar.archiveName}")
+    }
 }
 
-task dist (type: Zip) {
+task dist(type: Zip) {
     def zipRootDir = "${project.name}-$version"
-    into (zipRootDir) {
+    into(zipRootDir) {
         into('docs/apidocs') {
             from apidocs.destinationDir
         }
@@ -206,61 +113,85 @@ task dist (type: Zip) {
             from docsDir
         }
         into('dist') {
-            from coreModuleProjects().collect { project -> project.libsDir }
+            from coreModuleProjects.collect {project -> project.libsDir }
             from project(':spring-security-samples-tutorial').libsDir
             from project(':spring-security-samples-contacts').libsDir
         }
     }
 }
 
-dist.dependsOn apidocs, ':manual:doc'
-dist.dependsOn subprojects.collect { "$it.path:assemble" }
+dist {
+    dependsOn apidocs, ':manual:doc', subprojects.collect { "$it.path:assemble" }
+    doLast {
+        ant.checksum(file: archivePath, algorithm: 'SHA1', fileext: '.sha1')
+    }
+}
 
-dist.doLast {
-    ant.checksum(file: archivePath, algorithm: 'SHA1', fileext: '.sha1')
+task uploadDist(type: UploadDist) {
+    archiveFile = dist.archivePath
+    shaFile = "${dist.archivePath}.sha1" as File
+    archiveName = dist.archiveName
 }
 
-task uploadDist << {
-    def shaFile = file("${dist.archivePath}.sha1")
-    assert dist.archivePath.isFile()
-    assert shaFile.isFile()
-    ant.taskdef(resource: 'org/springframework/build/aws/ant/antlib.xml', classpath: configurations.antlibs.asPath)
-    ant.s3(accessKey: s3AccessKey, secretKey: s3SecretAccessKey) {
-        upload(bucketName: 'dist.springframework.org', file: dist.archivePath,
-                toFile: releaseType() + "/SEC/${dist.archiveName}", publicRead: 'true') {
-            metadata(name: 'project.name', value: 'Spring Security')
-            metadata(name: 'release.type', value: releaseType())
-            metadata(name: 'bundle.version', value: version)
-            metadata(name: 'package.file.name', value: dist.archiveName)
-        }
-        upload(bucketName: 'dist.springframework.org', file: shaFile,
-                toFile: releaseType() + "/SEC/${dist.archiveName}.sha1", publicRead: 'true')
-    }
+def getJavaProjects() {
+    subprojects.findAll {project -> project.name != 'faq' && project.name != 'manual' }
 }
 
-def javaProjects() {
-    subprojects.findAll { project -> project.name != 'faq' && project.name != 'manual' }
+def getSampleProjects() {
+    subprojects.findAll {project -> project.name.startsWith('spring-security-samples') }
 }
 
-def sampleProjects() {
-    subprojects.findAll { project -> project.name.startsWith('spring-security-samples') }
+def getItestProjects() {
+    subprojects.findAll {project -> project.name.startsWith('itest') }
 }
 
-def itestProjects() {
-    subprojects.findAll { project -> project.name.startsWith('itest') }
+def getCoreModuleProjects() {
+    javaProjects - sampleProjects - itestProjects - aspectjProjects
 }
 
-def coreModuleProjects() {
-    javaProjects() - sampleProjects() - itestProjects()
+def getAspectjProjects() {
+    subprojects.findAll {project -> project.name == 'spring-security-aspects' || project.name == 'spring-security-samples-aspectj'}
 }
 
-def releaseType() {
-    if (releaseBuild) {
-        'release'
-    } else if (snapshotBuild) {
-        'snapshot'
-    } else {
-        'milestone'
+class UploadDist extends DefaultTask {
+    @InputFile
+    File shaFile
+
+    @InputFile
+    File archiveFile
+
+    @Input
+    String archiveName
+
+    @InputFiles
+    def classpath
+
+    @TaskAction
+    def upload() {
+        project.ant {
+            taskdef(resource: 'org/springframework/build/aws/ant/antlib.xml', classpath: classpath.asPath)
+            s3(accessKey: project.s3AccessKey, secretKey: project.s3SecretAccessKey) {
+                upload(bucketName: 'dist.springframework.org', file: archiveFile,
+                        toFile: releaseType() + "/SEC/${archiveName}", publicRead: 'true') {
+                    metadata(name: 'project.name', value: 'Spring Security')
+                    metadata(name: 'release.type', value: releaseType())
+                    metadata(name: 'bundle.version', value: project.version)
+                    metadata(name: 'package.file.name', value: archiveName)
+                }
+                upload(bucketName: 'dist.springframework.org', file: shaFile,
+                        toFile: releaseType() + "/SEC/${archiveName}.sha1", publicRead: 'true')
+            }
+        }
+    }
+
+    def releaseType() {
+        if (project.releaseBuild) {
+            'release'
+        } else if (project.snapshotBuild) {
+            'snapshot'
+        } else {
+            'milestone'
+        }
     }
 }
 

+ 32 - 0
buildSrc/build.gradle

@@ -0,0 +1,32 @@
+apply id: 'groovy'
+
+repositories {
+    mavenRepo name:'localRepo', urls: "file://" + System.properties['user.home'] + "/.m2/repository"
+    mavenCentral()
+    mavenRepo name:'Shibboleth Repo', urls:'http://shibboleth.internet2.edu/downloads/maven2'
+}
+
+dependencies {
+    def fopDeps = [ 'org.apache.xmlgraphics:fop:0.95-1@jar',
+                    'org.apache.xmlgraphics:xmlgraphics-commons:1.3',
+                    'org.apache.xmlgraphics:batik-bridge:1.7@jar',
+                    'org.apache.xmlgraphics:batik-util:1.7@jar',
+                    'org.apache.xmlgraphics:batik-css:1.7@jar',
+                    'org.apache.xmlgraphics:batik-dom:1.7',
+                    'org.apache.xmlgraphics:batik-svg-dom:1.7@jar',
+                    'org.apache.avalon.framework:avalon-framework-api:4.3.1']
+    groovy localGroovy()
+    compile gradleApi(),
+            'org.apache.xerces:resolver:2.9.1',
+            'saxon:saxon:6.5.3',
+            'org.apache.xerces:xercesImpl:2.9.1',
+            fopDeps
+
+    runtime 'net.sf.xslthl:xslthl:2.0.1',
+            'net.sf.docbook:docbook-xsl:1.75.2:resources@zip'
+}
+
+task ide(type: Copy)  {
+    from configurations.runtime
+    into 'ide'
+}

+ 266 - 0
buildSrc/src/main/groovy/docbook/DocbookPlugin.groovy

@@ -0,0 +1,266 @@
+package docbook;
+
+import org.gradle.api.Plugin;
+import org.gradle.api.GradleException;
+import org.gradle.api.DefaultTask;
+import org.gradle.api.Task;
+import org.gradle.api.Project;
+import org.gradle.api.Action;
+import org.gradle.api.tasks.*;
+import org.gradle.api.file.FileCollection;
+
+import org.xml.sax.XMLReader;
+import org.xml.sax.InputSource;
+import org.apache.xml.resolver.CatalogManager;
+import org.apache.xml.resolver.tools.CatalogResolver;
+
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.*;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.sax.SAXResult;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import java.io.*;
+import java.util.*;
+import java.util.zip.*;
+import java.net.*;
+
+import org.apache.fop.apps.*;
+
+import com.icl.saxon.TransformerFactoryImpl;
+
+/**
+ * Gradle Docbook plugin implementation.
+ * <p>
+ * Creates three tasks: docbookHtml, docbookHtmlSingle and docbookPdf. Each task takes a single File on
+ * which it operates.
+ */
+class DocbookPlugin implements Plugin<Project> {
+    public void use(Project project) {
+        // Add the plugin tasks to the project
+        Task docbookHtml = project.tasks.add('docbookHtml', DocbookHtml.class);
+        docbookHtml.setDescription('Generates chunked docbook html output');
+
+        Task docbookHtmlSingle = project.tasks.add('docbookHtmlSingle', Docbook.class);
+        docbookHtmlSingle.setDescription('Generates single page docbook html output')
+        docbookHtmlSingle.suffix = '-single'
+
+        Task docbookFoPdf = project.tasks.add("docbookFoPdf", DocbookFoPdf.class);
+        docbookFoPdf.setDescription('Generates PDF output');
+        docbookFoPdf.extension = 'fo'
+    }
+}
+
+/**
+ */
+public class Docbook extends DefaultTask {
+
+    @Input
+    String extension = 'html';
+
+    @Input
+    String suffix = '';
+
+    @Input
+    boolean XIncludeAware = true;
+
+    @Input
+    boolean highlightingEnabled = true;
+
+    String admonGraphicsPath;
+
+    @InputDirectory
+    File sourceDirectory = new File(project.getProjectDir(), "src/docbook");
+
+    @Input
+    String sourceFileName;
+
+    @InputFile
+    File stylesheet;
+
+    @OutputDirectory
+    File docsDir = new File(project.getBuildDir(), "docs");
+
+    @TaskAction
+    public final void transform() {
+        SAXParserFactory factory = new org.apache.xerces.jaxp.SAXParserFactoryImpl();
+        factory.setXIncludeAware(XIncludeAware);
+        docsDir.mkdirs();
+
+        File srcFile = new File(sourceDirectory, sourceFileName);
+        String outputFilename = srcFile.getName().substring(0, srcFile.getName().length() - 4) + suffix + '.' + extension;
+
+        File outputFile = new File(getDocsDir(), outputFilename);
+
+        Result result = new StreamResult(outputFile.getAbsolutePath());
+        CatalogResolver resolver = new CatalogResolver(createCatalogManager());
+        InputSource inputSource = new InputSource(srcFile.getAbsolutePath());
+
+        XMLReader reader = factory.newSAXParser().getXMLReader();
+        reader.setEntityResolver(resolver);
+        TransformerFactory transformerFactory = new TransformerFactoryImpl();
+        transformerFactory.setURIResolver(resolver);
+        URL url = stylesheet.toURL();
+        Source source = new StreamSource(url.openStream(), url.toExternalForm());
+        Transformer transformer = transformerFactory.newTransformer(source);
+
+        if (highlightingEnabled) {
+            File highlightingDir = new File(getProject().getBuildDir(), "highlighting");
+            if (!highlightingDir.exists()) {
+                highlightingDir.mkdirs();
+                extractHighlightFiles(highlightingDir);
+            }
+
+            transformer.setParameter("highlight.xslthl.config", new File(highlightingDir, "xslthl-config.xml").toURI().toURL());
+
+            if (admonGraphicsPath != null) {
+                transformer.setParameter("admon.graphics", "1");
+                transformer.setParameter("admon.graphics.path", admonGraphicsPath);
+            }
+        }
+
+        preTransform(transformer, srcFile, outputFile);
+
+        transformer.transform(new SAXSource(reader, inputSource), result);
+
+        postTransform(outputFile);
+    }
+
+    private void extractHighlightFiles(File toDir) {
+        URLClassLoader cl = (URLClassLoader) getClass().getClassLoader();
+        URL[] urls = cl.getURLs();
+        URL docbookZip = null;
+
+        for (URL url : urls) {
+            if (url.toString().contains("docbook-xsl-")) {
+                docbookZip = url;
+                break;
+            }
+        }
+
+        if (docbookZip == null) {
+            throw new GradleException("Docbook zip file not found");
+        }
+
+        ZipFile zipFile = new ZipFile(new File(docbookZip.toURI()));
+
+        Enumeration e = zipFile.entries();
+        while (e.hasMoreElements()) {
+            ZipEntry ze = (ZipEntry) e.nextElement();
+            if (ze.getName().matches(".*/highlighting/.*\\.xml")) {
+                String filename = ze.getName().substring(ze.getName().lastIndexOf("/highlighting/") + 14);
+                copyFile(zipFile.getInputStream(ze), new File(toDir, filename));
+            }
+        }
+    }
+
+    private void copyFile(InputStream source, File destFile) {
+        destFile.createNewFile();
+        FileOutputStream to = null;
+        try {
+            to = new FileOutputStream(destFile);
+            byte[] buffer = new byte[4096];
+            int bytesRead;
+
+            while ((bytesRead = source.read(buffer)) > 0) {
+                to.write(buffer, 0, bytesRead);
+            }
+        } finally {
+            if (source != null) {
+                source.close();
+            }
+            if (to != null) {
+                to.close();
+            }
+        }
+    }
+
+    protected void preTransform(Transformer transformer, File sourceFile, File outputFile) {
+    }
+
+    protected void postTransform(File outputFile) {
+    }
+
+    private CatalogManager createCatalogManager() {
+        CatalogManager manager = new CatalogManager();
+        manager.setIgnoreMissingProperties(true);
+        ClassLoader classLoader = this.getClass().getClassLoader();
+        StringBuilder builder = new StringBuilder();
+        String docbookCatalogName = "docbook/catalog.xml";
+        URL docbookCatalog = classLoader.getResource(docbookCatalogName);
+
+        if (docbookCatalog == null) {
+            throw new IllegalStateException("Docbook catalog " + docbookCatalogName + " could not be found in " + classLoader);
+        }
+
+        builder.append(docbookCatalog.toExternalForm());
+
+        Enumeration enumeration = classLoader.getResources("/catalog.xml");
+        while (enumeration.hasMoreElements()) {
+            builder.append(';');
+            URL resource = (URL) enumeration.nextElement();
+            builder.append(resource.toExternalForm());
+        }
+        String catalogFiles = builder.toString();
+        manager.setCatalogFiles(catalogFiles);
+        return manager;
+    }
+}
+
+/**
+ */
+class DocbookHtml extends Docbook {
+
+    @Override
+    protected void preTransform(Transformer transformer, File sourceFile, File outputFile) {
+        String rootFilename = outputFile.getName();
+        rootFilename = rootFilename.substring(0, rootFilename.lastIndexOf('.'));
+        transformer.setParameter("root.filename", rootFilename);
+        transformer.setParameter("base.dir", outputFile.getParent() + File.separator);
+    }
+}
+
+/**
+ */
+class DocbookFoPdf extends Docbook {
+
+    /**
+     * <a href="http://xmlgraphics.apache.org/fop/0.95/embedding.html#render">From the FOP usage guide</a>
+     */
+    @Override
+    protected void postTransform(File foFile) {
+        FopFactory fopFactory = FopFactory.newInstance();
+
+        OutputStream out  = null;
+        final File pdfFile = getPdfOutputFile(foFile);
+        logger.debug("Transforming 'fo' file "+ foFile + " to PDF: " + pdfFile);
+
+        try {
+            out = new BufferedOutputStream(new FileOutputStream(pdfFile));
+
+            Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, out);
+
+            TransformerFactory factory = TransformerFactory.newInstance();
+            Transformer transformer = factory.newTransformer();
+
+            Source src = new StreamSource(foFile);
+
+            Result res = new SAXResult(fop.getDefaultHandler());
+
+            transformer.transform(src, res);
+        } finally {
+            if (out != null) {
+                out.close();
+            }
+        }
+
+        if (!foFile.delete()) {
+            logger.warn("Failed to delete 'fo' file " + foFile);
+        }
+    }
+
+    private File getPdfOutputFile(File foFile) {
+        String name = foFile.getAbsolutePath();
+        return new File(name.substring(0, name.length() - 2) + "pdf");
+    }
+}

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

@@ -0,0 +1 @@
+implementation-class=docbook.DocbookPlugin

+ 4 - 4
cas/cas.gradle

@@ -2,12 +2,12 @@
 dependencies {
     compile project(':spring-security-core'),
             project(':spring-security-web'),
-            "javax.servlet:servlet-api:2.5",
-            "org.springframework:spring-core:$springVersion",
-            "org.springframework:spring-context:$springVersion",            
+            "org.springframework:spring-context:$springVersion",
             "org.springframework:spring-beans:$springVersion",
             "org.springframework:spring-tx:$springVersion",
-            "org.springframework:spring-web:$springVersion",            
+            "org.springframework:spring-web:$springVersion",
             "org.jasig.cas:cas-client-core:3.1.9",
             "net.sf.ehcache:ehcache:$ehcacheVersion"
+
+    provided 'javax.servlet:servlet-api:2.5'
 }            

+ 3 - 3
config/config.gradle

@@ -5,15 +5,15 @@ compileTestJava.dependsOn(':spring-security-core:compileTestJava')
 dependencies {
     compile project(':spring-security-core'),
             project(':spring-security-web'),
-            "javax.servlet:servlet-api:2.5",
             "org.aspectj:aspectjweaver:$aspectjVersion",
             "org.springframework:spring-aop:$springVersion",
-            "org.springframework:spring-core:$springVersion",
             "org.springframework:spring-context:$springVersion",
-            "org.springframework:spring-web:$springVersion",            
+            "org.springframework:spring-web:$springVersion",
             "org.springframework:spring-beans:$springVersion",
             "org.springframework:spring-tx:$springVersion"
 
+    provided "javax.servlet:servlet-api:2.5"
+
     testCompile project(':spring-security-ldap'),
                 project(':spring-security-openid'),
                 files(this.project(':spring-security-core').sourceSets.test.classesDir),

+ 0 - 1
core/core.gradle

@@ -5,7 +5,6 @@ dependencies {
             "net.sf.ehcache:ehcache:$ehcacheVersion",
             "org.springframework:spring-aop:$springVersion",
             "org.springframework:spring-beans:$springVersion",
-            "org.springframework:spring-core:$springVersion",
             "org.springframework:spring-context:$springVersion",
             "org.springframework:spring-expression:$springVersion",
             "org.springframework:spring-jdbc:$springVersion",

+ 2 - 1
docs/faq/faq.gradle

@@ -3,7 +3,8 @@ apply id: 'docbook'
 
 defaultTasks 'docbookHtmlSingle'
 
-docbookSrcFileName = 'faq.xml'
+[docbookHtml, docbookFoPdf, docbookHtmlSingle]*.sourceFileName = 'faq.xml'
+
 docbookHtmlSingle.stylesheet = new File(projectDir, 'src/xsl/html-single-custom.xsl')
 
 docbookHtmlSingle.doLast {

+ 92 - 92
docs/faq/src/xsl/html-single-custom.xsl

@@ -1,101 +1,101 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-				xmlns:xslthl="http://xslthl.sf.net"
-				exclude-result-prefixes="xslthl"
-				version='1.0'>
-
-    <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"/>	
-	<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/highlight.xsl"/>
-	
-	<!--xsl:param name="use.id.as.filename">'1'</xsl:param-->
-
-	<!-- Use code syntax highlighting -->
-	<xsl:param name="highlight.source">1</xsl:param>
-
-<!-- Extensions 
-	<xsl:param name="use.extensions">1</xsl:param>
-	<xsl:param name="tablecolumns.extension">0</xsl:param>
-	<xsl:param name="callout.extensions">1</xsl:param>
+                xmlns:xslthl="http://xslthl.sf.net"
+                exclude-result-prefixes="xslthl"
+                version='1.0'>
+
+    <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"/>
+    <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/highlight.xsl"/>
+
+    <!--xsl:param name="use.id.as.filename">'1'</xsl:param-->
+
+    <!-- Use code syntax highlighting -->
+    <xsl:param name="highlight.source">1</xsl:param>
+
+<!-- Extensions
+    <xsl:param name="use.extensions">1</xsl:param>
+    <xsl:param name="tablecolumns.extension">0</xsl:param>
+    <xsl:param name="callout.extensions">1</xsl:param>
 -->
-<!-- Activate Graphics 
-	<xsl:param name="admon.graphics" select="1"/>
-	<xsl:param name="admon.graphics.path">images/</xsl:param>
-	<xsl:param name="admon.graphics.extension">.gif</xsl:param>
-	<xsl:param name="callout.graphics" select="1" />
-	<xsl:param name="callout.defaultcolumn">120</xsl:param>
-	<xsl:param name="callout.graphics.path">images/callouts/</xsl:param>
-	<xsl:param name="callout.graphics.extension">.gif</xsl:param>
--->	
-	<xsl:param name="table.borders.with.css" select="1"/>
-	<xsl:param name="html.stylesheet">css/faq.css</xsl:param>
-	<xsl:param name="html.stylesheet.type">text/css</xsl:param>
-
-	<!--xsl:param name="generate.toc">book toc,title</xsl:param-->
+<!-- Activate Graphics
+    <xsl:param name="admon.graphics" select="1"/>
+    <xsl:param name="admon.graphics.path">images/</xsl:param>
+    <xsl:param name="admon.graphics.extension">.gif</xsl:param>
+    <xsl:param name="callout.graphics" select="1" />
+    <xsl:param name="callout.defaultcolumn">120</xsl:param>
+    <xsl:param name="callout.graphics.path">images/callouts/</xsl:param>
+    <xsl:param name="callout.graphics.extension">.gif</xsl:param>
+-->
+    <xsl:param name="table.borders.with.css" select="1"/>
+    <xsl:param name="html.stylesheet">css/faq.css</xsl:param>
+    <xsl:param name="html.stylesheet.type">text/css</xsl:param>
+
+    <!--xsl:param name="generate.toc">book toc,title</xsl:param-->
 <!--
-	<xsl:param name="admonition.title.properties">text-align: left</xsl:param>
+    <xsl:param name="admonition.title.properties">text-align: left</xsl:param>
 
-	<xsl:param name="section.label.includes.component.label" select="1"/>
-	<xsl:param name="table.footnote.number.format" select="'1'"/>
+    <xsl:param name="section.label.includes.component.label" select="1"/>
+    <xsl:param name="table.footnote.number.format" select="'1'"/>
 -->
-	<xsl:template match='xslthl:keyword' mode="xslthl">
-		<span class="hl-keyword"><xsl:apply-templates mode="xslthl"/></span>
-	</xsl:template>
-
-	<xsl:template match='xslthl:comment' mode="xslthl">
-		<span class="hl-comment"><xsl:apply-templates mode="xslthl"/></span>
-	</xsl:template>
-
-	<xsl:template match='xslthl:oneline-comment' mode="xslthl">
-		<span class="hl-comment"><xsl:apply-templates mode="xslthl"/></span>
-	</xsl:template>
-
-	<xsl:template match='xslthl:multiline-comment' mode="xslthl">
-		<span class="hl-multiline-comment"><xsl:apply-templates mode="xslthl"/></span>
-	</xsl:template>
-
-	<xsl:template match='xslthl:tag' mode="xslthl">
-		<span class="hl-tag"><xsl:apply-templates mode="xslthl"/></span>
-	</xsl:template>
-
-	<xsl:template match='xslthl:attribute' mode="xslthl">
-		<span class="hl-attribute"><xsl:apply-templates mode="xslthl"/></span>
-	</xsl:template>
-
-	<xsl:template match='xslthl:value' mode="xslthl">
-		<span class="hl-value"><xsl:apply-templates mode="xslthl"/></span>
-	</xsl:template>
-	
-	<xsl:template match='xslthl:string' mode="xslthl">
-		<span class="hl-string"><xsl:apply-templates mode="xslthl"/></span>
-	</xsl:template>
-
-	<!-- Google Analytics -->
-	<xsl:template name="user.head.content">
-		<xsl:comment>Begin Google Analytics code</xsl:comment>
-		<script type="text/javascript">
-			var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
-			document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
-		</script>
-		<script type="text/javascript">
-			var pageTracker = _gat._getTracker("UA-2728886-3");
-			pageTracker._setDomainName("none");
-			pageTracker._setAllowLinker(true);
-			pageTracker._trackPageview();
-		</script>
-		<xsl:comment>End Google Analytics code</xsl:comment>
-	</xsl:template>
-
-	<!-- Loopfuse -->
-	<xsl:template name="user.footer.content">
-		<xsl:comment>Begin LoopFuse code</xsl:comment>
-		<script src="http://loopfuse.net/webrecorder/js/listen.js" type="text/javascript">
-		</script>
-		<script type="text/javascript">
-			_lf_cid = "LF_48be82fa";
-			_lf_remora();
-		</script>
-		<xsl:comment>End LoopFuse code</xsl:comment>
-	</xsl:template>
+    <xsl:template match='xslthl:keyword' mode="xslthl">
+        <span class="hl-keyword"><xsl:apply-templates mode="xslthl"/></span>
+    </xsl:template>
+
+    <xsl:template match='xslthl:comment' mode="xslthl">
+        <span class="hl-comment"><xsl:apply-templates mode="xslthl"/></span>
+    </xsl:template>
+
+    <xsl:template match='xslthl:oneline-comment' mode="xslthl">
+        <span class="hl-comment"><xsl:apply-templates mode="xslthl"/></span>
+    </xsl:template>
+
+    <xsl:template match='xslthl:multiline-comment' mode="xslthl">
+        <span class="hl-multiline-comment"><xsl:apply-templates mode="xslthl"/></span>
+    </xsl:template>
+
+    <xsl:template match='xslthl:tag' mode="xslthl">
+        <span class="hl-tag"><xsl:apply-templates mode="xslthl"/></span>
+    </xsl:template>
+
+    <xsl:template match='xslthl:attribute' mode="xslthl">
+        <span class="hl-attribute"><xsl:apply-templates mode="xslthl"/></span>
+    </xsl:template>
+
+    <xsl:template match='xslthl:value' mode="xslthl">
+        <span class="hl-value"><xsl:apply-templates mode="xslthl"/></span>
+    </xsl:template>
+
+    <xsl:template match='xslthl:string' mode="xslthl">
+        <span class="hl-string"><xsl:apply-templates mode="xslthl"/></span>
+    </xsl:template>
+
+    <!-- Google Analytics -->
+    <xsl:template name="user.head.content">
+        <xsl:comment>Begin Google Analytics code</xsl:comment>
+<script type="text/javascript">
+var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
+document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+</script>
+<script type="text/javascript">
+var pageTracker = _gat._getTracker("UA-2728886-3");
+pageTracker._setDomainName("none");
+pageTracker._setAllowLinker(true);
+pageTracker._trackPageview();
+</script>
+<xsl:comment>End Google Analytics code</xsl:comment>
+    </xsl:template>
+
+    <!-- Loopfuse -->
+    <xsl:template name="user.footer.content">
+<xsl:comment>Begin LoopFuse code</xsl:comment>
+<script src="http://loopfuse.net/webrecorder/js/listen.js" type="text/javascript">
+</script>
+<script type="text/javascript">
+_lf_cid = "LF_48be82fa";
+_lf_remora();
+</script>
+<xsl:comment>End LoopFuse code</xsl:comment>
+    </xsl:template>
 
 </xsl:stylesheet>

+ 4 - 2
docs/manual/manual.gradle

@@ -1,13 +1,15 @@
 apply id: 'base'
 apply id: 'docbook'
 
-docbookSrcFileName = 'springsecurity.xml'
+[docbookHtml, docbookFoPdf, docbookHtmlSingle]*.sourceFileName = 'springsecurity.xml';
+
 docbookHtml.stylesheet = new File(projectDir, 'src/xsl/html-custom.xsl')
+docbookHtmlSingle.stylesheet = new File(projectDir, 'src/xsl/html-single-custom.xsl')
 docbookFoPdf.stylesheet = new File(projectDir, 'src/xsl/pdf-custom.xsl')
 def imagesDir = new File(projectDir, 'src/docbook/images');
 docbookFoPdf.admonGraphicsPath = "${imagesDir}/"
 
-task doc (dependsOn: [docbookHtml, docbookFoPdf]) << {
+task doc (dependsOn: [docbookHtml, docbookHtmlSingle, docbookFoPdf]) << {
     resourcesDir = new File(projectDir, 'src/resources')
     ant {
         docsDir = new File(buildDir, 'docs')

+ 142 - 0
docs/manual/src/xsl/html-single-custom.xsl

@@ -0,0 +1,142 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:xslthl="http://xslthl.sf.net"
+                exclude-result-prefixes="xslthl"
+                version='1.0'>
+
+    <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"/>
+    <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/highlight.xsl"/>
+
+    <!-- Only use scaling in FO -->
+    <xsl:param name="ignore.image.scaling">1</xsl:param>
+
+    <!-- Use code syntax highlighting -->
+    <xsl:param name="highlight.source">1</xsl:param>
+
+<!-- Extensions -->
+    <xsl:param name="use.extensions">1</xsl:param>
+    <xsl:param name="tablecolumns.extension">0</xsl:param>
+    <xsl:param name="callout.extensions">1</xsl:param>
+
+<!-- Activate Graphics -->
+    <xsl:param name="admon.graphics" select="1"/>
+    <xsl:param name="admon.graphics.path">images/</xsl:param>
+    <xsl:param name="admon.graphics.extension">.png</xsl:param>
+    <xsl:param name="callout.graphics" select="1" />
+    <xsl:param name="callout.defaultcolumn">120</xsl:param>
+    <xsl:param name="callout.graphics.path">images/callouts/</xsl:param>
+    <xsl:param name="callout.graphics.extension">.png</xsl:param>
+
+    <xsl:param name="table.borders.with.css" select="1"/>
+    <xsl:param name="html.stylesheet">css/manual.css</xsl:param>
+    <xsl:param name="html.stylesheet.type">text/css</xsl:param>
+    <xsl:param name="generate.toc">book toc,title</xsl:param>
+
+    <xsl:param name="admonition.title.properties">text-align: left</xsl:param>
+
+    <!-- Leave image paths as relative when navigating XInclude -->
+    <xsl:param name="keep.relative.image.uris" select="1"/>
+
+<!-- Label Chapters and Sections (numbering) -->
+    <xsl:param name="chapter.autolabel" select="1"/>
+    <xsl:param name="section.autolabel" select="1"/>
+    <xsl:param name="section.autolabel.max.depth" select="2"/>
+
+    <xsl:param name="section.label.includes.component.label" select="1"/>
+    <xsl:param name="table.footnote.number.format" select="'1'"/>
+
+<!-- Show only Sections up to level 2 in the TOCs -->
+    <xsl:param name="toc.section.depth">2</xsl:param>
+
+<!-- Remove "Chapter" from the Chapter titles... -->
+    <xsl:param name="local.l10n.xml" select="document('')"/>
+    <l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
+        <l:l10n language="en">
+            <l:context name="title-numbered">
+                <l:template name="chapter" text="%n.&#160;%t"/>
+                <l:template name="section" text="%n&#160;%t"/>
+            </l:context>
+        </l:l10n>
+    </l:i18n>
+
+    <xsl:template match='xslthl:keyword' mode="xslthl">
+        <span class="hl-keyword"><xsl:apply-templates mode="xslthl"/></span>
+    </xsl:template>
+
+    <xsl:template match='xslthl:comment' mode="xslthl">
+        <span class="hl-comment"><xsl:apply-templates mode="xslthl"/></span>
+    </xsl:template>
+
+    <xsl:template match='xslthl:oneline-comment' mode="xslthl">
+        <span class="hl-comment"><xsl:apply-templates mode="xslthl"/></span>
+    </xsl:template>
+
+    <xsl:template match='xslthl:multiline-comment' mode="xslthl">
+        <span class="hl-multiline-comment"><xsl:apply-templates mode="xslthl"/></span>
+    </xsl:template>
+
+    <xsl:template match='xslthl:tag' mode="xslthl">
+        <span class="hl-tag"><xsl:apply-templates mode="xslthl"/></span>
+    </xsl:template>
+
+    <xsl:template match='xslthl:attribute' mode="xslthl">
+        <span class="hl-attribute"><xsl:apply-templates mode="xslthl"/></span>
+    </xsl:template>
+
+    <xsl:template match='xslthl:value' mode="xslthl">
+        <span class="hl-value"><xsl:apply-templates mode="xslthl"/></span>
+    </xsl:template>
+
+    <xsl:template match='xslthl:string' mode="xslthl">
+        <span class="hl-string"><xsl:apply-templates mode="xslthl"/></span>
+    </xsl:template>
+
+    <!-- Google Analytics -->
+    <xsl:template name="user.head.content">
+<xsl:comment>Begin Google Analytics code</xsl:comment>
+<script type="text/javascript">
+var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
+document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+</script>
+<script type="text/javascript">
+var pageTracker = _gat._getTracker("UA-2728886-3");
+pageTracker._setDomainName("none");
+pageTracker._setAllowLinker(true);
+pageTracker._trackPageview();
+</script>
+<xsl:comment>End Google Analytics code</xsl:comment>
+    </xsl:template>
+
+    <!-- Loopfuse -->
+    <xsl:template name="user.footer.content">
+<xsl:comment>Begin LoopFuse code</xsl:comment>
+<script src="http://loopfuse.net/webrecorder/js/listen.js" type="text/javascript">
+</script>
+<script type="text/javascript">
+_lf_cid = "LF_48be82fa";
+_lf_remora();
+</script>
+<xsl:comment>End LoopFuse code</xsl:comment>
+    </xsl:template>
+
+</xsl:stylesheet>

+ 24 - 0
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)
+            }
+        }
+    }
+}

+ 35 - 0
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

+ 39 - 0
gradle/javaprojects.gradle

@@ -0,0 +1,39 @@
+apply id: 'java'
+
+springVersion = '3.0.1.RELEASE'
+springLdapVersion = '1.3.0.RELEASE'
+ehcacheVersion = '1.6.2'
+aspectjVersion = '1.6.8'
+apacheDsVersion = '1.5.5'
+jstlVersion = '1.1.2'
+jettyVersion = '6.1.22'
+hsqlVersion = '1.8.0.10'
+
+configurations {
+    provided
+    compile.extendsFrom provided
+}
+
+dependencies {
+    compile 'commons-logging:commons-logging:1.1.1'
+
+    compile ("org.springframework:spring-core:$springVersion") {
+        exclude(group: 'commons-logging', module: 'commons-logging')
+    }
+
+    testCompile 'junit:junit:4.7',
+            'org.mockito:mockito-core:1.7',
+            'org.jmock:jmock:2.5.1',
+            'org.jmock:jmock-junit4:2.5.1',
+            'org.hamcrest:hamcrest-core:1.1',
+            'org.hamcrest:hamcrest-library:1.1',
+            "org.springframework:spring-test:$springVersion"
+}
+
+test {
+    onlyIf {
+        !project.hasProperty('skipTests')
+    }
+    jvmArgs = ['-ea', '-Xms128m', '-Xmx500m', '-XX:MaxPermSize=128m']
+}
+

+ 72 - 0
gradle/maven.gradle

@@ -0,0 +1,72 @@
+apply id: 'maven'
+
+// Create a source jar for uploading
+task sourceJar(type: Jar) {
+    classifier = 'sources'
+    from sourceSets.main.java
+}
+
+configurations {
+    deployerJars
+}
+
+artifacts {
+    archives sourceJar
+}
+
+dependencies {
+    deployerJars "org.springframework.build.aws:org.springframework.build.aws.maven:3.0.0.RELEASE"
+}
+
+gradle.taskGraph.whenReady {graph ->
+    if (graph.hasTask(uploadArchives)) {
+        // check properties defined and fail early
+        s3AccessKey
+        s3SecretAccessKey
+    }
+}
+
+def deployer = null
+
+uploadArchives {
+    deployer = repositories.mavenDeployer {
+        configuration = configurations.deployerJars
+    }
+    doFirst {
+        if (releaseBuild) {
+            // "mavenSyncRepoDir" should be set in properties
+            repository(url: mavenSyncRepoDir)
+        } else {
+            s3credentials = [userName: s3AccessKey, passphrase: s3SecretAccessKey]
+            repository(url: "s3://maven.springframework.org/milestone") {
+                authentication(s3credentials)
+            }
+            snapshotRepository(url: "s3://maven.springframework.org/snapshot") {
+                authentication(s3credentials)
+            }
+        }
+    }
+}
+
+// Pom Customization
+
+installer = install.repositories.mavenInstaller
+
+def optionalDeps = ['commons-logging', 'ehcache', 'log4j', 'apacheds-core', 'jsp-api', 'jsr250-api', 'ldapsdk']
+
+[installer, deployer]*.pom.collect { pom ->
+    pom.scopeMappings.addMapping(10, configurations.provided, 'provided')
+}
+
+[installer, deployer]*.pom*.whenConfigured { pom ->
+    pom.dependencies.findAll { dep ->
+        optionalDeps.contains(dep.artifactId) ||
+        dep.groupId.startsWith('org.apache.directory') ||
+        dep.groupId.startsWith('org.slf4j')
+    }*.optional = true
+
+    if (pom.artifactId == 'spring-security-config') {
+        pom.dependencies.find { dep -> dep.artifactId == 'spring-security-web'}.optional = true
+        pom.dependencies.find { dep -> dep.artifactId == 'spring-web'}.optional = true
+    }
+}

+ 4 - 3
itest/web/itest-web.gradle

@@ -1,12 +1,13 @@
 
 dependencies {
     compile     "org.springframework:spring-context:$springVersion",
-                "org.springframework:spring-web:$springVersion",
-                'javax.servlet:servlet-api:2.5'
+                "org.springframework:spring-web:$springVersion"
+
+    provided    'javax.servlet:servlet-api:2.5'
 
     testCompile project(':spring-security-core'),
                 project(':spring-security-web'),
-                "org.springframework:spring-core:$springVersion",
+                project(':spring-security-taglibs'),
                 "org.springframework:spring-beans:$springVersion",
                 "org.springframework:spring-webmvc:$springVersion",
                 "org.mortbay.jetty:jetty:$jettyVersion",

+ 5 - 0
itest/web/pom.xml

@@ -28,6 +28,11 @@
             <groupId>javax.servlet</groupId>
             <artifactId>servlet-api</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.springframework.security</groupId>
+            <artifactId>spring-security-taglibs</artifactId>
+            <version>${project.version}</version>
+        </dependency>
         <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-webmvc</artifactId>

+ 7 - 3
ldap/ldap.gradle

@@ -4,18 +4,22 @@ test.exclude('**/OpenLDAPIntegrationTestSuite.class')
 
 dependencies {
     compile project(':spring-security-core'),
-            "org.springframework:spring-core:$springVersion",
             "org.springframework:spring-beans:$springVersion",
             "org.springframework:spring-context:$springVersion",
             "org.springframework:spring-tx:$springVersion",
-            "org.springframework.ldap:spring-ldap-core:$springLdapVersion",
             "org.apache.directory.server:apacheds-core:$apacheDsVersion",
             "org.apache.directory.server:apacheds-core-entry:$apacheDsVersion",
             "org.apache.directory.server:apacheds-protocol-shared:$apacheDsVersion",
             "org.apache.directory.server:apacheds-protocol-ldap:$apacheDsVersion", 
             "org.apache.directory.server:apacheds-server-jndi:$apacheDsVersion",
-            'org.apache.directory.shared:shared-ldap:0.9.15',             
+            'org.apache.directory.shared:shared-ldap:0.9.15',
             'ldapsdk:ldapsdk:4.1'
+    compile ("org.springframework.ldap:spring-ldap-core:$springLdapVersion") {
+        exclude(group: 'commons-logging', module: 'commons-logging')
+        exclude(group: 'org.springframework', module: 'spring-core')
+        exclude(group: 'org.springframework', module: 'spring-tx')
+        exclude(group: 'org.springframework', module: 'spring-beans')
+    }
 
     runtime 'org.slf4j:slf4j-log4j12:1.4.3'
 }

+ 2 - 3
openid/openid.gradle

@@ -5,13 +5,12 @@ dependencies {
             project(':spring-security-web'),
             'org.openid4java:openid4java-nodeps:0.9.5',
             "org.springframework:spring-aop:$springVersion",
-            "org.springframework:spring-core:$springVersion",
             "org.springframework:spring-context:$springVersion",
             "org.springframework:spring-beans:$springVersion",
-            "org.springframework:spring-tx:$springVersion",            
+            "org.springframework:spring-tx:$springVersion",
             "org.springframework:spring-web:$springVersion"
 
-    provided "javax.servlet:servlet-api:2.5"
+    provided 'javax.servlet:servlet-api:2.5'
 
     runtime 'commons-httpclient:commons-httpclient:3.1'
 }

+ 0 - 3
samples/cas/cas.gradle

@@ -2,11 +2,8 @@ apply id: 'war'
 apply id: 'jetty'
 
 dependencies {
-//    providedCompile 'javax.servlet:servlet-api:2.5@jar'
-
     runtime project(':spring-security-core'),
             project(':spring-security-web'),
             project(':spring-security-config'),
-//            project(':taglibs'),
             'log4j:log4j:1.2.15@jar'
 }

+ 1 - 1
samples/contacts/contacts.gradle

@@ -5,10 +5,10 @@ apply id: 'jetty'
 
 dependencies {
     providedCompile 'javax.servlet:servlet-api:2.5@jar'
+
     compile project(':spring-security-core'),
             project(':spring-security-acl'),
             "org.springframework:spring-aop:$springVersion",
-            "org.springframework:spring-core:$springVersion",
             "org.springframework:spring-beans:$springVersion",
             "org.springframework:spring-context:$springVersion",
             "org.springframework:spring-jdbc:$springVersion",

+ 1 - 1
samples/tutorial/tutorial.gradle

@@ -5,8 +5,8 @@ apply id: 'jetty'
 
 dependencies {
     providedCompile 'javax.servlet:servlet-api:2.5@jar'
+
     compile project(':spring-security-core'),
-            "org.springframework:spring-core:$springVersion",
             "org.springframework:spring-beans:$springVersion",
             "org.springframework:spring-web:$springVersion",
             "org.springframework:spring-webmvc:$springVersion",

+ 16 - 26
sandbox/heavyduty/build.gradle

@@ -1,23 +1,17 @@
-usePlugin('war')
-usePlugin('jetty')
-usePlugin('project-reports')
+apply: 'war'
+apply: 'jetty'
+//apply: 'project-reports'
 
-version = '3.0.0.CI-SNAPSHOT'
-springVersion = '3.0.0.RELEASE'
-targetCompatibility = '1.5' 
+version = '3.1.0.CI-SNAPSHOT'
+springVersion = '3.0.1.RELEASE'
+targetCompatibility = '1.5'
 sourceCompatibility = '1.5'
 
 repositories {
-    mavenRepo name:'localRepo', urls:'file:///Users/luke/.m2/repository'
-}
-
-configurations {
-//    runtime.excludeRules.add(org: 'org.apache.commons')
+    mavenRepo name:'Local', urls: "file://" + System.properties['user.home'] + "/.m2/repository"
 }
 
 dependencies {
-    //
-    // NB: Transient deps are all runtime deps (unlike maven)
     compile 'aopalliance:aopalliance:1.0',
             "org.springframework.security:spring-security-core:$version",
             "org.springframework.security:spring-security-web:$version",
@@ -27,27 +21,23 @@ dependencies {
             "org.springframework:spring-tx:$springVersion",
             "org.springframework:spring-web:$springVersion",
             "org.springframework:spring-webmvc:$springVersion",
-            'commons-logging:commons-logging:1.1.1',
-            "org.aspectj:aspectjrt:1.6.5",
-            'org.hibernate:ejb3-persistence:1.0.2.GA'
-            'javax.persistence:persistence-api:1.0'
+            'org.aspectj:aspectjrt:1.6.8',
+            'org.hibernate:ejb3-persistence:1.0.2.GA',
+            'javax.persistence:persistence-api:1.0',
+            'org.slf4j:jcl-over-slf4j:1.5.11'            
 
-    providedCompile "javax.servlet:servlet-api:2.5"
+    providedCompile 'javax.servlet:servlet-api:2.5'
 
     runtime 'org.hibernate:hibernate-entitymanager:3.4.0.GA',
-            "org.springframework:spring-context-support:$springVersion",    
-            "org.springframework.security:spring-security-ldap:$version",    
+            "org.springframework:spring-context-support:$springVersion",
+            "org.springframework.security:spring-security-ldap:$version",
             "org.springframework.security:spring-security-config:$version",
-            "org.springframework.security:spring-security-taglibs:$version",             
+            "org.springframework.security:spring-security-taglibs:$version",
             "org.springframework:spring-orm:$springVersion",
             'org.apache.directory.server:apacheds-core:1.5.5',
             'org.apache.directory.server:apacheds-server-jndi:1.5.5',
             'org.freemarker:freemarker:2.3.16',
             "hsqldb:hsqldb:1.8.0.10",
-            'org.slf4j:slf4j-log4j12:1.5.8',
+            'org.slf4j:slf4j-log4j12:1.5.11',
             'log4j:log4j:1.2.14'
 }
-
-task ('pcomp') {
-    println configurations.compile
-}

+ 2 - 2
sandbox/heavyduty/pom.xml

@@ -4,7 +4,7 @@
     <artifactId>spring-security-heavyduty</artifactId>
     <name>Spring Security - Heavy Duty Sample</name>
     <packaging>war</packaging>
-    <version>3.0.3.CI-SNAPSHOT</version>
+    <version>3.1.0.CI-SNAPSHOT</version>
     <dependencies>
         <dependency>
             <groupId>org.springframework.security</groupId>
@@ -205,7 +205,7 @@
     </build>
     <properties>
         <spring.version>3.0.0.RELEASE</spring.version>
-        <spring.security.version>3.0.3.CI-SNAPSHOT</spring.security.version>
+        <spring.security.version>3.1.0.CI-SNAPSHOT</spring.security.version>
     </properties>
 
 </project>

+ 2 - 1
settings.gradle

@@ -6,7 +6,8 @@ def String[] modules = [
     'config',
     'cas',
     'openid',
-    'taglibs'
+    'taglibs',
+    'aspects'
 ]
 
 def String[] samples = [

+ 1 - 6
taglibs/taglibs.gradle

@@ -4,17 +4,12 @@ dependencies {
     compile project(':spring-security-core'),
             project(':spring-security-web'),
             project(':spring-security-acl'),
-            "org.springframework:spring-core:$springVersion",
             "org.springframework:spring-beans:$springVersion",
             "org.springframework:spring-context:$springVersion",
             "org.springframework:spring-expression:$springVersion",
             "org.springframework:spring-web:$springVersion"
 
-    provided 'javax.servlet:jsp-api:2.0'
-    
-    testCompile 'javax.servlet:servlet-api:2.5',
-                'javax.servlet:jsp-api:2.0'
+    provided 'javax.servlet:jsp-api:2.0', 'javax.servlet:servlet-api:2.5'
     
     testRuntime "taglibs:standard:$jstlVersion"
-
 }

+ 0 - 1
web/web.gradle

@@ -5,7 +5,6 @@ dependencies {
             'aopalliance:aopalliance:1.0',
             "org.aspectj:aspectjweaver:$aspectjVersion",
             "org.springframework:spring-aop:$springVersion",
-            "org.springframework:spring-core:$springVersion",
             "org.springframework:spring-beans:$springVersion",
             "org.springframework:spring-context:$springVersion",
             "org.springframework:spring-expression:$springVersion",