diff --git a/build.gradle b/build.gradle index 893abb7fee..0f23c501d9 100644 --- a/build.gradle +++ b/build.gradle @@ -4,8 +4,8 @@ description = 'Spring Security' allprojects { version = '3.1.1.CI-SNAPSHOT' - releaseBuild = version.endsWith('RELEASE') - snapshotBuild = version.endsWith('SNAPSHOT') + ext.releaseBuild = version.endsWith('RELEASE') + ext.snapshotBuild = version.endsWith('SNAPSHOT') group = 'org.springframework.security' @@ -16,11 +16,11 @@ allprojects { } // Set up different subproject lists for individual configuration -javaProjects = subprojects.findAll { project -> project.name != 'docs' && project.name != 'faq' && project.name != 'manual' } -sampleProjects = subprojects.findAll { project -> project.name.startsWith('spring-security-samples') } -itestProjects = subprojects.findAll { project -> project.name.startsWith('itest') } -coreModuleProjects = javaProjects - sampleProjects - itestProjects -aspectjProjects = [project(':spring-security-aspects'), project(':spring-security-samples-aspectj')] +ext.javaProjects = subprojects.findAll { project -> project.name != 'docs' && project.name != 'faq' && project.name != 'manual' } +ext.sampleProjects = subprojects.findAll { project -> project.name.startsWith('spring-security-samples') } +ext.itestProjects = subprojects.findAll { project -> project.name.startsWith('itest') } +ext.coreModuleProjects = javaProjects - sampleProjects - itestProjects +ext.aspectjProjects = [project(':spring-security-aspects'), project(':spring-security-samples-aspectj')] configure(javaProjects) { apply from: "$rootDir/gradle/javaprojects.gradle" @@ -28,7 +28,7 @@ configure(javaProjects) { configure(coreModuleProjects) { // Gives better names in structure101 jar diagram - sourceSets.main.classesDir = new File(buildDir, "classes/" + project.name.substring("spring-security".length() + 1)) + 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" @@ -75,5 +75,5 @@ task uploadDist(type: S3DistroUpload) { apply from: "$rootDir/gradle/ide-integration.gradle" task wrapper(type: Wrapper) { - gradleVersion = '1.0-milestone-3' + gradleVersion = '1.0' } diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 8cf7636879..d5e7d9fd08 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -3,8 +3,14 @@ apply plugin: 'groovy' repositories { mavenLocal() mavenCentral() - 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' + maven { + name = 'SpringSource Enterprise Release' + url = 'http://repository.springsource.com/maven/bundles/release' + } + maven { + name = 'SpringSource Enterprise External' + url = 'http://repository.springsource.com/maven/bundles/external' + } } // Docbook Plugin @@ -48,9 +54,3 @@ task ide(type: Copy) { from configurations.runtime into 'ide' } - -apply plugin: 'idea' - -ideaModule { - excludeDirs += file('.gradle') -} diff --git a/buildSrc/src/main/groovy/aspectj/AspectJPlugin.groovy b/buildSrc/src/main/groovy/aspectj/AspectJPlugin.groovy index 77165f2496..81fc7c2518 100644 --- a/buildSrc/src/main/groovy/aspectj/AspectJPlugin.groovy +++ b/buildSrc/src/main/groovy/aspectj/AspectJPlugin.groovy @@ -12,7 +12,7 @@ import org.gradle.api.GradleException import org.gradle.plugins.ide.eclipse.GenerateEclipseProject import org.gradle.plugins.ide.eclipse.GenerateEclipseClasspath import org.gradle.plugins.ide.eclipse.model.BuildCommand -import org.gradle.tooling.model.ProjectDependency +import org.gradle.plugins.ide.eclipse.model.ProjectDependency /** * @@ -41,7 +41,7 @@ class AspectJPlugin implements Plugin { dependsOn project.processResources sourceSet = project.sourceSets.main inputs.files(sourceSet.java.srcDirs) - outputs.dir(sourceSet.classesDir) + outputs.dir(sourceSet.output.classesDir) aspectPath = project.configurations.aspectpath } @@ -49,19 +49,19 @@ class AspectJPlugin implements Plugin { dependsOn project.processTestResources, project.compileJava, project.jar sourceSet = project.sourceSets.test inputs.files(sourceSet.java.srcDirs) - outputs.dir(sourceSet.classesDir) + outputs.dir(sourceSet.output.classesDir) aspectPath = project.files(project.configurations.aspectpath, project.jar.archivePath) } - project.tasks.withType(GenerateEclipseProject).all { - whenConfigured { p -> + project.tasks.withType(GenerateEclipseProject) { + project.eclipse.project.file.whenMerged { p -> p.natures.add(0, 'org.eclipse.ajdt.ui.ajnature') - p.buildCommands = [new BuildCommand('org.eclipse.ajdt.core.ajbuilder',[:])] + p.buildCommands = [new BuildCommand('org.eclipse.ajdt.core.ajbuilder')] } } - project.tasks.withType(GenerateEclipseClasspath).all { - whenConfigured { classpath -> + project.tasks.withType(GenerateEclipseClasspath) { + project.eclipse.classpath.file.whenMerged { classpath -> def entries = classpath.entries.findAll { it instanceof ProjectDependency}.findAll { entry -> def projectPath = entry.path.replaceAll('/',':') project.rootProject.findProject(projectPath).plugins.findPlugin(AspectJPlugin) @@ -86,7 +86,7 @@ class Ajc extends DefaultTask { def compile() { logger.info("Running ajc ...") 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.classesDir.absolutePath, + ant.iajc(classpath: sourceSet.compileClasspath.asPath, fork: 'true', destDir: sourceSet.output.classesDir.absolutePath, source: project.convention.plugins.java.sourceCompatibility, target: project.convention.plugins.java.targetCompatibility, aspectPath: aspectPath.asPath, sourceRootCopyFilter: '**/*.java', showWeaveInfo: 'true') { diff --git a/buildSrc/src/main/groovy/bundlor/BundlorPlugin.groovy b/buildSrc/src/main/groovy/bundlor/BundlorPlugin.groovy index b3b389163c..a48e1248e9 100644 --- a/buildSrc/src/main/groovy/bundlor/BundlorPlugin.groovy +++ b/buildSrc/src/main/groovy/bundlor/BundlorPlugin.groovy @@ -76,7 +76,7 @@ public class Bundlor extends DefaultTask { manifestTemplate = null } - inputPaths = project.files(project.sourceSets.main.classesDir) + inputPaths = project.files(project.sourceSets.main.output.classesDir) if (manifestTemplate != null) { project.jar.manifest.from manifest diff --git a/config/config.gradle b/config/config.gradle index 48f7698fd9..8943ebed88 100644 --- a/config/config.gradle +++ b/config/config.gradle @@ -27,7 +27,7 @@ dependencies { testCompile project(':spring-security-ldap'), project(':spring-security-openid'), - project(':spring-security-core').sourceSets.test.classes, + project(':spring-security-core').sourceSets.test.output, 'javax.annotation:jsr250-api:1.0', "org.springframework.ldap:spring-ldap-core:$springLdapVersion", "org.springframework:spring-expression:$springVersion", diff --git a/core/core.gradle b/core/core.gradle index a02f1e1ccc..7b986e138d 100644 --- a/core/core.gradle +++ b/core/core.gradle @@ -2,7 +2,7 @@ // We don't define a module dependency on crypto to avoid creating a transitive dependency def cryptoProject = project(':spring-security-crypto') -def cryptoClasses = cryptoProject.sourceSets.main.classes +def cryptoClasses = cryptoProject.sourceSets.main.output dependencies { compile cryptoProject, @@ -31,7 +31,7 @@ classes.dependsOn cryptoProject.classes classes.doLast { copy { from cryptoClasses - into sourceSets.main.classesDir + into sourceSets.main.output.classesDir } } @@ -43,15 +43,4 @@ sourceJar.from cryptoProject.sourceSets.main.java test { systemProperties['springSecurityVersion'] = version systemProperties['springVersion'] = springVersion -} - -// Add the crypto module in the IDE -ideaModule { - def cryptoDep = new org.gradle.plugins.ide.idea.model.ModuleDependency('spring-security-crypto', 'COMPILE') - cryptoDep.exported = true - module.dependencies.add(cryptoDep) -} - -eclipseProject { - referencedProjects.add('spring-security-crypto') } \ No newline at end of file diff --git a/docs/docs.gradle b/docs/docs.gradle index 73d5a5c5a5..d43118aa6c 100644 --- a/docs/docs.gradle +++ b/docs/docs.gradle @@ -17,7 +17,7 @@ project('faq') { [docbookHtml, docbookFoPdf, docbookHtmlSingle]*.sourceFileName = 'faq.xml' docbookHtmlSingle.suffix = '' - spec = copySpec { + ext.spec = copySpec { into ('faq') { from("$buildDir/docs") from("$projectDir/src/resources") @@ -36,7 +36,7 @@ project('manual') { // docbookFoPdf.admonGraphicsPath = "${imagesDir}/" docbookFoPdf.imgSrcPath = "${projectDir}/src/docbook/" - spec = copySpec { + ext.spec = copySpec { into ('reference') { from("$buildDir/docs") from("$projectDir/src/resources") @@ -56,7 +56,6 @@ task reference (type: Copy) { task apidocs(type: Javadoc) { destinationDir = new File(buildDir, 'apidocs') title = "Spring Security $version API" - optionsFile = file("$buildDir/tmp/javadoc.options") source coreModuleProjects.collect { project -> project.sourceSets.main.allJava @@ -94,7 +93,7 @@ apidocs.options.groups = [ ] -apiSpec = copySpec { +ext.apiSpec = copySpec { into('apidocs') { from(apidocs.destinationDir) } diff --git a/gradle/ide-integration.gradle b/gradle/ide-integration.gradle index ffb8109810..a22b9aac77 100644 --- a/gradle/ide-integration.gradle +++ b/gradle/ide-integration.gradle @@ -2,80 +2,40 @@ apply plugin: 'idea' configure(javaProjects) { apply plugin: 'idea' - apply plugin: 'eclipse' + apply plugin: 'eclipse-wtp' + + eclipse.classpath.downloadSources = true - ideaModule { - downloadJavadoc=false - excludeDirs.add(buildDir) - gradleCacheVariable = 'GRADLE_CACHE' - outputDir = "$rootProject.projectDir/intellij/out" as File - testOutputDir = "$rootProject.projectDir/intellij/testOut" as File - whenConfigured { module -> - def allClasses = module.dependencies.findAll() { dep -> - if (dep instanceof org.gradle.plugins.ide.idea.model.ModuleLibrary - && dep.classes.find { path -> - path.url.matches('.*jcl-over-slf4j.*') || - path.url.matches('.*servlet-api.*') || - path.url.matches('.*jsp-api.*') - }) { - dep.scope = 'COMPILE' - dep.exported = false - } - } - } - } - // GRADLE-1116 - eclipseClasspath.whenConfigured { classpath -> - classpath.entries.removeAll { entry -> entry.path.endsWith('/build/classes/test') } - } - eclipseClasspath.doFirst { - eclipseClasspath.whenConfigured { classpath -> - def includeDeps = project.configurations.getByName('runtime')?.collect { f-> f.absolutePath } as Set - classpath.entries.each { cp -> - if(cp instanceof org.gradle.plugins.ide.eclipse.model.Library) { - def include = includeDeps.contains(cp.path) - def attr = 'org.eclipse.jst.component.dependency' - if(include && project.hasProperty('war')) { - // GRADLE-1426 (part a) - cp.entryAttributes.put(attr,'/WEB-INF/lib') - } else if(!include) { - // GRADLE-1422 - cp.entryAttributes.remove(attr) - } - } - } - } - } - // GRADLE-1426 (part b) - project.plugins.withType(org.gradle.api.plugins.WarPlugin.class).all { - eclipseWtpComponent.whenConfigured { wtpComp -> - wtpComp.wbModuleEntries.findAll { it instanceof org.gradle.plugins.ide.eclipse.model.WbDependentModule }.each { e -> - if(!e.handle.startsWith('module:/resource/')) { - wtpComp.wbModuleEntries.remove(e) - } - } - } - } tasks.withType(org.gradle.plugins.ide.eclipse.GenerateEclipseWtpComponent) { - whenConfigured { wtpComponent -> - wtpComponent.contextPath = project.tasks.findByName('jettyRun')?.contextPath?.replaceFirst('/','') + project.eclipse.classpath.file.whenMerged { classpath-> + project.eclipse.wtp.component.file.whenMerged { wtpComponent -> + wtpComponent.contextPath = project.tasks.findByName('jettyRun')?.contextPath?.replaceFirst('/','') + } } } } -ideaModule { - excludeDirs += file('.gradle') - excludeDirs += file('buildSrc/build') - excludeDirs += file('buildSrc/.gradle') -} +project(':spring-security-samples-aspectj') { + task afterEclipseImport { + ext.srcFile = file('.classpath') + inputs.file srcFile + outputs.dir srcFile -ideaProject { - javaVersion = '1.6' - subprojects = [rootProject] + javaProjects - withXml { provider -> - // Use git - def node = provider.asNode() - def vcsConfig = node.component.find { it.'@name' == 'VcsDirectoryMappings' } - vcsConfig.mapping[0].'@vcs' = 'Git' + onlyIf { srcFile.exists() } + + doLast { + def classpath = new XmlParser().parse(srcFile) + + classpath.classpathentry.findAll{ it.@path == '/spring-security-aspects' }.each { node -> + if(node.children().size() == 0) { + def attrs = new Node(node,'attributes') + def adjtAttr = new Node(attrs,'attributes',[name: 'org.eclipse.ajdt.aspectpath', value: 'org.eclipse.ajdt.aspectpath']) + node.appendNode(adjtAttr) + } + } + + def writer = new FileWriter(srcFile) + new XmlNodePrinter(new PrintWriter(writer)).print(classpath) + } } } diff --git a/gradle/javaprojects.gradle b/gradle/javaprojects.gradle index 6462f4bdf9..530b847510 100644 --- a/gradle/javaprojects.gradle +++ b/gradle/javaprojects.gradle @@ -1,20 +1,20 @@ apply plugin: 'java' apply plugin: 'eclipse' -springVersion = '3.0.6.RELEASE' -springLdapVersion = '1.3.1.RELEASE' -ehcacheVersion = '1.6.2' -aspectjVersion = '1.6.10' -apacheDsVersion = '1.5.5' -jstlVersion = '1.2' -jettyVersion = '6.1.26' -hsqlVersion = '1.8.0.10' -slf4jVersion = '1.6.1' -logbackVersion = '0.9.29' -cglibVersion = '2.2' -powerMockVersion = '1.4.12' +ext.springVersion = '3.0.6.RELEASE' +ext.springLdapVersion = '1.3.1.RELEASE' +ext.ehcacheVersion = '1.6.2' +ext.aspectjVersion = '1.6.10' +ext.apacheDsVersion = '1.5.5' +ext.jstlVersion = '1.2' +ext.jettyVersion = '6.1.26' +ext.hsqlVersion = '1.8.0.10' +ext.slf4jVersion = '1.6.1' +ext.logbackVersion = '0.9.29' +ext.cglibVersion = '2.2' +ext.powerMockVersion = '1.4.12' -bundlorProperties = [ +ext.bundlorProperties = [ version: version, secRange: "[$version, 3.2.0)", springRange: "[$springVersion, 3.2.0)", @@ -55,13 +55,13 @@ sourceSets { integrationTest { java.srcDir file('src/integration-test/java') resources.srcDir file('src/integration-test/resources') - compileClasspath = sourceSets.main.classes + sourceSets.test.classes + configurations.integrationTestCompile - runtimeClasspath = classes + compileClasspath + configurations.integrationTestRuntime + compileClasspath = sourceSets.main.output + sourceSets.test.output + configurations.integrationTestCompile + runtimeClasspath = output + compileClasspath + configurations.integrationTestRuntime } } task integrationTest(type: Test, dependsOn: jar) { - testClassesDir = sourceSets.integrationTest.classesDir + testClassesDir = sourceSets.integrationTest.output.classesDir logging.captureStandardOutput(LogLevel.INFO) classpath = sourceSets.integrationTest.runtimeClasspath maxParallelForks = 1 diff --git a/gradle/maven-deployment.gradle b/gradle/maven-deployment.gradle index 6e2e764e07..dafaec648e 100644 --- a/gradle/maven-deployment.gradle +++ b/gradle/maven-deployment.gradle @@ -43,7 +43,7 @@ uploadArchives { if (releaseBuild) { repository(url: releaseRepositoryUrl) } else { - s3credentials = [userName: project.properties.s3AccessKey, passphrase: project.properties.s3SecretAccessKey] + def s3credentials = [userName: project.properties.s3AccessKey, passphrase: project.properties.s3SecretAccessKey] repository(url: milestoneRepositoryUrl) { authentication(s3credentials) } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 73dbae74c3..e3b3376e60 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ee037f8e66..d6d7f61d4f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Apr 27 16:17:28 BST 2011 +#Sun Jul 01 12:51:55 CDT 2012 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=http\://repo.gradle.org/gradle/distributions/gradle-1.0-milestone-3-bin.zip +distributionUrl=http\://services.gradle.org/distributions/gradle-1.0-bin.zip diff --git a/gradlew b/gradlew index d8809f151d..662dce77c3 100755 --- a/gradlew +++ b/gradlew @@ -1,16 +1,16 @@ #!/bin/bash ############################################################################## -## ## -## Gradle wrapper script for UN*X ## -## ## +## +## Gradle start up script for UN*X +## ############################################################################## -# Uncomment those lines to set JVM options. GRADLE_OPTS and JAVA_OPTS can be used together. -# GRADLE_OPTS="$GRADLE_OPTS -Xmx512m" -# JAVA_OPTS="$JAVA_OPTS -Xmx512m" +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="-XX:MaxPermSize=256M" -GRADLE_APP_NAME=Gradle +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -42,54 +42,51 @@ case "`uname`" in ;; esac -# Attempt to set JAVA_HOME if it's not already set. -if [ -z "$JAVA_HOME" ] ; then - if $darwin ; then - [ -z "$JAVA_HOME" -a -d "/Library/Java/Home" ] && export JAVA_HOME="/Library/Java/Home" - [ -z "$JAVA_HOME" -a -d "/System/Library/Frameworks/JavaVM.framework/Home" ] && export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Home" - else - javaExecutable="`which javac`" - [ -z "$javaExecutable" -o "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ] && die "JAVA_HOME not set and cannot find javac to deduce location, please set JAVA_HOME." - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - [ `expr "$readLink" : '\([^ ]*\)'` = "no" ] && die "JAVA_HOME not set and readlink not available, please set JAVA_HOME." - javaExecutable="`readlink -f \"$javaExecutable\"`" - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - export JAVA_HOME="$javaHome" - fi -fi - # For Cygwin, ensure paths are in UNIX format before anything is touched. if $cygwin ; then - [ -n "$JAVACMD" ] && JAVACMD=`cygpath --unix "$JAVACMD"` [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` fi -STARTER_MAIN_CLASS=org.gradle.wrapper.GradleWrapperMain -CLASSPATH=`dirname "$0"`/gradle/wrapper/gradle-wrapper.jar -WRAPPER_PROPERTIES=`dirname "$0"`/gradle/wrapper/gradle-wrapper.properties -# Determine the Java command to use to start the JVM. -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" else - JAVACMD="java" + PRG=`dirname "$PRG"`"/$link" fi -fi -if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" +APP_HOME="`pwd -P`" +cd "$SAVED" + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." -fi -if [ -z "$JAVA_HOME" ] ; then - warn "JAVA_HOME environment variable is not set" fi # Increase the maximum file descriptors if we can. @@ -108,15 +105,14 @@ if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then fi fi -# For Darwin, add GRADLE_APP_NAME to the JAVA_OPTS as -Xdock:name +# For Darwin, add options to specify how the application appears in the dock if $darwin; then - JAVA_OPTS="$JAVA_OPTS -Xdock:name=$GRADLE_APP_NAME" -# we may also want to set -Xdock:image + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi # For Cygwin, switch paths to Windows format before running java if $cygwin ; then - JAVA_HOME=`cygpath --path --mixed "$JAVA_HOME"` + APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` # We build the pattern for arguments to be converted via cygpath @@ -143,7 +139,7 @@ if $cygwin ; then eval `echo args$i`="\"$arg\"" fi i=$((i+1)) - done + done case $i in (0) set -- ;; (1) set -- "$args0" ;; @@ -158,11 +154,11 @@ if $cygwin ; then esac fi -GRADLE_APP_BASE_NAME=`basename "$0"` +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" -exec "$JAVACMD" $JAVA_OPTS $GRADLE_OPTS \ - -classpath "$CLASSPATH" \ - -Dorg.gradle.appname="$GRADLE_APP_BASE_NAME" \ - -Dorg.gradle.wrapper.properties="$WRAPPER_PROPERTIES" \ - $STARTER_MAIN_CLASS \ - "$@" +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat index 4855abb883..89759b8224 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,24 +1,37 @@ @if "%DEBUG%" == "" @echo off @rem ########################################################################## -@rem ## -@rem Gradle startup script for Windows ## -@rem ## +@rem +@rem Gradle startup script for Windows +@rem @rem ########################################################################## @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal -@rem Uncomment those lines to set JVM options. GRADLE_OPTS and JAVA_OPTS can be used together. -@rem set GRADLE_OPTS=%GRADLE_OPTS% -Xmx512m -@rem set JAVA_OPTS=%JAVA_OPTS% -Xmx512m +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS=-XX:MaxPermSize=256M set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=.\ +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% @rem Find java.exe -set JAVA_EXE=java.exe -if not defined JAVA_HOME goto init +if defined JAVA_HOME goto findJavaFromJavaHome +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe @@ -29,14 +42,14 @@ echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo. echo Please set the JAVA_HOME variable in your environment to match the echo location of your Java installation. -echo. -goto end + +goto fail :init @rem Get command-line arguments, handling Windowz variants if not "%OS%" == "Windows_NT" goto win9xME_args -if "%eval[2+2]" == "4" goto 4NT_args +if "%@eval[2+2]" == "4" goto 4NT_args :win9xME_args @rem Slurp the command line arguments. @@ -56,27 +69,22 @@ set CMD_LINE_ARGS=%$ :execute @rem Setup the command line -set STARTER_MAIN_CLASS=org.gradle.wrapper.GradleWrapperMain -set CLASSPATH=%DIRNAME%\gradle\wrapper\gradle-wrapper.jar -set WRAPPER_PROPERTIES=%DIRNAME%\gradle\wrapper\gradle-wrapper.properties - -set GRADLE_OPTS=%JAVA_OPTS% %GRADLE_OPTS% -Dorg.gradle.wrapper.properties="%WRAPPER_PROPERTIES%" +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar @rem Execute Gradle -"%JAVA_EXE%" %GRADLE_OPTS% -classpath "%CLASSPATH%" %STARTER_MAIN_CLASS% %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% :end @rem End local scope for the variables with windows NT shell if "%ERRORLEVEL%"=="0" goto mainEnd -if not "%OS%"=="Windows_NT" echo 1 > nul | choice /n /c:1 - +:fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit "%ERRORLEVEL%" -exit /b "%ERRORLEVEL%" +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 :mainEnd if "%OS%"=="Windows_NT" endlocal -:omega \ No newline at end of file +:omega diff --git a/ldap/ldap.gradle b/ldap/ldap.gradle index 781c56b5e0..8594baa37b 100644 --- a/ldap/ldap.gradle +++ b/ldap/ldap.gradle @@ -1,6 +1,6 @@ // Ldap build file -apacheds_libs = [ +def apacheds_libs = [ "org.apache.directory.server:apacheds-core:$apacheDsVersion", "org.apache.directory.server:apacheds-core-entry:$apacheDsVersion", "org.apache.directory.server:apacheds-protocol-shared:$apacheDsVersion", diff --git a/remoting/remoting.gradle b/remoting/remoting.gradle index 1cbf7c730e..2530862965 100644 --- a/remoting/remoting.gradle +++ b/remoting/remoting.gradle @@ -7,5 +7,5 @@ dependencies { "org.springframework:spring-context:$springVersion", "org.springframework:spring-web:$springVersion" - testCompile project(':spring-security-core').sourceSets.test.classes + testCompile project(':spring-security-core').sourceSets.test.output } diff --git a/samples/aspectj/aspectj.gradle b/samples/aspectj/aspectj.gradle index 2f098dd31c..b3c512ce37 100644 --- a/samples/aspectj/aspectj.gradle +++ b/samples/aspectj/aspectj.gradle @@ -6,4 +6,4 @@ dependencies { runtime project(':spring-security-config'), project(':spring-security-aspects') -} \ No newline at end of file +} diff --git a/samples/cas/sample/cassample.gradle b/samples/cas/sample/cassample.gradle index 8f98e507a9..c55767f6bf 100644 --- a/samples/cas/sample/cassample.gradle +++ b/samples/cas/sample/cassample.gradle @@ -24,9 +24,7 @@ sourceSets.integrationTest { groovy.srcDir file('src/integration-test/groovy') } -eclipseClasspath { - plusConfigurations += configurations.integrationTestRuntime -} +eclipse.classpath.plusConfigurations += configurations.integrationTestRuntime dependencies { groovy 'org.codehaus.groovy:groovy:1.7.10' @@ -53,10 +51,10 @@ dependencies { [jettyRun, jettyRunWar]*.configure { contextPath = "/cas-sample" - def httpConnector = new org.mortbay.jetty.nio.SelectChannelConnector(); + def httpConnector = jettyRunWar.class.classLoader.loadClass('org.mortbay.jetty.nio.SelectChannelConnector').newInstance() httpConnector.port = 8080 httpConnector.confidentialPort = 8443 - def httpsConnector = new org.mortbay.jetty.security.SslSocketConnector(); + def httpsConnector = jettyRunWar.class.classLoader.loadClass('org.mortbay.jetty.security.SslSocketConnector').newInstance() httpsConnector.port = 8443 httpsConnector.keystore = httpsConnector.truststore = keystore httpsConnector.keyPassword = httpsConnector.trustPassword = password @@ -87,13 +85,15 @@ integrationTest.doFirst { gradle.taskGraph.whenReady {graph -> def casServer = casServer() [casServer,jettyRunWar]*.metaClass*.getHttpsConnector {-> - delegate.connectors.find { it instanceof org.mortbay.jetty.security.SslSocketConnector } + def sslSocketConnClass = jettyRunWar.class.classLoader.loadClass('org.mortbay.jetty.security.SslSocketConnector') + delegate.connectors.find { it in sslSocketConnClass } } [casServer,jettyRunWar]*.metaClass*.getHttpsHost {-> "localhost:"+delegate.httpsConnector.port } jettyRunWar.metaClass.getHttpConnector {-> - delegate.connectors.find { it instanceof org.mortbay.jetty.nio.SelectChannelConnector } + def channelConnClass = jettyRunWar.class.classLoader.loadClass('org.mortbay.jetty.nio.SelectChannelConnector') + delegate.connectors.find { it in channelConnClass } } if (graph.hasTask(cas)) { casServer.daemon = true @@ -118,4 +118,4 @@ def availablePort() { int port = server.localPort server.close() port -} \ No newline at end of file +} diff --git a/samples/cas/server/casserver.gradle b/samples/cas/server/casserver.gradle index d08e870492..d3d98dc825 100644 --- a/samples/cas/server/casserver.gradle +++ b/samples/cas/server/casserver.gradle @@ -13,12 +13,12 @@ dependencies { } task casServerOverlay(type: Sync) { - war = configurations.casServer.resolve().toArray()[0] - warName = war.name.replace('.war','-custom') - overlayDir = file('src/main/webapp') - explodedWar = file("$buildDir/tmp/${warName}") - customWar = file("$buildDir/tmp/${warName}.war") - tokens = [logLevel: 'INFO'] + def war = configurations.casServer.resolve().toArray()[0] + def warName = war.name.replace('.war','-custom') + def overlayDir = file('src/main/webapp') + def explodedWar = file("$buildDir/tmp/${warName}") + ext.customWar = file("$buildDir/tmp/${warName}.war") + ext.tokens = [logLevel: 'INFO'] inputs.files(war, overlayDir) inputs.property('tokens',{tokens}) @@ -44,7 +44,7 @@ casServerOverlay.metaClass.setLogLevel { level -> task casServer (type: org.gradle.api.plugins.jetty.JettyRunWar, dependsOn: 'casServerOverlay') { contextPath = "/cas" - connectors = [new org.mortbay.jetty.security.SslSocketConnector()] + connectors = [casServer.class.classLoader.loadClass('org.mortbay.jetty.security.SslSocketConnector').newInstance()] connectors[0].port = 9443 connectors[0].keystore = connectors[0].truststore = keystore connectors[0].keyPassword = connectors[0].trustPassword = password @@ -58,4 +58,4 @@ task casServer (type: org.gradle.api.plugins.jetty.JettyRunWar, dependsOn: 'casS System.setProperty('javax.net.ssl.trustStore', keystore) System.setProperty('javax.net.ssl.trustStorePassword', password) } -} \ No newline at end of file +} diff --git a/samples/gae/gae.gradle b/samples/gae/gae.gradle index 5a3564888d..bb6710c7a0 100644 --- a/samples/gae/gae.gradle +++ b/samples/gae/gae.gradle @@ -2,13 +2,19 @@ apply plugin: 'war' apply plugin: 'jetty' apply plugin: 'gae' -gaeVersion="1.4.2" +def gaeVersion="1.4.2" repositories { - // Hibernate Validator - mavenRepo name: 'JBoss', urls: 'https://repository.jboss.org/nexus/content/repositories/releases' - // GAE Jars - mavenRepo name: 'GAE', urls:'http://maven-gae-plugin.googlecode.com/svn/repository' + maven { + // Hibernate Validator + name = 'JBoss' + url = 'https://repository.jboss.org/nexus/content/repositories/releases' + } + maven { + // GAE Jars + name = 'GAE' + url = 'http://maven-gae-plugin.googlecode.com/svn/repository' + } } // Remove logback as it causes security issues with GAE. diff --git a/samples/preauth/preauth.gradle b/samples/preauth/preauth.gradle index 69d0821ce3..e7218d8ef9 100644 --- a/samples/preauth/preauth.gradle +++ b/samples/preauth/preauth.gradle @@ -23,5 +23,5 @@ dependencies { jettyRun { contextPath = "/preauth" - userRealms = [new org.mortbay.jetty.security.HashUserRealm('Preauth Realm', "$projectDir/realm.properties")] + userRealms = [jettyRun.class.classLoader.loadClass('org.mortbay.jetty.security.HashUserRealm').newInstance('Preauth Realm', "$projectDir/realm.properties")] } diff --git a/samples/tutorial/tutorial.gradle b/samples/tutorial/tutorial.gradle index 31c0ddea89..60397a41b3 100644 --- a/samples/tutorial/tutorial.gradle +++ b/samples/tutorial/tutorial.gradle @@ -34,10 +34,10 @@ dependencies { jettyRun { contextPath = "/tutorial" - def httpConnector = new org.mortbay.jetty.nio.SelectChannelConnector(); + def httpConnector = jettyRunWar.class.classLoader.loadClass('org.mortbay.jetty.nio.SelectChannelConnector').newInstance() httpConnector.port = 8080 httpConnector.confidentialPort = 8443 - def httpsConnector = new org.mortbay.jetty.security.SslSocketConnector(); + def httpsConnector = jettyRunWar.class.classLoader.loadClass('org.mortbay.jetty.security.SslSocketConnector').newInstance() httpsConnector.port = 8443 httpsConnector.keystore = "$rootDir/samples/certificates/server.jks" httpsConnector.keyPassword = 'password' diff --git a/settings.gradle b/settings.gradle index 41e71cbfca..31db6dae91 100644 --- a/settings.gradle +++ b/settings.gradle @@ -34,7 +34,7 @@ def String[] itest = [ include modules modules.each {name -> - p = findProject(":${name}") + def p = findProject(":${name}") p.name = "spring-security-${name}" p.buildFileName = "${name}.gradle" } @@ -42,7 +42,7 @@ modules.each {name -> include samples samples.each {name -> - p = findProject(":${name}") + def p = findProject(":${name}") def fullName = name.replaceAll('/','') p.name = "spring-security-samples-${fullName}" p.buildFileName = "${fullName}.gradle" @@ -52,7 +52,7 @@ samples.each {name -> include itest itest.each { name -> - p = findProject(":${name}") + def p = findProject(":${name}") p.name = "itest-${name}" p.buildFileName = "itest-${name}.gradle" p.projectDir = new File(settingsDir, "itest/${name}"); @@ -60,7 +60,7 @@ itest.each { name -> include 'docs', 'docs:faq', 'docs:manual' -docs = findProject(':docs') +def docs = findProject(':docs') docs.buildFileName = 'docs.gradle' rootProject.children.each {project -> diff --git a/web/web.gradle b/web/web.gradle index 5a990c0ee4..9afb8a42e0 100644 --- a/web/web.gradle +++ b/web/web.gradle @@ -11,7 +11,7 @@ dependencies { provided 'javax.servlet:servlet-api:2.5' - testCompile project(':spring-security-core').sourceSets.test.classes, + testCompile project(':spring-security-core').sourceSets.test.output, 'commons-codec:commons-codec:1.3', "org.springframework:spring-test:$springVersion", "org.powermock:powermock-core:$powerMockVersion",