Permalink
Browse files

Tweaked build to use new shared gradle build module

  • Loading branch information...
1 parent 0f8c5ae commit 57948a712cbc046ff0115a57c8472f53c749ff99 Craig Walls committed Nov 15, 2010
Showing with 38 additions and 204 deletions.
  1. +3 −0 .gitmodules
  2. +23 −34 build.gradle
  3. +1 −0 buildSrc
  4. +0 −162 docs/build.gradle
  5. +7 −4 gradlew
  6. +4 −4 gradlew.bat
View
@@ -0,0 +1,3 @@
+[submodule "buildSrc"]
+ path = buildSrc
+ url = git://github.com/SpringSource/spring-build-gradle.git
View
@@ -13,26 +13,27 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+ import org.springframework.build.Version
// -----------------------------------------------------------------------------
// Main gradle build file for Spring Social
-//
-// - run `./gradlew(.bat) build` to kick off a complete compile-test-package
-//
+// @author Chris Beams
// @author Craig Walls
// -----------------------------------------------------------------------------
-
// -----------------------------------------------------------------------------
// Configuration for the root project
// -----------------------------------------------------------------------------
-apply from: "$rootDir/gradle/version.gradle"
-apply plugin: 'idea'
-
-// used for artifact names, building doc upload urls, etc.
description = 'Spring Social'
abbreviation = 'SOCIAL'
+apply plugin: 'base'
+apply plugin: 'idea'
+
+def buildSrcDir = "$rootDir/buildSrc"
+apply from: "$buildSrcDir/wrapper.gradle"
+apply from: "$buildSrcDir/maven-root-pom.gradle"
+
// -----------------------------------------------------------------------------
// Configuration for all projects including this one (the root project)
//
@@ -47,17 +48,14 @@ allprojects {
// milestone or release.
// @see org.springframework.build.Version under buildSrc/ for more info
// @see gradle.properties for the declaration of this property.
- version = createVersion(springSocialVersion)
+ version = new Version(springSocialVersion)
// default set of maven repositories to be used when resolving dependencies
repositories {
- mavenRepo urls: 'http://maven.springframework.org/snapshot'
- mavenCentral()
mavenRepo urls: 'http://maven.springframework.org/release'
mavenRepo urls: 'http://maven.springframework.org/milestone'
- mavenRepo urls: 'http://repository.springsource.com/maven/bundles/external'
- mavenRepo urls: 'http://repository.springsource.com/maven/bundles/release'
- mavenRepo urls: 'http://repository.springsource.com/maven/bundles/milestone'
+ mavenRepo urls: 'http://maven.springframework.org/snapshot'
+ mavenCentral()
}
}
@@ -89,10 +87,11 @@ configure(javaprojects) {
libsBinDir = new File(libsDir, 'bin')
libsSrcDir = new File(libsDir, 'src')
- // all core projects should be OSGi-compliant bundles
- // add the bundlor task to ensure proper manifests
- // apply from: "$rootDir/gradle/bundlor.gradle"
- apply from: "$rootDir/gradle/maven-deployment.gradle"
+ // add tasks for creating source jars and generating poms etc
+ apply from: "$buildSrcDir/maven-deployment.gradle"
+
+ // add tasks for finding and publishing .xsd files
+ apply from: "$buildSrcDir/schema-publication.gradle"
commonsHttpClientVersion = '3.1'
jacksonVersion = '1.5.3'
@@ -156,22 +155,12 @@ project('spring-social-core') {
}
}
-// add basic tasks like 'clean' and 'assemble' to the root project. e.g.: allows
-// running `gradle clean` from the root project and deleting the build directory
-apply plugin: 'base'
+// -----------------------------------------------------------------------------
+// Configuration for the docs subproject
+// -----------------------------------------------------------------------------
+project('docs') {
+ apply from: "$buildSrcDir/docs.gradle"
+}
-// add tasks like 'distArchive'
apply from: "$rootDir/gradle/dist.gradle"
-
-// add tasks like 'snapshotDependencyCheck'
apply from: "${rootDir}/gradle/checks.gradle"
-
-
-// -----------------------------------------------------------------------------
-// Import tasks related to releasing and managing the project
-// depending on the role played by the current user.
-//
-// @see gradle.properties for more information on roles
-// -----------------------------------------------------------------------------
-// add management tasks like `wrapper` for generating the gradlew* scripts
-apply from: "$rootDir/gradle/wrapper.gradle"
Submodule buildSrc added at 1aa2ac
View
@@ -1,162 +0,0 @@
-/*
- * Copyright 2002-2010 the original author or authors.
- *
- * Licensed 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.
- */
-
-apply plugin: 'base'
-
-description = "Spring Social Documentation"
-
-task build(dependsOn: assemble) {
- group = 'Build'
- description = 'Builds reference and API documentation and archives'
-}
-
-
-/**
- * Build aggregated JavaDoc HTML for all core project classes. Result is
- * suitable for packaging into a distribution zip or viewing directly with
- * a browser.
- *
- * @author cbeams
- * @author ltaylor
- * @see http://gradle.org/0.9-rc-1/docs/javadoc/org/gradle/api/tasks/javadoc/Javadoc.html
- */
- task api(type: Javadoc) {
- group = 'Documentation'
- description = "Builds aggregated JavaDoc HTML for all core project classes."
-
- // this task is a bit ugly to configure. it was a user contribution, and
- // Hans tells me it's on the roadmap to redesign it.
- srcDir = file("${projectDir}/src/api")
- destinationDir = file("${buildDir}/api")
- tmpDir = file("${buildDir}/api-work")
- optionsFile = file("${tmpDir}/apidocs/javadoc.options")
- options.stylesheetFile = file("${srcDir}/spring-javadoc.css")
- options.links = ["http://static.springframework.org/spring/docs/3.0.x/javadoc-api"]
- options.overview = "${srcDir}/overview.html"
- options.docFilesSubDirs = true
- title = "Spring Social ${version} API"
-
- // collect all the sources that will be included in the javadoc output
- source javaprojects.collect {project ->
- project.sourceSets.main.allJava
- }
-
- // collect all main classpaths to be able to resolve @see refs, etc.
- // this collection also determines the set of projects that this
- // task dependsOn, thus the runtimeClasspath is used to ensure all
- // projects are included, not just *dependencies* of all classes.
- // this is awkward and took me a while to figure out.
- classpath = files(javaprojects.collect {project ->
- project.sourceSets.main.runtimeClasspath
- })
-
- // copy the images from the doc-files dir over to the target
- doLast { task ->
- copy {
- from file("${task.srcDir}/doc-files")
- into file("${task.destinationDir}/doc-files")
- }
- }
-}
-
-/**
- *
- * @see http://www.gradle.org/0.9-preview-3/docs/userguide/userguide_single.html#sec:copying_files
- * @see http://www.gradle.org/0.9-preview-3/docs/javadoc/org/gradle/api/file/CopySpec.html
- */
-docsSpec = copySpec {
- into("${version}") {
- from('src/info/changelog.txt')
- }
-
- into("${version}/api") {
- from(api.destinationDir)
- }
-}
-
-task archive(type: Zip, dependsOn: [api]) {
- group = "Documentation"
- description = "Create a zip archive of reference and API documentation."
-
- baseName = rootProject.name + '-docs'
-
- // drop it right in the root of the build dir for simplicity
- destinationDir = buildDir
-
- // use the copy spec above to specify the contents of the zip
- with docsSpec
-}
-
-configurations { archives }
-artifacts { archives archive }
-
-configurations { scpAntTask }
-dependencies {
- scpAntTask("org.apache.ant:ant-jsch:1.8.1")
-}
-
-checkForProps(taskPath: project.path + ':uploadArchives', requiredProps: ['sshHost', 'sshUsername', 'sshPrivateKey'])
-
-uploadArchives {
- def sshHost = project.properties.sshHost
- def sshUsername = project.properties.sshUsername
- def remoteSiteDir = '/var/www/domains/springframework.org/static/htdocs/' + rootProject.name
- def docUrl = "http://${sshHost}/${rootProject.name}/docs/${version}"
- def remoteDocsDir = "${remoteSiteDir}/docs/"
- def fqRemoteDir = "${sshUsername}@${sshHost}:${remoteDocsDir}"
-
- group = 'Buildmaster'
- description = "Uploads and unpacks documentation archive" + (sshHost ? " to ${docUrl}" : ": Host is not specified")
-
- uploadDescriptor = false
-
- repositories {
- add(new org.apache.ivy.plugins.resolver.SshResolver()) {
- name = 'sshHost: ' + sshHost // used for debugging
- host = sshHost
- user = sshUsername
- if (project.hasProperty('sshPrivateKey')) {
- keyFile = sshPrivateKey ? sshPrivateKey as File : null
- }
- addArtifactPattern "${remoteDocsDir}/${archive.archiveName}"
- }
- }
-
- configurations { scpAntTask }
- dependencies { scpAntTask 'org.apache.ant:ant-jsch:1.8.1' }
-
- doFirst {
- println "Uploading: ${archive.archivePath} to ${fqRemoteDir}"
- }
-
- doLast {
- project.ant {
- taskdef(name: 'sshexec',
- classname: 'org.apache.tools.ant.taskdefs.optional.ssh.SSHExec',
- classpath: configurations.scpAntTask.asPath)
-
- // copy the archive, unpack it, then delete it
- def unpackCommand = "cd ${remoteDocsDir} && unzip -K -o ${archive.archiveName}"
- def deleteCommand = "rm ${remoteDocsDir}/${archive.archiveName}"
-
- println "sshexec ${unpackCommand}"
- sshexec(host: sshHost, username: sshUsername, keyfile: sshPrivateKey, command: unpackCommand)
- println "sshexec ${deleteCommand}"
- sshexec(host: sshHost, username: sshUsername, keyfile: sshPrivateKey, command: deleteCommand)
- println "UPLOAD SUCCESSFUL - validate by visiting ${docUrl}"
- }
- }
-}
View
@@ -7,8 +7,8 @@
##############################################################################
# Uncomment those lines to set JVM options. GRADLE_OPTS and JAVA_OPTS can be used together.
-# GRADLE_OPTS="$GRADLE_OPTS -Xmx512"
-# JAVA_OPTS="$JAVA_OPTS -Xmx512"
+GRADLE_OPTS="$GRADLE_OPTS -Xmx512m"
+# JAVA_OPTS="$JAVA_OPTS -Xmx512m"
GRADLE_APP_NAME=Gradle
@@ -63,8 +63,8 @@ if $cygwin ; then
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
+CLASSPATH=`dirname "$0"`/buildSrc/wrapper/gradle-wrapper.jar
+WRAPPER_PROPERTIES=`dirname "$0"`/buildSrc/wrapper/gradle-wrapper.properties
# Determine the Java command to use to start the JVM.
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
@@ -135,8 +135,11 @@ if $cygwin ; then
esac
fi
+GRADLE_APP_BASE_NAME=`basename "$0"`
+
"$JAVACMD" $JAVA_OPTS $GRADLE_OPTS \
-classpath "$CLASSPATH" \
+ -Dorg.gradle.appname="$GRADLE_APP_BASE_NAME" \
-Dorg.gradle.wrapper.properties="$WRAPPER_PROPERTIES" \
$STARTER_MAIN_CLASS \
"$@"
View
@@ -13,8 +13,8 @@
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% -Xmx512
-@rem set JAVA_OPTS=%JAVA_OPTS% -Xmx512
+@rem set GRADLE_OPTS=%GRADLE_OPTS% -Xmx512m
+@rem set JAVA_OPTS=%JAVA_OPTS% -Xmx512m
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.\
@@ -101,8 +101,8 @@ set CMD_LINE_ARGS=%$
@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 CLASSPATH=%DIRNAME%\buildSrc\wrapper\gradle-wrapper.jar
+set WRAPPER_PROPERTIES=%DIRNAME%\buildSrc\wrapper\gradle-wrapper.properties
set JAVA_EXE=%JAVA_HOME%\bin\java.exe
set GRADLE_OPTS=%JAVA_OPTS% %GRADLE_OPTS% -Dorg.gradle.wrapper.properties="%WRAPPER_PROPERTIES%"

0 comments on commit 57948a7

Please sign in to comment.