From 78ee92d2f964404b10af3698dff5259de366938d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Mon, 18 Dec 2023 06:37:41 +0100 Subject: [PATCH] Disable P2 mirror lists by default because they are unstable --- ...ArtifactRepositoryManagerAgentFactory.java | 38 +++++++++---------- .../test/AbstractTychoIntegrationTest.java | 2 +- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/transport/RemoteArtifactRepositoryManagerAgentFactory.java b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/transport/RemoteArtifactRepositoryManagerAgentFactory.java index c936a1669c..91dfe7ec1e 100644 --- a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/transport/RemoteArtifactRepositoryManagerAgentFactory.java +++ b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/transport/RemoteArtifactRepositoryManagerAgentFactory.java @@ -24,7 +24,7 @@ @Component(role = IAgentServiceFactory.class, hint = "org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager") public class RemoteArtifactRepositoryManagerAgentFactory implements IAgentServiceFactory { - @Requirement + @Requirement Logger logger; @Requirement @@ -33,26 +33,24 @@ public class RemoteArtifactRepositoryManagerAgentFactory implements IAgentServic @Requirement MavenAuthenticator authenticator; - @Override - public Object createService(IProvisioningAgent agent) { - IArtifactRepositoryManager plainRepoManager = (IArtifactRepositoryManager) new ArtifactRepositoryComponent() - .createService(agent); - if (getDisableP2MirrorsConfiguration()) { - plainRepoManager = new P2MirrorDisablingArtifactRepositoryManager(plainRepoManager, - logger); - } + @Override + public Object createService(IProvisioningAgent agent) { + IArtifactRepositoryManager plainRepoManager = (IArtifactRepositoryManager) new ArtifactRepositoryComponent() + .createService(agent); + if (getDisableP2MirrorsConfiguration()) { + plainRepoManager = new P2MirrorDisablingArtifactRepositoryManager(plainRepoManager, logger); + } return new RemoteArtifactRepositoryManager(plainRepoManager, repositoryIdManager, authenticator); - } + } - private boolean getDisableP2MirrorsConfiguration() { - String key = "tycho.disableP2Mirrors"; + private boolean getDisableP2MirrorsConfiguration() { + String key = "tycho.disableP2Mirrors"; String value = System.getProperty(key); - - boolean disableP2Mirrors = Boolean.parseBoolean(value); - if (disableP2Mirrors && logger.isDebugEnabled()) { - String message = key + "=" + value + " -> ignoring mirrors specified in p2 artifact repositories"; - logger.debug(message); - } - return disableP2Mirrors; - } + if (value != null) { + logger.info("Using " + key + + " to disable P2 mirrors is deprecated, use the property eclipse.p2.mirrors=false instead!"); + return Boolean.parseBoolean(value); + } + return false; + } } diff --git a/tycho-testing-harness/src/main/java/org/eclipse/tycho/test/AbstractTychoIntegrationTest.java b/tycho-testing-harness/src/main/java/org/eclipse/tycho/test/AbstractTychoIntegrationTest.java index 5254ea12d8..31ba59f72a 100644 --- a/tycho-testing-harness/src/main/java/org/eclipse/tycho/test/AbstractTychoIntegrationTest.java +++ b/tycho-testing-harness/src/main/java/org/eclipse/tycho/test/AbstractTychoIntegrationTest.java @@ -91,7 +91,7 @@ protected Verifier getVerifier(String test, boolean setTargetPlatform, File user Verifier verifier = new Verifier(testDir.getAbsolutePath()); verifier.setForkJvm(isForked()); if (isDisableMirrors()) { - verifier.setSystemProperty("tycho.disableP2Mirrors", "true"); + verifier.setSystemProperty("eclipse.p2.mirrors", "false"); } String debug = System.getProperty("tycho.mvnDebug"); if (debug != null) {