Skip to content

Commit

Permalink
Move feature aware configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
jasontedor committed Jun 5, 2018
1 parent 75dded7 commit a1c4bab
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ class PrecommitTasks {
precommitTasks.add(configureLoggerUsage(project))
}

if (project.path.startsWith(":x-pack:plugin:")) {
precommitTasks.add(configureFeatureAware(project))
}

Map<String, Object> precommitOptions = [
name: 'precommit',
group: JavaBasePlugin.VERIFICATION_GROUP,
Expand Down Expand Up @@ -180,23 +176,4 @@ class PrecommitTasks {
return loggerUsageTask
}

private static Task configureFeatureAware(final Project project) {
final Task featureAwareTask = project.tasks.create('featureAwareCheck', FeatureAwareTask.class)

// see the root Gradle file for additional logic regarding this configuration
project.configurations.create('featureAwarePlugin')
project.dependencies.add(
'featureAwarePlugin',
"org.elasticsearch.xpack.test:feature-aware:${org.elasticsearch.gradle.VersionProperties.elasticsearch}")
project.dependencies.add(
'featureAwarePlugin',
project.sourceSets.main.output.getClassesDirs())

featureAwareTask.configure { FeatureAwareTask fat ->
fat.classpath = project.configurations.featureAwarePlugin
}

return featureAwareTask
}

}
26 changes: 21 additions & 5 deletions x-pack/plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import org.elasticsearch.gradle.LoggedExec
import org.elasticsearch.gradle.MavenFilteringHack
import org.elasticsearch.gradle.precommit.FeatureAwareTask
import org.elasticsearch.gradle.test.NodeInfo

import java.nio.charset.StandardCharsets
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.StandardCopyOption
import org.elasticsearch.gradle.test.RunTask;

apply plugin: 'elasticsearch.standalone-rest-test'
apply plugin: 'elasticsearch.rest-test'
Expand All @@ -17,6 +13,26 @@ dependencies {
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
}

subprojects {
final SourceSet main = project.sourceSets.findByName("main")
if (main != null) {
final FeatureAwareTask featureAwareTask = project.tasks.create('featureAwareCheck', FeatureAwareTask.class)

// see the root Gradle file for additional logic regarding this configuration
project.configurations.create('featureAwarePlugin')
project.dependencies.add(
'featureAwarePlugin',
"org.elasticsearch.xpack.test:feature-aware:${org.elasticsearch.gradle.VersionProperties.elasticsearch}")
project.dependencies.add('featureAwarePlugin', main.output.getClassesDirs())

featureAwareTask.configure { FeatureAwareTask fat ->
fat.classpath = project.configurations.featureAwarePlugin
}

project.precommit.dependsOn featureAwareTask
}
}

// https://github.com/elastic/x-plugins/issues/724
configurations {
testArtifacts.extendsFrom testRuntime
Expand Down

0 comments on commit a1c4bab

Please sign in to comment.