Skip to content

Commit a27f28f

Browse files
committed
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
1 parent 06888e0 commit a27f28f

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

distribution/bwc/build.gradle

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -197,21 +197,15 @@ bwcVersions.forPreviousUnreleased { VersionCollection.UnreleasedVersionInfo unre
197197
}
198198
}
199199

200-
if (gradle.startParameter.taskNames == ["assemble"]) {
201-
// Gradle needs the `artifacts` declaration, including `builtBy` bellow to make projects dependencies on this
202-
// project work, but it will also trigger the build of these for the `assemble` task.
203-
// Since these are only used for testing, we don't want to assemble them if `assemble` is the single command being
204-
// ran.
205-
logger.info("Skipping BWC builds since `assemble` is the only task name provided on the command line")
206-
} else {
207-
artifacts {
208-
for (File artifactFile : artifactFiles) {
209-
String artifactName = artifactFile.name.contains('oss') ? 'elasticsearch-oss' : 'elasticsearch'
210-
String suffix = artifactFile.toString()[-3..-1]
211-
'default' file: artifactFile, name: artifactName, type: suffix, builtBy: buildBwcVersion
212-
}
213-
}
200+
artifacts {
201+
for (File artifactFile : artifactFiles) {
202+
String artifactName = artifactFile.name.contains('oss') ? 'elasticsearch-oss' : 'elasticsearch'
203+
String suffix = artifactFile.toString()[-3..-1]
204+
'default' file: artifactFile, name: artifactName, type: suffix, builtBy: buildBwcVersion
205+
}
214206
}
207+
// make sure no dependencies were added to assemble; we want it to be a no-op
208+
assemble.dependsOn = []
215209
}}
216210

217211
class IndentingOutputStream extends OutputStream {

0 commit comments

Comments
 (0)