Skip to content

Commit

Permalink
Do not use RepositorySystem constant but own Tycho one
Browse files Browse the repository at this point in the history
  • Loading branch information
laeubi committed Sep 9, 2024
1 parent 6f6cabb commit fabdd5d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.LegacySupport;
import org.apache.maven.repository.RepositorySystem;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
import org.eclipse.aether.transfer.TransferListener;
import org.eclipse.tycho.TychoConstants;

@Component(role = TransportCacheConfig.class)
public class DefaultTransportCacheConfig implements TransportCacheConfig, Initializable {
Expand All @@ -39,7 +39,7 @@ public void initialize() throws InitializationException {
File repoDir;
MavenSession session = legacySupport.getSession();
if (session == null) {
repoDir = RepositorySystem.defaultUserLocalRepository;
repoDir = TychoConstants.DEFAULT_USER_LOCALREPOSITORY;
offline = false;
update = false;
interactive = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.LegacySupport;
import org.apache.maven.repository.RepositorySystem;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
Expand All @@ -25,6 +24,7 @@
import org.eclipse.equinox.internal.p2.repository.Transport;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.core.spi.IAgentServiceFactory;
import org.eclipse.tycho.TychoConstants;

@Component(role = IAgentServiceFactory.class, hint = "org.eclipse.equinox.internal.p2.repository.CacheManager")
public class TychoRepositoryTransportCacheManagerAgentFactory implements IAgentServiceFactory, Initializable {
Expand All @@ -46,7 +46,7 @@ public Object createService(IProvisioningAgent agent) {
public void initialize() throws InitializationException {
MavenSession session = legacySupport.getSession();
if (session == null) {
repoDir = RepositorySystem.defaultUserLocalRepository;
repoDir = TychoConstants.DEFAULT_USER_LOCALREPOSITORY;
} else {
repoDir = new File(session.getLocalRepository().getBasedir());
}
Expand Down
5 changes: 5 additions & 0 deletions tycho-api/src/main/java/org/eclipse/tycho/TychoConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@
*******************************************************************************/
package org.eclipse.tycho;

import java.io.File;
import java.util.regex.Pattern;

public interface TychoConstants {

String USER_HOME = System.getProperty("user.home");
File USER_MAVEN_CONFIGURATION_HOME = new File(USER_HOME, ".m2");
File DEFAULT_USER_LOCALREPOSITORY = new File(USER_MAVEN_CONFIGURATION_HOME, "repository");

public static final String ECLIPSE_LATEST = "https://download.eclipse.org/releases/2024-06/";

public static final String TYCHO_NOT_CONFIGURED = "Tycho build extension not configured for ";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.LegacySupport;
import org.apache.maven.project.MavenProject;
import org.apache.maven.repository.RepositorySystem;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.eclipse.tycho.MavenRepositoryLocation;
import org.eclipse.tycho.ReactorProject;
import org.eclipse.tycho.TychoConstants;
import org.eclipse.tycho.core.osgitools.DefaultReactorProject;
import org.eclipse.tycho.core.shared.MavenContext;
import org.eclipse.tycho.core.shared.MavenLogger;
Expand Down Expand Up @@ -114,7 +114,7 @@ public ChecksumPolicy getChecksumsMode() {
public File getLocalRepositoryRoot() {
if (repoDir == null) {
repoDir = getSession().map(s -> s.getLocalRepository().getBasedir()).map(File::new)
.orElse(RepositorySystem.defaultUserLocalRepository);
.orElse(TychoConstants.DEFAULT_USER_LOCALREPOSITORY);
}
return repoDir;
}
Expand Down

0 comments on commit fabdd5d

Please sign in to comment.