@@ -106,10 +106,12 @@ public void apply(Project project) {
106106 TaskProvider <Copy > copyUpgradeTask = configureCopyUpgradeTask (project , upgradeVersion , upgradeDir );
107107 TaskProvider <Copy > copyPluginsTask = configureCopyPluginsTask (project , pluginsDir );
108108
109+ Map <ElasticsearchDistribution .Type , TaskProvider <?>> lifecyleTasks = lifecyleTasks (project , "distructiveDistroTest" );
109110 TaskProvider <Task > destructiveDistroTest = project .getTasks ().register ("destructiveDistroTest" );
110111 for (ElasticsearchDistribution distribution : distributions ) {
111112 TaskProvider <?> destructiveTask = configureDistroTest (project , distribution , dockerSupport );
112113 destructiveDistroTest .configure (t -> t .dependsOn (destructiveTask ));
114+ lifecyleTasks .get (distribution .getType ()).configure (t -> t .dependsOn (destructiveTask ));
113115 }
114116 Map <String , TaskProvider <?>> batsTests = new HashMap <>();
115117 configureBatsTest (project , "plugins" , distributionsDir , copyDistributionsTask , copyPluginsTask ).configure (
@@ -125,6 +127,7 @@ public void apply(Project project) {
125127 List <Object > vmDependencies = new ArrayList <>(configureVM (vmProject ));
126128 vmDependencies .add (project .getConfigurations ().getByName ("testRuntimeClasspath" ));
127129
130+ Map <ElasticsearchDistribution .Type , TaskProvider <?>> vmLifecyleTasks = lifecyleTasks (vmProject , "distroTest" );
128131 TaskProvider <Task > distroTest = vmProject .getTasks ().register ("distroTest" );
129132 for (ElasticsearchDistribution distribution : distributions ) {
130133 String destructiveTaskName = destructiveDistroTestTaskName (distribution );
@@ -139,6 +142,7 @@ public void apply(Project project) {
139142 );
140143 vmTask .configure (t -> t .dependsOn (distribution ));
141144
145+ vmLifecyleTasks .get (distribution .getType ()).configure (t -> t .dependsOn (vmTask ));
142146 distroTest .configure (t -> {
143147 // Only VM sub-projects that are specifically opted-in to testing Docker should
144148 // have the Docker task added as a dependency. Although we control whether Docker
@@ -168,6 +172,17 @@ public void apply(Project project) {
168172 });
169173 }
170174
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+
171186 private static Jdk createJdk (
172187 NamedDomainObjectContainer <Jdk > jdksContainer ,
173188 String name ,
0 commit comments