Only create system p2 repository when running in local mode.

This commit is contained in:
Roland Grunberg 2012-06-11 15:00:17 -04:00
parent ed7b67b58d
commit ebce2e6f42
1 changed files with 16 additions and 14 deletions

View File

@ -1,4 +1,4 @@
From 590e6eb40fb807c5b45c8360b80b7a12185b37a6 Mon Sep 17 00:00:00 2001
From 7d87e41ad0f3356b74d93be8588ef69539edcc91 Mon Sep 17 00:00:00 2001
From: Roland Grunberg <rgrunber@redhat.com>
Date: Thu, 7 Jun 2012 16:41:33 -0400
Subject: [PATCH] Implement a custom resolver for Tycho in local mode.
@ -20,11 +20,11 @@ Change-Id: I0609a1caecad753d811c5a93183547b33737657f
---
.../tycho/p2/target/TargetDefinitionResolver.java | 8 +++-
.../tycho/p2/target/TargetPlatformBuilderImpl.java | 5 +++
.../core/maven/TychoMavenLifecycleParticipant.java | 13 +++++++
.../core/maven/TychoMavenLifecycleParticipant.java | 15 ++++++++
.../tycho/core/osgitools/OsgiBundleProject.java | 38 +++++++++++++++++++-
.../tycho/osgi/runtime/TychoP2RuntimeLocator.java | 17 +++++++++
.../p2/resolver/P2TargetPlatformResolver.java | 10 +++++
6 files changed, 88 insertions(+), 3 deletions(-)
6 files changed, 90 insertions(+), 3 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 2d7d3b9..c628e6e 100644
@ -69,7 +69,7 @@ index 9da87bb..5785029 100644
metadataRepository = metadataRepositoryManager.loadRepository(location, monitor);
metadataRepositories.add(metadataRepository);
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java b/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java
index 80810d6..e3c6732 100644
index 80810d6..24efc87 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/core/maven/TychoMavenLifecycleParticipant.java
@@ -11,6 +11,7 @@
@ -80,20 +80,22 @@ index 80810d6..e3c6732 100644
import java.util.List;
import org.apache.maven.AbstractMavenLifecycleParticipant;
@@ -51,6 +52,18 @@ public class TychoMavenLifecycleParticipant extends AbstractMavenLifecyclePartic
@@ -51,6 +52,20 @@ public class TychoMavenLifecycleParticipant extends AbstractMavenLifecyclePartic
registerExecutionListener(session);
configureComponents(session);
+ // Create a system p2 repository for local dependency resolution
+ try {
+ String[] cmd = new String[] { "/usr/share/java/tycho/copy-platform-all",
+ System.getProperty("user.dir") + "/.m2/p2/repo" };
+ Process p = Runtime.getRuntime().exec(cmd);
+ p.waitFor();
+ } catch (IOException e) {
+ // Continue
+ } catch (InterruptedException e) {
+ // Continue
+ if (System.getProperty("maven.local.mode") != null) {
+ try {
+ String[] cmd = new String[] { "/usr/share/java/tycho/copy-platform-all",
+ System.getProperty("user.dir") + "/.m2/p2/repo" };
+ Process p = Runtime.getRuntime().exec(cmd);
+ p.waitFor();
+ } catch (IOException e) {
+ // Continue
+ } catch (InterruptedException e) {
+ // Continue
+ }
+ }
+
List<MavenProject> projects = session.getProjects();