-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15736 from aloubyansky/conditional-extension-deps
Conditional extension dependencies support for Maven-based projects
- Loading branch information
Showing
55 changed files
with
3,032 additions
and
251 deletions.
There are no files selected for viewing
84 changes: 84 additions & 0 deletions
84
...test/java/io/quarkus/deployment/conditionaldeps/CascadingConditionalDependenciesTest.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,84 @@ | ||
package io.quarkus.deployment.conditionaldeps; | ||
|
||
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; | ||
|
||
public class CascadingConditionalDependenciesTest extends ExecutableOutputOutcomeTestBase { | ||
|
||
@Override | ||
protected TsArtifact modelApp() { | ||
|
||
final TsQuarkusExt extA = new TsQuarkusExt("ext-a"); | ||
final TsQuarkusExt extB = new TsQuarkusExt("ext-b"); | ||
final TsQuarkusExt extC = new TsQuarkusExt("ext-c"); | ||
final TsQuarkusExt extD = new TsQuarkusExt("ext-d"); | ||
final TsQuarkusExt extE = new TsQuarkusExt("ext-e"); | ||
final TsQuarkusExt extF = new TsQuarkusExt("ext-f"); | ||
final TsQuarkusExt extG = new TsQuarkusExt("ext-g"); | ||
final TsQuarkusExt extH = new TsQuarkusExt("ext-h"); | ||
|
||
extA.setConditionalDeps(extB, extF); | ||
|
||
extB.setDependencyCondition(extC); | ||
extB.setConditionalDeps(extD); | ||
|
||
extD.setDependencyCondition(extE); | ||
|
||
extE.addDependency(extC); | ||
extE.setDependencyCondition(extA); | ||
extE.setDependencyCondition(extG); | ||
|
||
extF.setDependencyCondition(extD); | ||
|
||
extG.setDependencyCondition(extH); | ||
|
||
addToExpectedLib(extA.getRuntime()); | ||
addToExpectedLib(extB.getRuntime()); | ||
addToExpectedLib(extC.getRuntime()); | ||
addToExpectedLib(extD.getRuntime()); | ||
addToExpectedLib(extE.getRuntime()); | ||
addToExpectedLib(extF.getRuntime()); | ||
|
||
install(extA); | ||
install(extB); | ||
install(extC); | ||
install(extD); | ||
install(extE); | ||
install(extF); | ||
install(extG); | ||
install(extH); | ||
|
||
return TsArtifact.jar("app") | ||
.addManagedDependency(platformDescriptor()) | ||
.addManagedDependency(platformProperties()) | ||
.addDependency(extA) | ||
.addDependency(extE); | ||
} | ||
|
||
@Override | ||
protected void assertDeploymentDeps(List<AppDependency> deploymentDeps) throws Exception { | ||
final Set<AppDependency> expected = new HashSet<>(); | ||
expected.add(new AppDependency( | ||
new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, "ext-c-deployment", TsArtifact.DEFAULT_VERSION), "compile")); | ||
expected.add(new AppDependency( | ||
new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, "ext-a-deployment", TsArtifact.DEFAULT_VERSION), "compile")); | ||
expected.add(new AppDependency( | ||
new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, "ext-b-deployment", TsArtifact.DEFAULT_VERSION), "runtime")); | ||
expected.add(new AppDependency( | ||
new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, "ext-d-deployment", TsArtifact.DEFAULT_VERSION), "runtime")); | ||
expected.add(new AppDependency( | ||
new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, "ext-e-deployment", TsArtifact.DEFAULT_VERSION), "compile")); | ||
expected.add(new AppDependency( | ||
new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, "ext-f-deployment", TsArtifact.DEFAULT_VERSION), "runtime")); | ||
assertEquals(expected, new HashSet<>(deploymentDeps)); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
...a/io/quarkus/deployment/conditionaldeps/ConditionalDependencyWithSingleConditionTest.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,53 @@ | ||
package io.quarkus.deployment.conditionaldeps; | ||
|
||
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.model.AppModel; | ||
import io.quarkus.bootstrap.resolver.TsArtifact; | ||
import io.quarkus.bootstrap.resolver.TsQuarkusExt; | ||
import io.quarkus.deployment.runnerjar.ExecutableOutputOutcomeTestBase; | ||
|
||
public class ConditionalDependencyWithSingleConditionTest extends ExecutableOutputOutcomeTestBase { | ||
|
||
@Override | ||
protected TsArtifact modelApp() { | ||
|
||
final TsQuarkusExt extA = new TsQuarkusExt("ext-a"); | ||
|
||
final TsQuarkusExt extB = new TsQuarkusExt("ext-b"); | ||
extB.setDependencyCondition(extA); | ||
install(extB); | ||
|
||
final TsQuarkusExt extC = new TsQuarkusExt("ext-c"); | ||
extC.setConditionalDeps(extB); | ||
|
||
addToExpectedLib(extA.getRuntime()); | ||
addToExpectedLib(extB.getRuntime()); | ||
addToExpectedLib(extC.getRuntime()); | ||
|
||
return TsArtifact.jar("app") | ||
.addManagedDependency(platformDescriptor()) | ||
.addManagedDependency(platformProperties()) | ||
.addDependency(extC) | ||
.addDependency(extA); | ||
} | ||
|
||
@Override | ||
protected void assertAppModel(AppModel appModel) throws Exception { | ||
final List<AppDependency> deploymentDeps = appModel.getDeploymentDependencies(); | ||
final Set<AppDependency> expected = new HashSet<>(); | ||
expected.add(new AppDependency( | ||
new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, "ext-c-deployment", TsArtifact.DEFAULT_VERSION), "compile")); | ||
expected.add(new AppDependency( | ||
new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, "ext-a-deployment", TsArtifact.DEFAULT_VERSION), "compile")); | ||
expected.add(new AppDependency( | ||
new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, "ext-b-deployment", TsArtifact.DEFAULT_VERSION), "runtime")); | ||
assertEquals(expected, new HashSet<>(deploymentDeps)); | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
...ava/io/quarkus/deployment/conditionaldeps/ConditionalDependencyWithTwoConditionsTest.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,56 @@ | ||
package io.quarkus.deployment.conditionaldeps; | ||
|
||
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; | ||
|
||
public class ConditionalDependencyWithTwoConditionsTest extends ExecutableOutputOutcomeTestBase { | ||
|
||
@Override | ||
protected TsArtifact modelApp() { | ||
|
||
final TsQuarkusExt extA = new TsQuarkusExt("ext-a"); | ||
final TsQuarkusExt extD = new TsQuarkusExt("ext-d"); | ||
|
||
final TsQuarkusExt extB = new TsQuarkusExt("ext-b"); | ||
extB.setDependencyCondition(extA, extD); | ||
install(extB); | ||
|
||
final TsQuarkusExt extC = new TsQuarkusExt("ext-c"); | ||
extC.setConditionalDeps(extB); | ||
|
||
addToExpectedLib(extA.getRuntime()); | ||
addToExpectedLib(extB.getRuntime()); | ||
addToExpectedLib(extC.getRuntime()); | ||
addToExpectedLib(extD.getRuntime()); | ||
|
||
return TsArtifact.jar("app") | ||
.addManagedDependency(platformDescriptor()) | ||
.addManagedDependency(platformProperties()) | ||
.addDependency(extC) | ||
.addDependency(extA) | ||
.addDependency(extD); | ||
} | ||
|
||
@Override | ||
protected void assertDeploymentDeps(List<AppDependency> deploymentDeps) throws Exception { | ||
final Set<AppDependency> expected = new HashSet<>(); | ||
expected.add(new AppDependency( | ||
new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, "ext-c-deployment", TsArtifact.DEFAULT_VERSION), "compile")); | ||
expected.add(new AppDependency( | ||
new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, "ext-a-deployment", TsArtifact.DEFAULT_VERSION), "compile")); | ||
expected.add(new AppDependency( | ||
new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, "ext-b-deployment", TsArtifact.DEFAULT_VERSION), "runtime")); | ||
expected.add(new AppDependency( | ||
new AppArtifact(TsArtifact.DEFAULT_GROUP_ID, "ext-d-deployment", TsArtifact.DEFAULT_VERSION), "compile")); | ||
assertEquals(expected, new HashSet<>(deploymentDeps)); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
...arkus/deployment/conditionaldeps/DependencyConditionMatchesConditionalDependencyTest.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,50 @@ | ||
package io.quarkus.deployment.conditionaldeps; | ||
|
||
import io.quarkus.bootstrap.resolver.TsArtifact; | ||
import io.quarkus.bootstrap.resolver.TsQuarkusExt; | ||
import io.quarkus.deployment.runnerjar.ExecutableOutputOutcomeTestBase; | ||
|
||
public class DependencyConditionMatchesConditionalDependencyTest extends ExecutableOutputOutcomeTestBase { | ||
|
||
@Override | ||
protected TsArtifact modelApp() { | ||
|
||
final TsQuarkusExt extA = new TsQuarkusExt("ext-a"); | ||
|
||
final TsQuarkusExt extB = new TsQuarkusExt("ext-b"); | ||
extB.setDependencyCondition(extA); | ||
|
||
final TsQuarkusExt extD = new TsQuarkusExt("ext-d"); | ||
extD.setDependencyCondition(extB); | ||
extD.setConditionalDeps(extB); | ||
|
||
final TsQuarkusExt extC = new TsQuarkusExt("ext-c"); | ||
extC.setConditionalDeps(extD); | ||
|
||
install(extA); | ||
install(extB); | ||
install(extC); | ||
install(extD); | ||
|
||
addToExpectedLib(extA.getRuntime()); | ||
addToExpectedLib(extB.getRuntime()); | ||
addToExpectedLib(extC.getRuntime()); | ||
addToExpectedLib(extD.getRuntime()); | ||
|
||
return TsArtifact.jar("app") | ||
.addManagedDependency(platformDescriptor()) | ||
.addManagedDependency(platformProperties()) | ||
.addDependency(extC) | ||
.addDependency(extA); | ||
} | ||
|
||
@Override | ||
protected String[] expectedExtensionDependencies() { | ||
return new String[] { | ||
"ext-a", | ||
"ext-b", | ||
"ext-c", | ||
"ext-d" | ||
}; | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...t/java/io/quarkus/deployment/conditionaldeps/ExcludedDirectConditionalDependencyTest.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,49 @@ | ||
package io.quarkus.deployment.conditionaldeps; | ||
|
||
import io.quarkus.bootstrap.resolver.TsArtifact; | ||
import io.quarkus.bootstrap.resolver.TsQuarkusExt; | ||
import io.quarkus.deployment.runnerjar.ExecutableOutputOutcomeTestBase; | ||
|
||
public class ExcludedDirectConditionalDependencyTest extends ExecutableOutputOutcomeTestBase { | ||
|
||
@Override | ||
protected TsArtifact modelApp() { | ||
|
||
final TsQuarkusExt extA = new TsQuarkusExt("ext-a"); | ||
|
||
final TsQuarkusExt extB = new TsQuarkusExt("ext-b"); | ||
extB.setDependencyCondition(extA); | ||
install(extB); | ||
|
||
final TsQuarkusExt extD = new TsQuarkusExt("ext-d"); | ||
|
||
final TsQuarkusExt extE = new TsQuarkusExt("ext-e"); | ||
extE.setDependencyCondition(extD); | ||
install(extE); | ||
|
||
final TsQuarkusExt extC = new TsQuarkusExt("ext-c"); | ||
extC.setConditionalDeps(extB, extE); | ||
|
||
addToExpectedLib(extA.getRuntime()); | ||
addToExpectedLib(extC.getRuntime()); | ||
addToExpectedLib(extD.getRuntime()); | ||
addToExpectedLib(extE.getRuntime()); | ||
|
||
return TsArtifact.jar("app") | ||
.addManagedDependency(platformDescriptor()) | ||
.addManagedDependency(platformProperties()) | ||
.addDependency(extC, extB.getRuntime()) | ||
.addDependency(extA) | ||
.addDependency(extD); | ||
} | ||
|
||
@Override | ||
protected String[] expectedExtensionDependencies() { | ||
return new String[] { | ||
"ext-a", | ||
"ext-c", | ||
"ext-d", | ||
"ext-e" | ||
}; | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...va/io/quarkus/deployment/conditionaldeps/ExcludedTransitiveConditionalDependencyTest.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,43 @@ | ||
package io.quarkus.deployment.conditionaldeps; | ||
|
||
import io.quarkus.bootstrap.resolver.TsArtifact; | ||
import io.quarkus.bootstrap.resolver.TsQuarkusExt; | ||
import io.quarkus.deployment.runnerjar.ExecutableOutputOutcomeTestBase; | ||
|
||
public class ExcludedTransitiveConditionalDependencyTest extends ExecutableOutputOutcomeTestBase { | ||
|
||
@Override | ||
protected TsArtifact modelApp() { | ||
|
||
final TsQuarkusExt extA = new TsQuarkusExt("ext-a"); | ||
|
||
final TsQuarkusExt extB = new TsQuarkusExt("ext-b"); | ||
extB.setDependencyCondition(extA); | ||
install(extB); | ||
|
||
final TsQuarkusExt extC = new TsQuarkusExt("ext-c"); | ||
extC.setConditionalDeps(extB); | ||
|
||
final TsQuarkusExt extD = new TsQuarkusExt("ext-d"); | ||
extD.addDependency(extC); | ||
|
||
addToExpectedLib(extA.getRuntime()); | ||
addToExpectedLib(extC.getRuntime()); | ||
addToExpectedLib(extD.getRuntime()); | ||
|
||
return TsArtifact.jar("app") | ||
.addManagedDependency(platformDescriptor()) | ||
.addManagedDependency(platformProperties()) | ||
.addDependency(extD, extB.getRuntime()) | ||
.addDependency(extA); | ||
} | ||
|
||
@Override | ||
protected String[] expectedExtensionDependencies() { | ||
return new String[] { | ||
"ext-a", | ||
"ext-c", | ||
"ext-d" | ||
}; | ||
} | ||
} |
Oops, something went wrong.