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.
Merge pull request quarkusio#44167 from aloubyansky/runtime-model-only
An option to resolve only the runtime part of the ApplicationModel
Showing
9 changed files
with
242 additions
and
49 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
53 changes: 53 additions & 0 deletions
53
...ls/maven/src/test/java/io/quarkus/maven/ConditionalDependencyTreeMojoRuntimeOnlyTest.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.maven; | ||
|
||
import io.quarkus.bootstrap.resolver.TsArtifact; | ||
import io.quarkus.bootstrap.resolver.TsQuarkusExt; | ||
|
||
public class ConditionalDependencyTreeMojoRuntimeOnlyTest extends DependencyTreeMojoTestBase { | ||
@Override | ||
protected String mode() { | ||
return "prod"; | ||
} | ||
|
||
@Override | ||
protected boolean isIncubatingModelResolver() { | ||
return true; | ||
} | ||
|
||
@Override | ||
protected boolean isRuntimeOnly() { | ||
return true; | ||
} | ||
|
||
@Override | ||
protected void initRepo() { | ||
|
||
final TsQuarkusExt coreExt = new TsQuarkusExt("test-core-ext"); | ||
|
||
var tomatoExt = new TsQuarkusExt("quarkus-tomato").addDependency(coreExt); | ||
var mozzarellaExt = new TsQuarkusExt("quarkus-mozzarella").addDependency(coreExt); | ||
var basilExt = new TsQuarkusExt("quarkus-basil").addDependency(coreExt); | ||
|
||
var oilJar = TsArtifact.jar("quarkus-oil"); | ||
|
||
var capreseExt = new TsQuarkusExt("quarkus-caprese") | ||
.setDependencyCondition(tomatoExt, mozzarellaExt, basilExt) | ||
.addDependency(coreExt); | ||
capreseExt.getDeployment().addDependency(oilJar); | ||
capreseExt.install(repoBuilder); | ||
|
||
var saladExt = new TsQuarkusExt("quarkus-salad") | ||
.setConditionalDeps(capreseExt) | ||
.addDependency(coreExt); | ||
|
||
app = TsArtifact.jar("app-with-conditional-deps") | ||
.addDependency(tomatoExt) | ||
.addDependency(mozzarellaExt) | ||
.addDependency(basilExt) | ||
.addDependency(saladExt) | ||
.addDependency(oilJar); | ||
|
||
appModel = app.getPomModel(); | ||
app.install(repoBuilder); | ||
} | ||
} |
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
9 changes: 9 additions & 0 deletions
9
devtools/maven/src/test/resources/app-with-conditional-deps-1.jar.prod.rt
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,9 @@ | ||
[info] Quarkus application PROD mode build dependency tree: | ||
[info] io.quarkus.bootstrap.test:app-with-conditional-deps:pom:1 | ||
[info] ├─ io.quarkus.bootstrap.test:quarkus-tomato:1 (compile) | ||
[info] │ └─ io.quarkus.bootstrap.test:test-core-ext:1 (compile) | ||
[info] ├─ io.quarkus.bootstrap.test:quarkus-mozzarella:1 (compile) | ||
[info] ├─ io.quarkus.bootstrap.test:quarkus-basil:1 (compile) | ||
[info] ├─ io.quarkus.bootstrap.test:quarkus-salad:1 (compile) | ||
[info] │ └─ io.quarkus.bootstrap.test:quarkus-caprese:1 (compile) | ||
[info] └─ io.quarkus.bootstrap.test:quarkus-oil:1 (compile) |
82 changes: 82 additions & 0 deletions
82
...src/test/java/io/quarkus/bootstrap/resolver/test/RuntimeOnlyApplicationModelTestCase.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,82 @@ | ||
package io.quarkus.bootstrap.resolver.test; | ||
|
||
import io.quarkus.bootstrap.resolver.BootstrapAppModelResolver; | ||
import io.quarkus.bootstrap.resolver.CollectDependenciesBase; | ||
import io.quarkus.bootstrap.resolver.TsArtifact; | ||
import io.quarkus.bootstrap.resolver.TsQuarkusExt; | ||
import io.quarkus.bootstrap.resolver.maven.workspace.LocalProject; | ||
import io.quarkus.maven.dependency.DependencyFlags; | ||
|
||
public class RuntimeOnlyApplicationModelTestCase extends CollectDependenciesBase { | ||
|
||
private static final boolean runtimeOnly = true; | ||
|
||
@Override | ||
protected BootstrapAppModelResolver newAppModelResolver(LocalProject currentProject) throws Exception { | ||
var resolver = super.newAppModelResolver(currentProject); | ||
resolver.setIncubatingModelResolver(false); | ||
resolver.setRuntimeModelOnly(runtimeOnly); | ||
return resolver; | ||
} | ||
|
||
@Override | ||
protected void setupDependencies() { | ||
|
||
final TsQuarkusExt extA = new TsQuarkusExt("ext-a"); | ||
install(extA, false); | ||
if (!runtimeOnly) { | ||
addCollectedDeploymentDep(extA.getDeployment()); | ||
} | ||
|
||
installAsDep(extA.getRuntime(), | ||
DependencyFlags.DIRECT | ||
| DependencyFlags.RUNTIME_EXTENSION_ARTIFACT | ||
| DependencyFlags.TOP_LEVEL_RUNTIME_EXTENSION_ARTIFACT); | ||
|
||
final TsQuarkusExt extB = new TsQuarkusExt("ext-b"); | ||
install(extB, false); | ||
|
||
final TsQuarkusExt extC = new TsQuarkusExt("ext-c"); | ||
extC.setDependencyCondition(extB); | ||
install(extC, false); | ||
|
||
final TsQuarkusExt extD = new TsQuarkusExt("ext-d"); | ||
install(extD, false); | ||
installAsDep(extD.getRuntime(), | ||
DependencyFlags.DIRECT | ||
| DependencyFlags.RUNTIME_EXTENSION_ARTIFACT | ||
| DependencyFlags.TOP_LEVEL_RUNTIME_EXTENSION_ARTIFACT); | ||
if (!runtimeOnly) { | ||
addCollectedDeploymentDep(extD.getDeployment()); | ||
} | ||
|
||
final TsArtifact libE = TsArtifact.jar("lib-e"); | ||
install(libE, true); | ||
final TsArtifact libEBuildTIme = TsArtifact.jar("lib-e-build-time"); | ||
install(libEBuildTIme); | ||
if (!runtimeOnly) { | ||
addCollectedDeploymentDep(libEBuildTIme); | ||
} | ||
|
||
final TsQuarkusExt extE = new TsQuarkusExt("ext-e"); | ||
extE.setDependencyCondition(extD); | ||
extE.getRuntime().addDependency(libE); | ||
extE.getDeployment().addDependency(libEBuildTIme); | ||
install(extE, false); | ||
addCollectedDep(extE.getRuntime(), DependencyFlags.RUNTIME_EXTENSION_ARTIFACT); | ||
if (!runtimeOnly) { | ||
addCollectedDeploymentDep(extE.getDeployment()); | ||
} | ||
|
||
final TsQuarkusExt extF = new TsQuarkusExt("ext-f"); | ||
extF.setConditionalDeps(extC, extE); | ||
install(extF, false); | ||
installAsDep(extF.getRuntime(), | ||
DependencyFlags.DIRECT | ||
| DependencyFlags.RUNTIME_EXTENSION_ARTIFACT | ||
| DependencyFlags.TOP_LEVEL_RUNTIME_EXTENSION_ARTIFACT); | ||
if (!runtimeOnly) { | ||
addCollectedDeploymentDep(extF.getDeployment()); | ||
} | ||
} | ||
} |
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