Skip to content

Commit

Permalink
Merge pull request quarkusio#43516 from aloubyansky/mutable-model-fixes
Browse files Browse the repository at this point in the history
Do not include dependencies that haven't been copied to the distribution into the mutable application model
  • Loading branch information
aloubyansky authored Sep 26, 2024
2 parents 68f151e + a591984 commit f0762e4
Showing 1 changed file with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -41,14 +40,21 @@ public MutableJarApplicationModel(String baseName, Map<ArtifactKey, List<String>
String userProvidersDirectory, String appArchivePath) {
this.baseName = baseName;
this.userProvidersDirectory = userProvidersDirectory;
appArtifact = new SerializedDep(appModel.getAppArtifact(), paths, 0);
appArtifact.paths = Collections.singletonList(appArchivePath.replace('\\', '/'));
appArtifact = new SerializedDep(appModel.getAppArtifact(),
paths.getOrDefault(appModel.getAppArtifact().getKey(), List.of()), 0);
appArtifact.paths = List.of(appArchivePath.replace('\\', '/'));
localProjectArtifacts = new HashSet<>(appModel.getReloadableWorkspaceDependencies());
excludedResources = new HashMap<>(appModel.getRemovedResources());
dependencies = new ArrayList<>(appModel.getDependencies().size());
for (ResolvedDependency i : appModel.getDependencies()) {
dependencies.add(new SerializedDep(i, paths, i.getFlags()));
final List<String> pathList = paths.get(i.getKey());
if (pathList != null && !pathList.isEmpty()) {
dependencies.add(new SerializedDep(i, pathList, i.getFlags()));
} else {
localProjectArtifacts.remove(i.getKey());
excludedResources.remove(i.getKey());
}
}
localProjectArtifacts = new HashSet<>(appModel.getReloadableWorkspaceDependencies());
excludedResources = new HashMap<>(appModel.getRemovedResources());
capabilitiesContracts = new ArrayList<>(appModel.getExtensionCapabilities());
this.platformImports = appModel.getPlatforms();
}
Expand Down Expand Up @@ -83,15 +89,11 @@ private static class SerializedDep extends GACTV {
private List<String> paths;
private final int flags;

public SerializedDep(ResolvedDependency dependency, Map<ArtifactKey, List<String>> paths, int flags) {
public SerializedDep(ResolvedDependency dependency, List<String> paths, int flags) {
super(dependency.getGroupId(), dependency.getArtifactId(),
dependency.getClassifier(), dependency.getType(),
dependency.getVersion());
List<String> pathList = paths.get(dependency.getKey());
if (pathList == null) {
pathList = Collections.emptyList();
}
this.paths = pathList.stream().map(s -> s.replace('\\', '/')).collect(Collectors.toList());
this.paths = paths.stream().map(s -> s.replace('\\', '/')).collect(Collectors.toList());
this.flags = flags;
}

Expand All @@ -104,6 +106,7 @@ public ResolvedDependencyBuilder getDep(Path root) {
.setGroupId(getGroupId())
.setArtifactId(getArtifactId())
.setClassifier(getClassifier())
.setType(getType())
.setVersion(getVersion())
.setResolvedPaths(builder.build())
.setFlags(flags);
Expand Down

0 comments on commit f0762e4

Please sign in to comment.