Browse Source

Build: Make assemble a noop in bwc projects (#37245)

This commit makes the assemble tasks in the bwc projects noops by
setting the dependsOn directly. While we can not remove things from
dependsOn, we can still completely override the dependencies.

closes #33581
Ryan Ernst 6 years ago
parent
commit
722b850efd
1 changed files with 9 additions and 15 deletions
  1. 9 15
      distribution/bwc/build.gradle

+ 9 - 15
distribution/bwc/build.gradle

@@ -197,21 +197,15 @@ bwcVersions.forPreviousUnreleased { VersionCollection.UnreleasedVersionInfo unre
         }
     }
 
-    if (gradle.startParameter.taskNames == ["assemble"]) {
-        // Gradle needs the `artifacts` declaration, including `builtBy` bellow to make projects dependencies on this
-        // project work, but it will also trigger the build of these for the `assemble` task.
-        // Since these are only used for testing, we don't want to assemble them if `assemble` is the single command being
-        // ran.
-        logger.info("Skipping BWC builds since `assemble` is the only task name provided on the command line")
-    } else {
-        artifacts {
-            for (File artifactFile : artifactFiles) {
-                String artifactName = artifactFile.name.contains('oss') ? 'elasticsearch-oss' : 'elasticsearch'
-                String suffix = artifactFile.toString()[-3..-1]
-                'default' file: artifactFile, name: artifactName, type: suffix, builtBy: buildBwcVersion
-            }
-        }
+    artifacts {
+      for (File artifactFile : artifactFiles) {
+        String artifactName = artifactFile.name.contains('oss') ? 'elasticsearch-oss' : 'elasticsearch'
+        String suffix = artifactFile.toString()[-3..-1]
+        'default' file: artifactFile, name: artifactName, type: suffix, builtBy: buildBwcVersion
+      }
     }
+    // make sure no dependencies were added to assemble; we want it to be a no-op
+    assemble.dependsOn = []
 }}
 
 class IndentingOutputStream extends OutputStream {
@@ -237,4 +231,4 @@ class IndentingOutputStream extends OutputStream {
             }
         }
     }
-}
+}