diff --git a/core/deployment/src/main/java/io/quarkus/deployment/ApplicationArchive.java b/core/deployment/src/main/java/io/quarkus/deployment/ApplicationArchive.java
index aeed65324a2e8..5c8001efcd460 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/ApplicationArchive.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/ApplicationArchive.java
@@ -9,6 +9,8 @@
import io.quarkus.bootstrap.model.AppArtifactKey;
import io.quarkus.bootstrap.model.PathsCollection;
+import io.quarkus.maven.dependency.ArtifactKey;
+import io.quarkus.paths.PathCollection;
/**
* Represents an archive that is part of application code.
@@ -25,35 +27,28 @@ public interface ApplicationArchive {
IndexView getIndex();
/**
+ * If this archive is a jar file it will return the path to the jar file on the file system,
+ * otherwise it will return the directory that this corresponds to.
*
- * Returns a path representing the archive root. Note that if this is a jar archive this is not the path to the
- * jar, but rather a path to the root of the mounted {@link com.sun.nio.zipfs.ZipFileSystem}
- *
- * @return The archive root.
- * @deprecated in favor of {@link #getRootDirs()}
+ * @deprecated in favor of {@link #getResolvedPaths()}
*/
@Deprecated
- Path getArchiveRoot();
+ Path getArchiveLocation();
/**
+ * @deprecated in favor of {@link #getRootDirectories()}
*
- * @return true
if this archive is a jar
- * @deprecated does not appear to be used anywhere and now it shouldn't be
- */
- @Deprecated
- boolean isJarArchive();
-
- /**
- * If this archive is a jar file it will return the path to the jar file on the file system,
- * otherwise it will return the directory that this corresponds to.
+ * Returns paths representing the archive root directories. Note that every path in this collection
+ * is guaranteed to be a directory. If the actual application archive appears to be a JAR,
+ * this collection will include a path to the root of the mounted {@link java.nio.file.FileSystem}
+ * created from the JAR.
*
- * @deprecated in favor of {@link #getPaths()}
+ * @return The archive root directories.
*/
@Deprecated
- Path getArchiveLocation();
+ PathsCollection getRootDirs();
/**
- *
* Returns paths representing the archive root directories. Note that every path in this collection
* is guaranteed to be a directory. If the actual application archive appears to be a JAR,
* this collection will include a path to the root of the mounted {@link java.nio.file.FileSystem}
@@ -61,20 +56,33 @@ public interface ApplicationArchive {
*
* @return The archive root directories.
*/
- PathsCollection getRootDirs();
+ PathCollection getRootDirectories();
/**
- *
+ * @deprecated in favor of {@link #getResolvedPaths()}
* @return The paths representing the application root paths.
*/
+ @Deprecated
PathsCollection getPaths();
/**
*
+ * @return The paths representing the application root paths.
+ */
+ PathCollection getResolvedPaths();
+
+ /**
+ * @deprecated in favor of {@link #getKey()}
* @return the artifact key or null if not available
*/
AppArtifactKey getArtifactKey();
+ /**
+ *
+ * @return the artifact key or null if not available
+ */
+ ArtifactKey getKey();
+
/**
* Convenience method, returns the child path if it exists, otherwise null.
*
@@ -82,7 +90,7 @@ public interface ApplicationArchive {
* @return The child path, or null if it does not exist.
*/
default Path getChildPath(String path) {
- return getRootDirs().resolveExistingOrNull(path);
+ return getRootDirectories().resolveExistingOrNull(path);
}
/**
@@ -94,8 +102,8 @@ default Path getChildPath(String path) {
* @param consumer entry consumer
*/
default void processEntry(String path, BiConsumer consumer) {
- final Iterator dirs = getRootDirs().iterator();
- final Iterator paths = getPaths().iterator();
+ final Iterator dirs = getRootDirectories().iterator();
+ final Iterator paths = getResolvedPaths().iterator();
while (dirs.hasNext()) {
final Path child = dirs.next().resolve(path);
if (Files.exists(child)) {
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/ApplicationArchiveImpl.java b/core/deployment/src/main/java/io/quarkus/deployment/ApplicationArchiveImpl.java
index b415317a34b9e..5ec62ab2fc928 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/ApplicationArchiveImpl.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/ApplicationArchiveImpl.java
@@ -1,6 +1,5 @@
package io.quarkus.deployment;
-import java.io.Closeable;
import java.nio.file.Path;
import org.jboss.jandex.IndexView;
@@ -8,31 +7,27 @@
import io.quarkus.bootstrap.model.AppArtifactKey;
import io.quarkus.bootstrap.model.PathsCollection;
import io.quarkus.builder.item.MultiBuildItem;
+import io.quarkus.maven.dependency.ArtifactKey;
+import io.quarkus.paths.PathCollection;
+import io.quarkus.paths.PathList;
public final class ApplicationArchiveImpl extends MultiBuildItem implements ApplicationArchive {
private final IndexView indexView;
- private final PathsCollection rootDirs;
- private final boolean jar;
- private final PathsCollection paths;
- private final AppArtifactKey artifactKey;
+ private final PathCollection rootDirs;
+ private final PathCollection paths;
+ private final ArtifactKey artifactKey;
- public ApplicationArchiveImpl(IndexView indexView, Path archiveRoot, Closeable closeable, boolean jar,
- Path archiveLocation, AppArtifactKey artifactKey) {
- this(indexView, PathsCollection.of(archiveRoot), PathsCollection.of(archiveLocation), artifactKey);
+ public ApplicationArchiveImpl(IndexView indexView, Path archiveRoot,
+ Path archiveLocation, ArtifactKey artifactKey) {
+ this(indexView, PathList.of(archiveRoot), PathList.of(archiveLocation), artifactKey);
}
- public ApplicationArchiveImpl(IndexView indexView, PathsCollection rootDirs, PathsCollection paths,
- AppArtifactKey artifactKey) {
- this(indexView, rootDirs, paths, false, artifactKey);
- }
-
- private ApplicationArchiveImpl(IndexView indexView, PathsCollection rootDirs, PathsCollection paths, boolean jar,
- AppArtifactKey artifactKey) {
+ public ApplicationArchiveImpl(IndexView indexView, PathCollection rootDirs, PathCollection paths,
+ ArtifactKey artifactKey) {
this.indexView = indexView;
this.rootDirs = rootDirs;
this.paths = paths;
- this.jar = jar;
this.artifactKey = artifactKey;
}
@@ -43,35 +38,41 @@ public IndexView getIndex() {
@Override
@Deprecated
- public Path getArchiveRoot() {
- return rootDirs.iterator().next();
+ public Path getArchiveLocation() {
+ return paths.iterator().next();
}
@Override
@Deprecated
- public boolean isJarArchive() {
- return jar;
+ public PathsCollection getRootDirs() {
+ return PathsCollection.from(rootDirs);
}
@Override
- @Deprecated
- public Path getArchiveLocation() {
- return paths.iterator().next();
+ public PathCollection getRootDirectories() {
+ return rootDirs;
}
@Override
- public PathsCollection getRootDirs() {
- return rootDirs;
+ @Deprecated
+ public PathsCollection getPaths() {
+ return PathsCollection.from(paths);
}
@Override
- public PathsCollection getPaths() {
+ public PathCollection getResolvedPaths() {
return paths;
}
@Override
public AppArtifactKey getArtifactKey() {
- return artifactKey;
+ return artifactKey == null ? null
+ : new AppArtifactKey(artifactKey.getGroupId(), artifactKey.getArtifactId(), artifactKey.getClassifier(),
+ artifactKey.getType());
}
+ @Override
+ public ArtifactKey getKey() {
+ return artifactKey;
+ }
}
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/CodeGenContext.java b/core/deployment/src/main/java/io/quarkus/deployment/CodeGenContext.java
index a0c5dfb669c3e..d901f56d74a8d 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/CodeGenContext.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/CodeGenContext.java
@@ -4,16 +4,18 @@
import java.util.Map;
import io.quarkus.bootstrap.model.AppModel;
+import io.quarkus.bootstrap.model.ApplicationModel;
+import io.quarkus.bootstrap.util.BootstrapUtils;
public class CodeGenContext {
- private final AppModel model;
+ private final ApplicationModel model;
private final Path outDir;
private final Path workDir;
private final Path inputDir;
private final boolean redirectIO;
private final Map properties;
- public CodeGenContext(AppModel model, Path outDir, Path workDir, Path inputDir, boolean redirectIO,
+ public CodeGenContext(ApplicationModel model, Path outDir, Path workDir, Path inputDir, boolean redirectIO,
Map properties) {
this.model = model;
this.outDir = outDir;
@@ -23,7 +25,16 @@ public CodeGenContext(AppModel model, Path outDir, Path workDir, Path inputDir,
this.properties = properties;
}
+ /**
+ * @deprecated in favor of {@link #applicationModel()}
+ * @return
+ */
+ @Deprecated
public AppModel appModel() {
+ return BootstrapUtils.convert(model);
+ }
+
+ public ApplicationModel applicationModel() {
return model;
}
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/CodeGenerator.java b/core/deployment/src/main/java/io/quarkus/deployment/CodeGenerator.java
index c42d1524fc7f7..b6fe63616c2f9 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/CodeGenerator.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/CodeGenerator.java
@@ -9,7 +9,7 @@
import java.util.ServiceLoader;
import java.util.function.Consumer;
-import io.quarkus.bootstrap.model.AppModel;
+import io.quarkus.bootstrap.model.ApplicationModel;
import io.quarkus.bootstrap.model.PathsCollection;
import io.quarkus.bootstrap.prebuild.CodeGenException;
import io.quarkus.deployment.codegen.CodeGenData;
@@ -20,11 +20,10 @@
public class CodeGenerator {
// used by Gradle
- @SuppressWarnings("unused")
public static void initAndRun(ClassLoader classLoader,
PathsCollection sourceParentDirs, Path generatedSourcesDir, Path buildDir,
Consumer sourceRegistrar,
- AppModel appModel, Map properties) throws CodeGenException {
+ ApplicationModel appModel, Map properties) throws CodeGenException {
List generators = init(classLoader, sourceParentDirs, generatedSourcesDir, buildDir, sourceRegistrar);
for (CodeGenData generator : generators) {
generator.setRedirectIO(true);
@@ -82,7 +81,7 @@ private static T callWithClassloader(ClassLoader deploymentClassLoader, Code
*/
public static boolean trigger(ClassLoader deploymentClassLoader,
CodeGenData data,
- AppModel appModel,
+ ApplicationModel appModel,
Map properties) throws CodeGenException {
return callWithClassloader(deploymentClassLoader, () -> {
CodeGenProvider provider = data.provider;
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/ExtensionLoader.java b/core/deployment/src/main/java/io/quarkus/deployment/ExtensionLoader.java
index 47d6990c9d4fb..316bb7c692b9e 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/ExtensionLoader.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/ExtensionLoader.java
@@ -44,7 +44,7 @@
import org.jboss.logging.Logger;
import org.wildfly.common.function.Functions;
-import io.quarkus.bootstrap.model.AppModel;
+import io.quarkus.bootstrap.model.ApplicationModel;
import io.quarkus.builder.BuildChainBuilder;
import io.quarkus.builder.BuildContext;
import io.quarkus.builder.BuildStepBuilder;
@@ -125,7 +125,7 @@ private static boolean isRecorder(AnnotatedElement element) {
* @throws ClassNotFoundException if a build step class is not found
*/
public static Consumer loadStepsFrom(ClassLoader classLoader, Properties buildSystemProps,
- AppModel appModel, LaunchMode launchMode, DevModeType devModeType,
+ ApplicationModel appModel, LaunchMode launchMode, DevModeType devModeType,
Consumer configCustomizer)
throws IOException, ClassNotFoundException {
// populate with all known types
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/QuarkusAugmentor.java b/core/deployment/src/main/java/io/quarkus/deployment/QuarkusAugmentor.java
index 99df303269ebf..5ae5264e33b2b 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/QuarkusAugmentor.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/QuarkusAugmentor.java
@@ -17,7 +17,7 @@
import org.jboss.logging.Logger;
import io.quarkus.bootstrap.classloading.QuarkusClassLoader;
-import io.quarkus.bootstrap.model.AppModel;
+import io.quarkus.bootstrap.model.ApplicationModel;
import io.quarkus.bootstrap.model.PathsCollection;
import io.quarkus.builder.BuildChain;
import io.quarkus.builder.BuildChainBuilder;
@@ -36,6 +36,7 @@
import io.quarkus.deployment.builditem.ShutdownContextBuildItem;
import io.quarkus.deployment.pkg.builditem.BuildSystemTargetBuildItem;
import io.quarkus.dev.spi.DevModeType;
+import io.quarkus.paths.PathCollection;
import io.quarkus.runtime.LaunchMode;
import io.quarkus.runtime.util.JavaVersionUtil;
@@ -50,12 +51,12 @@ public class QuarkusAugmentor {
private final List> buildChainCustomizers;
private final LaunchMode launchMode;
private final DevModeType devModeType;
- private final List additionalApplicationArchives;
+ private final List additionalApplicationArchives;
private final Collection excludedFromIndexing;
private final LiveReloadBuildItem liveReloadBuildItem;
private final Properties buildSystemProperties;
private final Path targetDir;
- private final AppModel effectiveModel;
+ private final ApplicationModel effectiveModel;
private final String baseName;
private final Consumer configCustomizer;
private final boolean rebuild;
@@ -154,7 +155,7 @@ public BuildResult run() throws Exception {
.produce(new BuildSystemTargetBuildItem(targetDir, baseName, rebuild,
buildSystemProperties == null ? new Properties() : buildSystemProperties))
.produce(new AppModelProviderBuildItem(effectiveModel));
- for (PathsCollection i : additionalApplicationArchives) {
+ for (PathCollection i : additionalApplicationArchives) {
execBuilder.produce(new AdditionalApplicationArchiveBuildItem(i));
}
BuildResult buildResult = execBuilder.execute();
@@ -189,7 +190,7 @@ public static final class Builder {
public DevModeType auxiliaryDevModeType;
boolean rebuild;
- List additionalApplicationArchives = new ArrayList<>();
+ List additionalApplicationArchives = new ArrayList<>();
Collection excludedFromIndexing = Collections.emptySet();
ClassLoader classLoader;
PathsCollection root;
@@ -200,7 +201,7 @@ public static final class Builder {
LiveReloadBuildItem liveReloadState = new LiveReloadBuildItem();
Properties buildSystemProperties;
- AppModel effectiveModel;
+ ApplicationModel effectiveModel;
String baseName = "quarkus-application";
Consumer configCustomizer;
ClassLoader deploymentClassLoader;
@@ -213,11 +214,11 @@ public Builder addBuildChainCustomizer(Consumer customizer) {
return this;
}
- public List getAdditionalApplicationArchives() {
+ public List getAdditionalApplicationArchives() {
return additionalApplicationArchives;
}
- public Builder addAdditionalApplicationArchive(PathsCollection archive) {
+ public Builder addAdditionalApplicationArchive(PathCollection archive) {
this.additionalApplicationArchives.add(archive);
return this;
}
@@ -328,7 +329,7 @@ public Builder setTargetDir(Path outputDir) {
return this;
}
- public Builder setEffectiveModel(AppModel effectiveModel) {
+ public Builder setEffectiveModel(ApplicationModel effectiveModel) {
this.effectiveModel = effectiveModel;
return this;
}
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/builditem/AdditionalApplicationArchiveBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/builditem/AdditionalApplicationArchiveBuildItem.java
index ab0efa183b33e..0adb2c76867e4 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/builditem/AdditionalApplicationArchiveBuildItem.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/builditem/AdditionalApplicationArchiveBuildItem.java
@@ -1,27 +1,30 @@
package io.quarkus.deployment.builditem;
-import java.nio.file.Path;
-
import io.quarkus.bootstrap.model.PathsCollection;
import io.quarkus.builder.item.MultiBuildItem;
+import io.quarkus.paths.PathCollection;
/**
* An additional application archive. This build item can only be consumed, it should not be produced by build steps.
*/
public final class AdditionalApplicationArchiveBuildItem extends MultiBuildItem {
- private final PathsCollection path;
+ private final PathCollection path;
- public AdditionalApplicationArchiveBuildItem(PathsCollection path) {
+ public AdditionalApplicationArchiveBuildItem(PathCollection path) {
this.path = path;
}
+ /**
+ * @deprecated in favor of {@link #getResolvedPaths()}
+ * @return
+ */
@Deprecated
- public Path getPath() {
- return path.getSinglePath();
+ public PathsCollection getPaths() {
+ return PathsCollection.from(path);
}
- public PathsCollection getPaths() {
+ public PathCollection getResolvedPaths() {
return path;
}
}
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/builditem/AppModelProviderBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/builditem/AppModelProviderBuildItem.java
index 30784eb6f4f8d..19e8d697a8ef4 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/builditem/AppModelProviderBuildItem.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/builditem/AppModelProviderBuildItem.java
@@ -2,7 +2,7 @@
import org.jboss.logging.Logger;
-import io.quarkus.bootstrap.model.AppModel;
+import io.quarkus.bootstrap.model.ApplicationModel;
import io.quarkus.bootstrap.model.PlatformImports;
import io.quarkus.builder.item.SimpleBuildItem;
import io.quarkus.deployment.BootstrapConfig;
@@ -11,13 +11,13 @@ public final class AppModelProviderBuildItem extends SimpleBuildItem {
private static final Logger log = Logger.getLogger(AppModelProviderBuildItem.class);
- private final AppModel appModel;
+ private final ApplicationModel appModel;
- public AppModelProviderBuildItem(AppModel appModel) {
+ public AppModelProviderBuildItem(ApplicationModel appModel) {
this.appModel = appModel;
}
- public AppModel validateAndGet(BootstrapConfig config) {
+ public ApplicationModel validateAndGet(BootstrapConfig config) {
final PlatformImports platforms = appModel.getPlatforms();
if (platforms != null && !BootstrapConfig.MisalignedPlatformImports.IGNORE.equals(config.misalignedPlatformImports)
&& !platforms.isAligned()) {
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/builditem/ArchiveRootBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/builditem/ArchiveRootBuildItem.java
index e5040da4d992c..5d96878396507 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/builditem/ArchiveRootBuildItem.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/builditem/ArchiveRootBuildItem.java
@@ -89,7 +89,7 @@ private ArchiveRootBuildItem(Builder builder, QuarkusBuildCloseablesBuildItem bu
if (Files.isDirectory(root)) {
rootDirs.add(root);
} else {
- final FileSystem fs = buildCloseables.add(FileSystems.newFileSystem(root, null));
+ final FileSystem fs = buildCloseables.add(FileSystems.newFileSystem(root, (ClassLoader) null));
fs.getRootDirectories().forEach(rootDirs::add);
}
}
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/builditem/RemovedResourceBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/builditem/RemovedResourceBuildItem.java
index af1e2eba99bdf..25b34d5ecefb5 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/builditem/RemovedResourceBuildItem.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/builditem/RemovedResourceBuildItem.java
@@ -2,20 +2,20 @@
import java.util.Set;
-import io.quarkus.bootstrap.model.AppArtifactKey;
import io.quarkus.builder.item.MultiBuildItem;
+import io.quarkus.maven.dependency.ArtifactKey;
public final class RemovedResourceBuildItem extends MultiBuildItem {
- private final AppArtifactKey artifact;
+ private final ArtifactKey artifact;
private final Set resources;
- public RemovedResourceBuildItem(AppArtifactKey artifact, Set resources) {
+ public RemovedResourceBuildItem(ArtifactKey artifact, Set resources) {
this.artifact = artifact;
this.resources = resources;
}
- public AppArtifactKey getArtifact() {
+ public ArtifactKey getArtifact() {
return artifact;
}
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeContext.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeContext.java
index b52164b6a8136..2935aa4796398 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeContext.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeContext.java
@@ -17,6 +17,7 @@
import io.quarkus.bootstrap.app.QuarkusBootstrap;
import io.quarkus.bootstrap.model.AppArtifactKey;
import io.quarkus.bootstrap.model.PathsCollection;
+import io.quarkus.maven.dependency.ArtifactKey;
/**
* Object that is used to pass context data from the plugin doing the invocation
@@ -228,7 +229,7 @@ public Set getLocalArtifacts() {
public static class ModuleInfo implements Serializable {
- private final AppArtifactKey appArtifactKey;
+ private final ArtifactKey appArtifactKey;
private final String name;
private final String projectDirectory;
private final CompilationUnit main;
@@ -285,7 +286,7 @@ public String getTargetDir() {
return targetDir;
}
- public AppArtifactKey getAppArtifactKey() {
+ public ArtifactKey getArtifactKey() {
return appArtifactKey;
}
@@ -299,7 +300,7 @@ public Optional getTest() {
public static class Builder {
- private AppArtifactKey appArtifactKey;
+ private ArtifactKey appArtifactKey;
private String name;
private String projectDirectory;
private PathsCollection sourcePaths = PathsCollection.of();
@@ -316,7 +317,7 @@ public static class Builder {
private PathsCollection testResourcePaths = PathsCollection.of();
private String testResourcesOutputPath;
- public Builder setAppArtifactKey(AppArtifactKey appArtifactKey) {
+ public Builder setArtifactKey(ArtifactKey appArtifactKey) {
this.appArtifactKey = appArtifactKey;
return this;
}
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/IDEDevModeMain.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/IDEDevModeMain.java
index 886771374c893..f5ad2cc7224de 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/dev/IDEDevModeMain.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/IDEDevModeMain.java
@@ -1,30 +1,31 @@
package io.quarkus.deployment.dev;
import java.io.Closeable;
-import java.io.File;
import java.nio.file.Path;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import java.util.function.BiConsumer;
-import java.util.stream.Collectors;
import org.jboss.logging.Logger;
+import io.quarkus.bootstrap.BootstrapConstants;
import io.quarkus.bootstrap.BootstrapGradleException;
import io.quarkus.bootstrap.app.CuratedApplication;
+import io.quarkus.bootstrap.devmode.DependenciesFilter;
import io.quarkus.bootstrap.model.AppArtifactKey;
+import io.quarkus.bootstrap.model.ApplicationModel;
import io.quarkus.bootstrap.model.PathsCollection;
-import io.quarkus.bootstrap.model.gradle.QuarkusModel;
-import io.quarkus.bootstrap.model.gradle.WorkspaceModule;
import io.quarkus.bootstrap.resolver.AppModelResolverException;
-import io.quarkus.bootstrap.resolver.maven.workspace.LocalProject;
-import io.quarkus.bootstrap.resolver.maven.workspace.LocalWorkspace;
-import io.quarkus.bootstrap.util.PathsUtils;
-import io.quarkus.bootstrap.util.QuarkusModelHelper;
+import io.quarkus.bootstrap.util.BootstrapUtils;
import io.quarkus.bootstrap.utils.BuildToolHelper;
+import io.quarkus.bootstrap.workspace.ProcessedSources;
+import io.quarkus.bootstrap.workspace.WorkspaceModule;
+import io.quarkus.deployment.dev.DevModeContext.ModuleInfo;
import io.quarkus.dev.spi.DevModeType;
+import io.quarkus.maven.dependency.ArtifactKey;
+import io.quarkus.maven.dependency.GACT;
public class IDEDevModeMain implements BiConsumer>, Closeable {
@@ -38,41 +39,27 @@ public void accept(CuratedApplication curatedApplication, Map st
Path appClasses = (Path) stringObjectMap.get("app-classes");
DevModeContext devModeContext = new DevModeContext();
devModeContext.setArgs((String[]) stringObjectMap.get("args"));
+
+ ApplicationModel appModel = null;
try {
if (BuildToolHelper.isMavenProject(appClasses)) {
- LocalProject project = (LocalProject) stringObjectMap.get(APP_PROJECT);
- if (project == null) {
- project = LocalProject.loadWorkspace(appClasses);
- }
-
- DevModeContext.ModuleInfo root = toModule(project);
- devModeContext.setApplicationRoot(root);
-
- final LocalWorkspace workspace = project.getWorkspace();
- for (AppArtifactKey localKey : curatedApplication.getAppModel().getLocalProjectArtifacts()) {
- final LocalProject depProject = workspace.getProject(localKey.getGroupId(), localKey.getArtifactId());
- if (project == depProject) {
- continue;
- }
- if (depProject == null) {
- throw new IllegalStateException(
- "Failed to locate project dependency " + localKey + " in the workspace");
- }
- devModeContext.getAdditionalModules().add(toModule(depProject));
- devModeContext.getLocalArtifacts().add(localKey);
- }
+ appModel = curatedApplication.getApplicationModel();
} else {
- final QuarkusModel model = QuarkusModelHelper
- .deserializeQuarkusModel((Path) stringObjectMap.get(QuarkusModelHelper.SERIALIZED_QUARKUS_MODEL));
- final WorkspaceModule launchingModule = model.getWorkspace().getMainModule();
- DevModeContext.ModuleInfo root = toModule(launchingModule);
- devModeContext.setApplicationRoot(root);
- for (WorkspaceModule additionalModule : model.getWorkspace().getAllModules()) {
- if (!additionalModule.getArtifactCoords().equals(launchingModule.getArtifactCoords())) {
- devModeContext.getAdditionalModules().add(toModule(additionalModule));
+ appModel = BootstrapUtils
+ .deserializeQuarkusModel((Path) stringObjectMap.get(BootstrapConstants.SERIALIZED_APP_MODEL));
+ }
+
+ if (appModel != null) {
+ for (WorkspaceModule project : DependenciesFilter.getReloadableModules(appModel)) {
+ final ModuleInfo module = toModule(project);
+ if (project == appModel.getApplicationModule()) {
+ devModeContext.setApplicationRoot(module);
+ } else {
+ devModeContext.getAdditionalModules().add(module);
+ devModeContext.getLocalArtifacts()
+ .add(new AppArtifactKey(project.getId().getGroupId(), project.getId().getArtifactId()));
}
}
-
}
} catch (AppModelResolverException e) {
log.error("Failed to load workspace, hot reload will not be available", e);
@@ -99,50 +86,39 @@ private void terminateIfRunning() {
}
private DevModeContext.ModuleInfo toModule(WorkspaceModule module) throws BootstrapGradleException {
- AppArtifactKey key = new AppArtifactKey(module.getArtifactCoords().getGroupId(),
- module.getArtifactCoords().getArtifactId(), module.getArtifactCoords().getClassifier());
+ String classesDir = null;
final Set sourceParents = new LinkedHashSet<>();
- for (File srcDir : module.getSourceSourceSet().getSourceDirectories()) {
- sourceParents.add(srcDir.getParentFile().toPath());
+ final PathsCollection.Builder srcPaths = PathsCollection.builder();
+ for (ProcessedSources src : module.getMainSources()) {
+ sourceParents.add(src.getSourceDir().getParentFile().toPath());
+ srcPaths.add(src.getSourceDir().toPath());
+ if (classesDir == null) {
+ classesDir = src.getDestinationDir().toString();
+ }
}
+
String resourceDirectory = null;
- if (!module.getSourceSet().getResourceDirectories().isEmpty()) {
- // Peek the first one as we assume that it is the primary
- resourceDirectory = module.getSourceSet().getResourceDirectories().iterator().next().toString();
+ final PathsCollection.Builder resourcesPaths = PathsCollection.builder();
+ for (ProcessedSources src : module.getMainResources()) {
+ resourcesPaths.add(src.getSourceDir().toPath());
+ if (resourceDirectory == null) {
+ // Peek the first one as we assume that it is the primary
+ resourceDirectory = src.getDestinationDir().toString();
+ }
}
+ final ArtifactKey key = new GACT(module.getId().getGroupId(), module.getId().getArtifactId());
return new DevModeContext.ModuleInfo.Builder()
- .setAppArtifactKey(key)
- .setName(module.getArtifactCoords().getArtifactId())
- .setProjectDirectory(module.getProjectRoot().getPath())
- .setSourcePaths(PathsUtils.toPathsCollection(module.getSourceSourceSet().getSourceDirectories()))
- .setClassesPath(QuarkusModelHelper.getClassPath(module).toAbsolutePath().toString())
- .setResourcePaths(PathsUtils.toPathsCollection(module.getSourceSourceSet().getResourceDirectories()))
+ .setArtifactKey(key)
+ .setName(module.getId().getArtifactId())
+ .setProjectDirectory(module.getModuleDir().getPath())
+ .setSourcePaths(srcPaths.build())
+ .setClassesPath(classesDir)
+ .setResourcePaths(resourcesPaths.build())
.setResourcesOutputPath(resourceDirectory)
.setSourceParents(PathsCollection.from(sourceParents))
.setPreBuildOutputDir(module.getBuildDir().toPath().resolve("generated-sources").toAbsolutePath().toString())
.setTargetDir(module.getBuildDir().toString()).build();
}
-
- private DevModeContext.ModuleInfo toModule(LocalProject project) {
- return new DevModeContext.ModuleInfo.Builder()
- .setAppArtifactKey(project.getKey())
- .setName(project.getArtifactId())
- .setProjectDirectory(project.getDir().toAbsolutePath().toString())
- .setSourcePaths(PathsCollection.of(project.getSourcesSourcesDir().toAbsolutePath()))
- .setClassesPath(project.getClassesDir().toAbsolutePath().toString())
- .setResourcesOutputPath(project.getClassesDir().toAbsolutePath().toString())
- .setResourcePaths(
- PathsCollection.from(project.getResourcesSourcesDirs().toList().stream()
- .map(Path::toAbsolutePath)
- .collect(Collectors.toCollection(LinkedHashSet::new))))
- .setSourceParents(PathsCollection.of(project.getSourcesDir()))
- .setPreBuildOutputDir(project.getCodeGenOutputDir().toString())
- .setTargetDir(project.getOutputDir().toString())
- .setTestSourcePaths(PathsCollection.of(project.getTestSourcesSourcesDir()))
- .setTestClassesPath(project.getTestClassesDir().toAbsolutePath().toString())
- .setTestResourcesOutputPath(project.getTestClassesDir().toAbsolutePath().toString())
- .setTestResourcePaths(PathsCollection.from(project.getTestResourcesSourcesDirs())).build();
- }
}
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java
index c38d687364c70..bf62d68499827 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java
@@ -195,7 +195,7 @@ private void startCodeGenWatcher(QuarkusClassLoader classLoader, List urls = new HashSet<>();
- for (AppDependency i : application.getAppModel().getUserDependencies()) {
- for (Path p : i.getArtifact().getPaths()) {
+ for (ResolvedDependency i : application.getApplicationModel().getRuntimeDependencies()) {
+ for (Path p : i.getResolvedPaths()) {
urls.add(p.toUri().toURL());
}
}
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java
index 401cff00adaf2..ed08688b1e3e4 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java
@@ -148,13 +148,13 @@ public void init() {
continue;
} else if (config.includeModulePattern.isPresent()) {
Pattern p = Pattern.compile(config.includeModulePattern.get());
- if (!p.matcher(module.getAppArtifactKey().getGroupId() + ":" + module.getAppArtifactKey().getArtifactId())
+ if (!p.matcher(module.getArtifactKey().getGroupId() + ":" + module.getArtifactKey().getArtifactId())
.matches()) {
continue;
}
} else if (config.excludeModulePattern.isPresent()) {
Pattern p = Pattern.compile(config.excludeModulePattern.get());
- if (p.matcher(module.getAppArtifactKey().getGroupId() + ":" + module.getAppArtifactKey().getArtifactId())
+ if (p.matcher(module.getArtifactKey().getGroupId() + ":" + module.getArtifactKey().getArtifactId())
.matches()) {
continue;
}
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java
index 4d471d61ae611..0b95aa42ecd2c 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java
@@ -8,6 +8,7 @@
import java.nio.file.Path;
import java.nio.file.ProviderNotFoundException;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -22,10 +23,6 @@
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;
import io.quarkus.deployment.ApplicationArchiveImpl;
import io.quarkus.deployment.annotations.BuildProducer;
@@ -40,6 +37,12 @@
import io.quarkus.deployment.builditem.QuarkusBuildCloseablesBuildItem;
import io.quarkus.deployment.configuration.ClassLoadingConfig;
import io.quarkus.deployment.pkg.builditem.CurateOutcomeBuildItem;
+import io.quarkus.maven.dependency.ArtifactKey;
+import io.quarkus.maven.dependency.GACT;
+import io.quarkus.maven.dependency.GACTV;
+import io.quarkus.maven.dependency.ResolvedDependency;
+import io.quarkus.paths.PathCollection;
+import io.quarkus.paths.PathList;
import io.quarkus.runtime.annotations.ConfigDocMapKey;
import io.quarkus.runtime.annotations.ConfigDocSection;
import io.quarkus.runtime.annotations.ConfigItem;
@@ -95,9 +98,9 @@ ApplicationArchivesBuildItem build(
liveReloadContext.setContextObject(IndexCache.class, indexCache);
}
- Map> removedResources = new HashMap<>();
+ Map> removedResources = new HashMap<>();
for (Map.Entry> entry : classLoadingConfig.removedResources.entrySet()) {
- removedResources.put(new AppArtifactKey(entry.getKey().split(":")), entry.getValue());
+ removedResources.put(new GACT(entry.getKey().split(":")), entry.getValue());
}
List applicationArchives = scanForOtherIndexes(buildCloseables,
@@ -105,7 +108,8 @@ ApplicationArchivesBuildItem build(
markerFiles, root, additionalApplicationArchiveBuildItem, indexDependencyBuildItems, indexCache,
curateOutcomeBuildItem, removedResources);
return new ApplicationArchivesBuildItem(
- new ApplicationArchiveImpl(appindex.getIndex(), root.getRootDirs(), root.getPaths(), null),
+ new ApplicationArchiveImpl(appindex.getIndex(), PathList.from(root.getRootDirs()),
+ PathList.from(root.getPaths()), null),
applicationArchives);
}
@@ -113,7 +117,7 @@ private List scanForOtherIndexes(QuarkusBuildCloseablesBuild
ClassLoader classLoader, Set applicationArchiveFiles,
ArchiveRootBuildItem root, List additionalApplicationArchives,
List indexDependencyBuildItem, IndexCache indexCache,
- CurateOutcomeBuildItem curateOutcomeBuildItem, Map> removedResources)
+ CurateOutcomeBuildItem curateOutcomeBuildItem, Map> removedResources)
throws IOException {
List appArchives = new ArrayList<>();
@@ -130,7 +134,7 @@ private List scanForOtherIndexes(QuarkusBuildCloseablesBuild
indexCache, curateOutcomeBuildItem, removedResources);
for (AdditionalApplicationArchiveBuildItem i : additionalApplicationArchives) {
- for (Path apPath : i.getPaths()) {
+ for (Path apPath : i.getResolvedPaths()) {
if (!root.getPaths().contains(apPath) && indexedPaths.add(apPath)) {
appArchives.add(createApplicationArchive(buildCloseables, classLoader, indexCache, apPath, null,
removedResources));
@@ -145,27 +149,29 @@ public void addIndexDependencyPaths(List indexDependen
ClassLoader classLoader, ArchiveRootBuildItem root, Set indexedDeps, List appArchives,
QuarkusBuildCloseablesBuildItem buildCloseables, IndexCache indexCache,
CurateOutcomeBuildItem curateOutcomeBuildItem,
- Map> removedResources) {
+ Map> removedResources) {
if (indexDependencyBuildItems.isEmpty()) {
return;
}
- final List userDeps = curateOutcomeBuildItem.getEffectiveModel().getUserDependencies();
- final Map userMap = new HashMap<>(userDeps.size());
- for (AppDependency dep : userDeps) {
- userMap.put(dep.getArtifact().getKey(), dep.getArtifact());
+ final Collection userDeps = curateOutcomeBuildItem.getApplicationModel()
+ .getRuntimeDependencies();
+ final Map userMap = new HashMap<>(userDeps.size());
+ for (ResolvedDependency dep : userDeps) {
+ userMap.put(dep.getKey(), dep);
}
try {
for (IndexDependencyBuildItem indexDependencyBuildItem : indexDependencyBuildItems) {
- final AppArtifactKey key = new AppArtifactKey(indexDependencyBuildItem.getGroupId(),
+ final ArtifactKey key = new GACT(indexDependencyBuildItem.getGroupId(),
indexDependencyBuildItem.getArtifactId(),
indexDependencyBuildItem.getClassifier(),
- "jar");
- final AppArtifact artifact = userMap.get(key);
+ GACTV.TYPE_JAR);
+ final ResolvedDependency artifact = userMap.get(key);
if (artifact == null) {
+ userMap.keySet().forEach(k -> System.out.println(" - " + k.getClass().getSimpleName() + " " + k));
throw new RuntimeException(
"Could not resolve artifact " + key + " among the runtime dependencies of the application");
}
- for (Path path : artifact.getPaths()) {
+ for (Path path : artifact.getResolvedPaths()) {
if (!root.isExcludedFromIndexing(path) && !root.getPaths().contains(path) && indexedDeps.add(path)) {
appArchives.add(createApplicationArchive(buildCloseables, classLoader, indexCache, path, key,
removedResources));
@@ -179,12 +185,15 @@ public void addIndexDependencyPaths(List indexDependen
private static ApplicationArchive createApplicationArchive(QuarkusBuildCloseablesBuildItem buildCloseables,
ClassLoader classLoader,
- IndexCache indexCache, Path dep, AppArtifactKey artifactKey, Map> removedResources)
+ IndexCache indexCache, Path dep, ArtifactKey artifactKey, Map> removedResources)
throws IOException {
- final FileSystem fs = Files.isDirectory(dep) ? null : buildCloseables.add(FileSystems.newFileSystem(dep, classLoader));
- Set removed = removedResources.get(artifactKey);
- return new ApplicationArchiveImpl(indexPath(indexCache, dep, removed),
- fs == null ? dep : fs.getRootDirectories().iterator().next(), fs, fs != null, dep, artifactKey);
+ Path rootDir = dep;
+ if (!Files.isDirectory(dep)) {
+ final FileSystem fs = buildCloseables.add(FileSystems.newFileSystem(dep, classLoader));
+ rootDir = fs.getRootDirectories().iterator().next();
+ }
+ final IndexView index = indexPath(indexCache, dep, removedResources.get(artifactKey));
+ return new ApplicationArchiveImpl(index, rootDir, dep, artifactKey);
}
private static IndexView indexPath(IndexCache indexCache, Path dep, Set removed) throws IOException {
@@ -195,10 +204,10 @@ private static IndexView indexPath(IndexCache indexCache, Path dep, Set
private static void addMarkerFilePaths(Set applicationArchiveFiles,
ArchiveRootBuildItem root, CurateOutcomeBuildItem curateOutcomeBuildItem, Set indexedPaths,
List appArchives, QuarkusBuildCloseablesBuildItem buildCloseables, ClassLoader classLoader,
- IndexCache indexCache, Map> removed)
+ IndexCache indexCache, Map> removed)
throws IOException {
- for (AppDependency dep : curateOutcomeBuildItem.getEffectiveModel().getUserDependencies()) {
- final PathsCollection artifactPaths = dep.getArtifact().getPaths();
+ for (ResolvedDependency dep : curateOutcomeBuildItem.getApplicationModel().getRuntimeDependencies()) {
+ final PathCollection artifactPaths = dep.getResolvedPaths();
boolean containsMarker = false;
for (Path p : artifactPaths) {
if (root.isExcludedFromIndexing(p)) {
@@ -223,7 +232,7 @@ private static void addMarkerFilePaths(Set applicationArchiveFiles,
}
if (containsMarker) {
- final PathsCollection.Builder rootDirs = PathsCollection.builder();
+ final PathList.Builder rootDirs = PathList.builder();
final List indexes = new ArrayList<>(artifactPaths.size());
for (Path p : artifactPaths) {
if (Files.isDirectory(p)) {
@@ -232,14 +241,12 @@ private static void addMarkerFilePaths(Set applicationArchiveFiles,
final FileSystem fs = buildCloseables.add(FileSystems.newFileSystem(p, classLoader));
fs.getRootDirectories().forEach(rootDirs::add);
}
- indexes.add(
- indexPath(indexCache, p, removed.get(dep.getArtifact().getKey())));
-
+ indexes.add(indexPath(indexCache, p, removed.get(dep.getKey())));
indexedPaths.add(p);
}
appArchives
.add(new ApplicationArchiveImpl(indexes.size() == 1 ? indexes.get(0) : CompositeIndex.create(indexes),
- rootDirs.build(), artifactPaths, dep.getArtifact().getKey()));
+ rootDirs.build(), artifactPaths, dep.getKey()));
}
}
}
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/jbang/JBangAugmentorImpl.java b/core/deployment/src/main/java/io/quarkus/deployment/jbang/JBangAugmentorImpl.java
index 02dd62fd04ab6..b49d007a01c75 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/jbang/JBangAugmentorImpl.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/jbang/JBangAugmentorImpl.java
@@ -50,7 +50,7 @@ public void accept(CuratedApplication curatedApplication, Map re
.setTargetDir(quarkusBootstrap.getTargetDirectory())
.setDeploymentClassLoader(curatedApplication.createDeploymentClassLoader())
.setBuildSystemProperties(quarkusBootstrap.getBuildSystemProperties())
- .setEffectiveModel(curatedApplication.getAppModel());
+ .setEffectiveModel(curatedApplication.getApplicationModel());
if (quarkusBootstrap.getBaseName() != null) {
builder.setBaseName(quarkusBootstrap.getBaseName());
}
@@ -69,7 +69,7 @@ public void accept(CuratedApplication curatedApplication, Map re
//but we only need to add it to the additional app archives
//if it is forced as an app archive
if (i.isForceApplicationArchive()) {
- builder.addAdditionalApplicationArchive(i.getArchivePath());
+ builder.addAdditionalApplicationArchive(i.getResolvedPaths());
}
}
builder.addBuildChainCustomizer(new Consumer() {
@@ -122,7 +122,7 @@ public void accept(BuildChainBuilder builder) {
}
}
resultMap.put("files", result);
- List javaargs = new ArrayList();
+ final List javaargs = new ArrayList<>();
javaargs.add("-Djava.util.logging.manager=org.jboss.logmanager.LogManager");
resultMap.put("java-args", javaargs);
resultMap.put("main-class", buildResult.consume(MainClassBuildItem.class).getClassName());
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java b/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java
index 0c1f2401644b7..ee3df692555a0 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java
@@ -212,7 +212,7 @@ public void run() {
void setupStackTraceFormatter(ApplicationArchivesBuildItem item) {
List indexList = new ArrayList<>();
for (ApplicationArchive i : item.getAllApplicationArchives()) {
- if (Files.isDirectory(i.getArchiveLocation())) {
+ if (i.getResolvedPaths().isSinglePath() && Files.isDirectory(i.getResolvedPaths().getSinglePath())) {
indexList.add(i.getIndex());
}
}
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/mutability/DevModeTask.java b/core/deployment/src/main/java/io/quarkus/deployment/mutability/DevModeTask.java
index ca7c612bf518f..15df00956e5b3 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/mutability/DevModeTask.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/mutability/DevModeTask.java
@@ -23,18 +23,19 @@
import io.quarkus.bootstrap.app.CuratedApplication;
import io.quarkus.bootstrap.app.QuarkusBootstrap;
-import io.quarkus.bootstrap.model.AppArtifact;
-import io.quarkus.bootstrap.model.AppArtifactKey;
-import io.quarkus.bootstrap.model.AppDependency;
-import io.quarkus.bootstrap.model.AppModel;
-import io.quarkus.bootstrap.model.PersistentAppModel;
+import io.quarkus.bootstrap.model.ApplicationModel;
+import io.quarkus.bootstrap.model.MutableJarApplicationModel;
import io.quarkus.bootstrap.util.IoUtils;
import io.quarkus.deployment.dev.DevModeContext;
import io.quarkus.deployment.dev.IsolatedDevModeMain;
import io.quarkus.deployment.pkg.steps.JarResultBuildStep;
import io.quarkus.dev.spi.DevModeType;
+import io.quarkus.maven.dependency.ArtifactKey;
+import io.quarkus.maven.dependency.GACT;
+import io.quarkus.maven.dependency.ResolvedArtifactDependency;
+import io.quarkus.maven.dependency.ResolvedDependency;
+import io.quarkus.paths.PathList;
-@SuppressWarnings("Unused")
public class DevModeTask {
public static Closeable main(Path appRoot) throws Exception {
@@ -47,9 +48,9 @@ public static Closeable main(Path appRoot) throws Exception {
buildSystemProperties.load(buildIn);
}
- PersistentAppModel appModel = (PersistentAppModel) in.readObject();
+ final MutableJarApplicationModel appModel = (MutableJarApplicationModel) in.readObject();
- AppModel existingModel = appModel.getAppModel(appRoot);
+ ApplicationModel existingModel = appModel.getAppModel(appRoot);
DevModeContext context = createDevModeContext(appRoot, existingModel);
CuratedApplication bootstrap = QuarkusBootstrap.builder()
@@ -59,7 +60,7 @@ public static Closeable main(Path appRoot) throws Exception {
.setMode(QuarkusBootstrap.Mode.REMOTE_DEV_SERVER)
.setBuildSystemProperties(buildSystemProperties)
.setBaseName(appModel.getBaseName())
- .setApplicationRoot(existingModel.getAppArtifact().getPath())
+ .setApplicationRoot(existingModel.getAppArtifact().getResolvedPaths().getSinglePath())
.setTargetDirectory(appRoot.getParent())
.setBaseClassLoader(DevModeTask.class.getClassLoader())
.build().bootstrap();
@@ -73,14 +74,14 @@ public static Closeable main(Path appRoot) throws Exception {
}
}
- private static DevModeContext createDevModeContext(Path appRoot, AppModel appModel) throws IOException {
+ private static DevModeContext createDevModeContext(Path appRoot, ApplicationModel appModel) throws IOException {
DevModeContext context = new DevModeContext();
extractDevModeClasses(appRoot, appModel, new PostExtractAction() {
@Override
- public void run(AppArtifact dep, Path moduleClasses, boolean appArtifact) {
+ public void run(ResolvedDependency dep, Path moduleClasses, boolean appArtifact) {
- dep.setPath(moduleClasses);
- DevModeContext.ModuleInfo module = new DevModeContext.ModuleInfo.Builder().setAppArtifactKey(dep.getKey())
+ ((ResolvedArtifactDependency) dep).setResolvedPaths(PathList.of(moduleClasses));
+ DevModeContext.ModuleInfo module = new DevModeContext.ModuleInfo.Builder().setArtifactKey(dep.getKey())
.setName(dep.getArtifactId())
.setClassesPath(moduleClasses.toAbsolutePath().toString())
.setResourcesOutputPath(moduleClasses.toAbsolutePath().toString())
@@ -99,23 +100,25 @@ public void run(AppArtifact dep, Path moduleClasses, boolean appArtifact) {
}
- public static void extractDevModeClasses(Path appRoot, AppModel appModel, PostExtractAction postExtractAction)
+ public static void extractDevModeClasses(Path appRoot, ApplicationModel appModel, PostExtractAction postExtractAction)
throws IOException {
Path extracted = appRoot.resolve("dev");
Files.createDirectories(extracted);
- Map userDependencies = new HashMap<>();
- for (AppDependency i : appModel.getUserDependencies()) {
- userDependencies.put(i.getArtifact().getKey(), i.getArtifact());
+ Map rtDependencies = new HashMap<>();
+ for (ResolvedDependency i : appModel.getRuntimeDependencies()) {
+ rtDependencies.put(new GACT(i.getGroupId(), i.getArtifactId()), i);
}
//setup the classes that can be hot reloaded
//this code needs to be kept in sync with the code in IsolatedRemoteDevModeMain
//todo: look at a better way of doing this
- for (AppArtifactKey i : appModel.getLocalProjectArtifacts()) {
- boolean appArtifact = i.equals(appModel.getAppArtifact().getKey());
- AppArtifact dep = userDependencies.get(i);
+ for (ArtifactKey i : appModel.getReloadableWorkspaceDependencies()) {
+ boolean appArtifact = false;
+ ResolvedDependency dep = rtDependencies.get(i);
Path moduleClasses = null;
if (dep == null) {
+ appArtifact = i.getGroupId().equals(appModel.getAppArtifact().getGroupId())
+ && i.getArtifactId().equals(appModel.getAppArtifact().getArtifactId());
//check if this is the application itself
if (appArtifact) {
dep = appModel.getAppArtifact();
@@ -129,7 +132,7 @@ public static void extractDevModeClasses(Path appRoot, AppModel appModel, PostEx
continue;
}
IoUtils.createOrEmptyDir(moduleClasses);
- for (Path p : dep.getPaths()) {
+ for (Path p : dep.getResolvedPaths()) {
if (Files.isDirectory(p)) {
Path moduleTarget = moduleClasses;
Files.walkFileTree(p, new FileVisitor() {
@@ -187,6 +190,6 @@ public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOEx
}
interface PostExtractAction {
- void run(AppArtifact dep, Path moduleClasses, boolean appArtifact);
+ void run(ResolvedDependency dep, Path moduleClasses, boolean appArtifact);
}
}
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/mutability/ReaugmentTask.java b/core/deployment/src/main/java/io/quarkus/deployment/mutability/ReaugmentTask.java
index 264e8899dd859..c22d2b644ed01 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/mutability/ReaugmentTask.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/mutability/ReaugmentTask.java
@@ -18,8 +18,8 @@
import io.quarkus.bootstrap.app.AdditionalDependency;
import io.quarkus.bootstrap.app.CuratedApplication;
import io.quarkus.bootstrap.app.QuarkusBootstrap;
-import io.quarkus.bootstrap.model.AppModel;
-import io.quarkus.bootstrap.model.PersistentAppModel;
+import io.quarkus.bootstrap.model.ApplicationModel;
+import io.quarkus.bootstrap.model.MutableJarApplicationModel;
import io.quarkus.deployment.pkg.steps.JarResultBuildStep;
public class ReaugmentTask {
@@ -36,7 +36,7 @@ public static void main(Path appRoot) throws Exception {
buildSystemProperties.load(buildIn);
}
- PersistentAppModel appModel = (PersistentAppModel) in.readObject();
+ MutableJarApplicationModel appModel = (MutableJarApplicationModel) in.readObject();
List additional = new ArrayList<>();
if (appModel.getUserProvidersDirectory() != null) {
@@ -53,7 +53,7 @@ public void accept(Path path) {
}
}
- AppModel existingModel = appModel.getAppModel(appRoot);
+ final ApplicationModel existingModel = appModel.getAppModel(appRoot);
System.setProperty("quarkus.package.type", "mutable-jar");
try (CuratedApplication bootstrap = QuarkusBootstrap.builder()
.setAppArtifact(existingModel.getAppArtifact())
@@ -62,7 +62,7 @@ public void accept(Path path) {
.setBuildSystemProperties(buildSystemProperties)
.setBaseName(appModel.getBaseName())
.addAdditionalApplicationArchives(additional)
- .setApplicationRoot(existingModel.getAppArtifact().getPath())
+ .setApplicationRoot(existingModel.getAppArtifact().getResolvedPaths().getSinglePath())
.setTargetDirectory(appRoot.getParent())
.setBaseClassLoader(ReaugmentTask.class.getClassLoader())
.build().bootstrap()) {
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/builditem/CurateOutcomeBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/builditem/CurateOutcomeBuildItem.java
index d49e6b416c1a5..5b81bfd230a79 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/builditem/CurateOutcomeBuildItem.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/builditem/CurateOutcomeBuildItem.java
@@ -1,17 +1,30 @@
package io.quarkus.deployment.pkg.builditem;
import io.quarkus.bootstrap.model.AppModel;
+import io.quarkus.bootstrap.model.ApplicationModel;
+import io.quarkus.bootstrap.util.BootstrapUtils;
import io.quarkus.builder.item.SimpleBuildItem;
public final class CurateOutcomeBuildItem extends SimpleBuildItem {
- private final AppModel effectiveModel;
+ private final ApplicationModel appModel;
- public CurateOutcomeBuildItem(AppModel effectiveModel) {
- this.effectiveModel = effectiveModel;
+ private AppModel effectiveModel;
+
+ public CurateOutcomeBuildItem(ApplicationModel appModel) {
+ this.appModel = appModel;
}
+ /**
+ * @deprecated in favor of {@link #getApplicationModel()}
+ * @return application model
+ */
+ @Deprecated
public AppModel getEffectiveModel() {
- return effectiveModel;
+ return effectiveModel == null ? effectiveModel = BootstrapUtils.convert(appModel) : effectiveModel;
+ }
+
+ public ApplicationModel getApplicationModel() {
+ return appModel;
}
}
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/builditem/OutputTargetBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/builditem/OutputTargetBuildItem.java
index 0bbef34685cf4..24479c85b677c 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/builditem/OutputTargetBuildItem.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/builditem/OutputTargetBuildItem.java
@@ -5,8 +5,8 @@
import java.util.Properties;
import java.util.Set;
-import io.quarkus.bootstrap.model.AppArtifactKey;
import io.quarkus.builder.item.SimpleBuildItem;
+import io.quarkus.maven.dependency.ArtifactKey;
/**
* The location that output artifacts should be created in
@@ -19,10 +19,10 @@ public final class OutputTargetBuildItem extends SimpleBuildItem {
private final String baseName;
private final boolean rebuild;
private final Properties buildSystemProperties;
- private final Optional> includedOptionalDependencies;
+ private final Optional> includedOptionalDependencies;
public OutputTargetBuildItem(Path outputDirectory, String baseName, boolean rebuild, Properties buildSystemProperties,
- Optional> includedOptionalDependencies) {
+ Optional> includedOptionalDependencies) {
this.outputDirectory = outputDirectory;
this.baseName = baseName;
this.rebuild = rebuild;
@@ -46,7 +46,7 @@ public Properties getBuildSystemProperties() {
return buildSystemProperties;
}
- public Optional> getIncludedOptionalDependencies() {
+ public Optional> getIncludedOptionalDependencies() {
return includedOptionalDependencies;
}
}
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java
index 255099175941c..2973aec54cbb2 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java
@@ -52,10 +52,7 @@
import org.apache.commons.lang3.SystemUtils;
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.PersistentAppModel;
+import io.quarkus.bootstrap.model.MutableJarApplicationModel;
import io.quarkus.bootstrap.runner.QuarkusEntryPoint;
import io.quarkus.bootstrap.runner.SerializedApplication;
import io.quarkus.bootstrap.util.IoUtils;
@@ -84,6 +81,10 @@
import io.quarkus.deployment.pkg.builditem.UberJarMergedResourceBuildItem;
import io.quarkus.deployment.pkg.builditem.UberJarRequiredBuildItem;
import io.quarkus.deployment.util.FileUtil;
+import io.quarkus.maven.dependency.ArtifactKey;
+import io.quarkus.maven.dependency.Dependency;
+import io.quarkus.maven.dependency.GACT;
+import io.quarkus.maven.dependency.ResolvedDependency;
/**
* This build step builds both the thin jars and uber jars.
@@ -178,10 +179,10 @@ OutputTargetBuildItem outputTarget(BuildSystemTargetBuildItem bst, PackageConfig
String name = packageConfig.outputName.orElseGet(bst::getBaseName);
Path path = packageConfig.outputDirectory.map(s -> bst.getOutputDirectory().resolve(s))
.orElseGet(bst::getOutputDirectory);
- Optional> includedOptionalDependencies;
+ Optional> includedOptionalDependencies;
if (packageConfig.filterOptionalDependencies) {
includedOptionalDependencies = Optional.of(packageConfig.includedOptionalDependencies
- .map(set -> set.stream().map(AppArtifactKey::fromString).collect(Collectors.toSet()))
+ .map(set -> set.stream().map(s -> (ArtifactKey) GACT.fromString(s)).collect(Collectors.toSet()))
.orElse(Collections.emptySet()));
} else {
includedOptionalDependencies = Optional.empty();
@@ -336,28 +337,28 @@ private void buildUberJar0(CurateOutcomeBuildItem curateOutcomeBuildItem,
log.info("Building fat jar: " + runnerJar);
final Map seen = new HashMap<>();
- final Map> duplicateCatcher = new HashMap<>();
+ final Map> duplicateCatcher = new HashMap<>();
final Map> concatenatedEntries = new HashMap<>();
final Set mergeResourcePaths = mergedResources.stream()
.map(UberJarMergedResourceBuildItem::getPath)
.collect(Collectors.toSet());
- final Set removed = getRemovedKeys(classLoadingConfig);
+ final Set removed = getRemovedKeys(classLoadingConfig);
Set finalIgnoredEntries = new HashSet<>(IGNORED_ENTRIES);
packageConfig.userConfiguredIgnoredEntries.ifPresent(finalIgnoredEntries::addAll);
ignoredResources.stream()
.map(UberJarIgnoredResourceBuildItem::getPath)
.forEach(finalIgnoredEntries::add);
- final List appDeps = curateOutcomeBuildItem.getEffectiveModel().getUserDependencies();
+ final Collection appDeps = curateOutcomeBuildItem.getApplicationModel()
+ .getRuntimeDependencies();
- AppArtifact appArtifact = curateOutcomeBuildItem.getEffectiveModel().getAppArtifact();
+ ResolvedDependency appArtifact = curateOutcomeBuildItem.getApplicationModel().getAppArtifact();
// the manifest needs to be the first entry in the jar, otherwise JarInputStream does not work properly
// see https://bugs.openjdk.java.net/browse/JDK-8031748
generateManifest(runnerZipFs, "", packageConfig, appArtifact, mainClassBuildItem.getClassName(),
applicationInfo);
- for (AppDependency appDep : appDeps) {
- final AppArtifact depArtifact = appDep.getArtifact();
+ for (ResolvedDependency appDep : appDeps) {
// Exclude files that are not jars (typically, we can have XML files here, see https://github.com/quarkusio/quarkus/issues/2852)
// and are not part of the optional dependencies to include
@@ -365,7 +366,7 @@ private void buildUberJar0(CurateOutcomeBuildItem curateOutcomeBuildItem,
continue;
}
- for (Path resolvedDep : depArtifact.getPaths()) {
+ for (Path resolvedDep : appDep.getResolvedPaths()) {
Set existingEntries = new HashSet<>();
Set transformedFilesByJar = transformedClasses.getTransformedFilesByJar().get(resolvedDep);
if (transformedFilesByJar != null) {
@@ -389,8 +390,8 @@ private void buildUberJar0(CurateOutcomeBuildItem curateOutcomeBuildItem,
}
}
}
- Set> explained = new HashSet<>();
- for (Map.Entry> entry : duplicateCatcher.entrySet()) {
+ Set> explained = new HashSet<>();
+ for (Map.Entry> entry : duplicateCatcher.entrySet()) {
if (entry.getValue().size() > 1) {
if (explained.add(entry.getValue())) {
log.warn("Dependencies with duplicate files detected. The dependencies " + entry.getValue()
@@ -438,24 +439,24 @@ private void buildUberJar0(CurateOutcomeBuildItem curateOutcomeBuildItem,
* @param optionalDependencies the optional dependencies to include into the final package.
* @return {@code true} if the dependency should be included, {@code false} otherwise.
*/
- private static boolean includeAppDep(AppDependency appDep, Optional> optionalDependencies,
- Set removedArtifacts) {
- if (!"jar".equals(appDep.getArtifact().getType())) {
+ private static boolean includeAppDep(ResolvedDependency appDep, Optional> optionalDependencies,
+ Set removedArtifacts) {
+ if (!"jar".equals(appDep.getType())) {
return false;
}
if (appDep.isOptional()) {
- return optionalDependencies.map(appArtifactKeys -> appArtifactKeys.contains(appDep.getArtifact().getKey()))
+ return optionalDependencies.map(appArtifactKeys -> appArtifactKeys.contains(appDep.getKey()))
.orElse(true);
}
- if (removedArtifacts.contains(appDep.getArtifact().getKey())) {
+ if (removedArtifacts.contains(appDep.getKey())) {
return false;
}
return true;
}
private void walkFileDependencyForDependency(Path root, FileSystem runnerZipFs, Map seen,
- Map> duplicateCatcher, Map> concatenatedEntries,
- Set finalIgnoredEntries, AppDependency appDep, Set existingEntries,
+ Map> duplicateCatcher, Map> concatenatedEntries,
+ Set finalIgnoredEntries, Dependency appDep, Set existingEntries,
Set mergeResourcePaths) throws IOException {
final Path metaInfDir = root.resolve("META-INF");
Files.walkFileTree(root, EnumSet.of(FileVisitOption.FOLLOW_LINKS), Integer.MAX_VALUE,
@@ -588,7 +589,7 @@ private JarBuildItem buildThinJar(CurateOutcomeBuildItem curateOutcomeBuildItem,
} else {
IoUtils.createOrEmptyDir(quarkus);
}
- Map> copiedArtifacts = new HashMap<>();
+ Map> copiedArtifacts = new HashMap<>();
Path fernflowerJar = null;
Path decompiledOutputDir = null;
@@ -673,27 +674,27 @@ private JarBuildItem buildThinJar(CurateOutcomeBuildItem curateOutcomeBuildItem,
Set finalIgnoredEntries = new HashSet<>(IGNORED_ENTRIES);
packageConfig.userConfiguredIgnoredEntries.ifPresent(finalIgnoredEntries::addAll);
try (FileSystem runnerZipFs = ZipUtils.newZip(runnerJar)) {
- for (Path root : applicationArchivesBuildItem.getRootArchive().getRootDirs()) {
+ for (Path root : applicationArchivesBuildItem.getRootArchive().getRootDirectories()) {
copyFiles(root, runnerZipFs, null, finalIgnoredEntries);
}
}
}
- final Set parentFirstKeys = getParentFirstKeys(curateOutcomeBuildItem, classLoadingConfig);
+ final Set parentFirstKeys = getParentFirstKeys(curateOutcomeBuildItem, classLoadingConfig);
StringBuilder classPath = new StringBuilder();
- final Set removed = getRemovedKeys(classLoadingConfig);
- for (AppDependency appDep : curateOutcomeBuildItem.getEffectiveModel().getUserDependencies()) {
+ final Set removed = getRemovedKeys(classLoadingConfig);
+ for (ResolvedDependency appDep : curateOutcomeBuildItem.getApplicationModel().getRuntimeDependencies()) {
if (rebuild) {
- jars.addAll(appDep.getArtifact().getPaths().toList());
+ appDep.getResolvedPaths().forEach(jars::add);
} else {
copyDependency(parentFirstKeys, outputTargetBuildItem, copiedArtifacts, mainLib, baseLib, jars, true,
classPath, appDep, transformedClasses, removed);
}
- if (parentFirstKeys.contains(appDep.getArtifact().getKey())) {
- parentFirst.addAll(appDep.getArtifact().getPaths().toList());
+ if (parentFirstKeys.contains(appDep.getKey())) {
+ appDep.getResolvedPaths().forEach(parentFirst::add);
}
}
for (AdditionalApplicationArchiveBuildItem i : additionalApplicationArchiveBuildItems) {
- for (Path path : i.getPaths()) {
+ for (Path path : i.getResolvedPaths()) {
if (!path.getParent().equals(userProviders)) {
throw new RuntimeException(
"Additional application archives can only be provided from the user providers directory. " + path
@@ -744,7 +745,7 @@ private JarBuildItem buildThinJar(CurateOutcomeBuildItem curateOutcomeBuildItem,
}
if (!rebuild) {
try (FileSystem runnerZipFs = ZipUtils.newZip(initJar)) {
- AppArtifact appArtifact = curateOutcomeBuildItem.getEffectiveModel().getAppArtifact();
+ ResolvedDependency appArtifact = curateOutcomeBuildItem.getApplicationModel().getAppArtifact();
generateManifest(runnerZipFs, classPath.toString(), packageConfig, appArtifact,
QuarkusEntryPoint.class.getName(),
applicationInfo);
@@ -755,14 +756,14 @@ private JarBuildItem buildThinJar(CurateOutcomeBuildItem curateOutcomeBuildItem,
Path deploymentLib = libDir.resolve(DEPLOYMENT_LIB);
Files.createDirectories(deploymentLib);
- for (AppDependency appDep : curateOutcomeBuildItem.getEffectiveModel().getFullDeploymentDeps()) {
+ for (ResolvedDependency appDep : curateOutcomeBuildItem.getApplicationModel().getDependencies()) {
copyDependency(parentFirstKeys, outputTargetBuildItem, copiedArtifacts, deploymentLib, baseLib, jars,
false, classPath,
appDep, new TransformedClassesBuildItem(Collections.emptyMap()), removed); //we don't care about transformation here, so just pass in an empty item
}
- Map> relativePaths = new HashMap<>();
- for (Map.Entry> e : copiedArtifacts.entrySet()) {
+ Map> relativePaths = new HashMap<>();
+ for (Map.Entry> e : copiedArtifacts.entrySet()) {
relativePaths.put(e.getKey(),
e.getValue().stream().map(s -> buildDir.relativize(s).toString().replace('\\', '/'))
.collect(Collectors.toList()));
@@ -770,8 +771,9 @@ private JarBuildItem buildThinJar(CurateOutcomeBuildItem curateOutcomeBuildItem,
//now we serialize the data needed to build up the reaugmentation class path
//first the app model
- PersistentAppModel model = new PersistentAppModel(outputTargetBuildItem.getBaseName(), relativePaths,
- curateOutcomeBuildItem.getEffectiveModel(),
+ MutableJarApplicationModel model = new MutableJarApplicationModel(outputTargetBuildItem.getBaseName(),
+ relativePaths,
+ curateOutcomeBuildItem.getApplicationModel(),
packageConfig.userProvidersDirectory.orElse(null), buildDir.relativize(runnerJar).toString());
Path appmodelDat = deploymentLib.resolve(APPMODEL_DAT);
try (OutputStream out = Files.newOutputStream(appmodelDat)) {
@@ -787,8 +789,8 @@ private JarBuildItem buildThinJar(CurateOutcomeBuildItem curateOutcomeBuildItem,
try (OutputStream out = Files.newOutputStream(deploymentCp)) {
ObjectOutputStream obj = new ObjectOutputStream(out);
List paths = new ArrayList<>();
- for (AppDependency i : curateOutcomeBuildItem.getEffectiveModel().getFullDeploymentDeps()) {
- final List list = relativePaths.get(i.getArtifact().getKey());
+ for (ResolvedDependency i : curateOutcomeBuildItem.getApplicationModel().getDependencies()) {
+ final List list = relativePaths.get(i.getKey());
// some of the dependencies may have been filtered out
if (list != null) {
paths.addAll(list);
@@ -802,8 +804,8 @@ private JarBuildItem buildThinJar(CurateOutcomeBuildItem curateOutcomeBuildItem,
if (packageConfig.includeDependencyList) {
Path deplist = buildDir.resolve(QUARKUS_APP_DEPS);
List lines = new ArrayList<>();
- for (AppDependency i : curateOutcomeBuildItem.getEffectiveModel().getUserDependencies()) {
- lines.add(i.getArtifact().toString());
+ for (ResolvedDependency i : curateOutcomeBuildItem.getApplicationModel().getRuntimeDependencies()) {
+ lines.add(i.toGACTVString());
}
lines.sort(Comparator.naturalOrder());
Files.write(deplist, lines);
@@ -826,14 +828,14 @@ public void accept(Path path) {
/**
* @return a {@code Set} containing the key of the artifacts to load from the parent ClassLoader first.
*/
- private Set getParentFirstKeys(CurateOutcomeBuildItem curateOutcomeBuildItem,
+ private Set getParentFirstKeys(CurateOutcomeBuildItem curateOutcomeBuildItem,
ClassLoadingConfig classLoadingConfig) {
- final Set parentFirstKeys = new HashSet<>(
- curateOutcomeBuildItem.getEffectiveModel().getRunnerParentFirstArtifacts());
+ final Set parentFirstKeys = new HashSet<>(
+ curateOutcomeBuildItem.getApplicationModel().getRunnerParentFirst());
classLoadingConfig.parentFirstArtifacts.ifPresent(
parentFirstArtifacts -> {
for (String artifact : parentFirstArtifacts) {
- parentFirstKeys.add(new AppArtifactKey(artifact.split(":")));
+ parentFirstKeys.add(new GACT(artifact.split(":")));
}
});
return parentFirstKeys;
@@ -842,12 +844,12 @@ private Set getParentFirstKeys(CurateOutcomeBuildItem curateOutc
/**
* @return a {@code Set} containing the key of the artifacts to load from the parent ClassLoader first.
*/
- private Set getRemovedKeys(ClassLoadingConfig classLoadingConfig) {
- final Set removed = new HashSet<>();
+ private Set getRemovedKeys(ClassLoadingConfig classLoadingConfig) {
+ final Set removed = new HashSet<>();
classLoadingConfig.removedArtifacts.ifPresent(
removedArtifacts -> {
for (String artifact : removedArtifacts) {
- removed.add(new AppArtifactKey(artifact.split(":")));
+ removed.add(new GACT(artifact.split(":")));
}
});
return removed;
@@ -905,33 +907,32 @@ private boolean decompile(Path fernflowerJar, Path decompiledOutputDir, Path jar
return true;
}
- private void copyDependency(Set parentFirstArtifacts, OutputTargetBuildItem outputTargetBuildItem,
- Map> runtimeArtifacts, Path libDir, Path baseLib, List jars,
- boolean allowParentFirst, StringBuilder classPath, AppDependency appDep,
- TransformedClassesBuildItem transformedClasses, Set removedDeps)
+ private void copyDependency(Set parentFirstArtifacts, OutputTargetBuildItem outputTargetBuildItem,
+ Map> runtimeArtifacts, Path libDir, Path baseLib, List jars,
+ boolean allowParentFirst, StringBuilder classPath, ResolvedDependency appDep,
+ TransformedClassesBuildItem transformedClasses, Set removedDeps)
throws IOException {
- final AppArtifact depArtifact = appDep.getArtifact();
// Exclude files that are not jars (typically, we can have XML files here, see https://github.com/quarkusio/quarkus/issues/2852)
// and are not part of the optional dependencies to include
if (!includeAppDep(appDep, outputTargetBuildItem.getIncludedOptionalDependencies(), removedDeps)) {
return;
}
- if (runtimeArtifacts.containsKey(depArtifact.getKey())) {
+ if (runtimeArtifacts.containsKey(appDep.getKey())) {
return;
}
- for (Path resolvedDep : depArtifact.getPaths()) {
- final String fileName = depArtifact.getGroupId() + "." + resolvedDep.getFileName();
+ for (Path resolvedDep : appDep.getResolvedPaths()) {
+ final String fileName = appDep.getGroupId() + "." + resolvedDep.getFileName();
final Path targetPath;
- if (allowParentFirst && parentFirstArtifacts.contains(depArtifact.getKey())) {
+ if (allowParentFirst && parentFirstArtifacts.contains(appDep.getKey())) {
targetPath = baseLib.resolve(fileName);
classPath.append(" ").append(LIB).append("/").append(BOOT_LIB).append("/").append(fileName);
} else {
targetPath = libDir.resolve(fileName);
jars.add(targetPath);
}
- runtimeArtifacts.computeIfAbsent(depArtifact.getKey(), (s) -> new ArrayList<>(1)).add(targetPath);
+ runtimeArtifacts.computeIfAbsent(appDep.getKey(), (s) -> new ArrayList<>(1)).add(targetPath);
if (Files.isDirectory(resolvedDep)) {
// This case can happen when we are building a jar from inside the Quarkus repository
@@ -1101,7 +1102,7 @@ private NativeImageSourceJarBuildItem buildNativeImageUberJar(CurateOutcomeBuild
*/
private void copyJsonConfigFiles(ApplicationArchivesBuildItem applicationArchivesBuildItem, Path thinJarDirectory)
throws IOException {
- for (Path root : applicationArchivesBuildItem.getRootArchive().getRootDirs()) {
+ for (Path root : applicationArchivesBuildItem.getRootArchive().getRootDirectories()) {
try (Stream stream = Files.find(root, 1, IS_JSON_FILE_PREDICATE)) {
stream.forEach(new Consumer() {
@Override
@@ -1136,15 +1137,16 @@ private void doLegacyThinJarGeneration(CurateOutcomeBuildItem curateOutcomeBuild
final StringBuilder classPath = new StringBuilder();
final Map> services = new HashMap<>();
- final List appDeps = curateOutcomeBuildItem.getEffectiveModel().getUserDependencies();
+ final Collection appDeps = curateOutcomeBuildItem.getApplicationModel()
+ .getRuntimeDependencies();
final Set finalIgnoredEntries = new HashSet<>(IGNORED_ENTRIES);
packageConfig.userConfiguredIgnoredEntries.ifPresent(finalIgnoredEntries::addAll);
- final Set removed = getRemovedKeys(classLoadingConfig);
+ final Set removed = getRemovedKeys(classLoadingConfig);
copyLibraryJars(runnerZipFs, outputTargetBuildItem, transformedClasses, libDir, classPath, appDeps, services,
finalIgnoredEntries, removed);
- AppArtifact appArtifact = curateOutcomeBuildItem.getEffectiveModel().getAppArtifact();
+ ResolvedDependency appArtifact = curateOutcomeBuildItem.getApplicationModel().getAppArtifact();
// the manifest needs to be the first entry in the jar, otherwise JarInputStream does not work properly
// see https://bugs.openjdk.java.net/browse/JDK-8031748
generateManifest(runnerZipFs, classPath.toString(), packageConfig, appArtifact, mainClassBuildItem.getClassName(),
@@ -1156,11 +1158,10 @@ private void doLegacyThinJarGeneration(CurateOutcomeBuildItem curateOutcomeBuild
private void copyLibraryJars(FileSystem runnerZipFs, OutputTargetBuildItem outputTargetBuildItem,
TransformedClassesBuildItem transformedClasses, Path libDir,
- StringBuilder classPath, List appDeps, Map> services,
- Set ignoredEntries, Set removedDependencies) throws IOException {
+ StringBuilder classPath, Collection appDeps, Map> services,
+ Set ignoredEntries, Set removedDependencies) throws IOException {
- for (AppDependency appDep : appDeps) {
- final AppArtifact depArtifact = appDep.getArtifact();
+ for (ResolvedDependency appDep : appDeps) {
// Exclude files that are not jars (typically, we can have XML files here, see https://github.com/quarkusio/quarkus/issues/2852)
// and are not part of the optional dependencies to include
@@ -1168,17 +1169,18 @@ private void copyLibraryJars(FileSystem runnerZipFs, OutputTargetBuildItem outpu
continue;
}
- for (Path resolvedDep : depArtifact.getPaths()) {
+ for (Path resolvedDep : appDep.getResolvedPaths()) {
if (!Files.isDirectory(resolvedDep)) {
Set transformedFromThisArchive = transformedClasses.getTransformedFilesByJar().get(resolvedDep);
if (transformedFromThisArchive == null || transformedFromThisArchive.isEmpty()) {
- final String fileName = depArtifact.getGroupId() + "." + resolvedDep.getFileName();
+ final String fileName = appDep.getGroupId() + "." + resolvedDep.getFileName();
final Path targetPath = libDir.resolve(fileName);
Files.copy(resolvedDep, targetPath, StandardCopyOption.REPLACE_EXISTING);
classPath.append(" lib/").append(fileName);
} else {
//we have transformed classes, we need to handle them correctly
- final String fileName = "modified-" + depArtifact.getGroupId() + "." + resolvedDep.getFileName();
+ final String fileName = "modified-" + appDep.getGroupId() + "."
+ + resolvedDep.getFileName();
final Path targetPath = libDir.resolve(fileName);
classPath.append(" lib/").append(fileName);
filterZipFile(resolvedDep, targetPath, transformedFromThisArchive);
@@ -1270,7 +1272,7 @@ private void copyCommonContent(FileSystem runnerZipFs, Map>
}
}
- for (Path root : appArchives.getRootArchive().getRootDirs()) {
+ for (Path root : appArchives.getRootArchive().getRootDirectories()) {
copyFiles(root, runnerZipFs, concatenatedEntries, ignoredEntries);
}
@@ -1333,7 +1335,8 @@ private void filterZipFile(Path resolvedDep, Path targetPath, Set transf
* BEWARE this method should be invoked after file copy from target/classes and so on.
* Otherwise this manifest manipulation will be useless.
*/
- private void generateManifest(FileSystem runnerZipFs, final String classPath, PackageConfig config, AppArtifact appArtifact,
+ private void generateManifest(FileSystem runnerZipFs, final String classPath, PackageConfig config,
+ ResolvedDependency appArtifact,
String mainClassName,
ApplicationInfoBuildItem applicationInfo)
throws IOException {
@@ -1363,7 +1366,8 @@ private void generateManifest(FileSystem runnerZipFs, final String classPath, Pa
}
attributes.put(Attributes.Name.MAIN_CLASS, mainClassName);
if (config.manifest.addImplementationEntries && !attributes.containsKey(Attributes.Name.IMPLEMENTATION_TITLE)) {
- String name = ApplicationInfoBuildItem.UNSET_VALUE.equals(applicationInfo.getName()) ? appArtifact.getArtifactId()
+ String name = ApplicationInfoBuildItem.UNSET_VALUE.equals(applicationInfo.getName())
+ ? appArtifact.getArtifactId()
: applicationInfo.getName();
attributes.put(Attributes.Name.IMPLEMENTATION_TITLE, name);
}
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java
index 5077793e53a04..82317583865ea 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java
@@ -22,8 +22,6 @@
import org.apache.commons.lang3.SystemUtils;
import org.jboss.logging.Logger;
-import io.quarkus.bootstrap.model.AppArtifact;
-import io.quarkus.bootstrap.model.AppDependency;
import io.quarkus.bootstrap.util.IoUtils;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.nativeimage.ExcludeConfigBuildItem;
@@ -39,6 +37,8 @@
import io.quarkus.deployment.pkg.builditem.NativeImageSourceJarBuildItem;
import io.quarkus.deployment.pkg.builditem.OutputTargetBuildItem;
import io.quarkus.deployment.pkg.builditem.ProcessInheritIODisabled;
+import io.quarkus.maven.dependency.GACTV;
+import io.quarkus.maven.dependency.ResolvedDependency;
public class NativeImageBuildStep {
@@ -290,11 +290,9 @@ private void copyJarSourcesToLib(OutputTargetBuildItem outputTargetBuildItem,
libDirFile.mkdirs();
}
- final List appDeps = curateOutcomeBuildItem.getEffectiveModel().getUserDependencies();
- for (AppDependency appDep : appDeps) {
- final AppArtifact depArtifact = appDep.getArtifact();
- if (depArtifact.getType().equals("jar")) {
- for (Path resolvedDep : depArtifact.getPaths()) {
+ for (ResolvedDependency depArtifact : curateOutcomeBuildItem.getApplicationModel().getRuntimeDependencies()) {
+ if (depArtifact.getType().equals(GACTV.TYPE_JAR)) {
+ for (Path resolvedDep : depArtifact.getResolvedPaths()) {
if (!Files.isDirectory(resolvedDep)) {
// Do we need to handle transformed classes?
// Their bytecode might have been modified but is there source for such modification?
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/CapabilityAggregationStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/CapabilityAggregationStep.java
index 2b9d866363006..bca9c642c0d41 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/steps/CapabilityAggregationStep.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/CapabilityAggregationStep.java
@@ -5,9 +5,9 @@
import java.util.Map;
import java.util.function.BooleanSupplier;
-import io.quarkus.bootstrap.model.AppModel;
-import io.quarkus.bootstrap.model.CapabilityContract;
+import io.quarkus.bootstrap.model.ApplicationModel;
import io.quarkus.bootstrap.model.CapabilityErrors;
+import io.quarkus.bootstrap.model.ExtensionCapabilities;
import io.quarkus.deployment.BooleanSupplierFactoryBuildItem;
import io.quarkus.deployment.Capabilities;
import io.quarkus.deployment.annotations.BuildProducer;
@@ -27,9 +27,9 @@ public class CapabilityAggregationStep {
@BuildStep
void provideCapabilities(BuildProducer producer, CurateOutcomeBuildItem curateOutcomeBuildItem,
BooleanSupplierFactoryBuildItem supplierFactory) {
- final AppModel appModel = curateOutcomeBuildItem.getEffectiveModel();
+ final ApplicationModel appModel = curateOutcomeBuildItem.getApplicationModel();
- for (CapabilityContract contract : appModel.getCapabilityContracts().values()) {
+ for (ExtensionCapabilities contract : appModel.getExtensionCapabilities()) {
final String provider = contract.getExtension();
for (String capability : contract.getProvidesCapabilities()) {
int conditionIndex = capability.indexOf('?');
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/ClassTransformingBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/ClassTransformingBuildStep.java
index f145ec439df6c..76b2f974ba843 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/steps/ClassTransformingBuildStep.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/ClassTransformingBuildStep.java
@@ -32,8 +32,6 @@
import io.quarkus.bootstrap.BootstrapDebug;
import io.quarkus.bootstrap.classloading.ClassPathElement;
import io.quarkus.bootstrap.classloading.QuarkusClassLoader;
-import io.quarkus.bootstrap.model.AppArtifactKey;
-import io.quarkus.bootstrap.model.AppDependency;
import io.quarkus.deployment.QuarkusClassWriter;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.ApplicationArchivesBuildItem;
@@ -47,6 +45,9 @@
import io.quarkus.deployment.index.ConstPoolScanner;
import io.quarkus.deployment.pkg.PackageConfig;
import io.quarkus.deployment.pkg.builditem.CurateOutcomeBuildItem;
+import io.quarkus.maven.dependency.ArtifactKey;
+import io.quarkus.maven.dependency.GACT;
+import io.quarkus.maven.dependency.ResolvedDependency;
import io.quarkus.runtime.LaunchMode;
public class ClassTransformingBuildStep {
@@ -132,7 +133,6 @@ public byte[] apply(String className, byte[] originalBytes) {
List archives = cl.getElementsWithResource(classFileName);
if (!archives.isEmpty()) {
ClassPathElement classPathElement = archives.get(0);
- Path jar = classPathElement.getRoot();
byte[] classData = classPathElement.getResource(classFileName).getData();
Set constValues = constScanning.get(className);
if (constValues != null && !noConstScanning.contains(className)) {
@@ -269,18 +269,18 @@ private void handleRemovedResources(ClassLoadingConfig classLoadingConfig, Curat
Map> transformedClassesByJar,
List removedResourceBuildItems) {
//a little bit of a hack, but we use an empty transformed class to represent removed resources, as transforming a class removes it from the original archive
- Map> removed = new HashMap<>();
+ Map> removed = new HashMap<>();
for (Map.Entry> entry : classLoadingConfig.removedResources.entrySet()) {
- removed.put(new AppArtifactKey(entry.getKey().split(":")), entry.getValue());
+ removed.put(new GACT(entry.getKey().split(":")), entry.getValue());
}
for (RemovedResourceBuildItem i : removedResourceBuildItems) {
removed.computeIfAbsent(i.getArtifact(), k -> new HashSet<>()).addAll(i.getResources());
}
if (!removed.isEmpty()) {
- for (AppDependency i : curateOutcomeBuildItem.getEffectiveModel().getUserDependencies()) {
- Set filtered = removed.remove(i.getArtifact().getKey());
+ for (ResolvedDependency i : curateOutcomeBuildItem.getApplicationModel().getRuntimeDependencies()) {
+ Set filtered = removed.remove(i.getKey());
if (filtered != null) {
- for (Path path : i.getArtifact().getPaths()) {
+ for (Path path : i.getResolvedPaths()) {
transformedClassesByJar.computeIfAbsent(path, s -> new HashSet<>())
.addAll(filtered.stream()
.map(file -> new TransformedClassesBuildItem.TransformedClass(null, null, file, false))
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/util/ArtifactInfoUtil.java b/core/deployment/src/main/java/io/quarkus/deployment/util/ArtifactInfoUtil.java
index 84f57bfed31bc..db2ef3ebfc141 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/util/ArtifactInfoUtil.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/util/ArtifactInfoUtil.java
@@ -14,8 +14,8 @@
import java.util.Optional;
import java.util.Properties;
-import io.quarkus.bootstrap.model.AppDependency;
import io.quarkus.deployment.pkg.builditem.CurateOutcomeBuildItem;
+import io.quarkus.maven.dependency.ResolvedDependency;
public final class ArtifactInfoUtil {
@@ -56,22 +56,22 @@ public static Map.Entry groupIdAndArtifactId(Class> clazz,
} else if (curateOutcomeBuildItem != null) {
// this is needed only for QuarkusDevModeTest inside Quarkus where the class is read from the corresponding directory
Path path = Paths.get(codeLocation.toURI());
- for (AppDependency i : curateOutcomeBuildItem.getEffectiveModel().getFullDeploymentDeps()) {
- for (Path p : i.getArtifact().getPaths()) {
+ for (ResolvedDependency i : curateOutcomeBuildItem.getApplicationModel().getDependencies()) {
+ for (Path p : i.getResolvedPaths()) {
if (path.equals(p)) {
- String artifactId = i.getArtifact().getArtifactId();
+ String artifactId = i.getArtifactId();
if (artifactId.endsWith(DEPLOYMENT)) {
artifactId = artifactId.substring(0, artifactId.length() - DEPLOYMENT.length());
}
- return new AbstractMap.SimpleEntry<>(i.getArtifact().getGroupId(), artifactId);
+ return new AbstractMap.SimpleEntry<>(i.getGroupId(), artifactId);
}
}
}
return new AbstractMap.SimpleEntry<>("unspecified", "unspecified");
} else if ("file".equals(codeLocation.getProtocol())) {
// E.g. /quarkus/extensions/arc/deployment/target/classes/io/quarkus/arc/deployment/devconsole
- // This can happen if you run an example app in dev mode
+ // This can happen if you run an example app in dev mode
// and this app is part of a multi-module project which also declares the extension
// Just try to locate the pom.properties file in the target/maven-archiver directory
// Note that this hack will not work if addMavenDescriptor=false or if the pomPropertiesFile is overriden
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/util/WebJarUtil.java b/core/deployment/src/main/java/io/quarkus/deployment/util/WebJarUtil.java
index 94b686923613a..50fb048e1f0c4 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/util/WebJarUtil.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/util/WebJarUtil.java
@@ -32,14 +32,13 @@
import org.eclipse.microprofile.config.ConfigProvider;
import org.jboss.logging.Logger;
-import io.quarkus.bootstrap.model.AppArtifact;
-import io.quarkus.bootstrap.model.AppDependency;
-import io.quarkus.bootstrap.model.PathsCollection;
import io.quarkus.bootstrap.util.IoUtils;
import io.quarkus.builder.Version;
import io.quarkus.deployment.builditem.LaunchModeBuildItem;
import io.quarkus.deployment.builditem.LiveReloadBuildItem;
import io.quarkus.deployment.pkg.builditem.CurateOutcomeBuildItem;
+import io.quarkus.maven.dependency.ResolvedDependency;
+import io.quarkus.paths.PathCollection;
import io.quarkus.runtime.LaunchMode;
import io.smallrye.common.io.jar.JarFiles;
@@ -61,7 +60,7 @@ private WebJarUtil() {
public static void hotReloadBrandingChanges(CurateOutcomeBuildItem curateOutcomeBuildItem,
LaunchModeBuildItem launchMode,
- AppArtifact resourcesArtifact,
+ ResolvedDependency resourcesArtifact,
Set hotReloadChanges) throws IOException {
hotReloadBrandingChanges(curateOutcomeBuildItem, launchMode, resourcesArtifact, hotReloadChanges, true);
@@ -69,7 +68,7 @@ public static void hotReloadBrandingChanges(CurateOutcomeBuildItem curateOutcome
public static void hotReloadBrandingChanges(CurateOutcomeBuildItem curateOutcomeBuildItem,
LaunchModeBuildItem launchMode,
- AppArtifact resourcesArtifact,
+ ResolvedDependency resourcesArtifact,
Set hotReloadChanges,
boolean useDefaultQuarkusBranding) throws IOException {
@@ -78,16 +77,16 @@ public static void hotReloadBrandingChanges(CurateOutcomeBuildItem curateOutcome
for (String changedResource : hotReloadChanges) {
if (changedResource.startsWith(CUSTOM_MEDIA_FOLDER)) {
ClassLoader classLoader = WebJarUtil.class.getClassLoader();
- AppArtifact userApplication = curateOutcomeBuildItem.getEffectiveModel().getAppArtifact();
+ final ResolvedDependency userApplication = curateOutcomeBuildItem.getApplicationModel().getAppArtifact();
String fileName = changedResource.replace(CUSTOM_MEDIA_FOLDER, "");
// a branding file has changed !
String modulename = getModuleOverrideName(resourcesArtifact, fileName);
if (IGNORE_LIST.contains(fileName)
- && isOverride(userApplication.getPaths(), classLoader, fileName, modulename)) {
+ && isOverride(userApplication.getResolvedPaths(), classLoader, fileName, modulename)) {
Path deploymentPath = createResourcesDirectory(userApplication, resourcesArtifact);
Path filePath = deploymentPath.resolve(fileName);
try (InputStream override = insertVariables(userApplication,
- getOverride(userApplication.getPaths(), classLoader,
+ getOverride(userApplication.getResolvedPaths(), classLoader,
fileName, modulename, useDefaultQuarkusBranding),
fileName)) {
if (override != null) {
@@ -103,7 +102,7 @@ && isOverride(userApplication.getPaths(), classLoader, fileName, modulename)) {
public static Path copyResourcesForDevOrTest(LiveReloadBuildItem liveReloadBuildItem,
CurateOutcomeBuildItem curateOutcomeBuildItem,
LaunchModeBuildItem launchMode,
- AppArtifact resourcesArtifact,
+ ResolvedDependency resourcesArtifact,
String rootFolderInJar)
throws IOException {
return copyResourcesForDevOrTest(liveReloadBuildItem, curateOutcomeBuildItem, launchMode, resourcesArtifact,
@@ -113,13 +112,13 @@ public static Path copyResourcesForDevOrTest(LiveReloadBuildItem liveReloadBuild
public static Path copyResourcesForDevOrTest(LiveReloadBuildItem liveReloadBuildItem,
CurateOutcomeBuildItem curateOutcomeBuildItem,
LaunchModeBuildItem launchMode,
- AppArtifact resourcesArtifact,
+ ResolvedDependency resourcesArtifact,
String rootFolderInJar,
boolean useDefaultQuarkusBranding)
throws IOException {
rootFolderInJar = normalizeRootFolderInJar(rootFolderInJar);
- AppArtifact userApplication = curateOutcomeBuildItem.getEffectiveModel().getAppArtifact();
+ final ResolvedDependency userApplication = curateOutcomeBuildItem.getApplicationModel().getAppArtifact();
Path deploymentPath = createResourcesDirectory(userApplication, resourcesArtifact);
@@ -133,7 +132,7 @@ public static Path copyResourcesForDevOrTest(LiveReloadBuildItem liveReloadBuild
if (isEmpty(deploymentPath)) {
ClassLoader classLoader = WebJarUtil.class.getClassLoader();
- for (Path p : resourcesArtifact.getPaths()) {
+ for (Path p : resourcesArtifact.getResolvedPaths()) {
File artifactFile = p.toFile();
if (artifactFile.isFile()) {
// case of a jar file
@@ -151,9 +150,10 @@ public static Path copyResourcesForDevOrTest(LiveReloadBuildItem liveReloadBuild
jarFile.getInputStream(entry), fileName)) {
String modulename = getModuleOverrideName(resourcesArtifact, fileName);
if (IGNORE_LIST.contains(fileName)
- && isOverride(userApplication.getPaths(), classLoader, fileName, modulename)) {
+ && isOverride(userApplication.getResolvedPaths(), classLoader, fileName,
+ modulename)) {
try (InputStream override = insertVariables(userApplication,
- getOverride(userApplication.getPaths(), classLoader,
+ getOverride(userApplication.getResolvedPaths(), classLoader,
fileName, modulename, useDefaultQuarkusBranding),
fileName)) {
if (override == null) {
@@ -193,9 +193,9 @@ public FileVisitResult visitFile(final Path file,
String modulename = getModuleOverrideName(resourcesArtifact, fileName);
if (IGNORE_LIST.contains(fileName)
- && isOverride(userApplication.getPaths(), classLoader, fileName, modulename)) {
+ && isOverride(userApplication.getResolvedPaths(), classLoader, fileName, modulename)) {
try (InputStream override = insertVariables(userApplication,
- getOverride(userApplication.getPaths(), classLoader,
+ getOverride(userApplication.getResolvedPaths(), classLoader,
fileName, modulename, useDefaultQuarkusBranding),
fileName)) {
if (override == null) {
@@ -218,17 +218,17 @@ && isOverride(userApplication.getPaths(), classLoader, fileName, modulename)) {
}
public static Map copyResourcesForProduction(CurateOutcomeBuildItem curateOutcomeBuildItem,
- AppArtifact artifact,
+ ResolvedDependency artifact,
String rootFolderInJar) throws IOException {
return copyResourcesForProduction(curateOutcomeBuildItem, artifact, rootFolderInJar, true);
}
public static Map copyResourcesForProduction(CurateOutcomeBuildItem curateOutcomeBuildItem,
- AppArtifact artifact,
+ ResolvedDependency artifact,
String rootFolderInJar,
boolean useDefaultQuarkusBranding) throws IOException {
rootFolderInJar = normalizeRootFolderInJar(rootFolderInJar);
- AppArtifact userApplication = curateOutcomeBuildItem.getEffectiveModel().getAppArtifact();
+ final ResolvedDependency userApplication = curateOutcomeBuildItem.getApplicationModel().getAppArtifact();
Map map = new HashMap<>();
//we are including in a production artifact
@@ -236,7 +236,7 @@ public static Map copyResourcesForProduction(CurateOutcomeBuildI
//we could do this for dev mode as well but then we need to extract them every time
ClassLoader classLoader = WebJarUtil.class.getClassLoader();
- for (Path p : artifact.getPaths()) {
+ for (Path p : artifact.getResolvedPaths()) {
File artifactFile = p.toFile();
try (JarFile jarFile = JarFiles.create(artifactFile)) {
Enumeration entries = jarFile.entries();
@@ -249,9 +249,9 @@ public static Map copyResourcesForProduction(CurateOutcomeBuildI
byte[] content = null;
String modulename = getModuleOverrideName(artifact, filename);
if (IGNORE_LIST.contains(filename)
- && isOverride(userApplication.getPaths(), classLoader, filename, modulename)) {
+ && isOverride(userApplication.getResolvedPaths(), classLoader, filename, modulename)) {
try (InputStream resourceAsStream = insertVariables(userApplication,
- getOverride(userApplication.getPaths(), classLoader,
+ getOverride(userApplication.getResolvedPaths(), classLoader,
filename, modulename, useDefaultQuarkusBranding),
filename)) {
if (resourceAsStream != null) {
@@ -300,30 +300,32 @@ public static String updateUrl(String original, String path, String lineStartsWi
return original;
}
- public static AppArtifact getAppArtifact(CurateOutcomeBuildItem curateOutcomeBuildItem, String groupId, String artifactId) {
- for (AppDependency dep : curateOutcomeBuildItem.getEffectiveModel().getFullDeploymentDeps()) {
- if (dep.getArtifact().getArtifactId().equals(artifactId)
- && dep.getArtifact().getGroupId().equals(groupId)) {
- return dep.getArtifact();
+ public static ResolvedDependency getAppArtifact(CurateOutcomeBuildItem curateOutcomeBuildItem, String groupId,
+ String artifactId) {
+ for (ResolvedDependency dep : curateOutcomeBuildItem.getApplicationModel().getDependencies()) {
+ if (dep.getArtifactId().equals(artifactId)
+ && dep.getGroupId().equals(groupId)) {
+ return dep;
}
}
throw new RuntimeException("Could not find artifact " + groupId + ":" + artifactId
+ " among the application dependencies");
}
- private static void copyFile(AppArtifact appArtifact, Path file, String fileName, Path targetFilePath) throws IOException {
+ private static void copyFile(ResolvedDependency appArtifact, Path file, String fileName, Path targetFilePath)
+ throws IOException {
InputStream providedContent = pathToStream(file).orElse(null);
if (providedContent != null) {
Files.copy(insertVariables(appArtifact, providedContent, fileName), targetFilePath);
}
}
- private static String getModuleOverrideName(AppArtifact artifact, String filename) {
+ private static String getModuleOverrideName(ResolvedDependency artifact, String filename) {
String type = filename.substring(filename.lastIndexOf("."));
return artifact.getArtifactId() + type;
}
- private static InputStream getOverride(PathsCollection paths, ClassLoader classLoader, String filename, String modulename,
+ private static InputStream getOverride(PathCollection paths, ClassLoader classLoader, String filename, String modulename,
boolean useDefaultQuarkusBranding)
throws IOException {
@@ -336,7 +338,8 @@ private static InputStream getOverride(PathsCollection paths, ClassLoader classL
return overrideStream;
}
- private static InputStream insertVariables(AppArtifact appArtifact, InputStream is, String filename) throws IOException {
+ private static InputStream insertVariables(ResolvedDependency appArtifact, InputStream is, String filename)
+ throws IOException {
// Allow replacement of certain values in css
if (filename.endsWith(CSS)) {
Config c = ConfigProvider.getConfig();
@@ -355,7 +358,7 @@ private static InputStream insertVariables(AppArtifact appArtifact, InputStream
return is;
}
- private static InputStream getCustomOverride(PathsCollection paths, String filename, String modulename) {
+ private static InputStream getCustomOverride(PathCollection paths, String filename, String modulename) {
// Check if the developer supplied the files
Path customOverridePath = getCustomOverridePath(paths, filename, modulename);
if (customOverridePath != null) {
@@ -364,7 +367,7 @@ private static InputStream getCustomOverride(PathsCollection paths, String filen
return null;
}
- private static Path getCustomOverridePath(PathsCollection paths, String filename, String modulename) {
+ private static Path getCustomOverridePath(PathCollection paths, String filename, String modulename) {
// First check if the developer supplied the files
Iterator iterator = paths.iterator();
@@ -395,7 +398,7 @@ private static InputStream getQuarkusOverride(ClassLoader classLoader, String fi
return null;
}
- private static boolean isOverride(PathsCollection paths, ClassLoader classLoader, String filename, String modulename) {
+ private static boolean isOverride(PathCollection paths, ClassLoader classLoader, String filename, String modulename) {
// Check if quarkus override this.
return isQuarkusOverride(classLoader, filename, modulename) || isCustomOverride(paths, filename, modulename);
}
@@ -406,7 +409,7 @@ private static boolean isQuarkusOverride(ClassLoader classLoader, String filenam
|| fileExistInClasspath(classLoader, CUSTOM_MEDIA_FOLDER + filename);
}
- private static boolean isCustomOverride(PathsCollection paths, String filename, String modulename) {
+ private static boolean isCustomOverride(PathCollection paths, String filename, String modulename) {
Iterator iterator = paths.iterator();
while (iterator.hasNext()) {
Path root = iterator.next();
@@ -457,10 +460,11 @@ private static void createFile(InputStream source, Path targetFile) throws IOExc
}
}
- public static Path createResourcesDirectory(AppArtifact userApplication, AppArtifact resourcesArtifact) {
+ public static Path createResourcesDirectory(ResolvedDependency userApplication, ResolvedDependency resourcesArtifact) {
try {
- Path path = Paths.get(TMP_DIR, "quarkus", userApplication.getGroupId(), userApplication.getArtifactId(),
- resourcesArtifact.getGroupId(), resourcesArtifact.getArtifactId(), resourcesArtifact.getVersion());
+ Path path = Paths.get(TMP_DIR, "quarkus", userApplication.getGroupId(),
+ userApplication.getArtifactId(), resourcesArtifact.getGroupId(),
+ resourcesArtifact.getArtifactId(), resourcesArtifact.getVersion());
if (!Files.exists(path)) {
Files.createDirectories(path);
diff --git a/core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java b/core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java
index 9693eb1700819..966652ab95212 100644
--- a/core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java
+++ b/core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java
@@ -311,7 +311,7 @@ public BuildResult runCustomAction(Consumer chainBuild, Consu
chainBuilder.setClassLoader(classLoader);
ExtensionLoader.loadStepsFrom(classLoader, new Properties(),
- curatedApplication.getAppModel(), launchMode, devModeType, null)
+ curatedApplication.getApplicationModel(), launchMode, devModeType, null)
.accept(chainBuilder);
chainBuilder.loadProviders(classLoader);
@@ -375,7 +375,7 @@ private BuildResult runAugment(boolean firstRun, Set changedResources,
.setTargetDir(quarkusBootstrap.getTargetDirectory())
.setDeploymentClassLoader(deploymentClassLoader)
.setBuildSystemProperties(quarkusBootstrap.getBuildSystemProperties())
- .setEffectiveModel(curatedApplication.getAppModel());
+ .setEffectiveModel(curatedApplication.getApplicationModel());
if (quarkusBootstrap.getBaseName() != null) {
builder.setBaseName(quarkusBootstrap.getBaseName());
}
@@ -401,7 +401,7 @@ private BuildResult runAugment(boolean firstRun, Set changedResources,
//but we only need to add it to the additional app archives
//if it is forced as an app archive
if (i.isForceApplicationArchive()) {
- builder.addAdditionalApplicationArchive(i.getArchivePath());
+ builder.addAdditionalApplicationArchive(i.getResolvedPaths());
}
}
builder.excludeFromIndexing(quarkusBootstrap.getExcludeFromClassPath());
diff --git a/core/deployment/src/test/java/io/quarkus/deployment/conditionaldeps/CascadingConditionalDependenciesTest.java b/core/deployment/src/test/java/io/quarkus/deployment/conditionaldeps/CascadingConditionalDependenciesTest.java
index 2ce27781e6820..b530e413a6a2e 100644
--- a/core/deployment/src/test/java/io/quarkus/deployment/conditionaldeps/CascadingConditionalDependenciesTest.java
+++ b/core/deployment/src/test/java/io/quarkus/deployment/conditionaldeps/CascadingConditionalDependenciesTest.java
@@ -3,14 +3,15 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
-import io.quarkus.bootstrap.model.AppArtifact;
-import io.quarkus.bootstrap.model.AppDependency;
import io.quarkus.bootstrap.resolver.TsArtifact;
import io.quarkus.bootstrap.resolver.TsQuarkusExt;
import io.quarkus.deployment.runnerjar.ExecutableOutputOutcomeTestBase;
+import io.quarkus.maven.dependency.ArtifactDependency;
+import io.quarkus.maven.dependency.Dependency;
+import io.quarkus.maven.dependency.DependencyFlags;
+import io.quarkus.maven.dependency.GACTV;
public class CascadingConditionalDependenciesTest extends ExecutableOutputOutcomeTestBase {
@@ -65,26 +66,26 @@ protected TsArtifact modelApp() {
}
@Override
- protected void assertDeploymentDeps(List deploymentDeps) throws Exception {
- final Set expected = new HashSet<>();
- expected.add(new AppDependency(
- new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, "ext-c-deployment", TsArtifact.DEFAULT_VERSION), "compile",
- AppDependency.DEPLOYMENT_CP_FLAG));
- expected.add(new AppDependency(
- new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, "ext-a-deployment", TsArtifact.DEFAULT_VERSION), "compile",
- AppDependency.DEPLOYMENT_CP_FLAG));
- expected.add(new AppDependency(
- new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, "ext-b-deployment", TsArtifact.DEFAULT_VERSION), "runtime",
- AppDependency.DEPLOYMENT_CP_FLAG));
- expected.add(new AppDependency(
- new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, "ext-d-deployment", TsArtifact.DEFAULT_VERSION), "runtime",
- AppDependency.DEPLOYMENT_CP_FLAG));
- expected.add(new AppDependency(
- new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, "ext-e-deployment", TsArtifact.DEFAULT_VERSION), "compile",
- AppDependency.DEPLOYMENT_CP_FLAG));
- expected.add(new AppDependency(
- new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, "ext-f-deployment", TsArtifact.DEFAULT_VERSION), "runtime",
- AppDependency.DEPLOYMENT_CP_FLAG));
- assertEquals(expected, new HashSet<>(deploymentDeps));
+ protected void assertDeploymentDeps(Set deploymentDeps) throws Exception {
+ final Set expected = new HashSet<>();
+ expected.add(new ArtifactDependency(
+ new GACTV(TsArtifact.DEFAULT_GROUP_ID, "ext-c-deployment", TsArtifact.DEFAULT_VERSION), "compile",
+ DependencyFlags.DEPLOYMENT_CP));
+ expected.add(new ArtifactDependency(
+ new GACTV(TsArtifact.DEFAULT_GROUP_ID, "ext-a-deployment", TsArtifact.DEFAULT_VERSION), "compile",
+ DependencyFlags.DEPLOYMENT_CP));
+ expected.add(new ArtifactDependency(
+ new GACTV(TsArtifact.DEFAULT_GROUP_ID, "ext-b-deployment", TsArtifact.DEFAULT_VERSION), "runtime",
+ DependencyFlags.DEPLOYMENT_CP));
+ expected.add(new ArtifactDependency(
+ new GACTV(TsArtifact.DEFAULT_GROUP_ID, "ext-d-deployment", TsArtifact.DEFAULT_VERSION), "runtime",
+ DependencyFlags.DEPLOYMENT_CP));
+ expected.add(new ArtifactDependency(
+ new GACTV(TsArtifact.DEFAULT_GROUP_ID, "ext-e-deployment", TsArtifact.DEFAULT_VERSION), "compile",
+ DependencyFlags.DEPLOYMENT_CP));
+ expected.add(new ArtifactDependency(
+ new GACTV(TsArtifact.DEFAULT_GROUP_ID, "ext-f-deployment", TsArtifact.DEFAULT_VERSION), "runtime",
+ DependencyFlags.DEPLOYMENT_CP));
+ assertEquals(expected, deploymentDeps);
}
}
diff --git a/core/deployment/src/test/java/io/quarkus/deployment/conditionaldeps/ConditionalDependencyWithSingleConditionTest.java b/core/deployment/src/test/java/io/quarkus/deployment/conditionaldeps/ConditionalDependencyWithSingleConditionTest.java
index edf1d892fb095..aaab4037b90a0 100644
--- a/core/deployment/src/test/java/io/quarkus/deployment/conditionaldeps/ConditionalDependencyWithSingleConditionTest.java
+++ b/core/deployment/src/test/java/io/quarkus/deployment/conditionaldeps/ConditionalDependencyWithSingleConditionTest.java
@@ -3,15 +3,17 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
+import java.util.stream.Collectors;
-import io.quarkus.bootstrap.model.AppArtifact;
-import io.quarkus.bootstrap.model.AppDependency;
-import io.quarkus.bootstrap.model.AppModel;
+import io.quarkus.bootstrap.model.ApplicationModel;
import io.quarkus.bootstrap.resolver.TsArtifact;
import io.quarkus.bootstrap.resolver.TsQuarkusExt;
import io.quarkus.deployment.runnerjar.ExecutableOutputOutcomeTestBase;
+import io.quarkus.maven.dependency.ArtifactDependency;
+import io.quarkus.maven.dependency.Dependency;
+import io.quarkus.maven.dependency.DependencyFlags;
+import io.quarkus.maven.dependency.GACTV;
public class ConditionalDependencyWithSingleConditionTest extends ExecutableOutputOutcomeTestBase {
@@ -39,18 +41,20 @@ protected TsArtifact modelApp() {
}
@Override
- protected void assertAppModel(AppModel appModel) throws Exception {
- final List deploymentDeps = appModel.getDeploymentDependencies();
- final Set expected = new HashSet<>();
- expected.add(new AppDependency(
- new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, "ext-c-deployment", TsArtifact.DEFAULT_VERSION), "compile",
- AppDependency.DEPLOYMENT_CP_FLAG));
- expected.add(new AppDependency(
- new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, "ext-a-deployment", TsArtifact.DEFAULT_VERSION), "compile",
- AppDependency.DEPLOYMENT_CP_FLAG));
- expected.add(new AppDependency(
- new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, "ext-b-deployment", TsArtifact.DEFAULT_VERSION), "runtime",
- AppDependency.DEPLOYMENT_CP_FLAG));
- assertEquals(expected, new HashSet<>(deploymentDeps));
+ protected void assertAppModel(ApplicationModel appModel) throws Exception {
+ final Set deploymentDeps = appModel.getDependencies().stream()
+ .filter(d -> d.isDeploymentCp() && !d.isRuntimeCp()).map(d -> new ArtifactDependency(d))
+ .collect(Collectors.toSet());
+ final Set expected = new HashSet<>();
+ expected.add(new ArtifactDependency(
+ new GACTV(TsArtifact.DEFAULT_GROUP_ID, "ext-c-deployment", TsArtifact.DEFAULT_VERSION), "compile",
+ DependencyFlags.DEPLOYMENT_CP));
+ expected.add(new ArtifactDependency(
+ new GACTV(TsArtifact.DEFAULT_GROUP_ID, "ext-a-deployment", TsArtifact.DEFAULT_VERSION), "compile",
+ DependencyFlags.DEPLOYMENT_CP));
+ expected.add(new ArtifactDependency(
+ new GACTV(TsArtifact.DEFAULT_GROUP_ID, "ext-b-deployment", TsArtifact.DEFAULT_VERSION), "runtime",
+ DependencyFlags.DEPLOYMENT_CP));
+ assertEquals(expected, deploymentDeps);
}
}
diff --git a/core/deployment/src/test/java/io/quarkus/deployment/conditionaldeps/ConditionalDependencyWithTwoConditionsTest.java b/core/deployment/src/test/java/io/quarkus/deployment/conditionaldeps/ConditionalDependencyWithTwoConditionsTest.java
index 413dd7c5f4622..3e0cc7c22774a 100644
--- a/core/deployment/src/test/java/io/quarkus/deployment/conditionaldeps/ConditionalDependencyWithTwoConditionsTest.java
+++ b/core/deployment/src/test/java/io/quarkus/deployment/conditionaldeps/ConditionalDependencyWithTwoConditionsTest.java
@@ -3,14 +3,15 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
-import io.quarkus.bootstrap.model.AppArtifact;
-import io.quarkus.bootstrap.model.AppDependency;
import io.quarkus.bootstrap.resolver.TsArtifact;
import io.quarkus.bootstrap.resolver.TsQuarkusExt;
import io.quarkus.deployment.runnerjar.ExecutableOutputOutcomeTestBase;
+import io.quarkus.maven.dependency.ArtifactDependency;
+import io.quarkus.maven.dependency.Dependency;
+import io.quarkus.maven.dependency.DependencyFlags;
+import io.quarkus.maven.dependency.GACTV;
public class ConditionalDependencyWithTwoConditionsTest extends ExecutableOutputOutcomeTestBase {
@@ -41,20 +42,20 @@ protected TsArtifact modelApp() {
}
@Override
- protected void assertDeploymentDeps(List deploymentDeps) throws Exception {
- final Set expected = new HashSet<>();
- expected.add(new AppDependency(
- new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, "ext-c-deployment", TsArtifact.DEFAULT_VERSION), "compile",
- AppDependency.DEPLOYMENT_CP_FLAG));
- expected.add(new AppDependency(
- new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, "ext-a-deployment", TsArtifact.DEFAULT_VERSION), "compile",
- AppDependency.DEPLOYMENT_CP_FLAG));
- expected.add(new AppDependency(
- new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, "ext-b-deployment", TsArtifact.DEFAULT_VERSION), "runtime",
- AppDependency.DEPLOYMENT_CP_FLAG));
- expected.add(new AppDependency(
- new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, "ext-d-deployment", TsArtifact.DEFAULT_VERSION), "compile",
- AppDependency.DEPLOYMENT_CP_FLAG));
- assertEquals(expected, new HashSet<>(deploymentDeps));
+ protected void assertDeploymentDeps(Set deploymentDeps) throws Exception {
+ final Set expected = new HashSet<>();
+ expected.add(new ArtifactDependency(
+ new GACTV(TsArtifact.DEFAULT_GROUP_ID, "ext-c-deployment", TsArtifact.DEFAULT_VERSION), "compile",
+ DependencyFlags.DEPLOYMENT_CP));
+ expected.add(new ArtifactDependency(
+ new GACTV(TsArtifact.DEFAULT_GROUP_ID, "ext-a-deployment", TsArtifact.DEFAULT_VERSION), "compile",
+ DependencyFlags.DEPLOYMENT_CP));
+ expected.add(new ArtifactDependency(
+ new GACTV(TsArtifact.DEFAULT_GROUP_ID, "ext-b-deployment", TsArtifact.DEFAULT_VERSION), "runtime",
+ DependencyFlags.DEPLOYMENT_CP));
+ expected.add(new ArtifactDependency(
+ new GACTV(TsArtifact.DEFAULT_GROUP_ID, "ext-d-deployment", TsArtifact.DEFAULT_VERSION), "compile",
+ DependencyFlags.DEPLOYMENT_CP));
+ assertEquals(expected, deploymentDeps);
}
}
diff --git a/core/deployment/src/test/java/io/quarkus/deployment/conditionaldeps/UnsatisfiedConditionalDependencyWithTwoConditionsTest.java b/core/deployment/src/test/java/io/quarkus/deployment/conditionaldeps/UnsatisfiedConditionalDependencyWithTwoConditionsTest.java
index bb95bab51d86f..ea93ac2ae9cb6 100644
--- a/core/deployment/src/test/java/io/quarkus/deployment/conditionaldeps/UnsatisfiedConditionalDependencyWithTwoConditionsTest.java
+++ b/core/deployment/src/test/java/io/quarkus/deployment/conditionaldeps/UnsatisfiedConditionalDependencyWithTwoConditionsTest.java
@@ -3,14 +3,15 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
-import io.quarkus.bootstrap.model.AppArtifact;
-import io.quarkus.bootstrap.model.AppDependency;
import io.quarkus.bootstrap.resolver.TsArtifact;
import io.quarkus.bootstrap.resolver.TsQuarkusExt;
import io.quarkus.deployment.runnerjar.ExecutableOutputOutcomeTestBase;
+import io.quarkus.maven.dependency.ArtifactDependency;
+import io.quarkus.maven.dependency.Dependency;
+import io.quarkus.maven.dependency.DependencyFlags;
+import io.quarkus.maven.dependency.GACTV;
public class UnsatisfiedConditionalDependencyWithTwoConditionsTest extends ExecutableOutputOutcomeTestBase {
@@ -38,14 +39,14 @@ protected TsArtifact modelApp() {
}
@Override
- protected void assertDeploymentDeps(List deploymentDeps) throws Exception {
- final Set expected = new HashSet<>();
- expected.add(new AppDependency(
- new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, "ext-c-deployment", TsArtifact.DEFAULT_VERSION), "compile",
- AppDependency.DEPLOYMENT_CP_FLAG));
- expected.add(new AppDependency(
- new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, "ext-a-deployment", TsArtifact.DEFAULT_VERSION), "compile",
- AppDependency.DEPLOYMENT_CP_FLAG));
- assertEquals(expected, new HashSet<>(deploymentDeps));
+ protected void assertDeploymentDeps(Set deploymentDeps) throws Exception {
+ final Set expected = new HashSet<>();
+ expected.add(new ArtifactDependency(
+ new GACTV(TsArtifact.DEFAULT_GROUP_ID, "ext-c-deployment", TsArtifact.DEFAULT_VERSION), "compile",
+ DependencyFlags.DEPLOYMENT_CP));
+ expected.add(new ArtifactDependency(
+ new GACTV(TsArtifact.DEFAULT_GROUP_ID, "ext-a-deployment", TsArtifact.DEFAULT_VERSION), "compile",
+ DependencyFlags.DEPLOYMENT_CP));
+ assertEquals(expected, deploymentDeps);
}
}
diff --git a/core/deployment/src/test/java/io/quarkus/deployment/runnerjar/ExcludeExtensionDepsTest.java b/core/deployment/src/test/java/io/quarkus/deployment/runnerjar/ExcludeExtensionDepsTest.java
index 634ef1ca41717..063733aa3f476 100644
--- a/core/deployment/src/test/java/io/quarkus/deployment/runnerjar/ExcludeExtensionDepsTest.java
+++ b/core/deployment/src/test/java/io/quarkus/deployment/runnerjar/ExcludeExtensionDepsTest.java
@@ -4,13 +4,16 @@
import java.util.HashSet;
import java.util.Set;
+import java.util.stream.Collectors;
-import io.quarkus.bootstrap.model.AppArtifact;
-import io.quarkus.bootstrap.model.AppDependency;
-import io.quarkus.bootstrap.model.AppModel;
+import io.quarkus.bootstrap.model.ApplicationModel;
import io.quarkus.bootstrap.resolver.TsArtifact;
import io.quarkus.bootstrap.resolver.TsDependency;
import io.quarkus.bootstrap.resolver.TsQuarkusExt;
+import io.quarkus.maven.dependency.ArtifactDependency;
+import io.quarkus.maven.dependency.Dependency;
+import io.quarkus.maven.dependency.DependencyFlags;
+import io.quarkus.maven.dependency.GACTV;
/**
* The test allowing to make sure that if we exclude an extension from another extension, the
@@ -66,30 +69,33 @@ protected TsArtifact modelApp() {
}
@Override
- protected void assertAppModel(AppModel appModel) throws Exception {
- final Set expectedDeployDeps = new HashSet<>();
+ protected void assertAppModel(ApplicationModel appModel) throws Exception {
+ final Set expectedDeployDeps = new HashSet<>();
expectedDeployDeps
- .add(new AppDependency(new AppArtifact("io.quarkus.bootstrap.test", "ext-b-deployment", "1"), "compile",
- AppDependency.DEPLOYMENT_CP_FLAG));
- assertEquals(expectedDeployDeps, new HashSet<>(appModel.getDeploymentDependencies()));
- final Set expectedRuntimeDeps = new HashSet<>();
- expectedRuntimeDeps.add(new AppDependency(new AppArtifact("io.quarkus.bootstrap.test", "ext-b", "1"), "compile",
- AppDependency.DIRECT_FLAG, AppDependency.RUNTIME_EXTENSION_ARTIFACT_FLAG, AppDependency.RUNTIME_CP_FLAG,
- AppDependency.DEPLOYMENT_CP_FLAG));
- expectedRuntimeDeps.add(new AppDependency(new AppArtifact("io.quarkus.bootstrap.test", "ext-b-dep-1", "1"), "compile",
- AppDependency.RUNTIME_CP_FLAG, AppDependency.DEPLOYMENT_CP_FLAG));
- expectedRuntimeDeps.add(new AppDependency(new AppArtifact("io.quarkus.bootstrap.test", "ext-b-dep-2", "1"), "compile",
- AppDependency.RUNTIME_CP_FLAG, AppDependency.DEPLOYMENT_CP_FLAG));
+ .add(new ArtifactDependency(new GACTV("io.quarkus.bootstrap.test", "ext-b-deployment", "1"), "compile",
+ DependencyFlags.DEPLOYMENT_CP));
+ assertEquals(expectedDeployDeps, appModel.getDependencies().stream().filter(d -> d.isDeploymentCp() && !d.isRuntimeCp())
+ .map(d -> new ArtifactDependency(d)).collect(Collectors.toSet()));
+ final Set expectedRuntimeDeps = new HashSet<>();
+ expectedRuntimeDeps.add(new ArtifactDependency(new GACTV("io.quarkus.bootstrap.test", "ext-b", "1"), "compile",
+ DependencyFlags.DIRECT, DependencyFlags.RUNTIME_EXTENSION_ARTIFACT, DependencyFlags.RUNTIME_CP,
+ DependencyFlags.DEPLOYMENT_CP));
+ expectedRuntimeDeps.add(new ArtifactDependency(new GACTV("io.quarkus.bootstrap.test", "ext-b-dep-1", "1"), "compile",
+ DependencyFlags.RUNTIME_CP, DependencyFlags.DEPLOYMENT_CP));
+ expectedRuntimeDeps.add(new ArtifactDependency(new GACTV("io.quarkus.bootstrap.test", "ext-b-dep-2", "1"), "compile",
+ DependencyFlags.RUNTIME_CP, DependencyFlags.DEPLOYMENT_CP));
expectedRuntimeDeps
- .add(new AppDependency(new AppArtifact("io.quarkus.bootstrap.test", "ext-b-dep-trans-1", "1"), "compile",
- AppDependency.RUNTIME_CP_FLAG, AppDependency.DEPLOYMENT_CP_FLAG));
+ .add(new ArtifactDependency(new GACTV("io.quarkus.bootstrap.test", "ext-b-dep-trans-1", "1"), "compile",
+ DependencyFlags.RUNTIME_CP, DependencyFlags.DEPLOYMENT_CP));
expectedRuntimeDeps
- .add(new AppDependency(new AppArtifact("io.quarkus.bootstrap.test", "ext-b-dep-trans-2", "1"), "compile",
- AppDependency.RUNTIME_CP_FLAG, AppDependency.DEPLOYMENT_CP_FLAG));
- assertEquals(expectedRuntimeDeps, new HashSet<>(appModel.getUserDependencies()));
- final Set expectedFullDeps = new HashSet<>();
+ .add(new ArtifactDependency(new GACTV("io.quarkus.bootstrap.test", "ext-b-dep-trans-2", "1"), "compile",
+ DependencyFlags.RUNTIME_CP, DependencyFlags.DEPLOYMENT_CP));
+ assertEquals(expectedRuntimeDeps,
+ appModel.getRuntimeDependencies().stream().map(d -> new ArtifactDependency(d)).collect(Collectors.toSet()));
+ final Set expectedFullDeps = new HashSet<>();
expectedFullDeps.addAll(expectedDeployDeps);
expectedFullDeps.addAll(expectedRuntimeDeps);
- assertEquals(expectedFullDeps, new HashSet<>(appModel.getFullDeploymentDeps()));
+ assertEquals(expectedFullDeps,
+ appModel.getDependencies().stream().map(d -> new ArtifactDependency(d)).collect(Collectors.toSet()));
}
}
diff --git a/core/deployment/src/test/java/io/quarkus/deployment/runnerjar/ExcludeLibDepsTest.java b/core/deployment/src/test/java/io/quarkus/deployment/runnerjar/ExcludeLibDepsTest.java
index 80537c2dd27ea..a02a07168b39a 100644
--- a/core/deployment/src/test/java/io/quarkus/deployment/runnerjar/ExcludeLibDepsTest.java
+++ b/core/deployment/src/test/java/io/quarkus/deployment/runnerjar/ExcludeLibDepsTest.java
@@ -4,13 +4,16 @@
import java.util.HashSet;
import java.util.Set;
+import java.util.stream.Collectors;
-import io.quarkus.bootstrap.model.AppArtifact;
-import io.quarkus.bootstrap.model.AppDependency;
-import io.quarkus.bootstrap.model.AppModel;
+import io.quarkus.bootstrap.model.ApplicationModel;
import io.quarkus.bootstrap.resolver.TsArtifact;
import io.quarkus.bootstrap.resolver.TsDependency;
import io.quarkus.bootstrap.resolver.TsQuarkusExt;
+import io.quarkus.maven.dependency.ArtifactDependency;
+import io.quarkus.maven.dependency.Dependency;
+import io.quarkus.maven.dependency.DependencyFlags;
+import io.quarkus.maven.dependency.GACTV;
/**
* The test allowing to make sure that if we exclude a library from an extension, the
@@ -58,30 +61,33 @@ protected TsArtifact modelApp() {
}
@Override
- protected void assertAppModel(AppModel appModel) throws Exception {
- final Set expectedDeployDeps = new HashSet<>();
+ protected void assertAppModel(ApplicationModel appModel) throws Exception {
+ final Set expectedDeployDeps = new HashSet<>();
expectedDeployDeps
- .add(new AppDependency(new AppArtifact("io.quarkus.bootstrap.test", "ext-a-deployment", "1"), "compile",
- AppDependency.DEPLOYMENT_CP_FLAG));
- assertEquals(expectedDeployDeps, new HashSet<>(appModel.getDeploymentDependencies()));
- final Set expectedRuntimeDeps = new HashSet<>();
- expectedRuntimeDeps.add(new AppDependency(new AppArtifact("io.quarkus.bootstrap.test", "ext-a", "1"), "compile",
- AppDependency.DIRECT_FLAG, AppDependency.RUNTIME_EXTENSION_ARTIFACT_FLAG, AppDependency.RUNTIME_CP_FLAG,
- AppDependency.DEPLOYMENT_CP_FLAG));
- expectedRuntimeDeps.add(new AppDependency(new AppArtifact("io.quarkus.bootstrap.test", "ext-a-dep-1", "1"), "compile",
- AppDependency.RUNTIME_CP_FLAG, AppDependency.DEPLOYMENT_CP_FLAG));
- expectedRuntimeDeps.add(new AppDependency(new AppArtifact("io.quarkus.bootstrap.test", "ext-a-dep-2", "1"), "compile",
- AppDependency.RUNTIME_CP_FLAG, AppDependency.DEPLOYMENT_CP_FLAG));
+ .add(new ArtifactDependency(new GACTV("io.quarkus.bootstrap.test", "ext-a-deployment", "1"), "compile",
+ DependencyFlags.DEPLOYMENT_CP));
+ assertEquals(expectedDeployDeps, appModel.getDependencies().stream().filter(d -> d.isDeploymentCp() && !d.isRuntimeCp())
+ .map(d -> new ArtifactDependency(d)).collect(Collectors.toSet()));
+ final Set expectedRuntimeDeps = new HashSet<>();
+ expectedRuntimeDeps.add(new ArtifactDependency(new GACTV("io.quarkus.bootstrap.test", "ext-a", "1"), "compile",
+ DependencyFlags.DIRECT, DependencyFlags.RUNTIME_EXTENSION_ARTIFACT, DependencyFlags.RUNTIME_CP,
+ DependencyFlags.DEPLOYMENT_CP));
+ expectedRuntimeDeps.add(new ArtifactDependency(new GACTV("io.quarkus.bootstrap.test", "ext-a-dep-1", "1"), "compile",
+ DependencyFlags.RUNTIME_CP, DependencyFlags.DEPLOYMENT_CP));
+ expectedRuntimeDeps.add(new ArtifactDependency(new GACTV("io.quarkus.bootstrap.test", "ext-a-dep-2", "1"), "compile",
+ DependencyFlags.RUNTIME_CP, DependencyFlags.DEPLOYMENT_CP));
expectedRuntimeDeps
- .add(new AppDependency(new AppArtifact("io.quarkus.bootstrap.test", "ext-a-dep-trans-1", "1"), "compile",
- AppDependency.RUNTIME_CP_FLAG, AppDependency.DEPLOYMENT_CP_FLAG));
+ .add(new ArtifactDependency(new GACTV("io.quarkus.bootstrap.test", "ext-a-dep-trans-1", "1"), "compile",
+ DependencyFlags.RUNTIME_CP, DependencyFlags.DEPLOYMENT_CP));
expectedRuntimeDeps
- .add(new AppDependency(new AppArtifact("io.quarkus.bootstrap.test", "ext-a-dep-trans-2", "1"), "compile",
- AppDependency.RUNTIME_CP_FLAG, AppDependency.DEPLOYMENT_CP_FLAG));
- assertEquals(expectedRuntimeDeps, new HashSet<>(appModel.getUserDependencies()));
- final Set expectedFullDeps = new HashSet<>();
+ .add(new ArtifactDependency(new GACTV("io.quarkus.bootstrap.test", "ext-a-dep-trans-2", "1"), "compile",
+ DependencyFlags.RUNTIME_CP, DependencyFlags.DEPLOYMENT_CP));
+ assertEquals(expectedRuntimeDeps,
+ appModel.getRuntimeDependencies().stream().map(d -> new ArtifactDependency(d)).collect(Collectors.toSet()));
+ final Set expectedFullDeps = new HashSet<>();
expectedFullDeps.addAll(expectedDeployDeps);
expectedFullDeps.addAll(expectedRuntimeDeps);
- assertEquals(expectedFullDeps, new HashSet<>(appModel.getFullDeploymentDeps()));
+ assertEquals(expectedFullDeps,
+ appModel.getDependencies().stream().map(d -> new ArtifactDependency(d)).collect(Collectors.toSet()));
}
}
diff --git a/core/deployment/src/test/java/io/quarkus/deployment/runnerjar/ExecutableOutputOutcomeTestBase.java b/core/deployment/src/test/java/io/quarkus/deployment/runnerjar/ExecutableOutputOutcomeTestBase.java
index fdb2ebe7b8737..afc35d87a2359 100644
--- a/core/deployment/src/test/java/io/quarkus/deployment/runnerjar/ExecutableOutputOutcomeTestBase.java
+++ b/core/deployment/src/test/java/io/quarkus/deployment/runnerjar/ExecutableOutputOutcomeTestBase.java
@@ -12,6 +12,7 @@
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
@@ -20,6 +21,7 @@
import java.util.Set;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
+import java.util.stream.Collectors;
import java.util.stream.Stream;
import io.quarkus.bootstrap.BootstrapConstants;
@@ -27,13 +29,14 @@
import io.quarkus.bootstrap.app.AugmentResult;
import io.quarkus.bootstrap.app.CuratedApplication;
import io.quarkus.bootstrap.app.QuarkusBootstrap;
-import io.quarkus.bootstrap.model.AppArtifact;
-import io.quarkus.bootstrap.model.AppDependency;
-import io.quarkus.bootstrap.model.AppModel;
+import io.quarkus.bootstrap.model.ApplicationModel;
import io.quarkus.bootstrap.resolver.TsArtifact;
import io.quarkus.bootstrap.resolver.TsArtifact.ContentProvider;
import io.quarkus.bootstrap.resolver.TsDependency;
import io.quarkus.bootstrap.resolver.update.CreatorOutcomeTestBase;
+import io.quarkus.maven.dependency.ArtifactDependency;
+import io.quarkus.maven.dependency.Dependency;
+import io.quarkus.maven.dependency.ResolvedDependency;
public abstract class ExecutableOutputOutcomeTestBase extends CreatorOutcomeTestBase {
@@ -48,10 +51,10 @@ protected void addToExpectedLib(TsArtifact entry) {
expectedLib.add(entry.getGroupId() + '.' + entry.getArtifactId() + '-' + entry.getVersion() + '.' + entry.getType());
}
- protected void assertDeploymentDeps(List deploymentDeps) throws Exception {
+ protected void assertDeploymentDeps(Set deploymentDeps) throws Exception {
}
- protected void assertAppModel(AppModel appModel) throws Exception {
+ protected void assertAppModel(ApplicationModel appModel) throws Exception {
}
protected String[] expectedExtensionDependencies() {
@@ -110,18 +113,19 @@ public Path getPath(Path workDir) throws IOException {
return platformPropsDep;
}
- @SuppressWarnings("deprecation")
@Override
protected void testCreator(QuarkusBootstrap creator) throws Exception {
System.setProperty("quarkus.package.type", "legacy-jar");
try {
CuratedApplication curated = creator.bootstrap();
- assertAppModel(curated.getAppModel());
+ assertAppModel(curated.getApplicationModel());
final String[] expectedExtensions = expectedExtensionDependencies();
if (expectedExtensions != null) {
- assertExtensionDependencies(curated.getAppModel(), expectedExtensions);
+ assertExtensionDependencies(curated.getApplicationModel(), expectedExtensions);
}
- assertDeploymentDeps(curated.getAppModel().getDeploymentDependencies());
+ assertDeploymentDeps(
+ curated.getApplicationModel().getDependencies().stream().filter(d -> d.isDeploymentCp() && !d.isRuntimeCp())
+ .map(d -> new ArtifactDependency(d)).collect(Collectors.toSet()));
AugmentAction action = curated.createAugmentor();
AugmentResult outcome = action.createProductionApplication();
@@ -194,24 +198,28 @@ protected void testCreator(QuarkusBootstrap creator) throws Exception {
}
}
- @SuppressWarnings("deprecation")
- private static void assertExtensionDependencies(AppModel appModel, String[] expectedExtensions) {
- final Set expectedRuntime = new HashSet<>(expectedExtensions.length);
- final Set expectedDeployment = new HashSet<>(expectedExtensions.length);
+ private static void assertExtensionDependencies(ApplicationModel appModel, String[] expectedExtensions) {
+ final Set expectedRuntime = new HashSet<>(expectedExtensions.length);
+ final Set expectedDeployment = new HashSet<>(expectedExtensions.length);
for (String rtId : expectedExtensions) {
- expectedRuntime.add(new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, rtId, TsArtifact.DEFAULT_VERSION));
+ expectedRuntime.add(TsArtifact.DEFAULT_GROUP_ID + ":" + rtId + "::jar:" + TsArtifact.DEFAULT_VERSION);
expectedDeployment
- .add(new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, rtId + "-deployment", TsArtifact.DEFAULT_VERSION));
+ .add(TsArtifact.DEFAULT_GROUP_ID + ":" + rtId + "-deployment" + "::jar:" + TsArtifact.DEFAULT_VERSION);
}
- for (AppDependency dep : appModel.getUserDependencies()) {
- assertTrue(expectedRuntime.contains(dep.getArtifact()), dep.getArtifact().toString());
+ final Collection rtDeps = appModel.getRuntimeDependencies();
+ for (Dependency dep : rtDeps) {
+ final String coords = dep.toGACTVString();
+ assertTrue(expectedRuntime.contains(coords), coords);
}
- assertEquals(expectedExtensions.length, appModel.getUserDependencies().size());
+ assertEquals(expectedExtensions.length, rtDeps.size());
- for (AppDependency dep : appModel.getDeploymentDependencies()) {
- assertTrue(expectedDeployment.contains(dep.getArtifact()));
+ final List deploymentOnly = appModel.getDependencies().stream()
+ .filter(d -> d.isDeploymentCp() && !d.isRuntimeCp()).collect(Collectors.toList());
+ for (Dependency dep : deploymentOnly) {
+ final String coords = dep.toGACTVString();
+ assertTrue(expectedDeployment.contains(coords), coords);
}
- assertEquals(expectedExtensions.length, appModel.getDeploymentDependencies().size());
+ assertEquals(expectedExtensions.length, deploymentOnly.size());
}
}
diff --git a/core/deployment/src/test/java/io/quarkus/deployment/runnerjar/OptionalDepsTest.java b/core/deployment/src/test/java/io/quarkus/deployment/runnerjar/OptionalDepsTest.java
index d3fbaca4ef03a..8aced19be0e78 100644
--- a/core/deployment/src/test/java/io/quarkus/deployment/runnerjar/OptionalDepsTest.java
+++ b/core/deployment/src/test/java/io/quarkus/deployment/runnerjar/OptionalDepsTest.java
@@ -3,14 +3,15 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
-import io.quarkus.bootstrap.model.AppArtifact;
-import io.quarkus.bootstrap.model.AppDependency;
import io.quarkus.bootstrap.resolver.TsArtifact;
import io.quarkus.bootstrap.resolver.TsDependency;
import io.quarkus.bootstrap.resolver.TsQuarkusExt;
+import io.quarkus.maven.dependency.ArtifactDependency;
+import io.quarkus.maven.dependency.Dependency;
+import io.quarkus.maven.dependency.DependencyFlags;
+import io.quarkus.maven.dependency.GACTV;
public class OptionalDepsTest extends ExecutableOutputOutcomeTestBase {
@@ -66,18 +67,19 @@ protected TsArtifact modelApp() {
}
@Override
- protected void assertDeploymentDeps(List deploymentDeps) throws Exception {
- final Set expected = new HashSet<>();
- expected.add(new AppDependency(new AppArtifact("io.quarkus.bootstrap.test", "ext-a-deployment", "1"), "compile", true,
- AppDependency.DEPLOYMENT_CP_FLAG));
- expected.add(
- new AppDependency(new AppArtifact("io.quarkus.bootstrap.test", "ext-b-deployment-dep", "1"), "compile", true,
- AppDependency.DEPLOYMENT_CP_FLAG));
- expected.add(new AppDependency(new AppArtifact("io.quarkus.bootstrap.test", "ext-b-deployment", "1"), "compile", true,
- AppDependency.DEPLOYMENT_CP_FLAG));
- expected.add(
- new AppDependency(new AppArtifact("io.quarkus.bootstrap.test", "ext-d-deployment", "1"), "compile", false,
- AppDependency.DEPLOYMENT_CP_FLAG));
- assertEquals(expected, new HashSet<>(deploymentDeps));
+ protected void assertDeploymentDeps(Set deploymentDeps) throws Exception {
+ final Set expected = new HashSet<>();
+ expected.add(new ArtifactDependency(new GACTV("io.quarkus.bootstrap.test", "ext-a-deployment", "1"), "compile",
+ DependencyFlags.OPTIONAL,
+ DependencyFlags.DEPLOYMENT_CP));
+ expected.add(new ArtifactDependency(new GACTV("io.quarkus.bootstrap.test", "ext-b-deployment-dep", "1"), "compile",
+ DependencyFlags.OPTIONAL,
+ DependencyFlags.DEPLOYMENT_CP));
+ expected.add(new ArtifactDependency(new GACTV("io.quarkus.bootstrap.test", "ext-b-deployment", "1"), "compile",
+ DependencyFlags.OPTIONAL,
+ DependencyFlags.DEPLOYMENT_CP));
+ expected.add(new ArtifactDependency(new GACTV("io.quarkus.bootstrap.test", "ext-d-deployment", "1"), "compile",
+ DependencyFlags.DEPLOYMENT_CP));
+ assertEquals(expected, deploymentDeps);
}
}
diff --git a/core/deployment/src/test/java/io/quarkus/deployment/runnerjar/ProvidedExtensionDepsTest.java b/core/deployment/src/test/java/io/quarkus/deployment/runnerjar/ProvidedExtensionDepsTest.java
index 86ab3e41fb15b..bad9b791d832c 100644
--- a/core/deployment/src/test/java/io/quarkus/deployment/runnerjar/ProvidedExtensionDepsTest.java
+++ b/core/deployment/src/test/java/io/quarkus/deployment/runnerjar/ProvidedExtensionDepsTest.java
@@ -3,14 +3,15 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
-import io.quarkus.bootstrap.model.AppArtifact;
-import io.quarkus.bootstrap.model.AppDependency;
import io.quarkus.bootstrap.resolver.TsArtifact;
import io.quarkus.bootstrap.resolver.TsDependency;
import io.quarkus.bootstrap.resolver.TsQuarkusExt;
+import io.quarkus.maven.dependency.ArtifactDependency;
+import io.quarkus.maven.dependency.Dependency;
+import io.quarkus.maven.dependency.DependencyFlags;
+import io.quarkus.maven.dependency.GACTV;
public class ProvidedExtensionDepsTest extends ExecutableOutputOutcomeTestBase {
@@ -41,12 +42,12 @@ protected TsArtifact modelApp() {
}
@Override
- protected void assertDeploymentDeps(List deploymentDeps) throws Exception {
- final Set expected = new HashSet<>();
- expected.add(new AppDependency(new AppArtifact("io.quarkus.bootstrap.test", "ext-a-deployment", "1"), "compile",
- AppDependency.DEPLOYMENT_CP_FLAG));
- expected.add(new AppDependency(new AppArtifact("io.quarkus.bootstrap.test", "ext-a-deployment-dep", "1"), "compile",
- AppDependency.DEPLOYMENT_CP_FLAG));
- assertEquals(expected, new HashSet<>(deploymentDeps));
+ protected void assertDeploymentDeps(Set deploymentDeps) throws Exception {
+ final Set expected = new HashSet<>();
+ expected.add(new ArtifactDependency(new GACTV("io.quarkus.bootstrap.test", "ext-a-deployment", "1"), "compile",
+ DependencyFlags.DEPLOYMENT_CP));
+ expected.add(new ArtifactDependency(new GACTV("io.quarkus.bootstrap.test", "ext-a-deployment-dep", "1"), "compile",
+ DependencyFlags.DEPLOYMENT_CP));
+ assertEquals(expected, deploymentDeps);
}
}
diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/AppModelGradleResolver.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/AppModelGradleResolver.java
index 0e1ccd52c6f43..9520b0404a920 100644
--- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/AppModelGradleResolver.java
+++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/AppModelGradleResolver.java
@@ -1,6 +1,7 @@
package io.quarkus.gradle;
import java.nio.file.Path;
+import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Set;
@@ -13,74 +14,86 @@
import org.gradle.api.internal.artifacts.dependencies.DefaultDependencyArtifact;
import org.gradle.api.internal.artifacts.dependencies.DefaultExternalModuleDependency;
-import io.quarkus.bootstrap.model.AppArtifact;
-import io.quarkus.bootstrap.model.AppArtifactKey;
-import io.quarkus.bootstrap.model.AppDependency;
-import io.quarkus.bootstrap.model.AppModel;
-import io.quarkus.bootstrap.model.gradle.QuarkusModel;
+import io.quarkus.bootstrap.model.ApplicationModel;
import io.quarkus.bootstrap.resolver.AppModelResolver;
import io.quarkus.bootstrap.resolver.AppModelResolverException;
-import io.quarkus.bootstrap.util.QuarkusModelHelper;
+import io.quarkus.maven.dependency.ArtifactCoords;
+import io.quarkus.maven.dependency.ArtifactKey;
+import io.quarkus.maven.dependency.Dependency;
+import io.quarkus.maven.dependency.GACTV;
+import io.quarkus.maven.dependency.ResolvedArtifactDependency;
+import io.quarkus.maven.dependency.ResolvedDependency;
public class AppModelGradleResolver implements AppModelResolver {
- private AppModel appModel;
private final Project project;
- private final QuarkusModel model;
+ private final ApplicationModel model;
- public AppModelGradleResolver(Project project, QuarkusModel model) {
+ public AppModelGradleResolver(Project project, ApplicationModel model) {
this.model = model;
this.project = project;
}
@Override
- public String getLatestVersion(AppArtifact appArtifact, String upToVersion, boolean inclusive)
+ public String getLatestVersion(ArtifactCoords appArtifact, String upToVersion,
+ boolean inclusive)
throws AppModelResolverException {
try {
- return resolveArtifact(new AppArtifact(appArtifact.getGroupId(), appArtifact.getArtifactId(),
- appArtifact.getClassifier(), appArtifact.getType(),
- "[" + appArtifact.getVersion() + "," + upToVersion + (inclusive ? "]" : ")"))).getVersion();
+ return resolveArtifact(
+ new GACTV(appArtifact.getGroupId(), appArtifact.getArtifactId(),
+ appArtifact.getClassifier(), appArtifact.getType(),
+ "[" + appArtifact.getVersion() + "," + upToVersion + (inclusive ? "]" : ")")))
+ .getVersion();
} catch (AppModelResolverException e) {
return null;
}
}
@Override
- public String getLatestVersionFromRange(AppArtifact appArtifact, String range) throws AppModelResolverException {
+ public String getLatestVersionFromRange(ArtifactCoords appArtifact, String range)
+ throws AppModelResolverException {
try {
- return resolveArtifact(new AppArtifact(appArtifact.getGroupId(), appArtifact.getArtifactId(),
- appArtifact.getClassifier(), appArtifact.getType(), range)).getVersion();
+ return resolveArtifact(
+ new GACTV(appArtifact.getGroupId(), appArtifact.getArtifactId(),
+ appArtifact.getClassifier(), appArtifact.getType(), range)).getVersion();
} catch (AppModelResolverException e) {
return null;
}
}
@Override
- public String getNextVersion(AppArtifact appArtifact, String fromVersion, boolean fromVersionIncluded, String upToVersion,
+ public String getNextVersion(ArtifactCoords appArtifact, String fromVersion,
+ boolean fromVersionIncluded, String upToVersion,
boolean upToVersionIncluded)
throws AppModelResolverException {
throw new UnsupportedOperationException();
}
@Override
- public List listLaterVersions(AppArtifact appArtifact, String upToVersion, boolean inclusive)
+ public List listLaterVersions(ArtifactCoords appArtifact, String upToVersion,
+ boolean inclusive)
throws AppModelResolverException {
throw new UnsupportedOperationException();
}
@Override
- public void relink(AppArtifact appArtifact, Path localPath) throws AppModelResolverException {
+ public void relink(ArtifactCoords artifact, Path localPath)
+ throws AppModelResolverException {
}
@Override
- public Path resolve(AppArtifact appArtifact) throws AppModelResolverException {
- return resolveArtifact(appArtifact).getPaths().getSinglePath();
+ public ResolvedDependency resolve(ArtifactCoords appArtifact) throws AppModelResolverException {
+ return resolveArtifact(appArtifact);
}
- private AppArtifact resolveArtifact(AppArtifact appArtifact) throws AppModelResolverException {
- if (appArtifact.isResolved()) {
- return appArtifact;
+ private ResolvedDependency resolveArtifact(
+ ArtifactCoords appArtifact) throws AppModelResolverException {
+ if (ResolvedDependency.class.isAssignableFrom(appArtifact.getClass())) {
+ final ResolvedDependency resolved = (ResolvedDependency) appArtifact;
+ if (resolved.isResolved()) {
+ return resolved;
+ }
}
final DefaultDependencyArtifact dep = new DefaultDependencyArtifact();
dep.setExtension(appArtifact.getType());
@@ -108,48 +121,43 @@ private AppArtifact resolveArtifact(AppArtifact appArtifact) throws AppModelReso
&& (a.getClassifier() == null ? appArtifact.getClassifier() == null
: a.getClassifier().equals(appArtifact.getClassifier()))
&& appArtifact.getGroupId().equals(a.getModuleVersion().getId().getGroup())) {
- if (!appArtifact.getVersion().equals(a.getModuleVersion().getId().getVersion())) {
- appArtifact = new AppArtifact(appArtifact.getGroupId(), appArtifact.getArtifactId(),
- appArtifact.getClassifier(), appArtifact.getType(), a.getModuleVersion().getId().getVersion());
- }
- appArtifact.setPath(a.getFile().toPath());
- break;
+ final String version = appArtifact.getVersion().equals(a.getModuleVersion().getId().getVersion())
+ ? appArtifact.getVersion()
+ : a.getModuleVersion().getId().getVersion();
+ return new ResolvedArtifactDependency(appArtifact.getGroupId(), appArtifact.getArtifactId(),
+ appArtifact.getClassifier(), appArtifact.getType(), version, a.getFile().toPath());
}
}
-
- if (!appArtifact.isResolved()) {
- throw new AppModelResolverException("Failed to resolve " + appArtifact);
- }
- return appArtifact;
+ throw new AppModelResolverException("Failed to resolve " + appArtifact);
}
@Override
- public List resolveUserDependencies(AppArtifact appArtifact, List directDeps) {
+ public Collection resolveUserDependencies(ArtifactCoords appArtifact,
+ Collection directDeps) {
return Collections.emptyList();
}
@Override
- public AppModel resolveModel(AppArtifact appArtifact) throws AppModelResolverException {
- if (appModel != null) {
- if (appModel.getAppArtifact().equals(appArtifact)) {
- return appModel;
- } else {
- throw new AppModelResolverException(
- "Requested artifact : " + appArtifact + ", does not match loaded model " + appModel.getAppArtifact());
- }
+ public ApplicationModel resolveModel(ArtifactCoords appArtifact)
+ throws AppModelResolverException {
+ if (model.getAppArtifact().toGACTVString().equals(appArtifact.toGACTVString())) {
+ return model;
}
- appModel = QuarkusModelHelper.convert(model, appArtifact);
- return appModel;
+ throw new AppModelResolverException(
+ "Requested artifact " + appArtifact + " does not match loaded model " + model.getAppArtifact());
}
@Override
- public AppModel resolveModel(AppArtifact root, List deps) throws AppModelResolverException {
+ public ApplicationModel resolveModel(ArtifactCoords root, Collection deps)
+ throws AppModelResolverException {
throw new UnsupportedOperationException();
}
@Override
- public AppModel resolveManagedModel(AppArtifact appArtifact, List directDeps, AppArtifact managingProject,
- Set localProjects)
+ public ApplicationModel resolveManagedModel(ArtifactCoords appArtifact,
+ Collection directDeps,
+ ArtifactCoords managingProject,
+ Set localProjects)
throws AppModelResolverException {
return resolveModel(appArtifact);
}
diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java
index 1274a414b4f70..a3c87b826f56a 100644
--- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java
+++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java
@@ -30,7 +30,7 @@
import org.gradle.tooling.provider.model.ToolingModelBuilderRegistry;
import org.gradle.util.GradleVersion;
-import io.quarkus.gradle.builder.QuarkusModelBuilder;
+import io.quarkus.gradle.builder.GradleApplicationModelBuilder;
import io.quarkus.gradle.dependency.ApplicationDeploymentClasspathBuilder;
import io.quarkus.gradle.dependency.ConditionalDependenciesEnabler;
import io.quarkus.gradle.dependency.ExtensionDependency;
@@ -267,7 +267,7 @@ private Set getSourcesParents(SourceSet mainSourceSet) {
}
private void registerModel() {
- registry.register(new QuarkusModelBuilder());
+ registry.register(new GradleApplicationModelBuilder());
}
private void verifyGradleVersion() {
diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/builder/GradleApplicationModelBuilder.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/builder/GradleApplicationModelBuilder.java
new file mode 100644
index 0000000000000..1d2b9ac22531f
--- /dev/null
+++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/builder/GradleApplicationModelBuilder.java
@@ -0,0 +1,640 @@
+package io.quarkus.gradle.builder;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.gradle.api.GradleException;
+import org.gradle.api.Project;
+import org.gradle.api.artifacts.Configuration;
+import org.gradle.api.artifacts.ResolvedArtifact;
+import org.gradle.api.artifacts.ResolvedConfiguration;
+import org.gradle.api.artifacts.component.ProjectComponentIdentifier;
+import org.gradle.api.initialization.IncludedBuild;
+import org.gradle.api.internal.artifacts.dependencies.DefaultDependencyArtifact;
+import org.gradle.api.internal.artifacts.dependencies.DefaultExternalModuleDependency;
+import org.gradle.api.plugins.JavaPlugin;
+import org.gradle.api.plugins.JavaPluginConvention;
+import org.gradle.api.tasks.SourceSet;
+import org.gradle.api.tasks.TaskCollection;
+import org.gradle.api.tasks.compile.AbstractCompile;
+import org.gradle.language.jvm.tasks.ProcessResources;
+import org.gradle.tooling.provider.model.ParameterizedToolingModelBuilder;
+
+import io.quarkus.bootstrap.BootstrapConstants;
+import io.quarkus.bootstrap.model.ApplicationModel;
+import io.quarkus.bootstrap.model.ApplicationModelBuilder;
+import io.quarkus.bootstrap.model.CapabilityContract;
+import io.quarkus.bootstrap.model.PlatformImports;
+import io.quarkus.bootstrap.model.PlatformImportsImpl;
+import io.quarkus.bootstrap.model.gradle.ModelParameter;
+import io.quarkus.bootstrap.model.gradle.impl.ModelParameterImpl;
+import io.quarkus.bootstrap.resolver.AppModelResolverException;
+import io.quarkus.bootstrap.workspace.DefaultProcessedSources;
+import io.quarkus.bootstrap.workspace.DefaultWorkspaceModule;
+import io.quarkus.bootstrap.workspace.ProcessedSources;
+import io.quarkus.gradle.QuarkusPlugin;
+import io.quarkus.gradle.dependency.ApplicationDeploymentClasspathBuilder;
+import io.quarkus.gradle.dependency.DependencyUtils;
+import io.quarkus.maven.dependency.ArtifactCoords;
+import io.quarkus.maven.dependency.ArtifactKey;
+import io.quarkus.maven.dependency.GACT;
+import io.quarkus.maven.dependency.GACTV;
+import io.quarkus.maven.dependency.GAV;
+import io.quarkus.maven.dependency.ResolvedDependency;
+import io.quarkus.maven.dependency.ResolvedDependencyBuilder;
+import io.quarkus.paths.PathCollection;
+import io.quarkus.paths.PathList;
+import io.quarkus.runtime.LaunchMode;
+import io.quarkus.runtime.util.HashUtil;
+
+public class GradleApplicationModelBuilder implements ParameterizedToolingModelBuilder {
+
+ private static final String MAIN_RESOURCES_OUTPUT = "build/resources/main";
+ private static final String CLASSES_OUTPUT = "build/classes";
+ private static final String DEPLOYMENT_CONFIGURATION = "quarkusDeploymentConfiguration";
+ private static final String CLASSPATH_CONFIGURATION = "quarkusClasspathConfiguration";
+
+ private static Configuration classpathConfig(Project project, LaunchMode mode) {
+ if (LaunchMode.TEST.equals(mode)) {
+ return project.getConfigurations().getByName(JavaPlugin.TEST_RUNTIME_CLASSPATH_CONFIGURATION_NAME);
+ }
+ if (LaunchMode.DEVELOPMENT.equals(mode)) {
+ Configuration classpathConfiguration = project.getConfigurations().findByName(CLASSPATH_CONFIGURATION);
+ if (classpathConfiguration != null) {
+ project.getConfigurations().remove(classpathConfiguration);
+ }
+
+ return project.getConfigurations().create(CLASSPATH_CONFIGURATION).extendsFrom(
+ project.getConfigurations().getByName(QuarkusPlugin.DEV_MODE_CONFIGURATION_NAME),
+ project.getConfigurations().getByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME),
+ project.getConfigurations().getByName(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME));
+ }
+ return project.getConfigurations().getByName(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME);
+ }
+
+ private static Configuration deploymentClasspathConfig(Project project, LaunchMode mode,
+ Collection platforms) {
+
+ Configuration deploymentConfiguration = project.getConfigurations().findByName(DEPLOYMENT_CONFIGURATION);
+ if (deploymentConfiguration != null) {
+ project.getConfigurations().remove(deploymentConfiguration);
+ }
+
+ deploymentConfiguration = project.getConfigurations().create(DEPLOYMENT_CONFIGURATION)
+ .withDependencies(ds -> ds.addAll(platforms));
+ Configuration implementationDeployment = project.getConfigurations().findByName(ApplicationDeploymentClasspathBuilder
+ .toDeploymentConfigurationName(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME));
+ if (implementationDeployment != null) {
+ deploymentConfiguration.extendsFrom(implementationDeployment);
+ }
+
+ if (LaunchMode.TEST.equals(mode)) {
+ Configuration testDeploymentConfiguration = project.getConfigurations()
+ .findByName(ApplicationDeploymentClasspathBuilder
+ .toDeploymentConfigurationName(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME));
+ if (testDeploymentConfiguration != null) {
+ deploymentConfiguration.extendsFrom(testDeploymentConfiguration);
+ }
+ }
+ if (LaunchMode.DEVELOPMENT.equals(mode)) {
+ Configuration devDeploymentConfiguration = project.getConfigurations()
+ .findByName(ApplicationDeploymentClasspathBuilder
+ .toDeploymentConfigurationName(QuarkusPlugin.DEV_MODE_CONFIGURATION_NAME));
+ if (devDeploymentConfiguration != null) {
+ deploymentConfiguration.extendsFrom(devDeploymentConfiguration);
+ }
+
+ }
+ return deploymentConfiguration;
+ }
+
+ @Override
+ public boolean canBuild(String modelName) {
+ return modelName.equals(ApplicationModel.class.getName());
+ }
+
+ @Override
+ public Class