|
25 | 25 | import java.util.stream.Collectors;
|
26 | 26 |
|
27 | 27 | import org.assertj.core.util.VisibleForTesting;
|
28 |
| - |
29 | 28 | import org.springframework.data.release.deployment.DeploymentInformation;
|
30 | 29 | import org.springframework.data.release.deployment.StagingRepository;
|
31 | 30 | import org.springframework.data.release.model.Module;
|
@@ -74,42 +73,77 @@ public void updateProjectDescriptors(TrainIteration iteration, Phase phase) thro
|
74 | 73 | }
|
75 | 74 |
|
76 | 75 | /**
|
77 |
| - * Triggers the distribution builds for all modules participating in the given {@link TrainIteration}. |
| 76 | + * Prepares the versions of the given {@link TrainIteration} depending on the given {@link Phase}. |
78 | 77 | *
|
79 | 78 | * @param iteration must not be {@literal null}.
|
| 79 | + * @param phase must not be {@literal null}. |
80 | 80 | */
|
81 |
| - public void distributeResources(TrainIteration iteration) { |
| 81 | + public void prepareVersions(TrainIteration iteration, Phase phase) { |
82 | 82 |
|
83 | 83 | Assert.notNull(iteration, "Train iteration must not be null!");
|
| 84 | + Assert.notNull(phase, "Phase must not be null!"); |
84 | 85 |
|
85 |
| - distributeResources(iteration.getTrain()); |
| 86 | + BuildExecutor.Summary<ModuleIteration> summary = executor.doWithBuildSystemOrdered(iteration, |
| 87 | + (system, module) -> system.prepareVersion(module, phase)); |
| 88 | + |
| 89 | + logger.log(iteration, "Prepare versions: %s", summary); |
86 | 90 | }
|
87 | 91 |
|
88 | 92 | /**
|
89 |
| - * Triggers the distribution builds for all modules participating in the given {@link Train}. |
| 93 | + * Prepares the version of the given {@link ModuleIteration} depending on the given {@link Phase}. |
90 | 94 | *
|
91 |
| - * @param train must not be {@literal null}. |
| 95 | + * @param iteration must not be {@literal null}. |
| 96 | + * @param phase must not be {@literal null}. |
| 97 | + * @return |
92 | 98 | */
|
93 |
| - public void distributeResources(Train train) { |
| 99 | + @VisibleForTesting |
| 100 | + public ModuleIteration prepareVersion(ModuleIteration iteration, Phase phase) { |
94 | 101 |
|
95 |
| - Assert.notNull(train, "Train must not be null!"); |
| 102 | + Assert.notNull(iteration, "Module iteration must not be null!"); |
| 103 | + Assert.notNull(phase, "Phase must not be null!"); |
96 | 104 |
|
97 |
| - BuildExecutor.Summary<Module> summary = executor.doWithBuildSystemAnyOrder(train, |
98 |
| - BuildSystem::triggerDistributionBuild); |
| 105 | + return doWithBuildSystem(iteration, (system, module) -> system.prepareVersion(module, phase)); |
| 106 | + } |
99 | 107 |
|
100 |
| - logger.log(train, "Distribution build: %s", summary); |
| 108 | + |
| 109 | + /** |
| 110 | + * Opens a repository to stage artifacts for this {@link ModuleIteration}. |
| 111 | + * |
| 112 | + * @param iteration must not be {@literal null}. |
| 113 | + */ |
| 114 | + public void open(ModuleIteration iteration) { |
| 115 | + |
| 116 | + doWithBuildSystem(iteration, (buildSystem, moduleIteration) -> buildSystem.open()); |
101 | 117 | }
|
102 | 118 |
|
103 | 119 | /**
|
104 |
| - * Triggers the distribution builds for the given module. |
| 120 | + * Closes a repository to stage artifacts for this {@link ModuleIteration}. |
105 | 121 | *
|
106 | 122 | * @param iteration must not be {@literal null}.
|
| 123 | + * @param stagingRepository must not be {@literal null}. |
107 | 124 | */
|
108 |
| - public void distributeResources(ModuleIteration iteration) { |
| 125 | + public void close(ModuleIteration iteration, StagingRepository stagingRepository) { |
109 | 126 |
|
110 |
| - Assert.notNull(iteration, "ModuleIteration must not be null!"); |
| 127 | + Assert.notNull(stagingRepository, "StagingRepository must not be null"); |
| 128 | + Assert.isTrue(stagingRepository.isPresent(), "StagingRepository must be present"); |
111 | 129 |
|
112 |
| - doWithBuildSystem(iteration, BuildSystem::triggerDistributionBuild); |
| 130 | + doWithBuildSystem(iteration, (buildSystem, moduleIteration) -> { |
| 131 | + buildSystem.close(stagingRepository); |
| 132 | + return null; |
| 133 | + }); |
| 134 | + } |
| 135 | + |
| 136 | + /** |
| 137 | + * Performs a local build for all modules in the given {@link TrainIteration}. |
| 138 | + * |
| 139 | + * @param iteration must not be {@literal null}. |
| 140 | + * @return |
| 141 | + */ |
| 142 | + public void build(TrainIteration iteration) { |
| 143 | + |
| 144 | + executor.doWithBuildSystemOrdered(iteration, BuildSystem::triggerBuild); |
| 145 | + |
| 146 | + logger.log(iteration, "Build finished"); |
113 | 147 | }
|
114 | 148 |
|
115 | 149 | /**
|
@@ -149,72 +183,51 @@ public DeploymentInformation performRelease(ModuleIteration module) {
|
149 | 183 | }
|
150 | 184 |
|
151 | 185 | /**
|
152 |
| - * Prepares the versions of the given {@link TrainIteration} depending on the given {@link Phase}. |
| 186 | + * Triggers the distribution builds for all modules participating in the given {@link TrainIteration}. |
153 | 187 | *
|
154 | 188 | * @param iteration must not be {@literal null}.
|
155 |
| - * @param phase must not be {@literal null}. |
156 | 189 | */
|
157 |
| - public void prepareVersions(TrainIteration iteration, Phase phase) { |
| 190 | + public void distributeResources(TrainIteration iteration) { |
158 | 191 |
|
159 | 192 | Assert.notNull(iteration, "Train iteration must not be null!");
|
160 |
| - Assert.notNull(phase, "Phase must not be null!"); |
161 | 193 |
|
162 |
| - BuildExecutor.Summary<ModuleIteration> summary = executor.doWithBuildSystemOrdered(iteration, |
163 |
| - (system, module) -> system.prepareVersion(module, phase)); |
164 |
| - |
165 |
| - logger.log(iteration, "Prepare versions: %s", summary); |
| 194 | + distributeResources(iteration.getTrain()); |
166 | 195 | }
|
167 | 196 |
|
168 | 197 | /**
|
169 |
| - * Prepares the version of the given {@link ModuleIteration} depending on the given {@link Phase}. |
| 198 | + * Triggers the distribution builds for all modules participating in the given {@link Train}. |
170 | 199 | *
|
171 |
| - * @param iteration must not be {@literal null}. |
172 |
| - * @param phase must not be {@literal null}. |
173 |
| - * @return |
| 200 | + * @param train must not be {@literal null}. |
174 | 201 | */
|
175 |
| - @VisibleForTesting |
176 |
| - public ModuleIteration prepareVersion(ModuleIteration iteration, Phase phase) { |
| 202 | + public void distributeResources(Train train) { |
177 | 203 |
|
178 |
| - Assert.notNull(iteration, "Module iteration must not be null!"); |
179 |
| - Assert.notNull(phase, "Phase must not be null!"); |
| 204 | + Assert.notNull(train, "Train must not be null!"); |
180 | 205 |
|
181 |
| - return doWithBuildSystem(iteration, (system, module) -> system.prepareVersion(module, phase)); |
182 |
| - } |
| 206 | + BuildExecutor.Summary<Module> summary = executor.doWithBuildSystemAnyOrder(train, |
| 207 | + BuildSystem::triggerDistributionBuild); |
183 | 208 |
|
184 |
| - /** |
185 |
| - * Returns the {@link Path} of the local artifact repository. |
186 |
| - * |
187 |
| - * @return |
188 |
| - */ |
189 |
| - public Path getLocalRepository() { |
190 |
| - return properties.getLocalRepository().toPath(); |
| 209 | + logger.log(train, "Distribution build: %s", summary); |
191 | 210 | }
|
192 | 211 |
|
193 | 212 | /**
|
194 |
| - * Opens a repository to stage artifacts for this {@link ModuleIteration}. |
| 213 | + * Triggers the distribution builds for the given module. |
195 | 214 | *
|
196 | 215 | * @param iteration must not be {@literal null}.
|
197 | 216 | */
|
198 |
| - public void open(ModuleIteration iteration) { |
| 217 | + public void distributeResources(ModuleIteration iteration) { |
199 | 218 |
|
200 |
| - doWithBuildSystem(iteration, (buildSystem, moduleIteration) -> buildSystem.open()); |
| 219 | + Assert.notNull(iteration, "ModuleIteration must not be null!"); |
| 220 | + |
| 221 | + doWithBuildSystem(iteration, BuildSystem::triggerDistributionBuild); |
201 | 222 | }
|
202 | 223 |
|
203 | 224 | /**
|
204 |
| - * Closes a repository to stage artifacts for this {@link ModuleIteration}. |
| 225 | + * Returns the {@link Path} of the local artifact repository. |
205 | 226 | *
|
206 |
| - * @param iteration must not be {@literal null}. |
207 |
| - * @param stagingRepository must not be {@literal null}. |
| 227 | + * @return |
208 | 228 | */
|
209 |
| - public void close(ModuleIteration iteration, StagingRepository stagingRepository) { |
210 |
| - |
211 |
| - Assert.notNull(stagingRepository, "StagingRepository must not be null"); |
212 |
| - Assert.isTrue(stagingRepository.isPresent(), "StagingRepository must be present"); |
213 |
| - |
214 |
| - doWithBuildSystem(iteration, (buildSystem, moduleIteration) -> { |
215 |
| - buildSystem.close(stagingRepository); |
216 |
| - return null; |
217 |
| - }); |
| 229 | + public Path getLocalRepository() { |
| 230 | + return properties.getLocalRepository().toPath(); |
218 | 231 | }
|
219 | 232 |
|
220 | 233 | /**
|
|
0 commit comments