Implement a custom resolver when running in local mode.
When running in local mode, dependencies should be resolved by looking on the local system. Remote repositories should be ignored.
This commit is contained in:
parent
9a36347598
commit
733e99cdb1
76
depmap.xml
76
depmap.xml
@ -1,52 +1,4 @@
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<maven>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</maven>
|
||||
<jpp>
|
||||
<groupId>JPP/maven</groupId>
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</jpp>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<maven>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</maven>
|
||||
<jpp>
|
||||
<groupId>JPP/maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</jpp>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<maven>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-core</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</maven>
|
||||
<jpp>
|
||||
<groupId>JPP/maven</groupId>
|
||||
<artifactId>maven-core</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</jpp>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<maven>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-settings</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</maven>
|
||||
<jpp>
|
||||
<groupId>JPP/maven</groupId>
|
||||
<artifactId>maven-settings</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</jpp>
|
||||
</dependency>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<maven>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
@ -59,30 +11,4 @@
|
||||
<version>3.0.3</version>
|
||||
</jpp>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<maven>
|
||||
<groupId>org.sonatype.tycho</groupId>
|
||||
<artifactId>org.eclipse.jdt.core</artifactId>
|
||||
<version>3.6.0</version>
|
||||
</maven>
|
||||
<jpp>
|
||||
<groupId>JPP</groupId>
|
||||
<artifactId>jdt-core</artifactId>
|
||||
<version>3.6.0</version>
|
||||
</jpp>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<maven>
|
||||
<groupId>org.sonatype.tycho</groupId>
|
||||
<artifactId>org.eclipse.osgi</artifactId>
|
||||
<version>3.6.0</version>
|
||||
</maven>
|
||||
<jpp>
|
||||
<groupId>JPP</groupId>
|
||||
<artifactId>jdt-osgi</artifactId>
|
||||
<version>3.6.0</version>
|
||||
</jpp>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
@ -44,17 +44,6 @@
|
||||
assertEquals(originalManifest.size(), writtenManifest.size());
|
||||
for (Enumeration<String> keys = writtenManifest.keys(); keys.hasMoreElements();) {
|
||||
String key = keys.nextElement();
|
||||
--- ./tycho-0.14.0.old/tycho-core/src/main/java/org/eclipse/tycho/core/utils/EEVersion.java 2012-02-06 10:26:59.000000000 -0500
|
||||
+++ ./tycho-0.14.0/tycho-core/src/main/java/org/eclipse/tycho/core/utils/EEVersion.java 2012-02-14 10:47:58.743002506 -0500
|
||||
@@ -18,7 +18,7 @@
|
||||
public enum EEType {
|
||||
|
||||
// order is significant for comparison
|
||||
- OSGI_MINIMUM("OSGi/Minimum"), CDC_FOUNDATION("CDC/Foundation"), JAVA_SE("JavaSE");
|
||||
+ OSGI_MINIMUM("OSGi/Minimum"), CDC_FOUNDATION("CDC/Foundation"), JAVA_SE("JavaSE"), JRE("JRE");
|
||||
|
||||
private final String profileName;
|
||||
|
||||
--- ./tycho-0.14.0.old/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/OsgiManifest.java 2012-02-06 10:26:59.000000000 -0500
|
||||
+++ ./tycho-0.14.0/tycho-core/src/main/java/org/eclipse/tycho/core/osgitools/OsgiManifest.java 2012-02-10 15:36:32.000000000 -0500
|
||||
@@ -25,7 +25,7 @@
|
||||
@ -118,3 +107,28 @@
|
||||
+Require-Bundle: org.junit;bundle-version="[3.8.0,4.9.0)"
|
||||
Bundle-ClassPath: jars/surefire-junit3-2.10.jar
|
||||
Bundle-Vendor: %providerName
|
||||
--- ./tycho-0.14.x.old/tycho-core/src/main/java/org/eclipse/tycho/core/utils/EEVersion.java 2012-02-24 06:40:15.000000000 -0500
|
||||
+++ ./tycho-0.14.x/tycho-core/src/main/java/org/eclipse/tycho/core/utils/EEVersion.java 2012-05-03 14:09:09.000000000 -0400
|
||||
@@ -18,7 +18,7 @@
|
||||
public enum EEType {
|
||||
|
||||
// order is significant for comparison
|
||||
- OSGI_MINIMUM("OSGi/Minimum"), CDC_FOUNDATION("CDC/Foundation"), JAVA_SE("JavaSE");
|
||||
+ OSGI_MINIMUM("OSGi/Minimum"), CDC_FOUNDATION("CDC/Foundation"), JRE("JRE"), JAVA_SE("JavaSE");
|
||||
|
||||
private final String profileName;
|
||||
|
||||
--- ./tycho-0.14.x.old/tycho-core/src/main/java/org/eclipse/tycho/core/utils/ExecutionEnvironment.java 2012-02-24 06:40:15.000000000 -0500
|
||||
+++ ./tycho-0.14.x/tycho-core/src/main/java/org/eclipse/tycho/core/utils/ExecutionEnvironment.java 2012-05-03 14:09:09.000000000 -0400
|
||||
@@ -50,8 +50,9 @@
|
||||
|
||||
private EEVersion parseEEVersion(String systemCaps) {
|
||||
if (systemCaps == null && "JRE-1.1".equals(profileName)) {
|
||||
- // system capabilities entry is missing for JRE-1.1
|
||||
- return new EEVersion(Version.parseVersion("1.1"), EEType.JAVA_SE);
|
||||
+ // system capabilities entry is missing for JRE-1.1
|
||||
+ // TODO remove workaround when https://bugs.eclipse.org/377277 is fixed
|
||||
+ return new EEVersion(Version.parseVersion("1.1"), EEType.JRE);
|
||||
}
|
||||
List<EEVersion> eeVersions = new ArrayList<EEVersion>();
|
||||
try {
|
||||
|
84
tycho-use-custom-resolver.patch
Normal file
84
tycho-use-custom-resolver.patch
Normal file
@ -0,0 +1,84 @@
|
||||
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetDefinitionResolver.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetDefinitionResolver.java
|
||||
index 2d7d3b9..3084fff 100644
|
||||
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetDefinitionResolver.java
|
||||
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetDefinitionResolver.java
|
||||
@@ -24,6 +24,7 @@ import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
+import org.eclipse.core.runtime.URIUtil;
|
||||
import org.eclipse.equinox.p2.core.IProvisioningAgent;
|
||||
import org.eclipse.equinox.p2.core.ProvisionException;
|
||||
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
|
||||
@@ -100,8 +101,11 @@ public class TargetDefinitionResolver {
|
||||
|
||||
List<IMetadataRepository> metadataRepositories = new ArrayList<IMetadataRepository>();
|
||||
for (Repository repository : iuLocationDefinition.getRepositories()) {
|
||||
- artifactRepositories.add(repository.getLocation());
|
||||
- metadataRepositories.add(loadRepository(repository));
|
||||
+ // We cannot resolve a non-file URI in local mode
|
||||
+ if (System.getProperty("maven.local.mode") == null || URIUtil.isFileURI(repository.getLocation())) {
|
||||
+ artifactRepositories.add(repository.getLocation());
|
||||
+ metadataRepositories.add(loadRepository(repository));
|
||||
+ }
|
||||
}
|
||||
|
||||
IQueryable<IInstallableUnit> locationUnits = new CompoundQueryable<IInstallableUnit>(
|
||||
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetPlatformBuilderImpl.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetPlatformBuilderImpl.java
|
||||
index 9da87bb..3d15c5e 100644
|
||||
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetPlatformBuilderImpl.java
|
||||
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/target/TargetPlatformBuilderImpl.java
|
||||
@@ -255,6 +255,11 @@ public class TargetPlatformBuilderImpl implements TargetPlatformBuilder {
|
||||
return;
|
||||
}
|
||||
|
||||
+ // We cannot resolve a non-file URI in local mode
|
||||
+ if (System.getProperty("maven.local.mode") != null && !URIUtil.isFileURI(location)) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
try {
|
||||
metadataRepository = metadataRepositoryManager.loadRepository(location, monitor);
|
||||
metadataRepositories.add(metadataRepository);
|
||||
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/osgi/runtime/TychoP2RuntimeLocator.java b/tycho-core/src/main/java/org/eclipse/tycho/osgi/runtime/TychoP2RuntimeLocator.java
|
||||
index 15b3fff..c8f14df 100644
|
||||
--- a/tycho-core/src/main/java/org/eclipse/tycho/osgi/runtime/TychoP2RuntimeLocator.java
|
||||
+++ b/tycho-core/src/main/java/org/eclipse/tycho/osgi/runtime/TychoP2RuntimeLocator.java
|
||||
@@ -23,6 +23,7 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
|
||||
+import org.apache.maven.artifact.resolver.JavadirWorkspaceReader;
|
||||
import org.apache.maven.artifact.resolver.ResolutionErrorHandler;
|
||||
import org.apache.maven.execution.MavenSession;
|
||||
import org.apache.maven.model.Dependency;
|
||||
@@ -38,6 +39,7 @@ import org.codehaus.plexus.util.FileUtils;
|
||||
import org.eclipse.sisu.equinox.embedder.EquinoxRuntimeLocator;
|
||||
import org.eclipse.tycho.locking.facade.FileLockService;
|
||||
import org.eclipse.tycho.locking.facade.FileLocker;
|
||||
+import org.sonatype.aether.util.artifact.DefaultArtifact;
|
||||
|
||||
@Component(role = EquinoxRuntimeLocator.class)
|
||||
public class TychoP2RuntimeLocator implements EquinoxRuntimeLocator {
|
||||
@@ -158,6 +160,21 @@ public class TychoP2RuntimeLocator implements EquinoxRuntimeLocator {
|
||||
}
|
||||
|
||||
private File resolveArtifact(MavenSession session, Artifact artifact) throws MavenExecutionException {
|
||||
+
|
||||
+ // If we are in local mode, find the artifact on the system
|
||||
+ if (System.getProperty("maven.local.mode") != null) {
|
||||
+ JavadirWorkspaceReader wReader = new JavadirWorkspaceReader();
|
||||
+ DefaultArtifact newArtifact = new DefaultArtifact(artifact.getGroupId()
|
||||
+ + ":" + artifact.getArtifactId()
|
||||
+ + ":" + artifact.getType()
|
||||
+ + ":" + artifact.getVersion());
|
||||
+ File file = wReader.findArtifact(newArtifact);
|
||||
+ if (file != null) {
|
||||
+ artifact.setFile(file);
|
||||
+ return file;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
List<ArtifactRepository> repositories = new ArrayList<ArtifactRepository>();
|
||||
for (MavenProject project : session.getProjects()) {
|
||||
repositories.addAll(project.getPluginArtifactRepositories());
|
16
tycho.spec
16
tycho.spec
@ -1,4 +1,4 @@
|
||||
%global bootstrap 0
|
||||
%global bootstrap 1
|
||||
|
||||
%if %{bootstrap}
|
||||
%global snap -SNAPSHOT
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
Name: tycho
|
||||
Version: 0.14.1
|
||||
Release: 2%{?dist}
|
||||
Release: 2.1%{?dist}
|
||||
Summary: Plugins and extensions for building Eclipse plugins and OSGI bundles with Maven
|
||||
|
||||
Group: Development/Libraries
|
||||
@ -22,17 +22,18 @@ Source0: %{name}-0.14.x.tar.bz2
|
||||
# version 2.4.3 (impossible to have empty mojo created as aggregate). This
|
||||
# should be fixed upstream properly
|
||||
Source1: EmptyMojo.java
|
||||
|
||||
# we need to make sure we are using maven 3 deps
|
||||
Source2: depmap.xml
|
||||
|
||||
Patch0: %{name}-fix-build.patch
|
||||
# Upstream builds against maven-surefire 2.10 but in rawhide we have 2.12
|
||||
Patch1: %{name}-maven-surefire.patch
|
||||
Patch2: %{name}-use-custom-resolver.patch
|
||||
# Set some temporary build version so that the bootstrapped build has
|
||||
# a different version from the nonbootstrapped. Otherwise there will
|
||||
# be cyclic dependencies.
|
||||
%if %{bootstrap}
|
||||
Patch2: %{name}-bootstrap.patch
|
||||
Patch3: %{name}-bootstrap.patch
|
||||
%endif
|
||||
|
||||
BuildArch: noarch
|
||||
@ -109,8 +110,9 @@ This package contains the API documentation for %{name}.
|
||||
|
||||
%patch0 -p2
|
||||
%patch1 -p2
|
||||
%if %{bootstrap}
|
||||
%patch2 -p1
|
||||
%if %{bootstrap}
|
||||
%patch3 -p1
|
||||
%endif
|
||||
|
||||
find tycho-core -iname '*html' -delete
|
||||
@ -191,6 +193,10 @@ cp -pr target/site/api*/* %{buildroot}%{_javadocdir}/%{name}
|
||||
%{_javadocdir}/%{name}
|
||||
|
||||
%changelog
|
||||
* Wed Apr 25 2012 Roland Grunberg <rgrunber@redhat.com> 0.14.1-2.1
|
||||
- Implement a custom resolver when running in local mode.
|
||||
- Use upstream solution for BZ #372395 to fix the build.
|
||||
|
||||
* Wed Apr 4 2012 Roland Grunberg <rgrunber@redhat.com> 0.14.1-2
|
||||
- Non-bootstrap build.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user