Skip to content

Commit

Permalink
Merge pull request #15725 from aloubyansky/disable-registry-client
Browse files Browse the repository at this point in the history
Disabled and added an option to enable the registry client in devtools for the upcoming release
  • Loading branch information
geoand authored Mar 15, 2021
2 parents 087b300 + b2eb163 commit e1f9f47
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<ArtifactCoords> 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ public class CreateProjectMojo extends AbstractMojo {
@Component
RemoteRepositoryManager remoteRepoManager;

@Parameter(property = "enableRegistryClient")
private boolean enableRegistryClient;

@Override
public void execute() throws MojoExecutionException {

Expand All @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ public abstract class QuarkusProjectMojoBase extends AbstractMojo {
@Component
RemoteRepositoryManager remoteRepositoryManager;

@Parameter(property = "enableRegistryClient")
private boolean enableRegistryClient;

private List<ArtifactCoords> importedPlatforms;

private Artifact projectArtifact;
Expand Down Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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;
}
}
Expand Down

0 comments on commit e1f9f47

Please sign in to comment.