Remove assemble task when not used for publishing (#25228)

Removes the `assemble` task from projects that are not published.
This should speed up `gradle assemble` by skipping projects that
don't need to be built. Which is useful because `gradle assemble`
is how we cut releases.
This commit is contained in:
Nik Everett 2017-06-16 11:46:34 -04:00 committed by GitHub
parent b5cea6980b
commit 7b358190d6
10 changed files with 38 additions and 4 deletions

View File

@ -34,6 +34,8 @@ apply plugin: 'com.github.johnrengelman.shadow'
// have the shadow plugin provide the runShadow task
apply plugin: 'application'
tasks.remove(assemble) // Not published so no need to assemble
archivesBaseName = 'elasticsearch-benchmarks'
mainClassName = 'org.openjdk.jmh.Main'

View File

@ -420,3 +420,16 @@ task run(type: Run) {
group = 'Verification'
impliesSubProjects = true
}
/* Remove assemble on all qa projects because we don't need to publish
* artifacts for them. */
gradle.projectsEvaluated {
subprojects {
if (project.path.startsWith(':qa')) {
Task assemble = project.tasks.findByName('assemble')
if (assemble) {
project.tasks.remove(assemble)
}
}
}
}

View File

@ -394,8 +394,11 @@ class BuildPlugin implements Plugin<Project> {
project.tasks.withType(GenerateMavenPom.class) { GenerateMavenPom t ->
// place the pom next to the jar it is for
t.destination = new File(project.buildDir, "distributions/${project.archivesBaseName}-${project.version}.pom")
// build poms with assemble
project.assemble.dependsOn(t)
// build poms with assemble (if the assemble task exists)
Task assemble = project.tasks.findByName('assemble')
if (assemble) {
assemble.dependsOn(t)
}
}
}
}

View File

@ -32,6 +32,8 @@ public class DocsTestPlugin extends RestTestPlugin {
public void apply(Project project) {
project.pluginManager.apply('elasticsearch.standalone-rest-test')
super.apply(project)
// Docs are published separately so no need to assemble
project.tasks.remove(project.assemble)
Map<String, String> defaultSubstitutions = [
/* These match up with the asciidoc syntax for substitutions but
* the values may differ. In particular {version} needs to resolve

View File

@ -37,6 +37,8 @@ apply plugin: 'application'
group = 'org.elasticsearch.client'
tasks.remove(assemble) // Not published so no need to assemble
archivesBaseName = 'client-benchmarks'
mainClassName = 'org.elasticsearch.client.benchmark.BenchmarkMain'

View File

@ -27,9 +27,10 @@ esplugin {
classname 'org.elasticsearch.plugin.noop.NoopPlugin'
}
tasks.remove(assemble) // Not published so no need to assemble
compileJava.options.compilerArgs << "-Xlint:-cast,-deprecation,-rawtypes,-try,-unchecked"
// no unit tests
test.enabled = false
integTest.enabled = false

View File

@ -49,6 +49,7 @@ if (project.name == 'bwc-stable-snapshot') {
if (enabled) {
apply plugin: 'distribution'
tasks.remove(assemble) // Not published so no need to assemble
def (String major, String minor, String bugfix) = bwcVersion.split('\\.')
def (String currentMajor, String currentMinor, String currentBugfix) = version.split('\\.')

View File

@ -0,0 +1,9 @@
// Subprojects aren't published so do not assemble
gradle.projectsEvaluated {
subprojects {
Task assemble = project.tasks.findByName('assemble')
if (assemble) {
project.tasks.remove(assemble)
}
}
}

View File

@ -21,6 +21,7 @@ esplugin {
description 'Demonstrates all the pluggable Java entry points in Elasticsearch'
classname 'org.elasticsearch.plugin.example.JvmExamplePlugin'
}
tasks.remove(assemble) // Not published so no need to assemble
// no unit tests
test.enabled = false
@ -47,4 +48,3 @@ integTestCluster {
integTestRunner {
systemProperty 'external.address', "${ -> exampleFixture.addressAndPort }"
}

View File

@ -19,3 +19,4 @@
apply plugin: 'elasticsearch.build'
test.enabled = false
tasks.remove(assemble) // Not published so no need to assemble