Blob Blame History Raw
From b57fed1d046cde40d90bda409280463006337b4a Mon Sep 17 00:00:00 2001
From: Tobias Oberlies <tobias.oberlies@sap.com>
Date: Wed, 28 Nov 2012 14:13:42 +0100
Subject: [PATCH] 393686 Correctly add reactor artifacts to eclipserun mojo
 runtime

- Special handling for eclipserun runtime artifact from the reactor. It
  is questionable if we need this at all, but while the eclipserun
  runtime resolved from the target platform (and hence may include
  reactor artifacts), we need this special handling.
- Fail fast if reactor artifacts for runtime have not yet been packaged.
- Still no integration test - tested manually.

Bug: 393686
Change-Id: Ifa542df7af5691c9146b65ff230201c4c857d4b4
---
 .../tycho/extras/eclipserun/EclipseRunMojo.java      | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/tycho-eclipserun-plugin/src/main/java/org/eclipse/tycho/extras/eclipserun/EclipseRunMojo.java b/tycho-eclipserun-plugin/src/main/java/org/eclipse/tycho/extras/eclipserun/EclipseRunMojo.java
index 0ca5be1..a6fba3d 100644
--- a/tycho-eclipserun-plugin/src/main/java/org/eclipse/tycho/extras/eclipserun/EclipseRunMojo.java
+++ b/tycho-eclipserun-plugin/src/main/java/org/eclipse/tycho/extras/eclipserun/EclipseRunMojo.java
@@ -170,7 +170,25 @@ public class EclipseRunMojo extends AbstractMojo {
         EquinoxInstallationDescription installationDesc = new DefaultEquinoxInstallationDescription();
 
         for (ArtifactDescriptor artifact : runtimeArtifacts.getArtifacts(ArtifactKey.TYPE_ECLIPSE_PLUGIN)) {
-            installationDesc.addBundle(artifact);
+
+            ReactorProject reactorProject = artifact.getMavenProject();
+            if (reactorProject != null) {
+                // while reactor projects may be in the runtime, we need this special handling here
+                if (reactorProject.sameProject(project)) {
+                    // never add this project to the runtime
+                    continue;
+                }
+
+                File reactorArtifactFile = reactorProject.getArtifact(artifact.getClassifier());
+                if (reactorArtifactFile == null || !reactorArtifactFile.isFile()) {
+                    throw new MojoExecutionException(
+                            "Eclipse runtime includes artifact from the reactor which has not yet been built: "
+                                    + artifact);
+                }
+                installationDesc.addBundle(artifact.getKey(), reactorArtifactFile);
+            } else {
+                installationDesc.addBundle(artifact);
+            }
         }
 
         return installationFactory.createInstallation(installationDesc, work);
-- 
1.7.11.7