|
@@ -1,5 +1,3 @@
|
|
|
-import java.nio.file.Files
|
|
|
-
|
|
|
/*
|
|
|
* Licensed to Elasticsearch under one or more contributor
|
|
|
* license agreements. See the NOTICE file distributed with
|
|
@@ -19,25 +17,21 @@ import java.nio.file.Files
|
|
|
* under the License.
|
|
|
*/
|
|
|
|
|
|
-// we must use buildscript + apply so that an external plugin
|
|
|
-// can apply this file, since the plugins directive is not
|
|
|
-// supported through file includes
|
|
|
-buildscript {
|
|
|
- repositories {
|
|
|
- jcenter()
|
|
|
- }
|
|
|
- dependencies {
|
|
|
- classpath 'com.bmuschko:gradle-nexus-plugin:2.3.1'
|
|
|
- }
|
|
|
-}
|
|
|
+import java.nio.file.Files
|
|
|
+
|
|
|
apply plugin: 'groovy'
|
|
|
-apply plugin: 'com.bmuschko.nexus'
|
|
|
-// TODO: move common IDE configuration to a common file to include
|
|
|
-apply plugin: 'idea'
|
|
|
-apply plugin: 'eclipse'
|
|
|
|
|
|
group = 'org.elasticsearch.gradle'
|
|
|
-archivesBaseName = 'build-tools'
|
|
|
+
|
|
|
+if (project == rootProject) {
|
|
|
+ // change the build dir used during build init, so that doing a clean
|
|
|
+ // won't wipe out the buildscript jar
|
|
|
+ buildDir = 'build-bootstrap'
|
|
|
+}
|
|
|
+
|
|
|
+/*****************************************************************************
|
|
|
+ * Propagating version.properties to the rest of the build *
|
|
|
+ *****************************************************************************/
|
|
|
|
|
|
Properties props = new Properties()
|
|
|
props.load(project.file('version.properties').newDataInputStream())
|
|
@@ -51,13 +45,30 @@ if (snapshot) {
|
|
|
props.put("elasticsearch", version);
|
|
|
}
|
|
|
|
|
|
+File tempPropertiesFile = new File(project.buildDir, "version.properties")
|
|
|
+task writeVersionProperties {
|
|
|
+ inputs.properties(props)
|
|
|
+ outputs.file(tempPropertiesFile)
|
|
|
+ doLast {
|
|
|
+ OutputStream stream = Files.newOutputStream(tempPropertiesFile.toPath());
|
|
|
+ try {
|
|
|
+ props.store(stream, "UTF-8");
|
|
|
+ } finally {
|
|
|
+ stream.close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+processResources {
|
|
|
+ dependsOn writeVersionProperties
|
|
|
+ from tempPropertiesFile
|
|
|
+}
|
|
|
+
|
|
|
+/*****************************************************************************
|
|
|
+ * Dependencies used by the entire build *
|
|
|
+ *****************************************************************************/
|
|
|
|
|
|
repositories {
|
|
|
- mavenCentral()
|
|
|
- maven {
|
|
|
- name 'sonatype-snapshots'
|
|
|
- url "https://oss.sonatype.org/content/repositories/snapshots/"
|
|
|
- }
|
|
|
jcenter()
|
|
|
}
|
|
|
|
|
@@ -78,50 +89,80 @@ dependencies {
|
|
|
compile 'org.apache.rat:apache-rat:0.11'
|
|
|
}
|
|
|
|
|
|
-File tempPropertiesFile = new File(project.buildDir, "version.properties")
|
|
|
-task writeVersionProperties {
|
|
|
- inputs.properties(props)
|
|
|
- outputs.file(tempPropertiesFile)
|
|
|
- doLast {
|
|
|
- OutputStream stream = Files.newOutputStream(tempPropertiesFile.toPath());
|
|
|
- try {
|
|
|
- props.store(stream, "UTF-8");
|
|
|
- } finally {
|
|
|
- stream.close();
|
|
|
+
|
|
|
+/*****************************************************************************
|
|
|
+ * Bootstrap repositories and IDE setup *
|
|
|
+ *****************************************************************************/
|
|
|
+// this will only happen when buildSrc is built on its own during build init
|
|
|
+if (project == rootProject) {
|
|
|
+
|
|
|
+ // TODO: move common IDE configuration to a common file to include
|
|
|
+ apply plugin: 'idea'
|
|
|
+ apply plugin: 'eclipse'
|
|
|
+
|
|
|
+ repositories {
|
|
|
+ mavenCentral()
|
|
|
+ maven {
|
|
|
+ name 'sonatype-snapshots'
|
|
|
+ url "https://oss.sonatype.org/content/repositories/snapshots/"
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
-
|
|
|
-processResources {
|
|
|
- dependsOn writeVersionProperties
|
|
|
- from tempPropertiesFile
|
|
|
-}
|
|
|
|
|
|
-extraArchive {
|
|
|
- javadoc = false
|
|
|
- tests = false
|
|
|
-}
|
|
|
+ idea {
|
|
|
+ module {
|
|
|
+ inheritOutputDirs = false
|
|
|
+ outputDir = file('build-idea/classes/main')
|
|
|
+ testOutputDir = file('build-idea/classes/test')
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
-idea {
|
|
|
- module {
|
|
|
- inheritOutputDirs = false
|
|
|
- outputDir = file('build-idea/classes/main')
|
|
|
- testOutputDir = file('build-idea/classes/test')
|
|
|
+ eclipse {
|
|
|
+ classpath {
|
|
|
+ defaultOutputDir = file('build-eclipse')
|
|
|
+ }
|
|
|
}
|
|
|
-}
|
|
|
|
|
|
-eclipse {
|
|
|
- classpath {
|
|
|
- defaultOutputDir = file('build-eclipse')
|
|
|
+ task copyEclipseSettings(type: Copy) {
|
|
|
+ from project.file('src/main/resources/eclipse.settings')
|
|
|
+ into '.settings'
|
|
|
+ }
|
|
|
+ // otherwise .settings is not nuked entirely
|
|
|
+ tasks.cleanEclipse {
|
|
|
+ delete '.settings'
|
|
|
}
|
|
|
+ tasks.eclipse.dependsOn(cleanEclipse, copyEclipseSettings)
|
|
|
}
|
|
|
|
|
|
-task copyEclipseSettings(type: Copy) {
|
|
|
- from project.file('src/main/resources/eclipse.settings')
|
|
|
- into '.settings'
|
|
|
-}
|
|
|
-// otherwise .settings is not nuked entirely
|
|
|
-tasks.cleanEclipse {
|
|
|
- delete '.settings'
|
|
|
+/*****************************************************************************
|
|
|
+ * Normal project checks *
|
|
|
+ *****************************************************************************/
|
|
|
+
|
|
|
+// this happens when included as a normal project in the build, which we do
|
|
|
+// to enforce precommit checks like forbidden apis, as well as setup publishing
|
|
|
+if (project != rootProject) {
|
|
|
+ apply plugin: 'elasticsearch.build'
|
|
|
+ apply plugin: 'nebula.maven-base-publish'
|
|
|
+ apply plugin: 'nebula.maven-scm'
|
|
|
+
|
|
|
+ // groovydoc succeeds, but has some weird internal exception...
|
|
|
+ groovydoc.enabled = false
|
|
|
+
|
|
|
+ // build-tools is not ready for primetime with these...
|
|
|
+ dependencyLicenses.enabled = false
|
|
|
+ forbiddenApisMain.enabled = false
|
|
|
+ jarHell.enabled = false
|
|
|
+ loggerUsageCheck.enabled = false
|
|
|
+ thirdPartyAudit.enabled = false
|
|
|
+
|
|
|
+ // test for elasticsearch.build tries to run with ES...
|
|
|
+ test.enabled = false
|
|
|
+
|
|
|
+ // TODO: re-enable once randomizedtesting gradle code is published and removed from here
|
|
|
+ licenseHeaders.enabled = false
|
|
|
+
|
|
|
+ forbiddenPatterns {
|
|
|
+ exclude '**/*.wav'
|
|
|
+ // the file that actually defines nocommit
|
|
|
+ exclude '**/ForbiddenPatternsTask.groovy'
|
|
|
+ }
|
|
|
}
|
|
|
-tasks.eclipse.dependsOn(cleanEclipse, copyEclipseSettings)
|