From b2eb1631f5a146fd007c3845941229cf5a4e815c Mon Sep 17 00:00:00 2001 From: Alexey Loubyansky Date: Mon, 15 Mar 2021 12:37:50 +0100 Subject: [PATCH] Disabled and added an option to enable the registry client in devtools for the upcoming release --- .../io/quarkus/gradle/tasks/QuarkusPlatformTask.java | 8 +++++++- .../main/java/io/quarkus/maven/CreateProjectMojo.java | 7 ++++++- .../java/io/quarkus/maven/QuarkusProjectMojoBase.java | 6 +++++- .../io/quarkus/registry/ExtensionCatalogResolver.java | 9 ++++++++- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusPlatformTask.java b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusPlatformTask.java index c3905b83dadb6..9401798248ea2 100644 --- a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusPlatformTask.java +++ b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusPlatformTask.java @@ -32,13 +32,19 @@ public abstract class QuarkusPlatformTask extends QuarkusTask { + private static boolean isEnableRegistryClient() { + final String value = System.getProperty("enableRegistryClient"); + return value == null ? System.getProperties().containsKey("enableRegistryClient") : Boolean.parseBoolean(value); + } + QuarkusPlatformTask(String description) { super(description); } private ExtensionCatalog extensionsCatalog(boolean limitExtensionsToImportedPlatforms, MessageWriter log) { final List platforms = importedPlatforms(); - final ExtensionCatalogResolver catalogResolver = QuarkusProjectHelper.getCatalogResolver(log); + final ExtensionCatalogResolver catalogResolver = isEnableRegistryClient() ? QuarkusProjectHelper.getCatalogResolver(log) + : ExtensionCatalogResolver.empty(); if (catalogResolver.hasRegistries()) { try { return limitExtensionsToImportedPlatforms ? catalogResolver.resolveExtensionCatalog(platforms) diff --git a/devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java b/devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java index 048a886fba53d..0b77f4d46c119 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java @@ -185,6 +185,9 @@ public class CreateProjectMojo extends AbstractMojo { @Component RemoteRepositoryManager remoteRepoManager; + @Parameter(property = "enableRegistryClient") + private boolean enableRegistryClient; + @Override public void execute() throws MojoExecutionException { @@ -209,7 +212,9 @@ public void execute() throws MojoExecutionException { throw new MojoExecutionException("Failed to initialize Maven artifact resolver", e); } final MojoMessageWriter log = new MojoMessageWriter(getLog()); - final ExtensionCatalogResolver catalogResolver = QuarkusProjectHelper.getCatalogResolver(mvn, log); + final ExtensionCatalogResolver catalogResolver = enableRegistryClient + ? QuarkusProjectHelper.getCatalogResolver(mvn, log) + : ExtensionCatalogResolver.empty(); final ExtensionCatalog catalog = resolveExtensionsCatalog( StringUtils.defaultIfBlank(bomGroupId, null), diff --git a/devtools/maven/src/main/java/io/quarkus/maven/QuarkusProjectMojoBase.java b/devtools/maven/src/main/java/io/quarkus/maven/QuarkusProjectMojoBase.java index e0dcbcd077aff..6b8e374e3e640 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/QuarkusProjectMojoBase.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/QuarkusProjectMojoBase.java @@ -67,6 +67,9 @@ public abstract class QuarkusProjectMojoBase extends AbstractMojo { @Component RemoteRepositoryManager remoteRepositoryManager; + @Parameter(property = "enableRegistryClient") + private boolean enableRegistryClient; + private List importedPlatforms; private Artifact projectArtifact; @@ -142,7 +145,8 @@ protected boolean isLimitExtensionsToImportedPlatforms() { } private ExtensionCatalog resolveExtensionsCatalog() throws MojoExecutionException { - final ExtensionCatalogResolver catalogResolver = getExtensionCatalogResolver(); + final ExtensionCatalogResolver catalogResolver = enableRegistryClient ? getExtensionCatalogResolver() + : ExtensionCatalogResolver.empty(); if (catalogResolver.hasRegistries()) { try { return isLimitExtensionsToImportedPlatforms() diff --git a/independent-projects/tools/registry-client/src/main/java/io/quarkus/registry/ExtensionCatalogResolver.java b/independent-projects/tools/registry-client/src/main/java/io/quarkus/registry/ExtensionCatalogResolver.java index ff7a2d3288f2e..c50d4d8982439 100644 --- a/independent-projects/tools/registry-client/src/main/java/io/quarkus/registry/ExtensionCatalogResolver.java +++ b/independent-projects/tools/registry-client/src/main/java/io/quarkus/registry/ExtensionCatalogResolver.java @@ -29,6 +29,12 @@ public class ExtensionCatalogResolver { + public static ExtensionCatalogResolver empty() { + final ExtensionCatalogResolver resolver = new ExtensionCatalogResolver(); + resolver.registries = Collections.emptyList(); + return resolver; + } + public static Builder builder() { return new ExtensionCatalogResolver().new Builder(); } @@ -98,7 +104,8 @@ private void buildRegistryClients() { try { registries.add(new RegistryExtensionResolver(defaultClientFactory.buildRegistryClient(config), log)); } catch (RegistryResolutionException e) { - log.warn(e.getMessage()); + // TODO this should be enabled once the registry comes to life + log.debug(e.getMessage()); continue; } }