SEC-1906: Update to Gradle 1.0

This commit is contained in:
Rob Winch 2012-06-29 12:59:22 -05:00
parent 2fba10ab61
commit a2452ab514
24 changed files with 202 additions and 244 deletions

View File

@ -4,8 +4,8 @@ description = 'Spring Security'
allprojects { allprojects {
version = '3.1.1.CI-SNAPSHOT' version = '3.1.1.CI-SNAPSHOT'
releaseBuild = version.endsWith('RELEASE') ext.releaseBuild = version.endsWith('RELEASE')
snapshotBuild = version.endsWith('SNAPSHOT') ext.snapshotBuild = version.endsWith('SNAPSHOT')
group = 'org.springframework.security' group = 'org.springframework.security'
@ -16,11 +16,11 @@ allprojects {
} }
// Set up different subproject lists for individual configuration // Set up different subproject lists for individual configuration
javaProjects = subprojects.findAll { project -> project.name != 'docs' && project.name != 'faq' && project.name != 'manual' } ext.javaProjects = subprojects.findAll { project -> project.name != 'docs' && project.name != 'faq' && project.name != 'manual' }
sampleProjects = subprojects.findAll { project -> project.name.startsWith('spring-security-samples') } ext.sampleProjects = subprojects.findAll { project -> project.name.startsWith('spring-security-samples') }
itestProjects = subprojects.findAll { project -> project.name.startsWith('itest') } ext.itestProjects = subprojects.findAll { project -> project.name.startsWith('itest') }
coreModuleProjects = javaProjects - sampleProjects - itestProjects ext.coreModuleProjects = javaProjects - sampleProjects - itestProjects
aspectjProjects = [project(':spring-security-aspects'), project(':spring-security-samples-aspectj')] ext.aspectjProjects = [project(':spring-security-aspects'), project(':spring-security-samples-aspectj')]
configure(javaProjects) { configure(javaProjects) {
apply from: "$rootDir/gradle/javaprojects.gradle" apply from: "$rootDir/gradle/javaprojects.gradle"
@ -28,7 +28,7 @@ configure(javaProjects) {
configure(coreModuleProjects) { configure(coreModuleProjects) {
// Gives better names in structure101 jar diagram // 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' apply plugin: 'bundlor'
bundlor.expansions = bundlorProperties bundlor.expansions = bundlorProperties
apply from: "$rootDir/gradle/maven-deployment.gradle" apply from: "$rootDir/gradle/maven-deployment.gradle"
@ -75,5 +75,5 @@ task uploadDist(type: S3DistroUpload) {
apply from: "$rootDir/gradle/ide-integration.gradle" apply from: "$rootDir/gradle/ide-integration.gradle"
task wrapper(type: Wrapper) { task wrapper(type: Wrapper) {
gradleVersion = '1.0-milestone-3' gradleVersion = '1.0'
} }

View File

@ -3,8 +3,14 @@ apply plugin: 'groovy'
repositories { repositories {
mavenLocal() mavenLocal()
mavenCentral() mavenCentral()
mavenRepo name: 'SpringSource Enterprise Release', urls: 'http://repository.springsource.com/maven/bundles/release' maven {
mavenRepo name: 'SpringSource Enterprise External', urls: 'http://repository.springsource.com/maven/bundles/external' 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 // Docbook Plugin
@ -48,9 +54,3 @@ task ide(type: Copy) {
from configurations.runtime from configurations.runtime
into 'ide' into 'ide'
} }
apply plugin: 'idea'
ideaModule {
excludeDirs += file('.gradle')
}

View File

@ -12,7 +12,7 @@ import org.gradle.api.GradleException
import org.gradle.plugins.ide.eclipse.GenerateEclipseProject import org.gradle.plugins.ide.eclipse.GenerateEclipseProject
import org.gradle.plugins.ide.eclipse.GenerateEclipseClasspath import org.gradle.plugins.ide.eclipse.GenerateEclipseClasspath
import org.gradle.plugins.ide.eclipse.model.BuildCommand 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<Project> {
dependsOn project.processResources dependsOn project.processResources
sourceSet = project.sourceSets.main sourceSet = project.sourceSets.main
inputs.files(sourceSet.java.srcDirs) inputs.files(sourceSet.java.srcDirs)
outputs.dir(sourceSet.classesDir) outputs.dir(sourceSet.output.classesDir)
aspectPath = project.configurations.aspectpath aspectPath = project.configurations.aspectpath
} }
@ -49,19 +49,19 @@ class AspectJPlugin implements Plugin<Project> {
dependsOn project.processTestResources, project.compileJava, project.jar dependsOn project.processTestResources, project.compileJava, project.jar
sourceSet = project.sourceSets.test sourceSet = project.sourceSets.test
inputs.files(sourceSet.java.srcDirs) inputs.files(sourceSet.java.srcDirs)
outputs.dir(sourceSet.classesDir) outputs.dir(sourceSet.output.classesDir)
aspectPath = project.files(project.configurations.aspectpath, project.jar.archivePath) aspectPath = project.files(project.configurations.aspectpath, project.jar.archivePath)
} }
project.tasks.withType(GenerateEclipseProject).all { project.tasks.withType(GenerateEclipseProject) {
whenConfigured { p -> project.eclipse.project.file.whenMerged { p ->
p.natures.add(0, 'org.eclipse.ajdt.ui.ajnature') 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 { project.tasks.withType(GenerateEclipseClasspath) {
whenConfigured { classpath -> project.eclipse.classpath.file.whenMerged { classpath ->
def entries = classpath.entries.findAll { it instanceof ProjectDependency}.findAll { entry -> def entries = classpath.entries.findAll { it instanceof ProjectDependency}.findAll { entry ->
def projectPath = entry.path.replaceAll('/',':') def projectPath = entry.path.replaceAll('/',':')
project.rootProject.findProject(projectPath).plugins.findPlugin(AspectJPlugin) project.rootProject.findProject(projectPath).plugins.findPlugin(AspectJPlugin)
@ -86,7 +86,7 @@ class Ajc extends DefaultTask {
def compile() { def compile() {
logger.info("Running ajc ...") logger.info("Running ajc ...")
ant.taskdef(resource: "org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties", classpath: project.configurations.ajtools.asPath) 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, source: project.convention.plugins.java.sourceCompatibility,
target: project.convention.plugins.java.targetCompatibility, target: project.convention.plugins.java.targetCompatibility,
aspectPath: aspectPath.asPath, sourceRootCopyFilter: '**/*.java', showWeaveInfo: 'true') { aspectPath: aspectPath.asPath, sourceRootCopyFilter: '**/*.java', showWeaveInfo: 'true') {

View File

@ -76,7 +76,7 @@ public class Bundlor extends DefaultTask {
manifestTemplate = null manifestTemplate = null
} }
inputPaths = project.files(project.sourceSets.main.classesDir) inputPaths = project.files(project.sourceSets.main.output.classesDir)
if (manifestTemplate != null) { if (manifestTemplate != null) {
project.jar.manifest.from manifest project.jar.manifest.from manifest

View File

@ -27,7 +27,7 @@ dependencies {
testCompile project(':spring-security-ldap'), testCompile project(':spring-security-ldap'),
project(':spring-security-openid'), project(':spring-security-openid'),
project(':spring-security-core').sourceSets.test.classes, project(':spring-security-core').sourceSets.test.output,
'javax.annotation:jsr250-api:1.0', 'javax.annotation:jsr250-api:1.0',
"org.springframework.ldap:spring-ldap-core:$springLdapVersion", "org.springframework.ldap:spring-ldap-core:$springLdapVersion",
"org.springframework:spring-expression:$springVersion", "org.springframework:spring-expression:$springVersion",

View File

@ -2,7 +2,7 @@
// We don't define a module dependency on crypto to avoid creating a transitive dependency // We don't define a module dependency on crypto to avoid creating a transitive dependency
def cryptoProject = project(':spring-security-crypto') def cryptoProject = project(':spring-security-crypto')
def cryptoClasses = cryptoProject.sourceSets.main.classes def cryptoClasses = cryptoProject.sourceSets.main.output
dependencies { dependencies {
compile cryptoProject, compile cryptoProject,
@ -31,7 +31,7 @@ classes.dependsOn cryptoProject.classes
classes.doLast { classes.doLast {
copy { copy {
from cryptoClasses from cryptoClasses
into sourceSets.main.classesDir into sourceSets.main.output.classesDir
} }
} }
@ -44,14 +44,3 @@ test {
systemProperties['springSecurityVersion'] = version systemProperties['springSecurityVersion'] = version
systemProperties['springVersion'] = springVersion 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')
}

View File

@ -17,7 +17,7 @@ project('faq') {
[docbookHtml, docbookFoPdf, docbookHtmlSingle]*.sourceFileName = 'faq.xml' [docbookHtml, docbookFoPdf, docbookHtmlSingle]*.sourceFileName = 'faq.xml'
docbookHtmlSingle.suffix = '' docbookHtmlSingle.suffix = ''
spec = copySpec { ext.spec = copySpec {
into ('faq') { into ('faq') {
from("$buildDir/docs") from("$buildDir/docs")
from("$projectDir/src/resources") from("$projectDir/src/resources")
@ -36,7 +36,7 @@ project('manual') {
// docbookFoPdf.admonGraphicsPath = "${imagesDir}/" // docbookFoPdf.admonGraphicsPath = "${imagesDir}/"
docbookFoPdf.imgSrcPath = "${projectDir}/src/docbook/" docbookFoPdf.imgSrcPath = "${projectDir}/src/docbook/"
spec = copySpec { ext.spec = copySpec {
into ('reference') { into ('reference') {
from("$buildDir/docs") from("$buildDir/docs")
from("$projectDir/src/resources") from("$projectDir/src/resources")
@ -56,7 +56,6 @@ task reference (type: Copy) {
task apidocs(type: Javadoc) { task apidocs(type: Javadoc) {
destinationDir = new File(buildDir, 'apidocs') destinationDir = new File(buildDir, 'apidocs')
title = "Spring Security $version API" title = "Spring Security $version API"
optionsFile = file("$buildDir/tmp/javadoc.options")
source coreModuleProjects.collect { project -> source coreModuleProjects.collect { project ->
project.sourceSets.main.allJava project.sourceSets.main.allJava
@ -94,7 +93,7 @@ apidocs.options.groups = [
] ]
apiSpec = copySpec { ext.apiSpec = copySpec {
into('apidocs') { into('apidocs') {
from(apidocs.destinationDir) from(apidocs.destinationDir)
} }

View File

@ -2,80 +2,40 @@ apply plugin: 'idea'
configure(javaProjects) { configure(javaProjects) {
apply plugin: 'idea' 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) { tasks.withType(org.gradle.plugins.ide.eclipse.GenerateEclipseWtpComponent) {
whenConfigured { wtpComponent -> project.eclipse.classpath.file.whenMerged { classpath->
project.eclipse.wtp.component.file.whenMerged { wtpComponent ->
wtpComponent.contextPath = project.tasks.findByName('jettyRun')?.contextPath?.replaceFirst('/','') wtpComponent.contextPath = project.tasks.findByName('jettyRun')?.contextPath?.replaceFirst('/','')
} }
} }
} }
ideaModule {
excludeDirs += file('.gradle')
excludeDirs += file('buildSrc/build')
excludeDirs += file('buildSrc/.gradle')
} }
ideaProject { project(':spring-security-samples-aspectj') {
javaVersion = '1.6' task afterEclipseImport {
subprojects = [rootProject] + javaProjects ext.srcFile = file('.classpath')
withXml { provider -> inputs.file srcFile
// Use git outputs.dir srcFile
def node = provider.asNode()
def vcsConfig = node.component.find { it.'@name' == 'VcsDirectoryMappings' } onlyIf { srcFile.exists() }
vcsConfig.mapping[0].'@vcs' = 'Git'
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)
}
} }
} }

View File

@ -1,20 +1,20 @@
apply plugin: 'java' apply plugin: 'java'
apply plugin: 'eclipse' apply plugin: 'eclipse'
springVersion = '3.0.6.RELEASE' ext.springVersion = '3.0.6.RELEASE'
springLdapVersion = '1.3.1.RELEASE' ext.springLdapVersion = '1.3.1.RELEASE'
ehcacheVersion = '1.6.2' ext.ehcacheVersion = '1.6.2'
aspectjVersion = '1.6.10' ext.aspectjVersion = '1.6.10'
apacheDsVersion = '1.5.5' ext.apacheDsVersion = '1.5.5'
jstlVersion = '1.2' ext.jstlVersion = '1.2'
jettyVersion = '6.1.26' ext.jettyVersion = '6.1.26'
hsqlVersion = '1.8.0.10' ext.hsqlVersion = '1.8.0.10'
slf4jVersion = '1.6.1' ext.slf4jVersion = '1.6.1'
logbackVersion = '0.9.29' ext.logbackVersion = '0.9.29'
cglibVersion = '2.2' ext.cglibVersion = '2.2'
powerMockVersion = '1.4.12' ext.powerMockVersion = '1.4.12'
bundlorProperties = [ ext.bundlorProperties = [
version: version, version: version,
secRange: "[$version, 3.2.0)", secRange: "[$version, 3.2.0)",
springRange: "[$springVersion, 3.2.0)", springRange: "[$springVersion, 3.2.0)",
@ -55,13 +55,13 @@ sourceSets {
integrationTest { integrationTest {
java.srcDir file('src/integration-test/java') java.srcDir file('src/integration-test/java')
resources.srcDir file('src/integration-test/resources') resources.srcDir file('src/integration-test/resources')
compileClasspath = sourceSets.main.classes + sourceSets.test.classes + configurations.integrationTestCompile compileClasspath = sourceSets.main.output + sourceSets.test.output + configurations.integrationTestCompile
runtimeClasspath = classes + compileClasspath + configurations.integrationTestRuntime runtimeClasspath = output + compileClasspath + configurations.integrationTestRuntime
} }
} }
task integrationTest(type: Test, dependsOn: jar) { task integrationTest(type: Test, dependsOn: jar) {
testClassesDir = sourceSets.integrationTest.classesDir testClassesDir = sourceSets.integrationTest.output.classesDir
logging.captureStandardOutput(LogLevel.INFO) logging.captureStandardOutput(LogLevel.INFO)
classpath = sourceSets.integrationTest.runtimeClasspath classpath = sourceSets.integrationTest.runtimeClasspath
maxParallelForks = 1 maxParallelForks = 1

View File

@ -43,7 +43,7 @@ uploadArchives {
if (releaseBuild) { if (releaseBuild) {
repository(url: releaseRepositoryUrl) repository(url: releaseRepositoryUrl)
} else { } else {
s3credentials = [userName: project.properties.s3AccessKey, passphrase: project.properties.s3SecretAccessKey] def s3credentials = [userName: project.properties.s3AccessKey, passphrase: project.properties.s3SecretAccessKey]
repository(url: milestoneRepositoryUrl) { repository(url: milestoneRepositoryUrl) {
authentication(s3credentials) authentication(s3credentials)
} }

Binary file not shown.

View File

@ -1,6 +1,6 @@
#Wed Apr 27 16:17:28 BST 2011 #Sun Jul 01 12:51:55 CDT 2012
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists 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

90
gradlew vendored
View File

@ -1,16 +1,16 @@
#!/bin/bash #!/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. # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
# GRADLE_OPTS="$GRADLE_OPTS -Xmx512m" DEFAULT_JVM_OPTS="-XX:MaxPermSize=256M"
# JAVA_OPTS="$JAVA_OPTS -Xmx512m"
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. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum" MAX_FD="maximum"
@ -42,35 +42,32 @@ case "`uname`" in
;; ;;
esac 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. # For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then if $cygwin ; then
[ -n "$JAVACMD" ] && JAVACMD=`cygpath --unix "$JAVACMD"`
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi fi
STARTER_MAIN_CLASS=org.gradle.wrapper.GradleWrapperMain # Attempt to set APP_HOME
CLASSPATH=`dirname "$0"`/gradle/wrapper/gradle-wrapper.jar # Resolve links: $0 may be a link
WRAPPER_PROPERTIES=`dirname "$0"`/gradle/wrapper/gradle-wrapper.properties 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
PRG=`dirname "$PRG"`"/$link"
fi
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. # Determine the Java command to use to start the JVM.
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables # IBM's JDK on AIX uses strange locations for the executables
@ -78,18 +75,18 @@ if [ -z "$JAVACMD" ] ; then
else else
JAVACMD="$JAVA_HOME/bin/java" JAVACMD="$JAVA_HOME/bin/java"
fi fi
else
JAVACMD="java"
fi
fi
if [ ! -x "$JAVACMD" ] ; then if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi fi
if [ -z "$JAVA_HOME" ] ; then else
warn "JAVA_HOME environment variable is not set" 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 fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
@ -108,15 +105,14 @@ if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
fi fi
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 if $darwin; then
JAVA_OPTS="$JAVA_OPTS -Xdock:name=$GRADLE_APP_NAME" GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
# we may also want to set -Xdock:image
fi fi
# For Cygwin, switch paths to Windows format before running java # For Cygwin, switch paths to Windows format before running java
if $cygwin ; then if $cygwin ; then
JAVA_HOME=`cygpath --path --mixed "$JAVA_HOME"` APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
# We build the pattern for arguments to be converted via cygpath # We build the pattern for arguments to be converted via cygpath
@ -158,11 +154,11 @@ if $cygwin ; then
esac esac
fi 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 \ exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
-classpath "$CLASSPATH" \
-Dorg.gradle.appname="$GRADLE_APP_BASE_NAME" \
-Dorg.gradle.wrapper.properties="$WRAPPER_PROPERTIES" \
$STARTER_MAIN_CLASS \
"$@"

52
gradlew.bat vendored
View File

@ -1,24 +1,37 @@
@if "%DEBUG%" == "" @echo off @if "%DEBUG%" == "" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem ## @rem
@rem Gradle startup script for Windows ## @rem Gradle startup script for Windows
@rem ## @rem
@rem ########################################################################## @rem ##########################################################################
@rem Set local scope for the variables with windows NT shell @rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal if "%OS%"=="Windows_NT" setlocal
@rem Uncomment those lines to set JVM options. GRADLE_OPTS and JAVA_OPTS can be used together. @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
@rem set GRADLE_OPTS=%GRADLE_OPTS% -Xmx512m set DEFAULT_JVM_OPTS=-XX:MaxPermSize=256M
@rem set JAVA_OPTS=%JAVA_OPTS% -Xmx512m
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.\ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe @rem Find java.exe
set JAVA_EXE=java.exe if defined JAVA_HOME goto findJavaFromJavaHome
if not defined JAVA_HOME goto init
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_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe 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.
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation. echo location of your Java installation.
echo.
goto end goto fail
:init :init
@rem Get command-line arguments, handling Windowz variants @rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args 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 :win9xME_args
@rem Slurp the command line arguments. @rem Slurp the command line arguments.
@ -56,25 +69,20 @@ set CMD_LINE_ARGS=%$
:execute :execute
@rem Setup the command line @rem Setup the command line
set STARTER_MAIN_CLASS=org.gradle.wrapper.GradleWrapperMain set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
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%"
@rem Execute Gradle @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 :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd 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 Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code! rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit "%ERRORLEVEL%" if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b "%ERRORLEVEL%" exit /b 1
:mainEnd :mainEnd
if "%OS%"=="Windows_NT" endlocal if "%OS%"=="Windows_NT" endlocal

View File

@ -1,6 +1,6 @@
// Ldap build file // Ldap build file
apacheds_libs = [ def apacheds_libs = [
"org.apache.directory.server:apacheds-core:$apacheDsVersion", "org.apache.directory.server:apacheds-core:$apacheDsVersion",
"org.apache.directory.server:apacheds-core-entry:$apacheDsVersion", "org.apache.directory.server:apacheds-core-entry:$apacheDsVersion",
"org.apache.directory.server:apacheds-protocol-shared:$apacheDsVersion", "org.apache.directory.server:apacheds-protocol-shared:$apacheDsVersion",

View File

@ -7,5 +7,5 @@ dependencies {
"org.springframework:spring-context:$springVersion", "org.springframework:spring-context:$springVersion",
"org.springframework:spring-web:$springVersion" "org.springframework:spring-web:$springVersion"
testCompile project(':spring-security-core').sourceSets.test.classes testCompile project(':spring-security-core').sourceSets.test.output
} }

View File

@ -24,9 +24,7 @@ sourceSets.integrationTest {
groovy.srcDir file('src/integration-test/groovy') groovy.srcDir file('src/integration-test/groovy')
} }
eclipseClasspath { eclipse.classpath.plusConfigurations += configurations.integrationTestRuntime
plusConfigurations += configurations.integrationTestRuntime
}
dependencies { dependencies {
groovy 'org.codehaus.groovy:groovy:1.7.10' groovy 'org.codehaus.groovy:groovy:1.7.10'
@ -53,10 +51,10 @@ dependencies {
[jettyRun, jettyRunWar]*.configure { [jettyRun, jettyRunWar]*.configure {
contextPath = "/cas-sample" 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.port = 8080
httpConnector.confidentialPort = 8443 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.port = 8443
httpsConnector.keystore = httpsConnector.truststore = keystore httpsConnector.keystore = httpsConnector.truststore = keystore
httpsConnector.keyPassword = httpsConnector.trustPassword = password httpsConnector.keyPassword = httpsConnector.trustPassword = password
@ -87,13 +85,15 @@ integrationTest.doFirst {
gradle.taskGraph.whenReady {graph -> gradle.taskGraph.whenReady {graph ->
def casServer = casServer() def casServer = casServer()
[casServer,jettyRunWar]*.metaClass*.getHttpsConnector {-> [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 {-> [casServer,jettyRunWar]*.metaClass*.getHttpsHost {->
"localhost:"+delegate.httpsConnector.port "localhost:"+delegate.httpsConnector.port
} }
jettyRunWar.metaClass.getHttpConnector {-> 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)) { if (graph.hasTask(cas)) {
casServer.daemon = true casServer.daemon = true

View File

@ -13,12 +13,12 @@ dependencies {
} }
task casServerOverlay(type: Sync) { task casServerOverlay(type: Sync) {
war = configurations.casServer.resolve().toArray()[0] def war = configurations.casServer.resolve().toArray()[0]
warName = war.name.replace('.war','-custom') def warName = war.name.replace('.war','-custom')
overlayDir = file('src/main/webapp') def overlayDir = file('src/main/webapp')
explodedWar = file("$buildDir/tmp/${warName}") def explodedWar = file("$buildDir/tmp/${warName}")
customWar = file("$buildDir/tmp/${warName}.war") ext.customWar = file("$buildDir/tmp/${warName}.war")
tokens = [logLevel: 'INFO'] ext.tokens = [logLevel: 'INFO']
inputs.files(war, overlayDir) inputs.files(war, overlayDir)
inputs.property('tokens',{tokens}) inputs.property('tokens',{tokens})
@ -44,7 +44,7 @@ casServerOverlay.metaClass.setLogLevel { level ->
task casServer (type: org.gradle.api.plugins.jetty.JettyRunWar, dependsOn: 'casServerOverlay') { task casServer (type: org.gradle.api.plugins.jetty.JettyRunWar, dependsOn: 'casServerOverlay') {
contextPath = "/cas" 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].port = 9443
connectors[0].keystore = connectors[0].truststore = keystore connectors[0].keystore = connectors[0].truststore = keystore
connectors[0].keyPassword = connectors[0].trustPassword = password connectors[0].keyPassword = connectors[0].trustPassword = password

View File

@ -2,13 +2,19 @@ apply plugin: 'war'
apply plugin: 'jetty' apply plugin: 'jetty'
apply plugin: 'gae' apply plugin: 'gae'
gaeVersion="1.4.2" def gaeVersion="1.4.2"
repositories { repositories {
maven {
// Hibernate Validator // Hibernate Validator
mavenRepo name: 'JBoss', urls: 'https://repository.jboss.org/nexus/content/repositories/releases' name = 'JBoss'
url = 'https://repository.jboss.org/nexus/content/repositories/releases'
}
maven {
// GAE Jars // GAE Jars
mavenRepo name: 'GAE', urls:'http://maven-gae-plugin.googlecode.com/svn/repository' name = 'GAE'
url = 'http://maven-gae-plugin.googlecode.com/svn/repository'
}
} }
// Remove logback as it causes security issues with GAE. // Remove logback as it causes security issues with GAE.

View File

@ -23,5 +23,5 @@ dependencies {
jettyRun { jettyRun {
contextPath = "/preauth" 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")]
} }

View File

@ -34,10 +34,10 @@ dependencies {
jettyRun { jettyRun {
contextPath = "/tutorial" 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.port = 8080
httpConnector.confidentialPort = 8443 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.port = 8443
httpsConnector.keystore = "$rootDir/samples/certificates/server.jks" httpsConnector.keystore = "$rootDir/samples/certificates/server.jks"
httpsConnector.keyPassword = 'password' httpsConnector.keyPassword = 'password'

View File

@ -34,7 +34,7 @@ def String[] itest = [
include modules include modules
modules.each {name -> modules.each {name ->
p = findProject(":${name}") def p = findProject(":${name}")
p.name = "spring-security-${name}" p.name = "spring-security-${name}"
p.buildFileName = "${name}.gradle" p.buildFileName = "${name}.gradle"
} }
@ -42,7 +42,7 @@ modules.each {name ->
include samples include samples
samples.each {name -> samples.each {name ->
p = findProject(":${name}") def p = findProject(":${name}")
def fullName = name.replaceAll('/','') def fullName = name.replaceAll('/','')
p.name = "spring-security-samples-${fullName}" p.name = "spring-security-samples-${fullName}"
p.buildFileName = "${fullName}.gradle" p.buildFileName = "${fullName}.gradle"
@ -52,7 +52,7 @@ samples.each {name ->
include itest include itest
itest.each { name -> itest.each { name ->
p = findProject(":${name}") def p = findProject(":${name}")
p.name = "itest-${name}" p.name = "itest-${name}"
p.buildFileName = "itest-${name}.gradle" p.buildFileName = "itest-${name}.gradle"
p.projectDir = new File(settingsDir, "itest/${name}"); p.projectDir = new File(settingsDir, "itest/${name}");
@ -60,7 +60,7 @@ itest.each { name ->
include 'docs', 'docs:faq', 'docs:manual' include 'docs', 'docs:faq', 'docs:manual'
docs = findProject(':docs') def docs = findProject(':docs')
docs.buildFileName = 'docs.gradle' docs.buildFileName = 'docs.gradle'
rootProject.children.each {project -> rootProject.children.each {project ->

View File

@ -11,7 +11,7 @@ dependencies {
provided 'javax.servlet:servlet-api:2.5' 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', 'commons-codec:commons-codec:1.3',
"org.springframework:spring-test:$springVersion", "org.springframework:spring-test:$springVersion",
"org.powermock:powermock-core:$powerMockVersion", "org.powermock:powermock-core:$powerMockVersion",