diff --git a/build.gradle b/build.gradle index 4df5826631..eb42386217 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ // ----------------------------------------------------------------------------- // Configuration for the root project // ----------------------------------------------------------------------------- -apply from: "$rootDir/gradle/version.gradle" +apply from: "$rootDir/buildSrc/version.gradle" apply plugin: 'idea' // used for artifact names, building doc upload urls, etc. @@ -96,7 +96,7 @@ configure(javaprojects) { libsSrcDir = new File(libsDir, 'src') // add tasks for creating source jars and generating poms etc - apply from: "$rootDir/gradle/maven-deployment.gradle" + apply from: "$rootDir/buildSrc/maven-deployment.gradle" aspectjVersion = '1.6.8' cglibVersion = '2.2' @@ -412,13 +412,13 @@ project('spring-integration-xmpp') { apply plugin: 'base' // add tasks like 'distArchive' -apply from: "$rootDir/gradle/dist.gradle" +apply from: "$rootDir/buildSrc/dist.gradle" // add tasks like 'snapshotDependencyCheck' -apply from: "${rootDir}/gradle/checks.gradle" +apply from: "$rootDir/buildSrc/checks.gradle" // add 'generatePom' task to generate root pom with section -apply from: "$rootDir/gradle/maven-root-pom.gradle" +apply from: "$rootDir/buildSrc/maven-root-pom.gradle" // ----------------------------------------------------------------------------- // Import tasks related to releasing and managing the project @@ -427,4 +427,4 @@ apply from: "$rootDir/gradle/maven-root-pom.gradle" // @see gradle.properties for more information on roles // ----------------------------------------------------------------------------- // add management tasks like `wrapper` for generating the gradlew* scripts -apply from: "$rootDir/gradle/wrapper.gradle" +apply from: "$rootDir/buildSrc/wrapper.gradle" diff --git a/buildSrc b/buildSrc index 5949ed4de8..e02b8b97cf 160000 --- a/buildSrc +++ b/buildSrc @@ -1 +1 @@ -Subproject commit 5949ed4de8f7f2e7332faf1a36c5b66096bcf416 +Subproject commit e02b8b97cf6bd1e9ab6dbe2e1d7ed4848ded5d3d diff --git a/docs/build.gradle b/docs/build.gradle index b816d53880..6b761b33a2 100644 --- a/docs/build.gradle +++ b/docs/build.gradle @@ -15,7 +15,7 @@ */ apply plugin: 'base' -apply from: "$rootDir/gradle/docbook.gradle" +apply from: "$rootDir/buildSrc/docbook.gradle" description = "Spring Integration Documentation" diff --git a/gradle/checks.gradle b/gradle/checks.gradle deleted file mode 100644 index a06b4ec4a7..0000000000 --- a/gradle/checks.gradle +++ /dev/null @@ -1,90 +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. - */ - -/** - * Issue a snapshot dependency report across all Java projects. Detects not - * only direct snapshot dependencies, but transitive as well. - * - * @author Chris Beams - * @see snapshotDependencyCheck - */ -task snapshotDependencyReport { - description = 'Issues a snapshot dependency report across all Java projects' - - doFirst() { - def snapshotDependencies = new HashMap>() - - javaprojects.each { project -> - project.sourceSets.main.compileClasspath.allDependencies.each { dep -> - if (dep.version.endsWith('SNAPSHOT')) { - if (snapshotDependencies[project] == null) - snapshotDependencies[project] = new ArrayList() - snapshotDependencies[project].add(dep) - } - } - } - - project.hasSnapshotDependencies = snapshotDependencies.size() > 0 - - if (project.hasSnapshotDependencies) { - println "The following snapshot dependencies were found:" - snapshotDependencies.each { entry -> - println "${entry.key} depends on:" - entry.value.each { dep -> - println " ${dep}" - } - } - } - } -} - - -/** - * Abort the build if any Java projects have snapshot dependencies. It important - * that any non-snapshot release be checked for snapshot dependencies before - * final publication, as snapshot dependencies may change and thus make the - * release unstable and/or unreproducable. - * - * This task will be added to the build lifecycle automatically if the release - * is non-snapshot. - * - * -PignoreSnapshotDependencies will bypass aborting the build. A use case for - * this option would be if a transitive dependency out of your control is a - * snapshot release and you wish to proceed with releasing anyway. - * - * @author Chris Beams - * @see snapshotDependencyReport - */ -task snapshotDependencyCheck(dependsOn: snapshotDependencyReport) { - group = 'Verification' - description = 'Aborts the build if any Java project has snapshot dependencies.' - - // bind to build lifecycle if we're a non-snapshot release - if (version.releaseType != 'SNAPSHOT') { - check.dependsOn snapshotDependencyCheck - } - - onlyIf { - project.hasSnapshotDependencies && - !project.hasProperty('ignoreSnapshotDependencies') - } - doFirst { - throw new GradleException( - "aborting '${name}' task due to snapshot dependencies. " - + "supply -PignoreSnapshotDependencies to override") - } -} diff --git a/gradle/dist.gradle b/gradle/dist.gradle deleted file mode 100644 index abedc6e963..0000000000 --- a/gradle/dist.gradle +++ /dev/null @@ -1,138 +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. - */ - -// ----------------------------------------------------------------------------- -// Task definitions related to releasing the project -// -// @author Chris Beams -// ----------------------------------------------------------------------------- - -// ensure that every project has been evaluated before this script -// this allows us to look up tasks below and dereference dynamically -// assigned properties like 'docsSpec' below -project.subprojects.each { project -> - evaluationDependsOn project.path -} - -task check { - group = 'Verification' -} - -task build(dependsOn: [check, assemble]) { - group = 'Build' -} - -/** - * Build the distribution zip file. - * - * @author Chris Beams - */ -task distArchive(type: Zip) { - group = 'Build' - - destinationDir = buildDir - archiveName = "${project.name}-${project.version}.zip" - checksumPath = "${destinationDir}/${archiveName}.sha1" - def zipRootDir = "${project.name}-${project.version}" - - description = "Builds the distribution zip file at ${project.relativePath(destinationDir)}/${archiveName}" - - // depend on all projects with an assemble task - dependsOn subprojects*.tasks*.matching { task -> task.name == 'assemble' } - - // we need the docsSpec to be defined before evaluating this task - project.evaluationDependsOn(':docs') - - // set up outputs for use by incremental build and by tasks like 'cleanDist' - // the archive zip file will be added automatically to outputs.files - // but we must add the sha1 checksum ourselves - outputs.files file(checksumPath) - - // configure the contents of the zip file. remember that this is a - // configuration phase event. no zip is being created yet. the Zip - // task we extend will do that for us during the execution phase. - into(zipRootDir) { - // add all jars from java subprojects - into('bin') { - from javaprojects.collect { project -> project.libsBinDir } - } - - // add all source jars from java subprojects - into('src') { - from javaprojects.collect { project -> project.libsSrcDir } - } - - into('') { - from('docs/src/info') - } - - into("docs/api") { - from("docs/build/api") - } - - into("docs/reference") { - from("docs/build/reference") - } - } - - // once the zip has been written, create a sha1 hash for it - // this will write out the file at ${checksumPath} - doLast { - ant.checksum(file: archivePath, algorithm: 'SHA1', fileext: '.sha1') - assert file(checksumPath).isFile(): "${checksumPath} was not created" - } -} - -/** - * Upload the distribution zip file. - * - * @author Luke Taylor - * @author Chris Beams - */ -task uploadArchives(overwrite: true, dependsOn: distArchive) { // base plugin adds one we need to overwrite - group = 'Buildmaster' - description = 'Uploads the distribution zip file.' - - configurations { antlibs } - dependencies { - antlibs "org.springframework.build:org.springframework.build.aws.ant:3.0.3.RELEASE", - "net.java.dev.jets3t:jets3t:0.6.1" - } - - def releaseType = version.releaseType.toString().toLowerCase() - - doLast() { - println "Uploading: ${distArchive.archivePath} to s3" - project.ant { - taskdef(resource: 'org/springframework/build/aws/ant/antlib.xml', - classpath: configurations.antlibs.asPath) - s3(accessKey: s3AccessKey, secretKey: s3SecretAccessKey) { - upload(bucketName: 'dist.springframework.org', file: distArchive.archivePath, - toFile: releaseType + "/${rootProject.abbreviation}/${distArchive.archiveName}", publicRead: 'true') { - metadata(name: 'project.name', value: 'Spring Integration') - metadata(name: 'release.type', value: releaseType) - metadata(name: 'bundle.version', value: version) - metadata(name: 'package.file.name', value: distArchive.archiveName) - } - upload(bucketName: 'dist.springframework.org', file: "${distArchive.archivePath}.sha1", - toFile: releaseType + "/${rootProject.abbreviation}/${distArchive.archiveName}.sha1", publicRead: 'true') - } - } - } -} - - - diff --git a/gradle/docbook.gradle b/gradle/docbook.gradle deleted file mode 100644 index 225e4033fe..0000000000 --- a/gradle/docbook.gradle +++ /dev/null @@ -1,315 +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. - */ -import org.xml.sax.XMLReader; -import org.xml.sax.InputSource; -import org.apache.xml.resolver.CatalogManager; -import org.apache.xml.resolver.tools.CatalogResolver; - -import javax.xml.parsers.SAXParserFactory; -import javax.xml.transform.*; -import javax.xml.transform.sax.SAXSource; -import javax.xml.transform.sax.SAXResult; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; -import java.util.zip.*; - -import org.apache.fop.apps.*; - -import org.gradle.api.logging.LogLevel; - -import com.icl.saxon.TransformerFactoryImpl; -import ch.qos.logback.classic.Level; -import org.slf4j.LoggerFactory; - -buildscript { - repositories { - mavenCentral() - mavenRepo name: 'Shibboleth Repo', urls: 'http://shibboleth.internet2.edu/downloads/maven2' - } - dependencies { - def fopDeps = ['org.apache.xmlgraphics:fop:0.95-1@jar', - 'org.apache.xmlgraphics:xmlgraphics-commons:1.3', - 'org.apache.xmlgraphics:batik-bridge:1.7@jar', - 'org.apache.xmlgraphics:batik-util:1.7@jar', - 'org.apache.xmlgraphics:batik-css:1.7@jar', - 'org.apache.xmlgraphics:batik-dom:1.7', - 'org.apache.xmlgraphics:batik-svg-dom:1.7@jar', - 'org.apache.avalon.framework:avalon-framework-api:4.3.1'] - - classpath 'org.apache.xerces:resolver:2.9.1', - 'saxon:saxon:6.5.3', - 'org.apache.xerces:xercesImpl:2.9.1', - fopDeps, - 'net.sf.xslthl:xslthl:2.0.1', - 'net.sf.docbook:docbook-xsl:1.75.2:resources@zip' - } - -} - -/** - * Gradle Docbook plugin implementation. - *

