Skip to content

Commit

Permalink
Update to Gradle build
Browse files Browse the repository at this point in the history
  • Loading branch information
rwinch committed Oct 22, 2012
1 parent af5d591 commit 7200acf
Show file tree
Hide file tree
Showing 13 changed files with 672 additions and 444 deletions.
7 changes: 6 additions & 1 deletion .gitignore
@@ -1 +1,6 @@
target/ target/
.idea/
build/
bin/
*.iml
.gradle/
267 changes: 267 additions & 0 deletions build.gradle
@@ -0,0 +1,267 @@
buildscript {
repositories {
maven { url 'http://repo.springsource.org/plugins-release' }
}
dependencies {
classpath 'org.springframework.build.gradle:docbook-reference-plugin:0.1.5'
}
}

configure(allprojects) {
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'

group = 'org.springframework.security.kerberos'

sourceCompatibility=1.5
targetCompatibility=1.5

ext.junitVersion = '4.10'
ext.springSecurityVersion = '3.1.3.RELEASE'
ext.springVersion = '3.0.3.RELEASE'

[compileJava, compileTestJava]*.options*.compilerArgs = ['-Xlint:none']

test.systemProperty("java.awt.headless", "true")

repositories {
mavenCentral()
}

// servlet-api (2.5) and tomcat-servlet-api (3.0) classpath entries should not be
// exported to dependent projects in Eclipse to avoid false compilation errors due
// to changing APIs across these versions
eclipse.classpath.file.whenMerged { classpath ->
classpath.entries.findAll { entry -> entry.path.contains('servlet-api') }*.exported = false
}
}

configure(subprojects) { subproject ->
apply from: "${rootProject.projectDir}/publish-maven.gradle"

jar {
manifest.attributes['Created-By'] =
"${System.getProperty('java.version')} (${System.getProperty('java.specification.vendor')})"
manifest.attributes['Implementation-Title'] = subproject.name
manifest.attributes['Implementation-Version'] = subproject.version

from("${rootProject.projectDir}/src/dist") {
include "license.txt"
include "notice.txt"
into "META-INF"
expand(copyright: new Date().format('yyyy'), version: project.version)
}
}

javadoc {
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
options.author = true
options.header = project.name
//options.overview = "${projectDir}/src/main/java/overview.html"
}

task sourcesJar(type: Jar, dependsOn:classes) {
classifier = 'sources'
from sourceSets.main.allJava.srcDirs
include '**/*.java', '**/*.aj'
}

task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}

artifacts {
archives sourcesJar
archives javadocJar
}

dependencies {
testCompile "junit:junit:$junitVersion"
}
}


project('spring-security-kerberos-core') {
description = 'Spring Security Kerberos Core'

dependencies {
compile "org.springframework.security:spring-security-core:$springSecurityVersion"
compile "org.springframework.security:spring-security-web:$springSecurityVersion"
compile("commons-logging:commons-logging:1.1.1", optional)
compile("javax.servlet:servlet-api:2.5", provided)

testCompile "org.mockito:mockito-core:1.9.0"
}
}

project('spring-security-kerberos-sample') {
apply plugin: 'jetty'

description = 'Spring Security Kerberos Sample'
dependencies {
compile project(":spring-security-kerberos-core")
compile("javax.servlet:servlet-api:2.5", provided)
compile("org.springframework.security:spring-security-config:$springSecurityVersion")
}
}

configure(rootProject) {
description = 'Spring Framework'

apply plugin: 'docbook-reference'

reference {
sourceDir = file('src/reference/docbook')
}

// don't publish the default jar for the root project
configurations.archives.artifacts.clear()

task api(type: Javadoc) {
group = 'Documentation'
description = 'Generates aggregated Javadoc API documentation.'
title = "${rootProject.description} ${version} API"
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
options.author = true
options.header = rootProject.description
// options.overview = 'src/api/overview.html'
options.splitIndex = true
options.links(
'http://docs.jboss.org/jbossas/javadoc/4.0.5/connector'
)
source subprojects.collect { project ->
project.sourceSets.main.allJava
}
destinationDir = new File(buildDir, "api")
classpath = files(subprojects.collect { project ->
project.sourceSets.main.compileClasspath
})
maxMemory = '1024m'
}

task docsZip(type: Zip) {
group = 'Distribution'
classifier = 'docs'
description = "Builds -${classifier} archive containing api and reference " +
"for deployment at static.springframework.org/spring-security-kerberos/docs."

from('src/dist') {
include 'changelog.txt'
}

from (api) {
into 'api'
}

from (reference) {
into 'reference'
}
}

task schemaZip(type: Zip) {
group = 'Distribution'
classifier = 'schema'
description = "Builds -${classifier} archive containing all " +
"XSDs for deployment at static.springframework.org/schema."

subprojects.each { subproject ->
def Properties schemas = new Properties();

subproject.sourceSets.main.resources.find {
it.path.endsWith('META-INF/spring.schemas')
}?.withInputStream { schemas.load(it) }

for (def key : schemas.keySet()) {
def shortName = key.replaceAll(/http.*schema.(.*).spring-.*/, '$1')
assert shortName != key
File xsdFile = subproject.sourceSets.main.resources.find {
it.path.endsWith(schemas.get(key))
}
assert xsdFile != null
into (shortName) {
from xsdFile.path
}
}
}
}

task distZip(type: Zip, dependsOn: [docsZip, schemaZip]) {
group = 'Distribution'
classifier = 'dist'
description = "Builds -${classifier} archive, containing all jars and docs, " +
"suitable for community download page."

ext.baseDir = "${project.name}-${project.version}";

from('src/dist') {
include 'readme.txt'
include 'license.txt'
include 'notice.txt'
into "${baseDir}"
expand(copyright: new Date().format('yyyy'), version: project.version)
}

from(zipTree(docsZip.archivePath)) {
into "${baseDir}/docs"
}

from(zipTree(schemaZip.archivePath)) {
into "${baseDir}/schema"
}

subprojects.each { subproject ->
into ("${baseDir}/libs") {
from subproject.jar
if (subproject.tasks.findByPath('sourcesJar')) {
from subproject.sourcesJar
}
if (subproject.tasks.findByPath('javadocJar')) {
from subproject.javadocJar
}
}
}
}

// Create an distribution that contains all dependencies (required and optional).
// Not published by default; only for use when building from source.
task depsZip(type: Zip, dependsOn: distZip) { zipTask ->
group = 'Distribution'
classifier = 'dist-with-deps'
description = "Builds -${classifier} archive, containing everything " +
"in the -${distZip.classifier} archive plus all runtime dependencies."

from zipTree(distZip.archivePath)

gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.hasTask(":${zipTask.name}")) {
def projectNames = rootProject.subprojects*.name
def artifacts = new HashSet()
subprojects.each { subproject ->
subproject.configurations.runtime.resolvedConfiguration.resolvedArtifacts.each { artifact ->
def dependency = artifact.moduleVersion.id
if (!projectNames.contains(dependency.name)) {
artifacts << artifact.file
}
}
}

zipTask.from(artifacts) {
into "${distZip.baseDir}/deps"
}
}
}
}

artifacts {
archives docsZip
archives schemaZip
archives distZip
}

task wrapper(type: Wrapper) {
description = 'Generates gradlew[.bat] scripts'
gradleVersion = '1.1'
}
}
1 change: 1 addition & 0 deletions gradle.properties
@@ -0,0 +1 @@
version=1.0.0.CI-SNAPSHOT
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
#Mon Oct 22 11:35:04 CDT 2012
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.1-bin.zip

0 comments on commit 7200acf

Please sign in to comment.