forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include removed dependencies in the ApplicationModel with
DependencyFlags.REMOVED
- Loading branch information
1 parent
31afcb2
commit aa5a0bd
Showing
16 changed files
with
769 additions
and
62 deletions.
There are no files selected for viewing
90 changes: 90 additions & 0 deletions
90
core/deployment/src/test/java/io/quarkus/deployment/runnerjar/ExcludedArtifactsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package io.quarkus.deployment.runnerjar; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
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.ArtifactCoords; | ||
import io.quarkus.maven.dependency.ArtifactDependency; | ||
import io.quarkus.maven.dependency.Dependency; | ||
import io.quarkus.maven.dependency.DependencyFlags; | ||
|
||
public class ExcludedArtifactsTest extends BootstrapFromOriginalJarTestBase { | ||
|
||
@Override | ||
protected TsArtifact composeApplication() { | ||
|
||
final TsArtifact extADep = TsArtifact.jar("ext-a-dep"); | ||
// excluded in the extension descriptor addToExpectedLib(extADep); | ||
|
||
final TsArtifact depC = TsArtifact.jar("dep-c"); | ||
addToExpectedLib(depC); | ||
extADep.addDependency(depC); | ||
|
||
final TsArtifact depE = TsArtifact.jar("org.banned", "dep-e", "1"); | ||
depC.addDependency(depE); | ||
final TsArtifact depG = TsArtifact.jar("dep-g"); | ||
depE.addDependency(depG); | ||
addToExpectedLib(depG); | ||
|
||
final TsArtifact extADeploymentDep = TsArtifact.jar("ext-a-deployment-dep"); | ||
|
||
final TsQuarkusExt extA = new TsQuarkusExt("ext-a"); | ||
addToExpectedLib(extA.getRuntime()); | ||
extA.getRuntime().addDependency(extADep); | ||
extA.getDeployment().addDependency(extADeploymentDep); | ||
|
||
extA.getDescriptor().set("excluded-artifacts", | ||
extADep.getKey().toString() + ",org.banned*"); | ||
|
||
final TsArtifact depB = TsArtifact.jar("dep-b"); | ||
addToExpectedLib(depB); | ||
|
||
final TsArtifact depD = TsArtifact.jar("org.banned.too", "dep-d", "1"); | ||
depB.addDependency(depD); | ||
|
||
final TsArtifact depF = TsArtifact.jar("org.banned", "dep-f", "1"); | ||
depB.addDependency(depF); | ||
|
||
return TsArtifact.jar("app") | ||
.addManagedDependency(platformDescriptor()) | ||
.addManagedDependency(platformProperties()) | ||
.addDependency(extA) | ||
.addDependency(new TsDependency(depB)); | ||
} | ||
|
||
@Override | ||
protected void assertAppModel(ApplicationModel model) throws Exception { | ||
Set<Dependency> expected = new HashSet<>(); | ||
expected.add(new ArtifactDependency(ArtifactCoords.jar("io.quarkus.bootstrap.test", "ext-a-deployment", "1"), | ||
DependencyFlags.DEPLOYMENT_CP)); | ||
expected.add(new ArtifactDependency(ArtifactCoords.jar("io.quarkus.bootstrap.test", "ext-a-deployment-dep", "1"), | ||
DependencyFlags.DEPLOYMENT_CP)); | ||
assertEquals(expected, getDeploymentOnlyDeps(model)); | ||
|
||
expected = new HashSet<>(); | ||
expected.add(new ArtifactDependency(ArtifactCoords.jar("io.quarkus.bootstrap.test", "ext-a", "1"), | ||
DependencyFlags.RUNTIME_CP, DependencyFlags.DEPLOYMENT_CP, DependencyFlags.RUNTIME_EXTENSION_ARTIFACT, | ||
DependencyFlags.DIRECT, DependencyFlags.TOP_LEVEL_RUNTIME_EXTENSION_ARTIFACT)); | ||
expected.add(new ArtifactDependency(ArtifactCoords.jar("io.quarkus.bootstrap.test", "dep-c", "1"), | ||
DependencyFlags.RUNTIME_CP, DependencyFlags.DEPLOYMENT_CP)); | ||
expected.add(new ArtifactDependency(ArtifactCoords.jar("io.quarkus.bootstrap.test", "dep-b", "1"), | ||
DependencyFlags.RUNTIME_CP, DependencyFlags.DEPLOYMENT_CP, DependencyFlags.DIRECT)); | ||
expected.add(new ArtifactDependency(ArtifactCoords.jar("io.quarkus.bootstrap.test", "dep-g", "1"), | ||
DependencyFlags.RUNTIME_CP, DependencyFlags.DEPLOYMENT_CP)); | ||
assertEquals(expected, getDependenciesWithFlag(model, DependencyFlags.RUNTIME_CP)); | ||
|
||
expected = new HashSet<>(); | ||
expected.add(new ArtifactDependency(ArtifactCoords.jar("io.quarkus.bootstrap.test", "ext-a-dep", "1"), | ||
DependencyFlags.REMOVED)); | ||
expected.add(new ArtifactDependency(ArtifactCoords.jar("org.banned", "dep-e", "1"), DependencyFlags.REMOVED)); | ||
expected.add(new ArtifactDependency(ArtifactCoords.jar("org.banned.too", "dep-d", "1"), DependencyFlags.REMOVED)); | ||
expected.add(new ArtifactDependency(ArtifactCoords.jar("org.banned", "dep-f", "1"), DependencyFlags.REMOVED)); | ||
assertEquals(expected, getDependenciesWithFlag(model, DependencyFlags.REMOVED)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.