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.
Collect and expose compile-only dependencies through ApplicationModel
with DependencyFlag.COMPILE_ONLY flag set (Maven provided scope)
- Loading branch information
1 parent
2e6fe10
commit 967cc8a
Showing
9 changed files
with
497 additions
and
159 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
142 changes: 142 additions & 0 deletions
142
...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,142 @@ | ||
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 depC1 = TsArtifact.jar("dep-c"); | ||
//addToExpectedLib(depC1); | ||
extADep.addDependency(depC1); | ||
|
||
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(extADep) | ||
.addDependency(new TsDependency(extAProvidedDep, JavaScopes.PROVIDED)); | ||
extA.getDeployment() | ||
.addDependency(extADeploymentDep) | ||
.addDependency(new TsDependency(extAOptionalDeploymentDep, JavaScopes.PROVIDED)); | ||
|
||
final TsQuarkusExt extB = new TsQuarkusExt("ext-b"); | ||
addToExpectedLib(extB.getRuntime()); | ||
this.install(extB); | ||
|
||
final TsArtifact directProvidedDep = TsArtifact.jar("direct-provided-dep"); | ||
addToExpectedLib(directProvidedDep); | ||
|
||
final TsArtifact depC2 = TsArtifact.jar("dep-c", "2"); | ||
// here provided dependencies will override compile/runtime ones during version convergence | ||
addToExpectedLib(depC2); | ||
directProvidedDep.addDependency(depC2); | ||
|
||
final TsArtifact transitiveProvidedDep = TsArtifact.jar("transitive-provided-dep"); | ||
addToExpectedLib(transitiveProvidedDep); | ||
directProvidedDep.addDependency(transitiveProvidedDep); | ||
|
||
return TsArtifact.jar("app") | ||
.addManagedDependency(platformDescriptor()) | ||
.addManagedDependency(platformProperties()) | ||
.addDependency(extA) | ||
.addDependency(extB, JavaScopes.PROVIDED) | ||
.addDependency(new TsDependency(directProvidedDep, JavaScopes.PROVIDED)); | ||
} | ||
|
||
@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)); | ||
expected.add(new ArtifactDependency(ArtifactCoords.jar("io.quarkus.bootstrap.test", "ext-b-deployment", "1"), | ||
JavaScopes.PROVIDED, | ||
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.DIRECT, | ||
DependencyFlags.RUNTIME_EXTENSION_ARTIFACT, | ||
DependencyFlags.TOP_LEVEL_RUNTIME_EXTENSION_ARTIFACT)); | ||
expected.add(new ArtifactDependency(ArtifactCoords.jar("io.quarkus.bootstrap.test", "ext-a-dep", "1"), | ||
DependencyFlags.RUNTIME_CP, | ||
DependencyFlags.DEPLOYMENT_CP)); | ||
expected.add(new ArtifactDependency(ArtifactCoords.jar("io.quarkus.bootstrap.test", "dep-c", "2"), | ||
DependencyFlags.RUNTIME_CP, | ||
DependencyFlags.DEPLOYMENT_CP)); | ||
expected.add(new ArtifactDependency(ArtifactCoords.jar("io.quarkus.bootstrap.test", "ext-b", "1"), | ||
JavaScopes.PROVIDED, | ||
DependencyFlags.RUNTIME_EXTENSION_ARTIFACT, | ||
DependencyFlags.DIRECT, | ||
DependencyFlags.TOP_LEVEL_RUNTIME_EXTENSION_ARTIFACT, | ||
DependencyFlags.RUNTIME_CP, | ||
DependencyFlags.DEPLOYMENT_CP, | ||
DependencyFlags.COMPILE_ONLY)); | ||
expected.add(new ArtifactDependency(ArtifactCoords.jar("io.quarkus.bootstrap.test", "direct-provided-dep", "1"), | ||
JavaScopes.PROVIDED, | ||
DependencyFlags.DIRECT, | ||
DependencyFlags.RUNTIME_CP, | ||
DependencyFlags.DEPLOYMENT_CP, | ||
DependencyFlags.COMPILE_ONLY)); | ||
expected.add(new ArtifactDependency(ArtifactCoords.jar("io.quarkus.bootstrap.test", "transitive-provided-dep", "1"), | ||
JavaScopes.PROVIDED, | ||
DependencyFlags.RUNTIME_CP, | ||
DependencyFlags.DEPLOYMENT_CP, | ||
DependencyFlags.COMPILE_ONLY)); | ||
assertEquals(expected, getDependenciesWithFlag(model, DependencyFlags.RUNTIME_CP)); | ||
|
||
expected = new HashSet<>(); | ||
expected.add(new ArtifactDependency(ArtifactCoords.jar("io.quarkus.bootstrap.test", "ext-b", "1"), | ||
JavaScopes.PROVIDED, | ||
DependencyFlags.RUNTIME_EXTENSION_ARTIFACT, | ||
DependencyFlags.DIRECT, | ||
DependencyFlags.TOP_LEVEL_RUNTIME_EXTENSION_ARTIFACT, | ||
DependencyFlags.RUNTIME_CP, | ||
DependencyFlags.DEPLOYMENT_CP, | ||
DependencyFlags.COMPILE_ONLY)); | ||
expected.add(new ArtifactDependency(ArtifactCoords.jar("io.quarkus.bootstrap.test", "direct-provided-dep", "1"), | ||
JavaScopes.PROVIDED, | ||
DependencyFlags.DIRECT, | ||
DependencyFlags.RUNTIME_CP, | ||
DependencyFlags.DEPLOYMENT_CP, | ||
DependencyFlags.COMPILE_ONLY)); | ||
expected.add(new ArtifactDependency(ArtifactCoords.jar("io.quarkus.bootstrap.test", "transitive-provided-dep", "1"), | ||
JavaScopes.PROVIDED, | ||
DependencyFlags.RUNTIME_CP, | ||
DependencyFlags.DEPLOYMENT_CP, | ||
DependencyFlags.COMPILE_ONLY)); | ||
assertEquals(expected, getDependenciesWithFlag(model, DependencyFlags.COMPILE_ONLY)); | ||
} | ||
} |
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.