Skip to content

Commit

Permalink
Merge pull request #9494 from aloubyansky/9396
Browse files Browse the repository at this point in the history
Look for quarkus.index-dependency.* among the application runtime dependencies
  • Loading branch information
stuartwdouglas authored May 25, 2020
2 parents d1b3f01 + 3a5f3a8 commit 7ed7942
Show file tree
Hide file tree
Showing 17 changed files with 393 additions and 418 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import org.jboss.jandex.Indexer;
import org.jboss.logging.Logger;

import io.quarkus.bootstrap.model.AppArtifact;
import io.quarkus.bootstrap.model.AppArtifactKey;
import io.quarkus.bootstrap.model.AppDependency;
import io.quarkus.bootstrap.model.PathsCollection;
import io.quarkus.deployment.ApplicationArchive;
Expand Down Expand Up @@ -124,7 +126,7 @@ private List<ApplicationArchive> scanForOtherIndexes(QuarkusBuildCloseablesBuild

//get paths that are included via index-dependencies
addIndexDependencyPaths(indexDependencyBuildItem, classLoader, root, indexedPaths, appArchives, buildCloseables,
indexCache);
indexCache, curateOutcomeBuildItem);

for (AdditionalApplicationArchiveBuildItem i : additionalApplicationArchives) {
for (Path apPath : i.getPaths()) {
Expand All @@ -139,22 +141,34 @@ private List<ApplicationArchive> scanForOtherIndexes(QuarkusBuildCloseablesBuild

public void addIndexDependencyPaths(List<IndexDependencyBuildItem> indexDependencyBuildItems,
ClassLoader classLoader, ArchiveRootBuildItem root, Set<Path> indexedDeps, List<ApplicationArchive> appArchives,
QuarkusBuildCloseablesBuildItem buildCloseables, IndexCache indexCache) {
QuarkusBuildCloseablesBuildItem buildCloseables, IndexCache indexCache,
CurateOutcomeBuildItem curateOutcomeBuildItem) {
if (indexDependencyBuildItems.isEmpty()) {
return;
}
ArtifactIndex artifactIndex = new ArtifactIndex(new ClassPathArtifactResolver(classLoader));
final List<AppDependency> userDeps = curateOutcomeBuildItem.getEffectiveModel().getUserDependencies();
final Map<AppArtifactKey, AppArtifact> userMap = new HashMap<>(userDeps.size());
for (AppDependency dep : userDeps) {
userMap.put(dep.getArtifact().getKey(), dep.getArtifact());
}
try {
for (IndexDependencyBuildItem indexDependencyBuildItem : indexDependencyBuildItems) {
String classifier = indexDependencyBuildItem.getClassifier();
final Path path = artifactIndex.getPath(indexDependencyBuildItem.getGroupId(),
final AppArtifactKey key = new AppArtifactKey(indexDependencyBuildItem.getGroupId(),
indexDependencyBuildItem.getArtifactId(),
classifier == null || classifier.isEmpty() ? null : classifier);
if (!root.isExcludedFromIndexing(path) && !root.getPaths().contains(path) && indexedDeps.add(path)) {
appArchives.add(createApplicationArchive(buildCloseables, classLoader, indexCache, path));
indexDependencyBuildItem.getClassifier(),
"jar");
final AppArtifact artifact = userMap.get(key);
if (artifact == null) {
throw new RuntimeException(
"Could not resolve artifact " + key + " among the runtime dependencies of the application");
}
for (Path path : artifact.getPaths()) {
if (!root.isExcludedFromIndexing(path) && !root.getPaths().contains(path) && indexedDeps.add(path)) {
appArchives.add(createApplicationArchive(buildCloseables, classLoader, indexCache, path));
}
}
}
} catch (Exception e) {
} catch (IOException e) {
throw new RuntimeException(e);
}
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 7ed7942

Please sign in to comment.