Improve artifact resolution using XMvn Resolver. (Bug 986900)
This commit is contained in:
parent
cbbc0feb61
commit
7f114a0a72
@ -1,4 +1,4 @@
|
||||
From fa63e64381fc02e1d5b3086e4585f259fd2120f8 Mon Sep 17 00:00:00 2001
|
||||
From 92cdfc9a21142cc866265b45b37e85547145d15d Mon Sep 17 00:00:00 2001
|
||||
From: Roland Grunberg <rgrunber@redhat.com>
|
||||
Date: Tue, 12 Jun 2012 10:38:51 -0400
|
||||
Subject: [PATCH] Implement a custom resolver for Tycho in local mode.
|
||||
@ -29,7 +29,7 @@ Change-Id: Ia1ece07ece2412bc4a88901631f3f651ad2b634b
|
||||
---
|
||||
.../tycho/p2/target/TargetDefinitionResolver.java | 11 +++--
|
||||
.../tycho/p2/target/TargetPlatformBuilderImpl.java | 55 ++++++++++++++++++++--
|
||||
.../tycho/p2/repository/LocalRepositoryReader.java | 22 ++++++++-
|
||||
.../tycho/p2/repository/LocalRepositoryReader.java | 31 +++++++++++-
|
||||
tycho-core/pom.xml | 5 ++
|
||||
.../eclipse/tycho/core/locking/FileLockerImpl.java | 24 +++++++---
|
||||
.../core/maven/TychoMavenLifecycleParticipant.java | 28 +++++++++++
|
||||
@ -38,7 +38,7 @@ Change-Id: Ia1ece07ece2412bc4a88901631f3f651ad2b634b
|
||||
.../DefaultTargetPlatformConfigurationReader.java | 6 ++-
|
||||
.../osgi/runtime/TychoOsgiRuntimeLocator.java | 17 +++++++
|
||||
.../p2/resolver/P2TargetPlatformResolver.java | 11 +++++
|
||||
11 files changed, 214 insertions(+), 18 deletions(-)
|
||||
11 files changed, 223 insertions(+), 18 deletions(-)
|
||||
|
||||
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 2dc91ff..8395f82 100644
|
||||
@ -151,20 +151,18 @@ index 5b61351..b81f6be 100644
|
||||
if (includeLocalMavenRepo && logger.isDebugEnabled()) {
|
||||
IQueryResult<IInstallableUnit> locallyInstalledIUs = localMetadataRepository.query(QueryUtil.ALL_UNITS,
|
||||
diff --git a/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/repository/LocalRepositoryReader.java b/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/repository/LocalRepositoryReader.java
|
||||
index 8d36462..5965699 100644
|
||||
index 8d36462..eb05eff 100644
|
||||
--- a/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/repository/LocalRepositoryReader.java
|
||||
+++ b/tycho-bundles/org.eclipse.tycho.p2.resolver.shared/src/main/java/org/eclipse/tycho/p2/repository/LocalRepositoryReader.java
|
||||
@@ -10,7 +10,9 @@
|
||||
*******************************************************************************/
|
||||
@@ -11,6 +11,7 @@
|
||||
package org.eclipse.tycho.p2.repository;
|
||||
|
||||
+import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
+import java.io.InputStreamReader;
|
||||
+import java.lang.reflect.Method;
|
||||
|
||||
public class LocalRepositoryReader implements RepositoryReader {
|
||||
|
||||
@@ -21,7 +23,23 @@ public class LocalRepositoryReader implements RepositoryReader {
|
||||
@@ -21,7 +22,33 @@ public class LocalRepositoryReader implements RepositoryReader {
|
||||
}
|
||||
|
||||
public File getLocalArtifactLocation(GAV gav, String classifier, String extension) {
|
||||
@ -173,21 +171,31 @@ index 8d36462..5965699 100644
|
||||
+ File file = new File(localMavenRepositoryRoot, RepositoryLayoutHelper.getRelativePath(gav, classifier, extension));
|
||||
+ // In Fedora the artifact may be in an XMvn-defined repository location (not in reactor cache)
|
||||
+ if (!file.exists()) {
|
||||
+ String coord = gav.toString() + ":" + extension;
|
||||
+ try {
|
||||
+ // XMvn is required at runtime so this will exist
|
||||
+ Process p = Runtime.getRuntime().exec(new String[] { "xmvn-resolve", coord });
|
||||
+ p.waitFor();
|
||||
+ BufferedReader buff = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
||||
+ String filePath = buff.readLine();
|
||||
+ buff.close();
|
||||
+ file = new File(filePath);
|
||||
+ // Use plexus container to add, and lookup the resolver
|
||||
+ Class pclazz = Class.forName("org.codehaus.plexus.DefaultPlexusContainer");
|
||||
+ Object plexus = pclazz.newInstance();
|
||||
+
|
||||
+ // The resolver
|
||||
+ Class rclazz = Class.forName("org.fedoraproject.maven.resolver.DefaultResolver");
|
||||
+
|
||||
+ // Add the resolver to the plexus container
|
||||
+ Method mAdd = pclazz.getMethod("addComponent", Object.class, String.class);
|
||||
+ mAdd.invoke(plexus, rclazz.newInstance(), "org.fedoraproject.maven.resolver.Resolver");
|
||||
|
||||
+ // Retrieve the resolver from the plexus container
|
||||
+ Method mLookup = pclazz.getMethod("lookup", String.class);
|
||||
+ Object reader = mLookup.invoke(plexus, "org.fedoraproject.maven.resolver.Resolver");
|
||||
+
|
||||
+ // Invoke "resolve" method of the resolver
|
||||
+ Method mResolve = reader.getClass().getMethod("resolve", String.class, String.class, String.class, String.class);
|
||||
+ file = (File) mResolve.invoke(reader, gav.getGroupId(), gav.getArtifactId(), gav.getVersion(), extension);
|
||||
+ } catch (Exception e) {
|
||||
+ return file;
|
||||
+ e.printStackTrace();
|
||||
+ }
|
||||
+ }
|
||||
+ return file;
|
||||
|
||||
+
|
||||
+ }
|
||||
}
|
||||
diff --git a/tycho-core/pom.xml b/tycho-core/pom.xml
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
Name: tycho
|
||||
Version: 0.18.1
|
||||
Release: 3%{?dist}
|
||||
Release: 4%{?dist}
|
||||
Summary: Plugins and extensions for building Eclipse plugins and OSGI bundles with Maven
|
||||
|
||||
Group: Development/Libraries
|
||||
@ -295,6 +295,9 @@ install -m 644 $osgiJarPath $RPM_BUILD_ROOT%{_javadir}/%{name}/osgi.jar
|
||||
%{_javadocdir}/%{name}
|
||||
|
||||
%changelog
|
||||
* Tue Jul 30 2013 Roland Grunberg <rgrunber@redhat.com> - 0.18.1-4
|
||||
- Improve artifact resolution using XMvn Resolver. (Bug 986900)
|
||||
|
||||
* Mon Jul 29 2013 Roland Grunberg <rgrunber@redhat.com> - 0.18.1-3
|
||||
- Fix Tycho file locking to work in Fedora.
|
||||
- Skip validateConsistentTychoVersion by default. (Bug 987271)
|
||||
|
Loading…
Reference in New Issue
Block a user