spring-security/build.gradle

164 lines
5.0 KiB
Groovy

import java.util.jar.Manifest
import org.gradle.api.tasks.bundling.GradleManifest
apply id: 'base'
allprojects {
version = '3.0.2.CI-SNAPSHOT'
releaseBuild = version.endsWith('RELEASE')
group = 'org.springframework.security'
repositories {
mavenRepo name:'Local', urls:'file:///Users/luke/.m2/repository'
mavenCentral()
mavenRepo name:'SpringSource Milestone Repo', urls:'http://repository.springsource.com/maven/bundles/milestone'
}
}
configure(javaProjects()) {
apply id: 'java'
springVersion = '3.0.0.RELEASE'
springLdapVersion = '1.3.0.RELEASE'
ehcacheVersion = '1.6.2'
aspectjVersion = '1.6.5'
apacheDsVersion = '1.5.5'
jstlVersion = '1.1.2'
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 {
options.fork(forkMode: ForkMode.ONCE, jvmArgs: ["-ea", '-Xms128m', '-Xmx500m', '-XX:MaxPermSize=128m', '-XX:+HeapDumpOnOutOfMemoryError'])
}
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: "$buildDir/classes/main", 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")
}
task apidocs(type: Javadoc) {
destinationDir = new File(buildDir, 'apidocs')
optionsFile = file("$buildDir/tmp/javadoc.options")
source coreModuleProjects().collect { project ->
project.sourceSets.main.allJava
}
classpath = files(coreModuleProjects().collect { project ->
project.sourceSets.main.compileClasspath })
}
task dist (type: Zip) {
def docsDir = new File(project(':manual').buildDir, 'docs')
into('docs/apidocs') {
from apidocs.destinationDir
}
into('docs/reference') {
from docsDir
}
into('dist') {
from coreModuleProjects().collect { project -> project.libsDir }
}
}
dist.dependsOn apidocs, ':manual:doc'
dist.dependsOn subprojects.collect { "$it.path:assemble" }
def javaProjects() {
subprojects.findAll { project -> project.name != 'faq' && project.name != 'manual' }
}
def sampleProjects() {
subprojects.findAll { project -> project.name.startsWith('spring-security-samples') }
}
def coreModuleProjects() {
javaProjects() - sampleProjects()
}