- * Creates three tasks: docbookHtml, docbookHtmlSingle and docbookPdf. - * Each task takes a single File on which it operates. - * - * @author Luke Taylor - */ -// Add the plugin tasks to the project -task docbookHtml(type: DocbookHtml) { - setDescription('Generates chunked docbook html output.') - xdir = 'html' - classpath = buildscript.configurations.classpath -} - -task docbookHtmlSingle(type: Docbook) { - setDescription('Generates single page docbook html output.') - xdir = 'htmlsingle' - classpath = buildscript.configurations.classpath -} - -task docbookPdf(type: DocbookFoPdf) { - setDescription('Generates PDF docbook output.') - extension = 'fo' - xdir = 'pdf' - classpath = buildscript.configurations.classpath -} - -/** - */ -public class Docbook extends DefaultTask { - @Input - String extension = 'html'; - - @Input - boolean XIncludeAware = true; - - @Input - boolean highlightingEnabled = true; - - String admonGraphicsPath; - - @InputDirectory - File sourceDirectory = new File(project.getProjectDir(), "build/reference-work"); - - @Input - String sourceFileName; - - @InputFile - File stylesheet; - - @OutputDirectory - File docsDir = new File(project.getBuildDir(), "reference"); - - @InputFiles - Configuration classpath - - @TaskAction - public final void transform() { - // the docbook tasks issue spurious content to the console. redirect to INFO level - // so it doesn't show up in the default log level of LIFECYCLE unless the user has - // run gradle with '-d' or '-i' switches -- in that case show them everything - switch (project.gradle.startParameter.logLevel) { - case LogLevel.DEBUG: - case LogLevel.INFO: - break; - default: - logging.captureStandardOutput(LogLevel.INFO) - logging.captureStandardError(LogLevel.INFO) - } - - SAXParserFactory factory = new org.apache.xerces.jaxp.SAXParserFactoryImpl(); - factory.setXIncludeAware(XIncludeAware); - docsDir.mkdirs(); - - File srcFile = new File(sourceDirectory, sourceFileName); - String outputFilename = srcFile.getName().substring(0, srcFile.getName().length() - 4) + '.' + extension; - - File oDir = new File(getDocsDir(), xdir) - File outputFile = new File(oDir, outputFilename); - - Result result = new StreamResult(outputFile.getAbsolutePath()); - CatalogResolver resolver = new CatalogResolver(createCatalogManager()); - InputSource inputSource = new InputSource(srcFile.getAbsolutePath()); - - XMLReader reader = factory.newSAXParser().getXMLReader(); - reader.setEntityResolver(resolver); - TransformerFactory transformerFactory = new TransformerFactoryImpl(); - transformerFactory.setURIResolver(resolver); - URL url = stylesheet.toURL(); - Source source = new StreamSource(url.openStream(), url.toExternalForm()); - Transformer transformer = transformerFactory.newTransformer(source); - - if (highlightingEnabled) { - File highlightingDir = new File(getProject().getBuildDir(), "highlighting"); - if (!highlightingDir.exists()) { - highlightingDir.mkdirs(); - extractHighlightFiles(highlightingDir); - } - - transformer.setParameter("highlight.xslthl.config", new File(highlightingDir, "xslthl-config.xml").toURI().toURL()); - - if (admonGraphicsPath != null) { - transformer.setParameter("admon.graphics", "1"); - transformer.setParameter("admon.graphics.path", admonGraphicsPath); - } - } - - preTransform(transformer, srcFile, outputFile); - - transformer.transform(new SAXSource(reader, inputSource), result); - - postTransform(outputFile); - } - - private void extractHighlightFiles(File toDir) { - File docbookZip = classpath.files.find { file -> file.name.contains('docbook-xsl-')}; - - if (docbookZip == null) { - throw new GradleException("Docbook zip file not found"); - } - - ZipFile zipFile = new ZipFile(docbookZip); - - Enumeration e = zipFile.entries(); - while (e.hasMoreElements()) { - ZipEntry ze = (ZipEntry) e.nextElement(); - if (ze.getName().matches(".*/highlighting/.*\\.xml")) { - String filename = ze.getName().substring(ze.getName().lastIndexOf("/highlighting/") + 14); - copyFile(zipFile.getInputStream(ze), new File(toDir, filename)); - } - } - } - - private void copyFile(InputStream source, File destFile) { - destFile.createNewFile(); - FileOutputStream to = null; - try { - to = new FileOutputStream(destFile); - byte[] buffer = new byte[4096]; - int bytesRead; - - while ((bytesRead = source.read(buffer)) > 0) { - to.write(buffer, 0, bytesRead); - } - } finally { - if (source != null) { - source.close(); - } - if (to != null) { - to.close(); - } - } - } - - protected void preTransform(Transformer transformer, File sourceFile, File outputFile) { - } - - protected void postTransform(File outputFile) { - } - - private CatalogManager createCatalogManager() { - CatalogManager manager = new CatalogManager(); - manager.setIgnoreMissingProperties(true); - ClassLoader classLoader = this.getClass().getClassLoader(); - StringBuilder builder = new StringBuilder(); - String docbookCatalogName = "docbook/catalog.xml"; - URL docbookCatalog = classLoader.getResource(docbookCatalogName); - - if (docbookCatalog == null) { - throw new IllegalStateException("Docbook catalog " + docbookCatalogName + " could not be found in " + classLoader); - } - - builder.append(docbookCatalog.toExternalForm()); - - Enumeration enumeration = classLoader.getResources("/catalog.xml"); - while (enumeration.hasMoreElements()) { - builder.append(';'); - URL resource = (URL) enumeration.nextElement(); - builder.append(resource.toExternalForm()); - } - String catalogFiles = builder.toString(); - manager.setCatalogFiles(catalogFiles); - return manager; - } -} - -/** - */ -class DocbookHtml extends Docbook { - - @Override - protected void preTransform(Transformer transformer, File sourceFile, File outputFile) { - String rootFilename = outputFile.getName(); - rootFilename = rootFilename.substring(0, rootFilename.lastIndexOf('.')); - transformer.setParameter("root.filename", rootFilename); - transformer.setParameter("base.dir", outputFile.getParent() + File.separator); - } -} - -/** - */ -class DocbookFoPdf extends Docbook { - - /** - * From the FOP usage guide - */ - @Override - protected void postTransform(File foFile) { - FopFactory fopFactory = FopFactory.newInstance(); - - OutputStream out = null; - final File pdfFile = getPdfOutputFile(foFile); - logger.debug("Transforming 'fo' file " + foFile + " to PDF: " + pdfFile); - - try { - out = new BufferedOutputStream(new FileOutputStream(pdfFile)); - - Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, out); - - TransformerFactory factory = TransformerFactory.newInstance(); - Transformer transformer = factory.newTransformer(); - - Source src = new StreamSource(foFile); - - Result res = new SAXResult(fop.getDefaultHandler()); - - switch (project.gradle.startParameter.logLevel) { - case LogLevel.DEBUG: - case LogLevel.INFO: - break; - default: - // only show verbose fop output if the user has specified 'gradle -d' or 'gradle -i' - LoggerFactory.getILoggerFactory().getLogger('org.apache.fop').level = Level.ERROR - } - - transformer.transform(src, res); - - } finally { - if (out != null) { - out.close(); - } - } - - if (!foFile.delete()) { - logger.warn("Failed to delete 'fo' file " + foFile); - } - } - - private File getPdfOutputFile(File foFile) { - String name = foFile.getAbsolutePath(); - return new File(name.substring(0, name.length() - 2) + "pdf"); - } -} diff --git a/gradle/maven-deployment.gradle b/gradle/maven-deployment.gradle deleted file mode 100644 index d588d0ba56..0000000000 --- a/gradle/maven-deployment.gradle +++ /dev/null @@ -1,271 +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. - */ - -// ----------------------------------------------------------------------------- -// Tasks related to deploying Maven artifacts. -// -// @author Chris Beams -// ----------------------------------------------------------------------------- - -// check that upload-related properties are defined and fail early if not -// these properties ('s3AccessKey', etc) should be defined in -// 'gradle.properties' in $HOME/.gradle/gradle.properties -def requiredProps = version.releaseType == 'RELEASE' ? ['mavenSyncRepoDir'] : ['s3AccessKey', 's3SecretAccessKey'] -checkForProps(taskPath: project.path + ':uploadArchives', requiredProps: requiredProps) - -/** - * Builds a source jar artifact for all main java sources. - * - * @author Luke Taylor - */ -task sourceJar(type: Jar) { - description = 'Builds a source jar artifact suitable for maven deployment.' - classifier = 'sources' - from sourceSets.main.java -} -build.dependsOn sourceJar - -jar.destinationDir = project.libsBinDir -sourceJar.destinationDir = project.libsSrcDir - -// Add the source jar archive to the set of artifacts for this project. -// Note that the regular 'jar' archive is already added by default. -artifacts { - archives sourceJar -} - - -/** - * Deploy gradle-built artifacts to a remote maven repository. Overrides and - * further customizes the 'uploadArchives' task contributed by the 'maven' - * plugin. - * - * The repository that artifacts are deployed to is determined conditionally - * based on the release type of the project version. Snapshot builds will - * be deployed via s3 to the springframework maven snapshot repository; - * milestone builds will happen via s3 as well; release builds will be deployed - * to the local filesystem to be sync'd via sourceforge SVN and ultimately - * deployed to maven central. - * - * Gradle will generate Maven poms on-the-fly during the deployment process. - * This process is customized to add ASL license information, and for projects - * that have the erlangLicense property set to true, the Erlang License will be - * added to the pom as well. - * - * @author Chris Beams - * @see 'mavenSyncRepoDir' in gradle.properties - * @see `gradle install` for deploying artifacts to the local .m2 cache - * @see http://maven.apache.org/guides/mini/guide-central-repository-upload.html - */ -uploadArchives { - group = 'Buildmaster' - description = "Does a maven deploy of archives artifacts to " // url appended below - - def releaseRepositoryUrl = "file://${project.properties.mavenSyncRepoDir}" - def milestoneRepositoryUrl = 's3://maven.springframework.org/milestone' - def snapshotRepositoryUrl = 's3://maven.springframework.org/snapshot' - - // add a configuration with a classpath that includes our s3 maven deployer - configurations { deployerJars } - dependencies { - deployerJars "org.springframework.build.aws:org.springframework.build.aws.maven:3.0.0.RELEASE" - } - - def deployer = repositories.mavenDeployer { - switch (version.releaseType) { - case 'RELEASE': - repository(url: releaseRepositoryUrl) - description += releaseRepositoryUrl - break; - - case 'MILESTONE': - description += milestoneRepositoryUrl - s3credentials = [userName: project.properties.s3AccessKey, passphrase: project.properties.s3SecretAccessKey] - configuration = configurations.deployerJars - repository(url: milestoneRepositoryUrl) { - authentication(s3credentials) - } - snapshotRepository(url: snapshotRepositoryUrl) { - authentication(s3credentials) - } - break; - - case 'SNAPSHOT': - description += snapshotRepositoryUrl - s3credentials = [userName: project.properties.s3AccessKey, passphrase: project.properties.s3SecretAccessKey] - configuration = configurations.deployerJars - repository(url: milestoneRepositoryUrl) { - authentication(s3credentials) - } - snapshotRepository(url: snapshotRepositoryUrl) { - authentication(s3credentials) - } - break; - - default: - throw new GradleException("unknown ReleaseType") - } - } - - configurePom(deployer.pom) -} - - -/** - * Install gradle-built artifacts to the local m2 maven cache. - * Further customizes the 'install' task contributed by the 'maven' plugin. - */ -install { - group = 'Build' - description = "Does a maven install of archives artifacts to local m2 cache" - - configurePom(repositories.mavenInstaller.pom) -} - - -/** - * Generate a Maven pom.xml for use at build time. Dependency information will - * be based on Gradle metadata for the project, and other customizations such - * as licensing information and source compatibility settings are configured - * within. - * - * @author Chris Beams - * @see http://gradle.org/0.9-preview-3/docs/userguide/userguide_single.html#pomBuilder - */ -task generatePom { - group = 'Build' - description = 'Generates a Maven POM file suitable for use in building the project' - - generatedPomFileName = "pom.xml" - - // enable partial cleaning with `gradle cleanGeneratePom` - outputs.files(generatedPomFileName) - - doLast() { - // customize the pom creation process - p = pom { - project { - name = project.description - properties { - setProperty('project.build.sourceEncoding', 'UTF8') - } - build { - plugins { - plugin { - groupId = 'org.apache.maven.plugins' - artifactId = 'maven-compiler-plugin' - configuration { - source = '1.5' - target = '1.5' - } - } - plugin { - groupId = 'org.apache.maven.plugins' - artifactId = 'maven-surefire-plugin' - configuration { - includes { - include = '**/*Tests.java' - } - excludes { - exclude = '**/*Abstract*.java' - } - } - } - } - resources { - resource { - directory = 'src/main/java' - includes = ['**/*'] - excludes = ['**/*.java'] - } - resource { - directory = 'src/main/resources' - includes = ['**/*'] - } - } - testResources { - testResource { - directory = 'src/test/java' - includes = ['**/*'] - excludes = ['**/*.java'] - } - testResource { - directory = 'src/test/resources' - includes = ['**/*'] - } - } - } - } - } - - // customizing the artifact id is a special case that must be configured - // after the pom is fully configured, otherwise it'll be overwritten - p.whenConfigured { pom -> pom.artifactId = project.name } - - configurePom(p) - - // write the pom.xml file out to the filesystem - p.writeTo(generatedPomFileName) - } - - // ensure that pom generation happens every time resources are processed - // (which practically means any time a build happens). if the dependencies - // for the project have been updated (in $rootDir/build.gradle), the pom - // will have diffs in it and the developer will be reminded to check in - // the change during the next commit cycle. - //processResources.dependsOn generatePom -} - - -/** - * Read dynamic 'optional' and 'provided' properties from gradle dependencies - * and translate them to their maven POM equivalents. - */ -def configurePom(def pom) { - pom.whenConfigured { generatedPom -> - def optionalDeps = configurations.testRuntime.allDependencies.findAll { gradleDep -> - gradleDep.asDynamicObject.hasProperty('optional') && gradleDep.optional - } - def providedDeps = configurations.testRuntime.allDependencies.findAll { gradleDep -> - gradleDep.asDynamicObject.hasProperty('provided') && gradleDep.provided - } - generatedPom.dependencies.each { mavenDep -> - mavenDep.optional = optionalDeps.any { optionalDep -> - optionalDep.group == mavenDep.groupId && - optionalDep.name == mavenDep.artifactId && - optionalDep.version == mavenDep.version - } - boolean isProvided = providedDeps.any { providedDep -> - providedDep.group == mavenDep.groupId && - providedDep.name == mavenDep.artifactId && - providedDep.version == mavenDep.version - } - if (isProvided) { - mavenDep.scope = 'provided' - } - } - } - - pom.project { - licenses { - license { - name 'The Apache Software License, Version 2.0' - url 'http://www.apache.org/licenses/LICENSE-2.0.txt' - distribution 'repo' - } - } - } -} diff --git a/gradle/maven-root-pom.gradle b/gradle/maven-root-pom.gradle deleted file mode 100644 index d26f1402ec..0000000000 --- a/gradle/maven-root-pom.gradle +++ /dev/null @@ -1,62 +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. - */ - -/** - * Generate a root Maven pom.xml for use at build time. Contains nothing other - * than a 'modules' section aggregating child projects. This pom will never be - * installed locally or deployed remotely. Child projects will not explicitly - * declare this pom as their parent, given than nothing need be inherited from - * it. - * - * @author Chris Beams - * @see maven-deployment.gradle for per-project generatePom task - */ -task generatePom { - apply plugin: 'maven' - group = 'Build' - description = 'Generates a root Maven pom for convenience.' - - generatedPomFileName = "pom.xml" - - // enable partial cleaning with `gradle cleanGeneratePom` - outputs.files(generatedPomFileName) - - doLast() { - // customize the pom creation process - p = pom { - project { - name = project.description - packaging = 'pom' - modules = javaprojects.collect { project -> project.name } - } - } - - // customizing the artifact id is a special case that must be configured - // after the pom is fully configured, otherwise it'll be overwritten - p.whenConfigured { pom -> pom.artifactId = project.name } - - // write the pom.xml file out to the filesystem - p.writeTo(generatedPomFileName) - } - - // ensure that pom generation happens every time resources are processed - // (which practically means any time a build happens). if the dependencies - // for the project have been updated (in $rootDir/build.gradle), the pom - // will have diffs in it and the developer will be reminded to check in - // the change during the next commit cycle. - //processResources.dependsOn generatePom -} diff --git a/gradle/version.gradle b/gradle/version.gradle deleted file mode 100644 index 310cf2752d..0000000000 --- a/gradle/version.gradle +++ /dev/null @@ -1,83 +0,0 @@ -class Version { - /** - * Indicates whether a version is a release, milestone, or snapshot - */ - static final String RELEASE = 'RELEASE' - static final String MILESTONE = 'MILESTONE' - static final String SNAPSHOT = 'SNAPSHOT' - - String value - String releaseType - int majorVersion - int minorVersion - - /** - * @param dotted -quad version spec, e.g.: 1.0.0.RELEASE - */ - public Version(String value) { - this.value = value; - this.releaseType = releaseTypeFor(value); - this.majorVersion = Integer.parseInt(this.value.substring(0, this.value.indexOf('.'))); - String afterMajor = this.value.substring(this.value.indexOf('.') + 1); - this.minorVersion = Integer.parseInt(afterMajor.substring(0, afterMajor.indexOf('.'))); - } - - public int getMajorVersion() { - return this.majorVersion; - } - - public int getMinorVersion() { - return this.minorVersion - } - - /** - * @return 1.0.x style - */ - public String getWildcardValue() { - return majorVersion + '.' + minorVersion + '.x'; - } - - /** - * @return the version string returned by {@link getValue ( )} - */ - public String toString() { - return this.getValue(); - } - - /** - * @param dotted -quad version spec, e.g.: 1.0.0.RELEASE - */ - public static String releaseTypeFor(String version) { - if (version.endsWith("RELEASE")) return RELEASE; - if (version.endsWith("SNAPSHOT")) return SNAPSHOT; - if (version.matches(".*\\.M[0-9]+\$")) return MILESTONE; - if (version.matches(".*\\.RC[0-9]+\$")) return MILESTONE; - - throw new InvalidUserDataException("unknown version scheme: " + - "versions must end in (SNAPSHOT|M[0-9]+|RC[0-9]+|RELEASE), " + - "but got (" + version + ")"); - } -} - -project.createVersion = { value -> - new Version(value) -} - -def requiredPropSets = [] - -gradle.taskGraph.whenReady { graph -> - requiredPropSets.each { args -> - if (graph.hasTask(args.taskPath)) { - def missingProps = args.requiredProps.findAll { prop -> - !project.hasProperty(prop) - } - if (missingProps) { - throw new GradleException("For executing the ${args.taskPath} task you need to set all ${missingProps} properties") - } - } - } -} -project.checkForProps = { Map args -> - requiredPropSets.add args -} - diff --git a/gradle/wrapper.gradle b/gradle/wrapper.gradle deleted file mode 100644 index 36e7ac7d0f..0000000000 --- a/gradle/wrapper.gradle +++ /dev/null @@ -1,32 +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. - */ - -/** - * Generate gradlew and gradlew.bat scripts and associated files. These - * convenience scripts allow users to operate the build without being forced to - * download and install gradle. - * - * @author Chris Beams - * @see http://gradle.org/0.9-preview-3/docs/userguide/userguide_single.html#gradle_wrapper - */ -task wrapper(type: Wrapper) { - group = 'Buildmaster' - description = "Generates gradlew and gradlew.bat bootstrap scripts" - gradleVersion = '0.9-preview-3' - // place jar file and properties into a - // subdirectory to avoid root dir clutter - jarPath = 'gradle/wrapper' -} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 4eb13be9e5..0000000000 Binary files a/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 682c93283d..0000000000 --- a/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,9 +0,0 @@ -#Wed Oct 27 06:30:22 EDT 2010 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -distributionVersion=0.9-build-daemon-20101027111821+1100 -zipStorePath=wrapper/dists -urlRoot=http\://gradle.artifactoryonline.com/gradle/distributions/gradle-snapshots -distributionName=gradle -distributionClassifier=bin diff --git a/gradlew b/gradlew index 062dcf316d..03a2a5bb9d 100755 --- a/gradlew +++ b/gradlew @@ -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 \ "$@" diff --git a/gradlew.bat b/gradlew.bat index 114aaa4c7d..5f9e45784a 100755 --- a/gradlew.bat +++ b/gradlew.bat @@ -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%"