|
43 | 43 | import javax.inject.Inject; |
44 | 44 | import java.io.File; |
45 | 45 | import java.util.ArrayList; |
46 | | -import java.util.Collections; |
47 | 46 | import java.util.HashMap; |
48 | 47 | import java.util.HashSet; |
49 | 48 | import java.util.List; |
50 | 49 | import java.util.Map; |
51 | 50 | import java.util.Set; |
| 51 | +import java.util.stream.Stream; |
52 | 52 |
|
53 | 53 | abstract public class JavaFXOptions { |
54 | 54 |
|
@@ -185,23 +185,29 @@ private void declareFXDependencies(String conf) { |
185 | 185 | // This allows users to make multiple modifications to the 'configurations' list at arbitrary times during |
186 | 186 | // build configuration. |
187 | 187 | getConfigurationContainer().getByName(conf).withDependencies(dependencySet -> { |
188 | | - if (!List.of(configurations).contains(conf)) { |
189 | | - // configuration was removed: do nothing |
190 | | - return; |
191 | | - } |
192 | | - JavaFXModule.getJavaFXModules(this.modules).stream() |
193 | | - .sorted() |
194 | | - .forEach(javaFXModule -> { |
195 | | - if (customSDKArtifactRepository != null) { |
196 | | - dependencySet.add(getDependencies().create(Map.of("name", javaFXModule.getModuleName()))); |
197 | | - } else { |
198 | | - dependencySet.add(getDependencies().create( |
199 | | - MAVEN_JAVAFX_ARTIFACT_GROUP_ID + ":" |
200 | | - + javaFXModule.getArtifactName() + ":" |
201 | | - + getVersion() |
202 | | - )); |
203 | | - } |
204 | | - }); |
| 188 | + if (!List.of(configurations).contains(conf)) { |
| 189 | + // configuration was removed: do nothing |
| 190 | + return; |
| 191 | + } |
| 192 | + |
| 193 | + var javaFXModules = JavaFXModule.getJavaFXModules(this.modules); |
| 194 | + if (customSDKArtifactRepository == null) { |
| 195 | + javaFXModules.stream().sorted().forEach(javaFXModule -> dependencySet.add(getDependencies().create( |
| 196 | + MAVEN_JAVAFX_ARTIFACT_GROUP_ID + ":" + javaFXModule.getArtifactName() + ":" + getVersion() |
| 197 | + ))); |
| 198 | + } else { |
| 199 | + // Use the list of dependencies of each module to also add direct dependencies for those. |
| 200 | + // This is needed, because there is no information about transitive dependencies in the metadata |
| 201 | + // of the modules (as there is no such metadata in the local sdk). |
| 202 | + var javaFXModulesWithTransitives = Stream.concat( |
| 203 | + javaFXModules.stream(), |
| 204 | + javaFXModules.stream().flatMap(m -> m.getDependentModules().stream()) |
| 205 | + ).distinct().sorted(); |
| 206 | + |
| 207 | + javaFXModulesWithTransitives.forEach(javaFXModule -> dependencySet.add(getDependencies().create( |
| 208 | + Map.of("name", javaFXModule.getModuleName()) |
| 209 | + ))); |
| 210 | + } |
205 | 211 | }); |
206 | 212 | } |
207 | 213 |
|
|
0 commit comments