Browse Source

Add version checker tool to distributions

Ryan Ernst 8 years ago
parent
commit
60b823c756
3 changed files with 37 additions and 4 deletions
  1. 8 4
      distribution/build.gradle
  2. 28 0
      distribution/tools/java-version-checker/build.gradle
  3. 1 0
      settings.gradle

+ 8 - 4
distribution/build.gradle

@@ -40,6 +40,8 @@ buildscript {
   }
 }
 
+Collection distributions = project.subprojects.findAll { it.path.contains(':tools') == false }
+
 /*****************************************************************************
  *                                Notice file                                *
  *****************************************************************************/
@@ -84,7 +86,7 @@ project.rootProject.subprojects.findAll { it.path.startsWith(':modules:') }.each
   // the finalizer task follow the original task immediately. To work around this,
   // we make the mustRunAfter the finalizer task itself.
   // See https://discuss.gradle.org/t/cross-project-task-dependencies-ordering-screws-up-finalizers/13190
-  project.configure(project.subprojects.findAll { it.name != 'integ-test-zip' }) { Project distribution ->
+  project.configure(distributions.findAll { it.name != 'integ-test-zip' }) { Project distribution ->
     distribution.afterEvaluate({
       // some integTest tasks will have multiple finalizers
       distribution.integTest.mustRunAfter module.tasks.find { t -> t.name.matches(".*integTest\$") }.getFinalizedBy()
@@ -118,7 +120,7 @@ task clean(type: Delete) {
   delete 'build'
 }
 
-subprojects {
+configure(distributions) {
   /*****************************************************************************
    *                            Rest test config                               *
    *****************************************************************************/
@@ -162,6 +164,8 @@ subprojects {
       into 'lib'
       from project(':core').jar
       from project(':core').configurations.runtime
+      // delay add tools using closures, since they have not yet been configured, so no jar task exists yet
+      from { project(':distribution:tools:java-version-checker').jar }
     }
 
     modulesFiles = copySpec {
@@ -217,7 +221,7 @@ subprojects {
 /*****************************************************************************
  *                         Zip and tgz configuration                         *
  *****************************************************************************/
-configure(subprojects.findAll { ['zip', 'tar', 'integ-test-zip'].contains(it.name) }) {
+configure(distributions.findAll { ['zip', 'tar', 'integ-test-zip'].contains(it.name) }) {
   // CopySpec does not make it easy to create an empty director so we create the directory that we want, and then point CopySpec to its
   // parent to copy to the root of the distribution
   File plugins = new File(buildDir, 'plugins-hack/plugins')
@@ -286,7 +290,7 @@ configure(subprojects.findAll { ['zip', 'tar', 'integ-test-zip'].contains(it.nam
  *    rpm -qlp --dump path/to/elasticsearch.rpm
  *    dpkg -c path/to/elasticsearch.deb
  */
-configure(subprojects.findAll { ['deb', 'rpm'].contains(it.name) }) {
+configure(distributions.findAll { ['deb', 'rpm'].contains(it.name) }) {
   integTest.enabled = Os.isFamily(Os.FAMILY_WINDOWS) == false
   File packagingFiles = new File(buildDir, 'packaging')
   project.ext.packagingFiles = packagingFiles

+ 28 - 0
distribution/tools/java-version-checker/build.gradle

@@ -0,0 +1,28 @@
+/*
+ * Licensed to Elasticsearch under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Elasticsearch licenses this file to you 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.gradle.api.JavaVersion
+
+apply plugin: 'elasticsearch.build'
+
+targetCompatibility = JavaVersion.VERSION_1_6
+sourceCompatibility = JavaVersion.VERSION_1_6
+
+test.enabled = false
+loggerUsageCheck.enabled = false

+ 1 - 0
settings.gradle

@@ -19,6 +19,7 @@ List projects = [
   'distribution:tar',
   'distribution:deb',
   'distribution:rpm',
+  'distribution:tools:java-version-checker',
   'test:framework',
   'test:fixtures:example-fixture',
   'test:fixtures:hdfs-fixture',