Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restoring the option to ignore p2 mirrors via the Maven settings #3295

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*******************************************************************************/
package org.eclipse.tycho.p2maven.transport;

import org.apache.maven.plugin.LegacySupport;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.Logger;
Expand All @@ -34,6 +35,9 @@ public class RemoteArtifactRepositoryManagerAgentFactory implements IAgentServic
@Requirement
MavenAuthenticator authenticator;

@Requirement
protected LegacySupport mavenContext;

@Override
public Object createService(IProvisioningAgent agent) {
IArtifactRepositoryManager plainRepoManager = (IArtifactRepositoryManager) new ArtifactRepositoryComponent()
Expand All @@ -45,14 +49,36 @@ public Object createService(IProvisioningAgent agent) {
}

private boolean getDisableP2MirrorsConfiguration() {
String key = "tycho.disableP2Mirrors";
String value = System.getProperty(key);
if (value != null) {
logger.info("Using " + key
String deprecatedKey = "tycho.disableP2Mirrors";
String deprecatedValue = getMirrorProperty(deprecatedKey);

if (deprecatedValue != null) {
logger.info("Using " + deprecatedKey
+ " to disable P2 mirrors is deprecated, use the property eclipse.p2.mirrors instead, see https://tycho.eclipseprojects.io/doc/"
+ TychoVersion.getTychoVersion() + "/SystemProperties.html for details.");
return Boolean.parseBoolean(value);
return Boolean.parseBoolean(deprecatedValue);
}

String key = "eclipse.p2.mirrors ";
String value = getMirrorProperty(key);

if (value != null) {
// eclipse.p2.mirrors false -> disable mirrors
laeubi marked this conversation as resolved.
Show resolved Hide resolved
return !Boolean.parseBoolean(value);
}
return false;

}

private String getMirrorProperty(String key) {
String value = System.getProperty(key);
if (key == null && mavenContext.getSession() != null) {
key = mavenContext.getSession().getSystemProperties().getProperty(key);

if (key == null) {
key = mavenContext.getSession().getUserProperties().getProperty(key);
}
}
return value;
}
}
Loading