diff --git a/sisu-equinox/sisu-equinox-embedder/src/main/java/org/eclipse/sisu/equinox/embedder/EquinoxRuntimeLocator.java b/sisu-equinox/sisu-equinox-embedder/src/main/java/org/eclipse/sisu/equinox/embedder/EquinoxRuntimeLocator.java
index 4e0d16c44d..73af1a34f9 100644
--- a/sisu-equinox/sisu-equinox-embedder/src/main/java/org/eclipse/sisu/equinox/embedder/EquinoxRuntimeLocator.java
+++ b/sisu-equinox/sisu-equinox-embedder/src/main/java/org/eclipse/sisu/equinox/embedder/EquinoxRuntimeLocator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 Sonatype Inc. and others.
+ * Copyright (c) 2008, 2021 Sonatype Inc. and others.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -36,6 +36,11 @@ public static interface EquinoxRuntimeDescription {
}
// TODO do we need more specific exception type here?
- public void locateRuntime(EquinoxRuntimeDescription description) throws Exception;
+
+ default void locateRuntime(EquinoxRuntimeDescription description) throws Exception {
+ locateRuntime(description, false);
+ }
+
+ public void locateRuntime(EquinoxRuntimeDescription description, boolean forked) throws Exception;
}
diff --git a/sisu-equinox/sisu-equinox-launching/src/main/java/org/eclipse/sisu/equinox/launching/internal/P2ApplicationLauncher.java b/sisu-equinox/sisu-equinox-launching/src/main/java/org/eclipse/sisu/equinox/launching/internal/P2ApplicationLauncher.java
index 83923860a3..b9bec6f6eb 100644
--- a/sisu-equinox/sisu-equinox-launching/src/main/java/org/eclipse/sisu/equinox/launching/internal/P2ApplicationLauncher.java
+++ b/sisu-equinox/sisu-equinox-launching/src/main/java/org/eclipse/sisu/equinox/launching/internal/P2ApplicationLauncher.java
@@ -115,7 +115,7 @@ public void addBundle(File location) {
public void addBundleStartLevel(String id, int level, boolean autostart) {
description.addBundleStartLevel(new BundleStartLevel(id, level, autostart));
}
- });
+ }, true);
EquinoxInstallation installation = installationFactory.createInstallation(description,
installationFolder);
diff --git a/tycho-bundles/tycho-bundles-external/tycho-bundles-external.product b/tycho-bundles/tycho-bundles-external/tycho-bundles-external.product
index aea4f8144f..96fcf75390 100644
--- a/tycho-bundles/tycho-bundles-external/tycho-bundles-external.product
+++ b/tycho-bundles/tycho-bundles-external/tycho-bundles-external.product
@@ -26,6 +26,9 @@
+
+
+
@@ -43,6 +46,7 @@
+
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/osgi/runtime/TychoOsgiRuntimeArtifacts.java b/tycho-core/src/main/java/org/eclipse/tycho/osgi/runtime/TychoOsgiRuntimeArtifacts.java
index f459900b43..34c74a4aaf 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/osgi/runtime/TychoOsgiRuntimeArtifacts.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/osgi/runtime/TychoOsgiRuntimeArtifacts.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 Sonatype Inc. and others.
+ * Copyright (c) 2008, 2021 Sonatype Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -22,6 +22,11 @@ public interface TychoOsgiRuntimeArtifacts {
*/
public static final String HINT_FRAMEWORK = "framework";
+ /**
+ * tycho shared runtime artifact
+ */
+ public static final String HINT_SHARED = "shared";
+
/**
* Bundle manifest attribute name, if set, bundle is not intended for use when Tycho is embedded
* in another Equinox-based application. The only currently known use case is the Equinox secure
@@ -37,4 +42,13 @@ public interface TychoOsgiRuntimeArtifacts {
* the runtime as is.
*/
public List getRuntimeArtifacts();
+
+ static Dependency newDependency(String groupId, String artifactId, String version, String type) {
+ Dependency d = new Dependency();
+ d.setGroupId(groupId);
+ d.setArtifactId(artifactId);
+ d.setVersion(version);
+ d.setType(type);
+ return d;
+ }
}
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/osgi/runtime/TychoOsgiRuntimeLocator.java b/tycho-core/src/main/java/org/eclipse/tycho/osgi/runtime/TychoOsgiRuntimeLocator.java
index ea817a9275..0be3dc282e 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/osgi/runtime/TychoOsgiRuntimeLocator.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/osgi/runtime/TychoOsgiRuntimeLocator.java
@@ -95,34 +95,42 @@ public class TychoOsgiRuntimeLocator implements EquinoxRuntimeLocator {
private DevWorkspaceResolver workspaceState;
@Override
- public void locateRuntime(EquinoxRuntimeDescription description) throws MavenExecutionException {
+ public void locateRuntime(EquinoxRuntimeDescription description, boolean forked) throws MavenExecutionException {
WorkspaceTychoOsgiRuntimeLocator workspaceLocator = WorkspaceTychoOsgiRuntimeLocator
.getResolver(this.workspaceState);
MavenSession session = buildContext.getSession();
- addRuntimeArtifacts(workspaceLocator, session, description);
-
- for (String systemPackage : SYSTEM_PACKAGES_EXTRA) {
- description.addExtraSystemPackage(systemPackage);
+ TychoOsgiRuntimeArtifacts framework = runtimeArtifacts.get(TychoOsgiRuntimeArtifacts.HINT_FRAMEWORK);
+ if (framework != null) {
+ addRuntimeArtifacts(workspaceLocator, description, session, framework);
}
-
+ if (forked) {
+ TychoOsgiRuntimeArtifacts shared = runtimeArtifacts.get(TychoOsgiRuntimeArtifacts.HINT_SHARED);
+ if (framework != null) {
+ addRuntimeArtifacts(workspaceLocator, description, session, shared);
+ }
+ } else {
+ for (String systemPackage : SYSTEM_PACKAGES_EXTRA) {
+ description.addExtraSystemPackage(systemPackage);
+ }
+ }
+ addAdditionalRuntimeArtifacts(workspaceLocator, session, description);
if (workspaceLocator != null) {
workspaceLocator.addPlatformProperties(description);
}
}
- public void addRuntimeArtifacts(WorkspaceTychoOsgiRuntimeLocator workspaceLocator, MavenSession session,
+ public void addAdditionalRuntimeArtifacts(WorkspaceTychoOsgiRuntimeLocator workspaceLocator, MavenSession session,
EquinoxRuntimeDescription description) throws MavenExecutionException {
- TychoOsgiRuntimeArtifacts framework = runtimeArtifacts.get(TychoOsgiRuntimeArtifacts.HINT_FRAMEWORK);
- if (framework != null) {
- addRuntimeArtifacts(workspaceLocator, description, session, framework);
- }
-
for (Map.Entry entry : runtimeArtifacts.entrySet()) {
- if (!TychoOsgiRuntimeArtifacts.HINT_FRAMEWORK.equals(entry.getKey())) {
- addRuntimeArtifacts(workspaceLocator, description, session, entry.getValue());
+ if (TychoOsgiRuntimeArtifacts.HINT_FRAMEWORK.equals(entry.getKey())) {
+ continue;
+ }
+ if (TychoOsgiRuntimeArtifacts.HINT_SHARED.equals(entry.getKey())) {
+ continue;
}
+ addRuntimeArtifacts(workspaceLocator, description, session, entry.getValue());
}
}
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/osgi/runtime/TychoOsgiRuntimeMainArtifacts.java b/tycho-core/src/main/java/org/eclipse/tycho/osgi/runtime/TychoOsgiRuntimeMainArtifacts.java
index 8f05a64eda..a7c63a451f 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/osgi/runtime/TychoOsgiRuntimeMainArtifacts.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/osgi/runtime/TychoOsgiRuntimeMainArtifacts.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 Sonatype Inc. and others.
+ * Copyright (c) 2008, 2021 Sonatype Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,10 +26,10 @@ public class TychoOsgiRuntimeMainArtifacts implements TychoOsgiRuntimeArtifacts
String tychoVersion = TychoVersion.getTychoVersion();
- ARTIFACTS.add(newDependency("org.eclipse.tycho", "tycho-bundles-external", tychoVersion, "zip"));
- ARTIFACTS.add(newDependency("org.eclipse.tycho", "org.eclipse.tycho.p2.resolver.impl", tychoVersion, "jar"));
- ARTIFACTS.add(newDependency("org.eclipse.tycho", "org.eclipse.tycho.p2.maven.repository", tychoVersion, "jar"));
- ARTIFACTS.add(newDependency("org.eclipse.tycho", "org.eclipse.tycho.p2.tools.impl", tychoVersion, "jar"));
+ ARTIFACTS.add(TychoOsgiRuntimeArtifacts.newDependency("org.eclipse.tycho", "tycho-bundles-external", tychoVersion, "zip"));
+ ARTIFACTS.add(TychoOsgiRuntimeArtifacts.newDependency("org.eclipse.tycho", "org.eclipse.tycho.p2.resolver.impl", tychoVersion, "jar"));
+ ARTIFACTS.add(TychoOsgiRuntimeArtifacts.newDependency("org.eclipse.tycho", "org.eclipse.tycho.p2.maven.repository", tychoVersion, "jar"));
+ ARTIFACTS.add(TychoOsgiRuntimeArtifacts.newDependency("org.eclipse.tycho", "org.eclipse.tycho.p2.tools.impl", tychoVersion, "jar"));
}
@Override
@@ -37,13 +37,4 @@ public List getRuntimeArtifacts() {
return ARTIFACTS;
}
- private static Dependency newDependency(String groupId, String artifactId, String version, String type) {
- Dependency d = new Dependency();
- d.setGroupId(groupId);
- d.setArtifactId(artifactId);
- d.setVersion(version);
- d.setType(type);
- return d;
- }
-
}
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/osgi/runtime/TychoOsgiSharedArtifacts.java b/tycho-core/src/main/java/org/eclipse/tycho/osgi/runtime/TychoOsgiSharedArtifacts.java
new file mode 100644
index 0000000000..a91f5fc77a
--- /dev/null
+++ b/tycho-core/src/main/java/org/eclipse/tycho/osgi/runtime/TychoOsgiSharedArtifacts.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2021 Christoph Läubrich and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Christoph Läubrich - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tycho.osgi.runtime;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.maven.model.Dependency;
+import org.codehaus.plexus.component.annotations.Component;
+import org.eclipse.tycho.core.utils.TychoVersion;
+
+@Component(role = TychoOsgiRuntimeArtifacts.class, hint = TychoOsgiRuntimeArtifacts.HINT_SHARED)
+public class TychoOsgiSharedArtifacts implements TychoOsgiRuntimeArtifacts {
+ private static final List ARTIFACTS;
+
+ static {
+ ARTIFACTS = new ArrayList<>();
+
+ String tychoVersion = TychoVersion.getTychoVersion();
+
+ ARTIFACTS.add(TychoOsgiRuntimeArtifacts.newDependency("org.eclipse.tycho", "org.eclipse.tycho.core.shared",
+ tychoVersion, "jar"));
+ ARTIFACTS.add(TychoOsgiRuntimeArtifacts.newDependency("org.eclipse.tycho", "org.eclipse.tycho.embedder.shared",
+ tychoVersion, "jar"));
+ ARTIFACTS.add(TychoOsgiRuntimeArtifacts.newDependency("org.eclipse.tycho",
+ "org.eclipse.tycho.p2.resolver.shared", tychoVersion, "jar"));
+ ARTIFACTS.add(TychoOsgiRuntimeArtifacts.newDependency("org.eclipse.tycho", "org.eclipse.tycho.p2.tools.shared",
+ tychoVersion, "jar"));
+ }
+
+ @Override
+ public List getRuntimeArtifacts() {
+ return Collections.unmodifiableList(ARTIFACTS);
+ }
+
+}
diff --git a/tycho-testing-harness/src/main/java/org/eclipse/tycho/testing/StubEquinoxRuntimeLocator.java b/tycho-testing-harness/src/main/java/org/eclipse/tycho/testing/StubEquinoxRuntimeLocator.java
index d2248aa65e..ccb668fb70 100644
--- a/tycho-testing-harness/src/main/java/org/eclipse/tycho/testing/StubEquinoxRuntimeLocator.java
+++ b/tycho-testing-harness/src/main/java/org/eclipse/tycho/testing/StubEquinoxRuntimeLocator.java
@@ -18,7 +18,7 @@
@Component(role = EquinoxRuntimeLocator.class, hint = "stub")
public class StubEquinoxRuntimeLocator implements EquinoxRuntimeLocator {
@Override
- public void locateRuntime(EquinoxRuntimeDescription description) throws Exception {
+ public void locateRuntime(EquinoxRuntimeDescription description, boolean forked) throws Exception {
throw new UnsupportedOperationException();
}
}