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 compile-only dependencies in the ApplicationModel
- Loading branch information
1 parent
f7da1d7
commit 48c1028
Showing
9 changed files
with
239 additions
and
33 deletions.
There are no files selected for viewing
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
92 changes: 92 additions & 0 deletions
92
...ment/src/test/java/io/quarkus/deployment/runnerjar/ProvidedExtensionDepsTestModeTest.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,92 @@ | ||
package io.quarkus.deployment.runnerjar; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
import org.eclipse.aether.util.artifact.JavaScopes; | ||
|
||
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 ProvidedExtensionDepsTestModeTest extends BootstrapFromOriginalJarTestBase { | ||
|
||
@Override | ||
protected boolean isBootstrapForTestMode() { | ||
return true; | ||
} | ||
|
||
@Override | ||
protected TsArtifact composeApplication() { | ||
|
||
final TsArtifact extADep = TsArtifact.jar("ext-a-dep"); | ||
addToExpectedLib(extADep); | ||
|
||
final TsArtifact extAProvidedDep = TsArtifact.jar("ext-a-provided-dep"); | ||
|
||
final TsArtifact extADeploymentDep = TsArtifact.jar("ext-a-deployment-dep"); | ||
final TsArtifact extAOptionalDeploymentDep = TsArtifact.jar("ext-a-provided-deployment-dep"); | ||
|
||
final TsQuarkusExt extA = new TsQuarkusExt("ext-a"); | ||
addToExpectedLib(extA.getRuntime()); | ||
extA.getRuntime() | ||
.addDependency(new TsDependency(extADep)) | ||
.addDependency(new TsDependency(extAProvidedDep, "provided")); | ||
extA.getDeployment() | ||
.addDependency(new TsDependency(extADeploymentDep)) | ||
.addDependency(new TsDependency(extAOptionalDeploymentDep, "provided")); | ||
|
||
final TsQuarkusExt extB = new TsQuarkusExt("ext-b"); | ||
this.install(extB); | ||
addToExpectedLib(extB.getRuntime()); // test mode enabled | ||
|
||
final TsArtifact someProvidedDep = TsArtifact.jar("some-provided-dep"); | ||
addToExpectedLib(someProvidedDep); // test mode enabled | ||
|
||
return TsArtifact.jar("app") | ||
.addManagedDependency(platformDescriptor()) | ||
.addManagedDependency(platformProperties()) | ||
.addDependency(extA) | ||
.addDependency(extB, "provided") | ||
.addDependency(new TsDependency(someProvidedDep, "provided")); | ||
} | ||
|
||
@Override | ||
protected void assertAppModel(ApplicationModel model) throws Exception { | ||
|
||
final Set<Dependency> compileOnly = new HashSet<>(); | ||
compileOnly.add(new ArtifactDependency(ArtifactCoords.jar("io.quarkus.bootstrap.test", "ext-b", "1"), | ||
JavaScopes.PROVIDED, | ||
DependencyFlags.RUNTIME_CP, | ||
DependencyFlags.DEPLOYMENT_CP, | ||
DependencyFlags.RUNTIME_EXTENSION_ARTIFACT, | ||
DependencyFlags.DIRECT, | ||
DependencyFlags.TOP_LEVEL_RUNTIME_EXTENSION_ARTIFACT, | ||
DependencyFlags.COMPILE_ONLY)); | ||
compileOnly.add(new ArtifactDependency(ArtifactCoords.jar("io.quarkus.bootstrap.test", "some-provided-dep", "1"), | ||
JavaScopes.PROVIDED, | ||
DependencyFlags.RUNTIME_CP, | ||
DependencyFlags.DEPLOYMENT_CP, | ||
DependencyFlags.DIRECT, | ||
DependencyFlags.COMPILE_ONLY)); | ||
assertEquals(compileOnly, getDependenciesWithFlag(model, DependencyFlags.COMPILE_ONLY)); | ||
|
||
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)); | ||
expected.add(new ArtifactDependency(ArtifactCoords.jar("io.quarkus.bootstrap.test", "ext-b-deployment", "1"), | ||
JavaScopes.PROVIDED, | ||
DependencyFlags.DEPLOYMENT_CP)); | ||
|
||
assertEquals(expected, getDeploymentOnlyDeps(model)); | ||
} | ||
} |
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.