Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Loubyansky committed Nov 23, 2024
1 parent 9e5dc13 commit ac5983b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ private ApplicationModel buildAppModel(ResolvedDependencyBuilder appArtifact,
if (logTime) {
start = System.currentTimeMillis();
}
if (incubatingModelResolver) {
if (true) {
IncubatingApplicationModelResolver.newInstance()
.setArtifactResolver(mvn)
.setApplicationModelBuilder(appBuilder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public static IncubatingApplicationModelResolver newInstance() {

private final ExtensionInfo EXT_INFO_NONE = new ExtensionInfo();

private final List<AppDep> deploymentInjectionPoints = new ArrayList<>();
private List<AppDep> deploymentInjectionPoints = new ArrayList<>();
private final Map<ArtifactKey, ExtensionInfo> allExtensions = new ConcurrentHashMap<>();
private Collection<ConditionalDependency> conditionalDepsToProcess = new ConcurrentLinkedDeque<>();

Expand Down Expand Up @@ -282,6 +282,7 @@ private void activateConditionalDeps() {
}
}
}
conditionalDepsToProcess = List.of();
}

private void populateModelBuilder(DependencyNode root) {
Expand Down Expand Up @@ -312,27 +313,13 @@ private Collection<AppDep> collectDeploymentDeps() {
final ConcurrentLinkedDeque<AppDep> injectQueue = new ConcurrentLinkedDeque<>();
var taskRunner = new ModelResolutionTaskRunner();
for (AppDep extDep : deploymentInjectionPoints) {
injectDeploymentDep(taskRunner, extDep, injectQueue);
extDep.scheduleCollectDeploymentDeps(taskRunner, injectQueue);
}
deploymentInjectionPoints = List.of();
taskRunner.waitForCompletion();
return injectQueue;
}

private void injectDeploymentDep(ModelResolutionTaskRunner taskRunner, AppDep extDep,
ConcurrentLinkedDeque<AppDep> injectQueue) {
var resolvedDep = appBuilder.getDependency(getKey(extDep.ext.info.deploymentArtifact));
if (resolvedDep == null) {
taskRunner.run(() -> {
extDep.ext.collectDeploymentDeps();
injectQueue.add(extDep);
});
} else {
// if resolvedDep isn't null, it means the deployment artifact is on the runtime classpath
// in which case we also clear the reloadable flag on it, in case it's coming from the workspace
resolvedDep.clearFlag(DependencyFlags.RELOADABLE);
}
}

/**
* Resolves and adds compile-only dependencies to the application model with the {@link DependencyFlags#COMPILE_ONLY} flag.
* Compile-only dependencies are resolved as direct dependencies of the root with all the previously resolved dependencies
Expand Down Expand Up @@ -447,7 +434,8 @@ private void clearReloadableFlag(ResolvedDependencyBuilder dep) {
}
}

private DependencyNode normalize(RepositorySystemSession session, DependencyNode root) throws AppModelResolverException {
private static DependencyNode normalize(RepositorySystemSession session, DependencyNode root)
throws AppModelResolverException {
final DependencyGraphTransformationContext context = new SimpleDependencyGraphTransformationContext(session);
try {
// resolves version conflicts
Expand Down Expand Up @@ -661,8 +649,8 @@ void setFlags(byte walkingFlags) {
if (ext != null) {
ext.info.ensureActivated(appBuilder);
if (isFlagOn(walkingFlags, COLLECT_TOP_EXTENSION_RUNTIME_NODES)) {
resolvedDep.setFlags(DependencyFlags.TOP_LEVEL_RUNTIME_EXTENSION_ARTIFACT);
walkingFlags = clearFlag(walkingFlags, COLLECT_TOP_EXTENSION_RUNTIME_NODES);
resolvedDep.setFlags(DependencyFlags.TOP_LEVEL_RUNTIME_EXTENSION_ARTIFACT);
}
if (isFlagOn(walkingFlags, COLLECT_DEPLOYMENT_INJECTION_POINTS)) {
walkingFlags = clearFlag(walkingFlags, COLLECT_DEPLOYMENT_INJECTION_POINTS);
Expand Down Expand Up @@ -771,6 +759,23 @@ private void collectConditionalDependencies()
}
}

private void scheduleCollectDeploymentDeps(ModelResolutionTaskRunner taskRunner,
ConcurrentLinkedDeque<AppDep> injectQueue) {
var resolvedDep = appBuilder.getDependency(getKey(ext.info.deploymentArtifact));
if (resolvedDep == null) {
taskRunner.run(this::collectDeploymentDeps);
injectQueue.add(this);
} else {
// if resolvedDep isn't null, it means the deployment artifact is on the runtime classpath
// in which case we also clear the reloadable flag on it, in case it's coming from the workspace
resolvedDep.clearFlag(DependencyFlags.RELOADABLE);
}
}

private void collectDeploymentDeps() throws BootstrapDependencyProcessingException {
ext.collectDeploymentDeps();
}

private void injectDeploymentDependency() {
// if the parent is an extension then add the deployment node as a dependency of the parent's deployment node
// (that would happen when injecting conditional dependencies)
Expand Down

0 comments on commit ac5983b

Please sign in to comment.