@@ -106,10 +106,12 @@ public void apply(Project project) {
106
106
TaskProvider <Copy > copyUpgradeTask = configureCopyUpgradeTask (project , upgradeVersion , upgradeDir );
107
107
TaskProvider <Copy > copyPluginsTask = configureCopyPluginsTask (project , pluginsDir );
108
108
109
+ Map <ElasticsearchDistribution .Type , TaskProvider <?>> lifecyleTasks = lifecyleTasks (project , "distructiveDistroTest" );
109
110
TaskProvider <Task > destructiveDistroTest = project .getTasks ().register ("destructiveDistroTest" );
110
111
for (ElasticsearchDistribution distribution : distributions ) {
111
112
TaskProvider <?> destructiveTask = configureDistroTest (project , distribution , dockerSupport );
112
113
destructiveDistroTest .configure (t -> t .dependsOn (destructiveTask ));
114
+ lifecyleTasks .get (distribution .getType ()).configure (t -> t .dependsOn (destructiveTask ));
113
115
}
114
116
Map <String , TaskProvider <?>> batsTests = new HashMap <>();
115
117
configureBatsTest (project , "plugins" , distributionsDir , copyDistributionsTask , copyPluginsTask ).configure (
@@ -125,6 +127,7 @@ public void apply(Project project) {
125
127
List <Object > vmDependencies = new ArrayList <>(configureVM (vmProject ));
126
128
vmDependencies .add (project .getConfigurations ().getByName ("testRuntimeClasspath" ));
127
129
130
+ Map <ElasticsearchDistribution .Type , TaskProvider <?>> vmLifecyleTasks = lifecyleTasks (vmProject , "distroTest" );
128
131
TaskProvider <Task > distroTest = vmProject .getTasks ().register ("distroTest" );
129
132
for (ElasticsearchDistribution distribution : distributions ) {
130
133
String destructiveTaskName = destructiveDistroTestTaskName (distribution );
@@ -139,6 +142,7 @@ public void apply(Project project) {
139
142
);
140
143
vmTask .configure (t -> t .dependsOn (distribution ));
141
144
145
+ vmLifecyleTasks .get (distribution .getType ()).configure (t -> t .dependsOn (vmTask ));
142
146
distroTest .configure (t -> {
143
147
// Only VM sub-projects that are specifically opted-in to testing Docker should
144
148
// have the Docker task added as a dependency. Although we control whether Docker
@@ -168,6 +172,17 @@ public void apply(Project project) {
168
172
});
169
173
}
170
174
175
+ private static Map <ElasticsearchDistribution .Type , TaskProvider <?>> lifecyleTasks (Project project , String taskPrefix ) {
176
+ Map <ElasticsearchDistribution .Type , TaskProvider <?>> lifecyleTasks = new HashMap <>();
177
+
178
+ lifecyleTasks .put (Type .DOCKER , project .getTasks ().register (taskPrefix + ".docker" ));
179
+ lifecyleTasks .put (Type .ARCHIVE , project .getTasks ().register (taskPrefix + ".archives" ));
180
+ lifecyleTasks .put (Type .DEB , project .getTasks ().register (taskPrefix + ".packages" ));
181
+ lifecyleTasks .put (Type .RPM , lifecyleTasks .get (Type .DEB ));
182
+
183
+ return lifecyleTasks ;
184
+ }
185
+
171
186
private static Jdk createJdk (
172
187
NamedDomainObjectContainer <Jdk > jdksContainer ,
173
188
String name ,
0 commit comments