Skip to content

Commit

Permalink
Merge pull request quarkusio#44680 from aloubyansky/incubating-model-…
Browse files Browse the repository at this point in the history
…resolver-ws-resolution

Incubating Maven resolver: do not load the workspace when the original resolver isn't aware of it
  • Loading branch information
aloubyansky authored Nov 25, 2024
2 parents 36be0e0 + 17ddf2a commit 87e1d39
Show file tree
Hide file tree
Showing 7 changed files with 380 additions and 196 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import io.quarkus.maven.dependency.DependencyFlags;
import io.quarkus.maven.dependency.ResolvedDependencyBuilder;
import io.quarkus.paths.PathTree;
import io.quarkus.paths.PathVisit;

public class ApplicationDependencyTreeResolver {

Expand Down Expand Up @@ -583,23 +584,30 @@ private ExtensionInfo getExtensionInfoOrNull(Artifact artifact, List<RemoteRepos

artifact = resolve(artifact, repos);
final Path path = artifact.getFile().toPath();
final Properties descriptor = PathTree.ofDirectoryOrArchive(path).apply(BootstrapConstants.DESCRIPTOR_PATH, visit -> {
if (visit == null) {
return null;
}
try {
return readDescriptor(visit.getPath());
} catch (IOException e) {
throw new UncheckedIOException(e);
}
});
final Properties descriptor = PathTree.ofDirectoryOrArchive(path).apply(BootstrapConstants.DESCRIPTOR_PATH,
ApplicationDependencyTreeResolver::readExtensionProperties);
if (descriptor != null) {
ext = new ExtensionInfo(artifact, descriptor, devMode);
allExtensions.put(extKey, ext);
}
return ext;
}

private static Properties readExtensionProperties(PathVisit visit) {
if (visit == null) {
return null;
}
try {
final Properties rtProps = new Properties();
try (BufferedReader reader = Files.newBufferedReader(visit.getPath())) {
rtProps.load(reader);
}
return rtProps;
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}

private void injectDeploymentDependencies(ExtensionDependency extDep)
throws BootstrapDependencyProcessingException {
log.debugf("Injecting deployment dependency %s", extDep.info.deploymentArtifact);
Expand Down Expand Up @@ -719,14 +727,6 @@ private void clearWalkingFlag(byte flag) {
}
}

private static Properties readDescriptor(Path path) throws IOException {
final Properties rtProps = new Properties();
try (BufferedReader reader = Files.newBufferedReader(path)) {
rtProps.load(reader);
}
return rtProps;
}

private static class ExtensionDependency {

static ExtensionDependency get(DependencyNode node) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package io.quarkus.bootstrap.resolver.maven;

/**
* Blocking implementation of the {@link ModelResolutionTaskRunner}.
* Each call to {@link #run(ModelResolutionTask)} will block until the task has finished running.
* {@link #waitForCompletion()} is a no-op in this implementation.
*/
class BlockingModelResolutionTaskRunner implements ModelResolutionTaskRunner {

static BlockingModelResolutionTaskRunner getInstance() {
return new BlockingModelResolutionTaskRunner();
}

@Override
public void run(ModelResolutionTask task) {
task.run();
}

@Override
public void waitForCompletion() {
}
}
Loading

0 comments on commit 87e1d39

Please sign in to comment.