Skip to content

Commit 232ebd2

Browse files
authored
Merge pull request #50554 from aloubyansky/ignore-quarkus-core-in-non-platform-catalog
Ignore quarkus-core in non-platform extension catalogs
2 parents 91b7dd3 + 3ecb649 commit 232ebd2

File tree

3 files changed

+59
-2
lines changed

3 files changed

+59
-2
lines changed

independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/commands/handlers/CreateProjectCommandHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ private static List<ExtensionCatalog> ensureQuarkusCorePresent(List<ExtensionCat
418418
int catalogContainingCoreIndex = -1;
419419
for (int i = 0; i < catalogs.size(); ++i) {
420420
ExtensionCatalog catalog = catalogs.get(i);
421-
if (catalog.getMetadata()
421+
if (catalog.isPlatform() && catalog.getMetadata()
422422
.get(Constants.REGISTRY_CLIENT_ALL_CATALOG_EXTENSIONS) instanceof Map<?, ?> allCatalogExtensions) {
423423
final ArtifactCoords managedQuarkusCore = (ArtifactCoords) allCatalogExtensions
424424
.get(quarkusCore.getArtifact().getKey());

independent-projects/tools/devtools-testing/src/main/java/io/quarkus/devtools/testing/registry/client/TestRegistryClientBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ public TestRegistryBuilder registry() {
982982
}
983983

984984
private void persist(Path nonPlatformDir) {
985-
codestarts.forEach(c -> c.persist());
985+
codestarts.forEach(TestCodestartBuilder::persist);
986986
final Path json = getNonPlatformCatalogPath(nonPlatformDir, extensions.getQuarkusCoreVersion());
987987
try {
988988
extensions.persist(json);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package io.quarkus.devtools.project.create;
2+
3+
import java.nio.file.Path;
4+
import java.util.List;
5+
6+
import org.junit.jupiter.api.BeforeAll;
7+
import org.junit.jupiter.api.Test;
8+
9+
import io.quarkus.devtools.testing.registry.client.TestRegistryClientBuilder;
10+
import io.quarkus.maven.dependency.ArtifactCoords;
11+
12+
public class CreateProjectWithNonPlatformExtensionTest extends MultiplePlatformBomsTestBase {
13+
14+
private static final String PLATFORM_KEY = "org.acme.platform";
15+
16+
@BeforeAll
17+
public static void setup() throws Exception {
18+
TestRegistryClientBuilder.newInstance()
19+
//.debug()
20+
.baseDir(configDir())
21+
// registry
22+
.newRegistry("registry.acme.org")
23+
// platform key
24+
.newPlatform(PLATFORM_KEY)
25+
.newStream("1.1")
26+
// 1.1.1 release
27+
.newRelease("1.1.1")
28+
.quarkusVersion("1.1.1")
29+
// default bom including quarkus-core + essential metadata
30+
.addCoreMember().release()
31+
.stream().platform().registry()
32+
.newNonPlatformCatalog("1.1.1")
33+
.addExtension("org.bla", "bla-magic", "5.5.5")
34+
// this is just to make sure quarkus-core (by accident) included in a non-platform catalog does not mislead the tools
35+
.addExtension("io.quarkus", "quarkus-core", "5.5.5")
36+
.registry()
37+
.clientBuilder()
38+
.build();
39+
40+
enableRegistryClient();
41+
}
42+
43+
protected String getMainPlatformKey() {
44+
return PLATFORM_KEY;
45+
}
46+
47+
@Test
48+
public void projectWithNonPlatformExtensionOnly() throws Exception {
49+
final Path projectDir = newProjectDir("project-non-platform-ext");
50+
createProject(projectDir, List.of("bla-magic"));
51+
52+
assertModel(projectDir,
53+
List.of(mainPlatformBom()),
54+
List.of(ArtifactCoords.jar("org.bla", "bla-magic", "5.5.5")),
55+
"1.1.1");
56+
}
57+
}

0 commit comments

Comments
 (0)