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 14cdfaa81eb75..d7f5f4700d71a 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/ApplicationArchive.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/ApplicationArchive.java @@ -6,7 +6,6 @@ import org.jboss.jandex.IndexView; -import io.quarkus.bootstrap.model.AppArtifactKey; import io.quarkus.bootstrap.model.PathsCollection; import io.quarkus.maven.dependency.ArtifactKey; import io.quarkus.maven.dependency.ResolvedDependency; @@ -72,12 +71,6 @@ public interface ApplicationArchive { */ 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 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 252e59aeaf3db..a7818759ba9b5 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/ApplicationArchiveImpl.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/ApplicationArchiveImpl.java @@ -8,7 +8,6 @@ import org.jboss.jandex.IndexView; -import io.quarkus.bootstrap.model.AppArtifactKey; import io.quarkus.bootstrap.model.PathsCollection; import io.quarkus.builder.item.MultiBuildItem; import io.quarkus.maven.dependency.ArtifactKey; @@ -62,21 +61,6 @@ public PathCollection getResolvedPaths() { return PathList.from(openTree.getOriginalTree().getRoots()); } - @Override - @Deprecated - /** - * @deprecated in favor of {@link #getKey()} - * @return archive key - */ - public AppArtifactKey getArtifactKey() { - if (resolvedDependency == null) { - return null; - } - ArtifactKey artifactKey = resolvedDependency.getKey(); - return new AppArtifactKey(artifactKey.getGroupId(), artifactKey.getArtifactId(), artifactKey.getClassifier(), - artifactKey.getType()); - } - @Override public ArtifactKey getKey() { return resolvedDependency != null ? resolvedDependency.getKey() : null; diff --git a/devtools/gradle/gradle-extension-plugin/src/main/java/io/quarkus/extension/gradle/tasks/ExtensionDescriptorTask.java b/devtools/gradle/gradle-extension-plugin/src/main/java/io/quarkus/extension/gradle/tasks/ExtensionDescriptorTask.java index 938f1d83199f8..d58c4ba9e54b8 100644 --- a/devtools/gradle/gradle-extension-plugin/src/main/java/io/quarkus/extension/gradle/tasks/ExtensionDescriptorTask.java +++ b/devtools/gradle/gradle-extension-plugin/src/main/java/io/quarkus/extension/gradle/tasks/ExtensionDescriptorTask.java @@ -12,6 +12,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Properties; import java.util.Set; @@ -36,14 +37,13 @@ import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; import io.quarkus.bootstrap.BootstrapConstants; -import io.quarkus.bootstrap.model.AppArtifactCoords; -import io.quarkus.bootstrap.model.AppArtifactKey; import io.quarkus.bootstrap.model.ApplicationModelBuilder; import io.quarkus.devtools.project.extensions.ScmInfoProvider; import io.quarkus.extension.gradle.QuarkusExtensionConfiguration; import io.quarkus.extension.gradle.dsl.Capability; import io.quarkus.extension.gradle.dsl.RemovedResource; import io.quarkus.fs.util.ZipUtils; +import io.quarkus.maven.dependency.ArtifactCoords; import io.quarkus.maven.dependency.ArtifactKey; import io.quarkus.maven.dependency.GACT; @@ -113,9 +113,9 @@ private void generateQuarkusExtensionProperties(Path metaInfDir) { if (conditionalDependencies != null && !conditionalDependencies.isEmpty()) { final StringBuilder buf = new StringBuilder(); int i = 0; - buf.append(AppArtifactCoords.fromString(conditionalDependencies.get(i++)).toString()); + buf.append(ArtifactCoords.fromString(conditionalDependencies.get(i++))); while (i < conditionalDependencies.size()) { - buf.append(' ').append(AppArtifactCoords.fromString(conditionalDependencies.get(i++)).toString()); + buf.append(' ').append(ArtifactCoords.fromString(conditionalDependencies.get(i++))); } props.setProperty(BootstrapConstants.CONDITIONAL_DEPENDENCIES, buf.toString()); } @@ -315,7 +315,7 @@ private void computeArtifactCoords(ObjectNode extObject) { } } if (artifactNode == null || groupId == null || artifactId == null || version == null) { - final AppArtifactCoords coords = new AppArtifactCoords( + final ArtifactCoords coords = ArtifactCoords.of( groupId == null ? projectInfo.get("group") : groupId, artifactId == null ? projectInfo.get("name") : artifactId, null, @@ -363,7 +363,7 @@ private void computeQuarkusExtensions(ObjectNode extObject) { ObjectNode metadataNode = getMetadataNode(extObject); Set extensions = new HashSet<>(); for (ResolvedArtifact resolvedArtifact : getClasspath().getResolvedConfiguration().getResolvedArtifacts()) { - if (resolvedArtifact.getExtension().equals("jar")) { + if (Objects.equals(resolvedArtifact.getExtension(), "jar")) { Path p = resolvedArtifact.getFile().toPath(); if (Files.isDirectory(p) && isExtension(p)) { extensions.add(resolvedArtifact); @@ -382,7 +382,7 @@ private void computeQuarkusExtensions(ObjectNode extObject) { for (ResolvedArtifact extension : extensions) { ModuleVersionIdentifier id = extension.getModuleVersion().getId(); extensionArray - .add(new AppArtifactKey(id.getGroup(), id.getName(), extension.getClassifier(), extension.getExtension()) + .add(ArtifactKey.of(id.getGroup(), id.getName(), extension.getClassifier(), extension.getExtension()) .toGacString()); } } diff --git a/devtools/gradle/gradle-extension-plugin/src/main/java/io/quarkus/extension/gradle/tasks/ValidateExtensionTask.java b/devtools/gradle/gradle-extension-plugin/src/main/java/io/quarkus/extension/gradle/tasks/ValidateExtensionTask.java index 172a88e778d5c..f293844ddfa3a 100644 --- a/devtools/gradle/gradle-extension-plugin/src/main/java/io/quarkus/extension/gradle/tasks/ValidateExtensionTask.java +++ b/devtools/gradle/gradle-extension-plugin/src/main/java/io/quarkus/extension/gradle/tasks/ValidateExtensionTask.java @@ -15,12 +15,12 @@ import org.gradle.api.tasks.Internal; import org.gradle.api.tasks.TaskAction; -import io.quarkus.bootstrap.model.AppArtifactKey; import io.quarkus.extension.gradle.QuarkusExtensionConfiguration; import io.quarkus.gradle.tooling.dependency.ArtifactExtensionDependency; import io.quarkus.gradle.tooling.dependency.DependencyUtils; import io.quarkus.gradle.tooling.dependency.ExtensionDependency; import io.quarkus.gradle.tooling.dependency.ProjectExtensionDependency; +import io.quarkus.maven.dependency.ArtifactKey; public class ValidateExtensionTask extends DefaultTask { @@ -59,12 +59,12 @@ public void setDeploymentModuleClasspath(Configuration deploymentModuleClasspath public void validateExtension() { Set runtimeArtifacts = getRuntimeModuleClasspath().getResolvedConfiguration().getResolvedArtifacts(); - List deploymentModuleKeys = collectRuntimeExtensionsDeploymentKeys(runtimeArtifacts); - List invalidRuntimeArtifacts = findExtensionInConfiguration(runtimeArtifacts, deploymentModuleKeys); + List deploymentModuleKeys = collectRuntimeExtensionsDeploymentKeys(runtimeArtifacts); + List invalidRuntimeArtifacts = findExtensionInConfiguration(runtimeArtifacts, deploymentModuleKeys); Set deploymentArtifacts = getDeploymentModuleClasspath().getResolvedConfiguration() .getResolvedArtifacts(); - List existingDeploymentModuleKeys = findExtensionInConfiguration(deploymentArtifacts, + List existingDeploymentModuleKeys = findExtensionInConfiguration(deploymentArtifacts, deploymentModuleKeys); deploymentModuleKeys.removeAll(existingDeploymentModuleKeys); @@ -81,21 +81,17 @@ public void validateExtension() { } } - private List collectRuntimeExtensionsDeploymentKeys(Set runtimeArtifacts) { - List runtimeExtensions = new ArrayList<>(); + private List collectRuntimeExtensionsDeploymentKeys(Set runtimeArtifacts) { + List runtimeExtensions = new ArrayList<>(); for (ResolvedArtifact resolvedArtifact : runtimeArtifacts) { ExtensionDependency extension = DependencyUtils.getExtensionInfoOrNull(getProject(), resolvedArtifact); if (extension != null) { - if (extension instanceof ProjectExtensionDependency) { - final ProjectExtensionDependency ped = (ProjectExtensionDependency) extension; - + if (extension instanceof ProjectExtensionDependency ped) { runtimeExtensions - .add(new AppArtifactKey(ped.getDeploymentModule().getGroup().toString(), + .add(ArtifactKey.ga(ped.getDeploymentModule().getGroup().toString(), ped.getDeploymentModule().getName())); - } else if (extension instanceof ArtifactExtensionDependency) { - final ArtifactExtensionDependency aed = (ArtifactExtensionDependency) extension; - - runtimeExtensions.add(new AppArtifactKey(aed.getDeploymentModule().getGroupId(), + } else if (extension instanceof ArtifactExtensionDependency aed) { + runtimeExtensions.add(ArtifactKey.ga(aed.getDeploymentModule().getGroupId(), aed.getDeploymentModule().getArtifactId())); } } @@ -103,12 +99,12 @@ private List collectRuntimeExtensionsDeploymentKeys(Set findExtensionInConfiguration(Set deploymentArtifacts, - List extensions) { - List foundExtensions = new ArrayList<>(); + private List findExtensionInConfiguration(Set deploymentArtifacts, + List extensions) { + List foundExtensions = new ArrayList<>(); for (ResolvedArtifact deploymentArtifact : deploymentArtifacts) { - AppArtifactKey key = toAppArtifactKey(deploymentArtifact.getModuleVersion()); + ArtifactKey key = toArtifactKey(deploymentArtifact.getModuleVersion()); if (extensions.contains(key)) { foundExtensions.add(key); } @@ -116,21 +112,21 @@ private List findExtensionInConfiguration(Set return foundExtensions; } - private void printValidationErrors(List invalidRuntimeArtifacts, - List missingDeploymentArtifacts) { + private void printValidationErrors(List invalidRuntimeArtifacts, + List missingDeploymentArtifacts) { Logger log = getLogger(); log.error("Quarkus Extension Dependency Verification Error"); if (!invalidRuntimeArtifacts.isEmpty()) { log.error("The following deployment artifact(s) appear on the runtime classpath: "); - for (AppArtifactKey invalidRuntimeArtifact : invalidRuntimeArtifacts) { + for (ArtifactKey invalidRuntimeArtifact : invalidRuntimeArtifacts) { log.error("- " + invalidRuntimeArtifact); } } if (!missingDeploymentArtifacts.isEmpty()) { log.error("The following deployment artifact(s) were found to be missing in the deployment module: "); - for (AppArtifactKey missingDeploymentArtifact : missingDeploymentArtifacts) { + for (ArtifactKey missingDeploymentArtifact : missingDeploymentArtifacts) { log.error("- " + missingDeploymentArtifact); } } @@ -138,7 +134,7 @@ private void printValidationErrors(List invalidRuntimeArtifacts, throw new GradleException("Quarkus Extension Dependency Verification Error. See logs below"); } - private static AppArtifactKey toAppArtifactKey(ResolvedModuleVersion artifactId) { - return new AppArtifactKey(artifactId.getId().getGroup(), artifactId.getId().getName()); + private static ArtifactKey toArtifactKey(ResolvedModuleVersion artifactId) { + return ArtifactKey.ga(artifactId.getId().getGroup(), artifactId.getId().getName()); } } diff --git a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppArtifact.java b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppArtifact.java deleted file mode 100644 index 16a6074f78843..0000000000000 --- a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppArtifact.java +++ /dev/null @@ -1,135 +0,0 @@ -package io.quarkus.bootstrap.model; - -import java.io.Serializable; -import java.nio.file.Path; -import java.util.Collection; -import java.util.List; - -import io.quarkus.bootstrap.workspace.WorkspaceModule; -import io.quarkus.maven.dependency.ArtifactCoords; -import io.quarkus.maven.dependency.ResolvedDependency; -import io.quarkus.paths.PathCollection; -import io.quarkus.paths.PathList; - -/** - * Represents an application (or its dependency) artifact. - * - * @deprecated in favor of {@link ResolvedDependency} and {@link io.quarkus.maven.dependency.Dependency}. - * - * @author Alexey Loubyansky - */ -@Deprecated(forRemoval = true, since = "3.11.0") -public class AppArtifact extends AppArtifactCoords implements ResolvedDependency, Serializable { - - private static final long serialVersionUID = -6226544163467103712L; - - protected PathsCollection paths; - private final WorkspaceModule module; - private final String scope; - private final int flags; - - public AppArtifact(AppArtifactCoords coords) { - this(coords, null); - } - - public AppArtifact(AppArtifactCoords coords, WorkspaceModule module) { - this(coords.getGroupId(), coords.getArtifactId(), coords.getClassifier(), coords.getType(), coords.getVersion(), - module, "compile", 0); - } - - public AppArtifact(String groupId, String artifactId, String version) { - super(groupId, artifactId, version); - module = null; - scope = "compile"; - flags = 0; - } - - public AppArtifact(String groupId, String artifactId, String classifier, String type, String version) { - super(groupId, artifactId, classifier, type, version); - module = null; - scope = "compile"; - flags = 0; - } - - public AppArtifact(String groupId, String artifactId, String classifier, String type, String version, - WorkspaceModule module, String scope, int flags) { - super(groupId, artifactId, classifier, type, version); - this.module = module; - this.scope = scope; - this.flags = flags; - } - - /** - * @deprecated in favor of {@link #getResolvedPaths()} - */ - @Deprecated - public Path getPath() { - return paths.getSinglePath(); - } - - /** - * Associates the artifact with the given path - * - * @param path artifact location - */ - public void setPath(Path path) { - setPaths(PathsCollection.of(path)); - } - - /** - * Collection of the paths that collectively constitute the artifact's content. - * Normally, especially in the Maven world, an artifact is resolved to a single path, - * e.g. a JAR or a project's output directory. However, in Gradle, depending on the build/test phase, - * artifact's content may need to be represented as a collection of paths. - * - * @return collection of paths that constitute the artifact's content - */ - public PathsCollection getPaths() { - return paths; - } - - /** - * Associates the artifact with a collection of paths that constitute its content. - * - * @param paths collection of paths that constitute the artifact's content. - */ - public void setPaths(PathsCollection paths) { - this.paths = paths; - } - - /** - * Whether the artifact has been resolved, i.e. associated with paths - * that constitute its content. - * - * @return true if the artifact has been resolved, otherwise - false - */ - @Override - public boolean isResolved() { - return paths != null && !paths.isEmpty(); - } - - @Override - public PathCollection getResolvedPaths() { - return paths == null ? null : PathList.from(paths); - } - - @Override - public WorkspaceModule getWorkspaceModule() { - return module; - } - - @Override - public String getScope() { - return scope; - } - - @Override - public int getFlags() { - return flags; - } - - @Override - public Collection getDependencies() { - return List.of(); - } -} diff --git a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppArtifactCoords.java b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppArtifactCoords.java deleted file mode 100644 index f932ce116e12b..0000000000000 --- a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppArtifactCoords.java +++ /dev/null @@ -1,149 +0,0 @@ -package io.quarkus.bootstrap.model; - -import static java.util.Objects.requireNonNull; - -import java.io.Serializable; -import java.util.Objects; - -import io.quarkus.maven.dependency.ArtifactCoords; -import io.quarkus.maven.dependency.GACT; - -/** - * GroupId, artifactId, classifier, type, version - * - * @deprecated in favor of {@link ArtifactCoords} - * - * @author Alexey Loubyansky - */ -@Deprecated(forRemoval = true, since = "3.11.0") -public class AppArtifactCoords implements ArtifactCoords, Serializable { - - private static final long serialVersionUID = -4401898149727779844L; - - public static final String TYPE_JAR = "jar"; - public static final String TYPE_POM = "pom"; - - public static AppArtifactCoords fromString(String str) { - return new AppArtifactCoords(split(str, new String[5])); - } - - protected static String[] split(String str, String[] parts) { - requireNonNull(str, "str is required"); - final int firstSep = str.indexOf(':'); - final int versionSep = str.lastIndexOf(':'); - if (firstSep < 0) { - throw new IllegalArgumentException( - "Invalid AppArtifactCoords string without any separator: " + str); - } - if (firstSep == versionSep) { - throw new IllegalArgumentException( - "Use AppArtifactKey instead of AppArtifactCoords to deal with 'groupId:artifactId': " + str); - } - if (versionSep <= 0 || versionSep == str.length() - 1) { - throw new IllegalArgumentException("One of type, version or separating them ':' is missing from '" + str + "'"); - } - parts[4] = str.substring(versionSep + 1); - return GACT.split(str, parts, versionSep); - } - - protected final String groupId; - protected final String artifactId; - protected final String classifier; - protected final String type; - protected final String version; - - protected transient AppArtifactKey key; - - protected AppArtifactCoords(String[] parts) { - groupId = parts[0]; - artifactId = parts[1]; - classifier = parts[2]; - type = parts[3] == null ? TYPE_JAR : parts[3]; - version = parts[4]; - } - - public AppArtifactCoords(AppArtifactKey key, String version) { - this.key = key; - this.groupId = key.getGroupId(); - this.artifactId = key.getArtifactId(); - this.classifier = key.getClassifier(); - this.type = key.getType(); - this.version = version; - } - - public AppArtifactCoords(String groupId, String artifactId, String version) { - this(groupId, artifactId, "", TYPE_JAR, version); - } - - public AppArtifactCoords(String groupId, String artifactId, String type, String version) { - this(groupId, artifactId, "", type, version); - } - - public AppArtifactCoords(String groupId, String artifactId, String classifier, String type, String version) { - this.groupId = groupId; - this.artifactId = artifactId; - this.classifier = classifier == null ? "" : classifier; - this.type = type; - this.version = version; - } - - public String getGroupId() { - return groupId; - } - - public String getArtifactId() { - return artifactId; - } - - public String getClassifier() { - return classifier; - } - - public String getType() { - return type; - } - - public String getVersion() { - return version; - } - - public AppArtifactKey getKey() { - return key == null ? key = new AppArtifactKey(groupId, artifactId, classifier, type) : key; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AppArtifactCoords that = (AppArtifactCoords) o; - return Objects.equals(groupId, that.groupId) && - Objects.equals(artifactId, that.artifactId) && - Objects.equals(classifier, that.classifier) && - Objects.equals(type, that.type) && - Objects.equals(version, that.version); - } - - @Override - public int hashCode() { - return Objects.hash(groupId, artifactId, classifier, type, version); - } - - @Override - public String toString() { - final StringBuilder buf = new StringBuilder(); - append(buf); - return buf.toString(); - } - - protected StringBuilder append(final StringBuilder buf) { - buf.append(groupId).append(':').append(artifactId).append(':'); - if (classifier != null && !classifier.isEmpty()) { - buf.append(classifier); - } - return buf.append(':').append(type).append(':').append(version); - } -} diff --git a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppArtifactKey.java b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppArtifactKey.java deleted file mode 100644 index 877d41ce04729..0000000000000 --- a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppArtifactKey.java +++ /dev/null @@ -1,139 +0,0 @@ -package io.quarkus.bootstrap.model; - -import java.io.Serializable; - -import io.quarkus.maven.dependency.ArtifactKey; -import io.quarkus.maven.dependency.GACT; - -/** - * GroupId, artifactId and classifier - * - * @deprecated in favor of {@link ArtifactKey} - * - * @author Alexey Loubyansky - */ -@Deprecated(forRemoval = true, since = "3.11.0") -public class AppArtifactKey implements ArtifactKey, Serializable { - - private static final long serialVersionUID = -6758193261385541101L; - - public static AppArtifactKey fromString(String str) { - return new AppArtifactKey(GACT.split(str, new String[4], str.length())); - } - - protected final String groupId; - protected final String artifactId; - protected final String classifier; - protected final String type; - - public AppArtifactKey(String[] parts) { - this.groupId = parts[0]; - this.artifactId = parts[1]; - if (parts.length == 2 || parts[2] == null) { - this.classifier = ""; - } else { - this.classifier = parts[2]; - } - if (parts.length <= 3 || parts[3] == null) { - this.type = "jar"; - } else { - this.type = parts[3]; - } - } - - public AppArtifactKey(String groupId, String artifactId) { - this(groupId, artifactId, null); - } - - public AppArtifactKey(String groupId, String artifactId, String classifier) { - this(groupId, artifactId, classifier, null); - } - - public AppArtifactKey(String groupId, String artifactId, String classifier, String type) { - this.groupId = groupId; - this.artifactId = artifactId; - this.classifier = classifier == null ? "" : classifier; - this.type = type; - } - - public String getGroupId() { - return groupId; - } - - public String getArtifactId() { - return artifactId; - } - - public String getClassifier() { - return classifier; - } - - public String getType() { - return type; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((artifactId == null) ? 0 : artifactId.hashCode()); - result = prime * result + ((classifier == null) ? 0 : classifier.hashCode()); - result = prime * result + ((groupId == null) ? 0 : groupId.hashCode()); - result = prime * result + ((type == null) ? 0 : type.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (!(obj instanceof ArtifactKey)) - return false; - ArtifactKey other = (ArtifactKey) obj; - if (artifactId == null) { - if (other.getArtifactId() != null) - return false; - } else if (!artifactId.equals(other.getArtifactId())) - return false; - if (classifier == null) { - if (other.getClassifier() != null) - return false; - } else if (!classifier.equals(other.getClassifier())) - return false; - if (groupId == null) { - if (other.getGroupId() != null) - return false; - } else if (!groupId.equals(other.getGroupId())) - return false; - if (type == null) { - return other.getType() == null; - } else - return type.equals(other.getType()); - } - - @Override - public String toString() { - final StringBuilder buf = new StringBuilder(); - buf.append(groupId).append(':').append(artifactId); - if (!classifier.isEmpty()) { - buf.append(':').append(classifier); - } else if (type != null) { - buf.append(':'); - } - if (type != null) { - buf.append(':').append(type); - } - return buf.toString(); - } - - public String toGacString() { - final StringBuilder buf = new StringBuilder(); - buf.append(groupId).append(':').append(artifactId); - if (!classifier.isEmpty()) { - buf.append(':').append(classifier); - } - return buf.toString(); - } -} diff --git a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppDependency.java b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppDependency.java deleted file mode 100644 index e59c2761452b1..0000000000000 --- a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppDependency.java +++ /dev/null @@ -1,141 +0,0 @@ -package io.quarkus.bootstrap.model; - -import java.io.Serializable; -import java.util.Collection; -import java.util.List; -import java.util.Objects; - -import io.quarkus.maven.dependency.ArtifactCoords; -import io.quarkus.maven.dependency.ArtifactKey; -import io.quarkus.maven.dependency.DependencyFlags; -import io.quarkus.maven.dependency.ResolvedDependency; -import io.quarkus.paths.PathCollection; - -/** - * @deprecated in favor of {@link ResolvedDependency} - */ -@Deprecated(forRemoval = true, since = "3.11.0") -public class AppDependency implements ResolvedDependency, Serializable { - - private static final long serialVersionUID = 7030281544498286020L; - - private final AppArtifact artifact; - private final String scope; - private int flags; - - public AppDependency(AppArtifact artifact, String scope, int... flags) { - this(artifact, scope, false, flags); - } - - public AppDependency(AppArtifact artifact, String scope, boolean optional, int... flags) { - this.artifact = artifact; - this.scope = scope; - int tmpFlags = optional ? DependencyFlags.OPTIONAL : 0; - for (int f : flags) { - tmpFlags |= f; - } - this.flags = tmpFlags; - } - - public AppArtifact getArtifact() { - return artifact; - } - - @Override - public String getScope() { - return scope; - } - - @Override - public int getFlags() { - return flags; - } - - public void clearFlag(int flag) { - if ((flags & flag) > 0) { - flags ^= flag; - } - } - - @Override - public int hashCode() { - return Objects.hash(artifact, flags, scope); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - AppDependency other = (AppDependency) obj; - return Objects.equals(artifact, other.artifact) && flags == other.flags && Objects.equals(scope, other.scope); - } - - @Override - public String toString() { - final StringBuilder buf = new StringBuilder(); - artifact.append(buf).append('('); - if (isDirect()) { - buf.append("direct "); - } - if (isOptional()) { - buf.append("optional "); - } - if (isWorkspaceModule()) { - buf.append("local "); - } - if (isRuntimeExtensionArtifact()) { - buf.append("extension "); - } - if (isRuntimeCp()) { - buf.append("runtime-cp "); - } - if (isDeploymentCp()) { - buf.append("deployment-cp "); - } - return buf.append(scope).append(')').toString(); - } - - @Override - public String getGroupId() { - return artifact.getGroupId(); - } - - @Override - public String getArtifactId() { - return artifact.getArtifactId(); - } - - @Override - public String getClassifier() { - return artifact.getClassifier(); - } - - @Override - public String getType() { - return artifact.getType(); - } - - @Override - public String getVersion() { - return artifact.getVersion(); - } - - @Override - public ArtifactKey getKey() { - return artifact.getKey(); - } - - @Override - public PathCollection getResolvedPaths() { - return artifact.getResolvedPaths(); - } - - @Override - public Collection getDependencies() { - return List.of(); - } -} diff --git a/independent-projects/bootstrap/app-model/src/test/java/io/quarkus/bootstrap/model/AppArtifactCoordsTest.java b/independent-projects/bootstrap/app-model/src/test/java/io/quarkus/bootstrap/model/AppArtifactCoordsTest.java deleted file mode 100644 index 4dcb3c170d1f8..0000000000000 --- a/independent-projects/bootstrap/app-model/src/test/java/io/quarkus/bootstrap/model/AppArtifactCoordsTest.java +++ /dev/null @@ -1,54 +0,0 @@ -package io.quarkus.bootstrap.model; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -class AppArtifactCoordsTest { - - @Test - void testFails() { - String message = assertThrows(IllegalArgumentException.class, () -> AppArtifactCoords.fromString("test-artifact")) - .getMessage(); - Assertions.assertTrue(message.contains("Invalid AppArtifactCoords string without any separator")); - } - - @Test - void testGAFails() { - String message = assertThrows(IllegalArgumentException.class, - () -> AppArtifactCoords.fromString("io.quarkus:test-artifact")).getMessage(); - Assertions.assertTrue(message.contains("Use AppArtifactKey instead of AppArtifactCoords")); - } - - @Test - void testGAV() { - final AppArtifactCoords appArtifactCoords = AppArtifactCoords.fromString("io.quarkus:test-artifact:1.1"); - assertEquals("io.quarkus", appArtifactCoords.getGroupId()); - assertEquals("test-artifact", appArtifactCoords.getArtifactId()); - assertEquals("1.1", appArtifactCoords.getVersion()); - assertEquals("", appArtifactCoords.getClassifier()); - assertEquals("jar", appArtifactCoords.getType()); - } - - @Test - void testGACV() { - final AppArtifactCoords appArtifactCoords = AppArtifactCoords.fromString("io.quarkus:test-artifact:classif:1.1"); - assertEquals("io.quarkus", appArtifactCoords.getGroupId()); - assertEquals("test-artifact", appArtifactCoords.getArtifactId()); - assertEquals("1.1", appArtifactCoords.getVersion()); - assertEquals("classif", appArtifactCoords.getClassifier()); - assertEquals("jar", appArtifactCoords.getType()); - } - - @Test - void testGACTV() { - final AppArtifactCoords appArtifactCoords = AppArtifactCoords.fromString("io.quarkus:test-artifact:classif:json:1.1"); - assertEquals("io.quarkus", appArtifactCoords.getGroupId()); - assertEquals("test-artifact", appArtifactCoords.getArtifactId()); - assertEquals("1.1", appArtifactCoords.getVersion()); - assertEquals("classif", appArtifactCoords.getClassifier()); - assertEquals("json", appArtifactCoords.getType()); - } -} diff --git a/independent-projects/extension-maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java b/independent-projects/extension-maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java index 0ae05193c4cb1..648aba21576f8 100644 --- a/independent-projects/extension-maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java +++ b/independent-projects/extension-maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java @@ -564,8 +564,7 @@ private void completeCodestartArtifact(ObjectMapper mapper, ObjectNode extObject /** * If artifact contains "G:A" the project version is added to have "G:A:V"
- * else the version must be defined either with ${project.version} or hardcoded
- * to be compatible with AppArtifactCoords.fromString + * else the version must be defined either with ${project.version} or hardcoded * * @param originalArtifact * @param projectVersion