@@ -25,7 +25,7 @@ import org.elasticsearch.gradle.NoticeTask
25
25
import org.elasticsearch.gradle.Version
26
26
import org.elasticsearch.gradle.VersionProperties
27
27
import org.elasticsearch.gradle.test.RestIntegTestTask
28
- import org.elasticsearch.gradle.test .RunTask
28
+ import org.elasticsearch.gradle.testclusters .RunTask
29
29
import org.elasticsearch.gradle.testclusters.TestClustersPlugin
30
30
import org.elasticsearch.gradle.tool.ClasspathUtils
31
31
import org.gradle.api.InvalidUserDataException
@@ -68,35 +68,28 @@ class PluginBuildPlugin implements Plugin<Project> {
68
68
project. archivesBaseName = name
69
69
project. description = extension1. description
70
70
configurePublishing(project, extension1)
71
- if (project. plugins. hasPlugin(TestClustersPlugin . class) == false ) {
72
- project. integTestCluster. dependsOn(project. tasks. bundlePlugin)
73
- if (isModule) {
74
- project. integTestCluster. module(project)
75
- } else {
76
- project. integTestCluster. plugin(project. path)
77
- }
71
+
72
+ project. tasks. integTest. dependsOn(project. tasks. bundlePlugin)
73
+ if (isModule) {
74
+ project. testClusters. integTest. module(
75
+ project. file(project. tasks. bundlePlugin. archiveFile)
76
+ )
78
77
} else {
79
- project. tasks. integTest. dependsOn(project. tasks. bundlePlugin)
80
- if (isModule) {
78
+ project. testClusters. integTest. plugin(
79
+ project. file(project. tasks. bundlePlugin. archiveFile)
80
+ )
81
+ }
82
+
83
+ project. extensions. getByType(PluginPropertiesExtension ). extendedPlugins. each { pluginName ->
84
+ // Auto add dependent modules to the test cluster
85
+ if (project. findProject(" :modules:${ pluginName} " ) != null ) {
86
+ project. integTest. dependsOn(project. project(" :modules:${ pluginName} " ). tasks. bundlePlugin)
81
87
project. testClusters. integTest. module(
82
- project. file(project. tasks. bundlePlugin. archiveFile)
83
- )
84
- } else {
85
- project. testClusters. integTest. plugin(
86
- project. file(project. tasks. bundlePlugin. archiveFile)
88
+ project. file(project. project(" :modules:${ pluginName} " ). tasks. bundlePlugin. archiveFile)
87
89
)
88
90
}
89
-
90
- project. extensions. getByType(PluginPropertiesExtension ). extendedPlugins. each { pluginName ->
91
- // Auto add dependent modules to the test cluster
92
- if (project. findProject(" :modules:${ pluginName} " ) != null ) {
93
- project. integTest. dependsOn(project. project(" :modules:${ pluginName} " ). tasks. bundlePlugin)
94
- project. testClusters. integTest. module(
95
- project. file(project. project(" :modules:${ pluginName} " ). tasks. bundlePlugin. archiveFile)
96
- )
97
- }
98
- }
99
91
}
92
+
100
93
if (extension1. name == null ) {
101
94
throw new InvalidUserDataException (' name is a required setting for esplugin' )
102
95
}
@@ -120,14 +113,6 @@ class PluginBuildPlugin implements Plugin<Project> {
120
113
]
121
114
buildProperties. expand(properties)
122
115
buildProperties. inputs. properties(properties)
123
- project. tasks. run. dependsOn(project. tasks. bundlePlugin)
124
- if (isModule) {
125
- project. tasks. run. clusterConfig. distribution = System . getProperty(
126
- ' run.distribution' , isXPackModule ? ' default' : ' oss'
127
- )
128
- } else {
129
- project. tasks. run. clusterConfig. plugin(project. path)
130
- }
131
116
if (isModule == false || isXPackModule) {
132
117
addNoticeGeneration(project, extension1)
133
118
}
@@ -148,7 +133,11 @@ class PluginBuildPlugin implements Plugin<Project> {
148
133
createIntegTestTask(project)
149
134
createBundleTasks(project, extension)
150
135
project. configurations. getByName(' default' ). extendsFrom(project. configurations. getByName(' runtime' ))
151
- project. tasks. create(' run' , RunTask ) // allow running ES with this plugin in the foreground of a build
136
+ // allow running ES with this plugin in the foreground of a build
137
+ project. tasks. register(' run' , RunTask ) {
138
+ dependsOn(project. tasks. bundlePlugin)
139
+ useCluster project. testClusters. integTest
140
+ }
152
141
}
153
142
154
143
private void configurePublishing (Project project , PluginPropertiesExtension extension ) {
@@ -195,10 +184,6 @@ class PluginBuildPlugin implements Plugin<Project> {
195
184
private static void createIntegTestTask (Project project ) {
196
185
RestIntegTestTask integTest = project. tasks. create(' integTest' , RestIntegTestTask . class)
197
186
integTest. mustRunAfter(' precommit' , ' test' )
198
- if (project. plugins. hasPlugin(TestClustersPlugin . class) == false ) {
199
- // only if not using test clusters
200
- project. integTestCluster. distribution = System . getProperty(' tests.distribution' , ' integ-test-zip' )
201
- }
202
187
project. check. dependsOn(integTest)
203
188
}
204
189
0 commit comments