diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 92b1807725..6d654cd8f0 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -6,6 +6,16 @@ If you are reading this in the browser, then you can quickly jump to specific ve
## 5.0.0 (under development)
+### Support for new `includeJRE` flag when building products
+
+PDE recently added a new flag for the product to mark it to [include a JRE](https://github.com/eclipse-pde/eclipse.pde/pull/1075),
+this is also now supported with Tycho, activate this flag has the following effects:
+
+- The product gets a new requirement for a JustJ JRE
+- The JustJ update site is automatically added to the `materialize-products` goal if such product is present
+
+There is [a demo project](https://github.com/eclipse-tycho/tycho/tree/main/demo/justj/automaticInstall) shows an example for a product using that flag and including an JRE that is suitable to launch the product automatically.
+
### Support for CycloneDX Maven Plugin
The `tycho-sbom` plugin can be added as a dependency to the [CycloneDX Maven plugin](https://cyclonedx.github.io/cyclonedx-maven-plugin/index.html),
diff --git a/demo/justj/README.md b/demo/justj/README.md
new file mode 100644
index 0000000000..842302d94e
--- /dev/null
+++ b/demo/justj/README.md
@@ -0,0 +1,7 @@
+Tycho JustJ Demo Projects
+===================
+
+Sample projects demonstrating how to use Tycho with JustJ.
+
+* `product`: Shows how to manually include JustJ in a product using a dedicated feature
+* `automaticInstall`: Shows how to use automatic install with the `includeJRE` option in the product
\ No newline at end of file
diff --git a/demo/justj/automaticInstall/pom.xml b/demo/justj/automaticInstall/pom.xml
new file mode 100644
index 0000000000..aa60cb03d1
--- /dev/null
+++ b/demo/justj/automaticInstall/pom.xml
@@ -0,0 +1,66 @@
+
+
+ 4.0.0
+ org.eclipse.tycho.demo
+ product-with-justj
+ 0.0.1-SNAPSHOT
+ eclipse-repository
+
+ 5.0.0-SNAPSHOT
+ https://download.eclipse.org/releases/2024-03/
+
+
+
+ platform
+ ${target-platform}
+ p2
+
+
+
+
+
+ org.eclipse.tycho
+ tycho-maven-plugin
+ ${tycho-version}
+ true
+
+
+ org.eclipse.tycho
+ tycho-p2-director-plugin
+ ${tycho-version}
+
+
+ materialize-products
+
+ materialize-products
+
+
+
+
+
+
+ org.eclipse.tycho
+ tycho-p2-repository-plugin
+ ${tycho-version}
+
+
+ default-assemble-repository
+
+ assemble-repository
+
+ none
+
+
+ default-archive-repository
+
+ archive-repository
+
+ none
+
+
+
+
+
+
diff --git a/demo/justj/automaticInstall/product-with-features.product b/demo/justj/automaticInstall/product-with-features.product
new file mode 100644
index 0000000000..69f4da897d
--- /dev/null
+++ b/demo/justj/automaticInstall/product-with-features.product
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/demo/justj/product/pom.xml b/demo/justj/product/pom.xml
index be55396a1e..68f8ae8bb2 100644
--- a/demo/justj/product/pom.xml
+++ b/demo/justj/product/pom.xml
@@ -1,5 +1,6 @@
-
4.0.0
org.eclipse.tycho.demo
@@ -7,8 +8,8 @@
0.0.1-SNAPSHOT
eclipse-repository
- 2.7.3
- https://download.eclipse.org/releases/2022-06/
+ 5.0.0-SNAPSHOT
+ https://download.eclipse.org/releases/2024-03/
@@ -35,11 +36,47 @@
target-platform-configuration
${tycho-version}
-
none
+
+ org.eclipse.tycho
+ tycho-p2-director-plugin
+ ${tycho-version}
+
+
+ materialize-products
+
+ materialize-products
+
+
+
+
+
+
+ org.eclipse.tycho
+ tycho-p2-repository-plugin
+ ${tycho-version}
+
+
+ default-assemble-repository
+
+ assemble-repository
+
+ none
+
+
+ default-archive-repository
+
+ archive-repository
+
+ none
+
+
+
diff --git a/demo/justj/product/product-with-features.product b/demo/justj/product/product-with-features.product
index 620074a8e5..12af6ba737 100644
--- a/demo/justj/product/product-with-features.product
+++ b/demo/justj/product/product-with-features.product
@@ -1,7 +1,7 @@
-
+
@@ -11,12 +11,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tycho-api/src/main/java/org/eclipse/tycho/TychoConstants.java b/tycho-api/src/main/java/org/eclipse/tycho/TychoConstants.java
index 9b85b76be2..a5e8dbe122 100644
--- a/tycho-api/src/main/java/org/eclipse/tycho/TychoConstants.java
+++ b/tycho-api/src/main/java/org/eclipse/tycho/TychoConstants.java
@@ -22,6 +22,10 @@ public interface TychoConstants {
public static final String TYCHO_NOT_CONFIGURED = "Tycho build extension not configured for ";
+ public static final String NAMESPACE_JUSTJ = "org.eclipse.justj";
+
+ public static final String NAME_JUSTJ_JRE = "jre";
+
static final String ANY_QUALIFIER = "qualifier";
static final boolean USE_SMART_BUILDER = Boolean
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2/tools/publisher/PublishProductToolImpl.java b/tycho-core/src/main/java/org/eclipse/tycho/p2/tools/publisher/PublishProductToolImpl.java
index 4d73213b55..168094b28a 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/p2/tools/publisher/PublishProductToolImpl.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/p2/tools/publisher/PublishProductToolImpl.java
@@ -25,9 +25,14 @@
import org.eclipse.equinox.internal.p2.publisher.eclipse.IProductDescriptor;
import org.eclipse.equinox.internal.p2.publisher.eclipse.ProductFile;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.IRequirement;
+import org.eclipse.equinox.p2.metadata.IVersionedId;
+import org.eclipse.equinox.p2.metadata.MetadataFactory;
import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.publisher.AdviceFileAdvice;
+import org.eclipse.equinox.p2.publisher.IPublisherAction;
import org.eclipse.equinox.p2.publisher.IPublisherAdvice;
+import org.eclipse.equinox.p2.publisher.actions.RootIUAction;
import org.eclipse.equinox.p2.publisher.eclipse.ProductAction;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
@@ -36,6 +41,7 @@
import org.eclipse.tycho.BuildFailureException;
import org.eclipse.tycho.DependencySeed;
import org.eclipse.tycho.Interpolator;
+import org.eclipse.tycho.TychoConstants;
import org.eclipse.tycho.core.resolver.target.ArtifactTypeHelper;
import org.eclipse.tycho.core.shared.MavenLogger;
import org.eclipse.tycho.p2.repository.PublishingRepository;
@@ -68,7 +74,7 @@ public PublishProductToolImpl(PublisherActionRunner publisherRunner, PublishingR
}
@Override
- public List publishProduct(File productFile, File launcherBinaries, String flavor)
+ public List publishProduct(File productFile, File launcherBinaries, String flavor, String jreName)
throws IllegalArgumentException {
IProductDescriptor originalProduct = loadProductFile(productFile);
@@ -77,7 +83,25 @@ public List publishProduct(File productFile, File launcherBinari
IPublisherAdvice[] advice = getProductSpecificAdviceFileAdvice(productFile, expandedProduct);
- ProductAction action = new ProductAction(null, expandedProduct, flavor, launcherBinaries);
+ ProductAction action = new ProductAction(null, expandedProduct, flavor, launcherBinaries) {
+ @Override
+ protected IPublisherAction createRootIUAction() {
+ if (jreName != null) {
+ return new RootIUAction(id, version, name) {
+ @Override
+ protected Collection createIURequirements(
+ Collection extends IVersionedId> children) {
+ Collection requirements = new ArrayList<>(
+ super.createIURequirements(children));
+ requirements.add(MetadataFactory.createRequirement(TychoConstants.NAMESPACE_JUSTJ, jreName,
+ null, null, false, false));
+ return requirements;
+ }
+ };
+ }
+ return super.createRootIUAction();
+ }
+ };
IMetadataRepository metadataRepository = publishingRepository.getMetadataRepository();
IArtifactRepository artifactRepository = publishingRepository
.getArtifactRepositoryForWriting(new ProductBinariesWriteSession(expandedProduct.getId()));
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2/tools/publisher/facade/PublishProductTool.java b/tycho-core/src/main/java/org/eclipse/tycho/p2/tools/publisher/facade/PublishProductTool.java
index 297005b4b4..9a2e2ca153 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/p2/tools/publisher/facade/PublishProductTool.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/p2/tools/publisher/facade/PublishProductTool.java
@@ -29,7 +29,9 @@ public interface PublishProductTool {
* A folder that contains the native Eclipse launcher binaries
* @param flavor
* The installation flavor the product shall be published for
+ * @param jreName
+ * name of the JustJ JRE to include or null
if none is desired
* @return a handles to the published product IU
*/
- List publishProduct(File productDefinition, File launcherBinaries, String flavor);
+ List publishProduct(File productDefinition, File launcherBinaries, String flavor, String jreName);
}
diff --git a/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/PublishProductToolTest.java b/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/PublishProductToolTest.java
index 69be8274fd..d3183b4a5c 100644
--- a/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/PublishProductToolTest.java
+++ b/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/PublishProductToolTest.java
@@ -110,7 +110,7 @@ public void testProductPublishingWithLaunchers() throws Exception {
File launcherBinaries = resourceFile("launchers/");
subject = initPublisher();
- Collection seeds = subject.publishProduct(productDefinition, launcherBinaries, FLAVOR);
+ Collection seeds = subject.publishProduct(productDefinition, launcherBinaries, FLAVOR, null);
assertEquals(1, seeds.size());
DependencySeed seed = seeds.iterator().next();
@@ -132,7 +132,7 @@ public void testExpandProductVersionQualifier() {
File productDefinition = resourceFile("publishers/products/test.product");
subject = initPublisher();
- IInstallableUnit unit = getUnit(subject.publishProduct(productDefinition, null, FLAVOR));
+ IInstallableUnit unit = getUnit(subject.publishProduct(productDefinition, null, FLAVOR, null));
assertEquals("0.1.0." + QUALIFIER, unit.getVersion().toString());
}
@@ -143,7 +143,7 @@ public void testExpandVersionsOfInclusionsWithZeros() throws Exception {
subject = initPublisher(createBundleIU("test.plugin", "0.1.0.20141230"), createBundleIU("test.plugin", "1.1.0"),
createFeatureIU("test.feature", "0.2.0.20141230"), createFeatureIU("test.feature", "1.2.0"));
- IInstallableUnit unit = getUnit(subject.publishProduct(productDefinition, null, FLAVOR));
+ IInstallableUnit unit = getUnit(subject.publishProduct(productDefinition, null, FLAVOR, null));
assertThat(unit.getRequirements(), hasItem(strictRequirement("test.plugin", "1.1.0")));
assertThat(unit.getRequirements(), hasItem(strictRequirement("test.feature.feature.group", "1.2.0")));
@@ -155,7 +155,7 @@ public void testExpandVersionsOfInclusionsWithQualifierLiterals() throws Excepti
subject = initPublisher(createBundleIU("test.plugin", "0.1.0.20141230"), createBundleIU("test.plugin", "1.1.0"),
createFeatureIU("test.feature", "0.2.0.20141230"), createFeatureIU("test.feature", "1.2.0"));
- IInstallableUnit unit = getUnit(subject.publishProduct(productDefinition, null, FLAVOR));
+ IInstallableUnit unit = getUnit(subject.publishProduct(productDefinition, null, FLAVOR, null));
assertThat(unit.getRequirements(), hasItem(strictRequirement("test.plugin", "0.1.0.20141230")));
assertThat(unit.getRequirements(), hasItem(strictRequirement("test.feature.feature.group", "0.2.0.20141230")));
@@ -167,7 +167,7 @@ public void testExpandVersionWithSyntaxError() throws Exception {
subject = initPublisher();
BuildFailureException e = assertThrows(BuildFailureException.class,
- () -> subject.publishProduct(productDefinition, null, FLAVOR));
+ () -> subject.publishProduct(productDefinition, null, FLAVOR, null));
assertThat(e.getMessage(),
both(containsString("inclusionsWithVersionSyntaxError.product")).and(containsString("nonOSGi")));
}
@@ -180,7 +180,7 @@ public void testPublishingReportsAllResolutionErrorsAtOnce() throws Exception {
logVerifier.expectError(containsString("test.feature1"));
logVerifier.expectError(containsString("test.feature2"));
assertThrows(DependencyResolutionException.class,
- () -> subject.publishProduct(productDefinition, null, FLAVOR));
+ () -> subject.publishProduct(productDefinition, null, FLAVOR, null));
}
@Test
@@ -189,7 +189,7 @@ public void testExpandVersionsIgnoresBundlesInFeatureBasedProduct() throws Excep
File productDefinition = resourceFile("publishers/products/featureProductWithLeftovers.product");
subject = initPublisher(createFeatureIU("org.eclipse.rcp", "3.3.101.R34x_v20081125"));
- IInstallableUnit unit = getUnit(subject.publishProduct(productDefinition, null, FLAVOR));
+ IInstallableUnit unit = getUnit(subject.publishProduct(productDefinition, null, FLAVOR, null));
assertThat(unit.getRequirements(),
hasItem(strictRequirement("org.eclipse.rcp.feature.group", "3.3.101.R34x_v20081125")));
@@ -200,7 +200,7 @@ public void testExpandVersionsIgnoresFeaturesInBundleBasedProduct() throws Excep
File productDefinition = resourceFile("publishers/products/pluginProductWithLeftovers.product");
subject = initPublisher(createBundleIU("org.eclipse.core.runtime", "3.5.0.v20090525"));
- IInstallableUnit unit = getUnit(subject.publishProduct(productDefinition, null, FLAVOR));
+ IInstallableUnit unit = getUnit(subject.publishProduct(productDefinition, null, FLAVOR, null));
assertThat(unit.getRequirements(), hasItem(strictRequirement("org.eclipse.core.runtime", "3.5.0.v20090525")));
}
@@ -214,7 +214,7 @@ public void testPublishingWithMissingFragments() throws Exception {
logVerifier.expectError(containsString("org.eclipse.core.filesystem.hpux.ppc"));
assertThrows(DependencyResolutionException.class,
- () -> subject.publishProduct(productDefinition, launcherBinaries, FLAVOR));
+ () -> subject.publishProduct(productDefinition, launcherBinaries, FLAVOR, null));
}
@Test
@@ -222,7 +222,7 @@ public void testPublishingWithP2Inf() {
File productDefinition = resourceFile("publishers/products/p2Inf/test.product");
subject = initPublisher();
- subject.publishProduct(productDefinition, null, FLAVOR);
+ subject.publishProduct(productDefinition, null, FLAVOR, null);
assertThat(unitsIn(outputRepository), hasItem(unitWithId("testproduct")));
IInstallableUnit unit = getUnique(unitWithId("testproduct"), unitsIn(outputRepository));
@@ -239,7 +239,7 @@ public void testPublishingWithProductSpecificP2Inf() {
File productDefinition = resourceFile("publishers/products/p2InfPerProduct/test.product");
subject = initPublisher();
- IInstallableUnit unit = getUnit(subject.publishProduct(productDefinition, null, FLAVOR));
+ IInstallableUnit unit = getUnit(subject.publishProduct(productDefinition, null, FLAVOR, null));
assertThat(unit.getRequirements(), hasItem(strictRequirement("extra.iu", "1.2.3." + QUALIFIER)));
}
@@ -250,7 +250,7 @@ public void testPublishingWithVariableExpansion() {
subject = initPublisher(createBundleIU("org.eclipse.osgi", "3.10.1.v20140909-1633"));
when(interpolatorMock.interpolate("${unqualifiedVersion}.${buildQualifier}")).thenReturn("1.0.0.20150109");
- IInstallableUnit mainUnit = getUnit(subject.publishProduct(productDefinition, null, FLAVOR));
+ IInstallableUnit mainUnit = getUnit(subject.publishProduct(productDefinition, null, FLAVOR, null));
String configUnitId = "tooling" + mainUnit.getId() + ".config.testws.testos.testarch";
IInstallableUnit configUnit = getUnique(unitWithId(configUnitId), unitsIn(outputRepository));
@@ -265,7 +265,7 @@ public void testPublishingWithRootFeatures() {
createFeatureIU("org.eclipse.e4.rcp", "1.0"), createFeatureIU("org.eclipse.help", "2.0.102.v20140128"),
createFeatureIU("org.eclipse.egit", "2.0"));
- List seeds = subject.publishProduct(productDefinition, null, FLAVOR);
+ List seeds = subject.publishProduct(productDefinition, null, FLAVOR, null);
IInstallableUnit productUnit = getUnique(productUnit(), unitsIn(seeds));
assertThat(productUnit.getRequirements(),
diff --git a/tycho-its/src/test/java/org/eclipse/tycho/test/DemoTest.java b/tycho-its/src/test/java/org/eclipse/tycho/test/DemoTest.java
index dba3c902be..78edecb9ee 100644
--- a/tycho-its/src/test/java/org/eclipse/tycho/test/DemoTest.java
+++ b/tycho-its/src/test/java/org/eclipse/tycho/test/DemoTest.java
@@ -12,6 +12,7 @@
*******************************************************************************/
package org.eclipse.tycho.test;
+import java.io.File;
import java.util.List;
import org.apache.maven.it.Verifier;
@@ -23,6 +24,14 @@
*/
public class DemoTest extends AbstractTychoIntegrationTest {
+ @Test
+ public void testTychoJustJDemo() throws Exception {
+ assertIncludesJustJ(new File(runDemo("justj", "-f", "product").getBasedir(),
+ "product/target/products/product-with-justj-features"));
+ assertIncludesJustJ(new File(runDemo("justj", "-f", "automaticInstall").getBasedir(),
+ "automaticInstall/target/products/product-with-justj-features"));
+ }
+
@Test
public void testSureFireDemo() throws Exception {
runDemo("testing/surefire/", "-f", "with-maven-layout");
diff --git a/tycho-metadata-model/src/main/java/org/eclipse/tycho/model/ProductConfiguration.java b/tycho-metadata-model/src/main/java/org/eclipse/tycho/model/ProductConfiguration.java
index faa476d54b..cb6c1c87db 100644
--- a/tycho-metadata-model/src/main/java/org/eclipse/tycho/model/ProductConfiguration.java
+++ b/tycho-metadata-model/src/main/java/org/eclipse/tycho/model/ProductConfiguration.java
@@ -172,6 +172,11 @@ public boolean includeLaunchers() {
return attribute == null || Boolean.parseBoolean(attribute);
}
+ public boolean includeJRE() {
+ String attribute = dom.getAttributeValue("includeJRE");
+ return attribute != null && Boolean.parseBoolean(attribute);
+ }
+
public String getVersion() {
return dom.getAttributeValue("version");
}
diff --git a/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/MaterializeProductsMojo.java b/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/MaterializeProductsMojo.java
index 6dae367992..04d48737ea 100644
--- a/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/MaterializeProductsMojo.java
+++ b/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/MaterializeProductsMojo.java
@@ -13,6 +13,8 @@
package org.eclipse.tycho.plugins.p2.director;
import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -32,7 +34,10 @@
import org.apache.maven.toolchain.ToolchainManager;
import org.codehaus.plexus.logging.Logger;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.internal.p2.metadata.IRequiredCapability;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.IRequirement;
+import org.eclipse.tycho.ArtifactType;
import org.eclipse.tycho.DependencySeed;
import org.eclipse.tycho.ExecutionEnvironment;
import org.eclipse.tycho.TargetEnvironment;
@@ -149,6 +154,14 @@ public enum DirectorRuntimeType {
@Parameter(defaultValue = "internal")
private DirectorRuntimeType directorRuntime;
+ /**
+ * If a product requires JustJ this repository is automatically added as part of the product
+ * assembly, if not this is just ignored. To disable this feature one can set the configuration
+ * to an empty value
+ */
+ @Parameter(defaultValue = "https://download.eclipse.org/justj/jres")
+ private String productRepository;
+
/**
* Controls if products are allowed to be build in parallel
*/
@@ -157,13 +170,27 @@ public enum DirectorRuntimeType {
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
- List products = getProductConfig().getProducts();
+ ProductConfig productConfig = getProductConfig();
+ List products = productConfig.getProducts();
if (products.isEmpty()) {
getLog().info("No product definitions found, nothing to do");
return;
}
DirectorRuntime director = getDirectorRuntime();
RepositoryReferences sources = getSourceRepositories();
+ if (productRepository != null && !productRepository.isBlank()) {
+ for (Product product : products) {
+ if (requiresJustJ(productConfig, product)) {
+ try {
+ sources.addRepository(new URI(productRepository));
+ } catch (URISyntaxException e) {
+ throw new MojoFailureException(" contains invalid URI: " + productRepository,
+ e);
+ }
+ break;
+ }
+ }
+ }
if (parallel) {
ExecutorService executorService = Executors.newWorkStealingPool();
ExecutorCompletionService service = new ExecutorCompletionService<>(executorService);
@@ -212,6 +239,23 @@ public void execute() throws MojoExecutionException, MojoFailureException {
}
}
+ private boolean requiresJustJ(ProductConfig productConfig, Product product) {
+ for (DependencySeed seed : productConfig.getProjectSeeds()) {
+ if (ArtifactType.TYPE_ECLIPSE_PRODUCT.equals(seed.getType()) && product.getId().equals(seed.getId())) {
+ IInstallableUnit installableUnit = seed.getInstallableUnit();
+ for (IRequirement requirement : installableUnit.getRequirements()) {
+ if (requirement instanceof IRequiredCapability cap) {
+ if (TychoConstants.NAMESPACE_JUSTJ.equals(cap.getNamespace())
+ && cap.getName().startsWith(TychoConstants.NAME_JUSTJ_JRE)) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
private void buildProduct(DirectorRuntime director, RepositoryReferences sources, Product product,
TargetEnvironment env) throws MojoFailureException {
DirectorRuntime.Command command = director
diff --git a/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/ProductConfig.java b/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/ProductConfig.java
index 88cceb065e..53a9172a9f 100644
--- a/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/ProductConfig.java
+++ b/tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/ProductConfig.java
@@ -34,8 +34,11 @@
// TODO rename; this name collides with the class ProductConfiguration used by the publisher mojo
class ProductConfig {
private List products;
+ private Collection projectSeeds;
- public ProductConfig(List userConfig, Collection projectSeeds) throws MojoFailureException {
+ public ProductConfig(List userConfig, Collection projectSeeds)
+ throws MojoFailureException {
+ this.projectSeeds = projectSeeds;
if (userConfig != null) {
products = userConfig;
for (Product product : products) {
@@ -63,8 +66,8 @@ private static void checkConfiguredProductsExist(Product configuredProduct, Coll
return;
}
}
- throw new MojoFailureException("Product with id '" + configuredProduct.getId()
- + "' does not exist in the project"); // TODO "... in the target platform"
+ throw new MojoFailureException(
+ "Product with id '" + configuredProduct.getId() + "' does not exist in the project"); // TODO "... in the target platform"
}
}
@@ -108,4 +111,8 @@ public List getProducts() {
return products;
}
+ public Collection getProjectSeeds() {
+ return projectSeeds;
+ }
+
}
diff --git a/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishProductMojo.java b/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishProductMojo.java
index 33665bacbb..27067df7ad 100644
--- a/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishProductMojo.java
+++ b/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishProductMojo.java
@@ -104,6 +104,16 @@ public final class PublishProductMojo extends AbstractPublishMojo {
@Parameter(defaultValue = "${project.basedir}")
private File productsDirectory;
+ /**
+ * Name of the (JustJ) jre to use when the product includes a JRE currently only supported value
+ * (and the default value) is
+ *
+ */
+ @Parameter(defaultValue = "jre")
+ private String jreName;
+
@Override
protected Collection publishContent(PublisherServiceFactory publisherServiceFactory)
throws MojoExecutionException, MojoFailureException {
@@ -125,8 +135,9 @@ protected Collection publishContent(PublisherServiceFactory publ
}
boolean includeLaunchers = productConfiguration.includeLaunchers();
- seeds.addAll(publisher.publishProduct(productFile,
- includeLaunchers ? getExpandedLauncherBinaries() : null, FLAVOR));
+ seeds.addAll(
+ publisher.publishProduct(productFile, includeLaunchers ? getExpandedLauncherBinaries() : null,
+ FLAVOR, productConfiguration.includeJRE() ? jreName : null));
hasLaunchers |= includeLaunchers;
} catch (IOException e) {
throw new MojoExecutionException(
diff --git a/tycho-testing-harness/src/main/java/org/eclipse/tycho/test/AbstractTychoIntegrationTest.java b/tycho-testing-harness/src/main/java/org/eclipse/tycho/test/AbstractTychoIntegrationTest.java
index 3e71c90c0c..d621b8b828 100644
--- a/tycho-testing-harness/src/main/java/org/eclipse/tycho/test/AbstractTychoIntegrationTest.java
+++ b/tycho-testing-harness/src/main/java/org/eclipse/tycho/test/AbstractTychoIntegrationTest.java
@@ -14,9 +14,11 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.io.File;
import java.io.IOException;
+import java.nio.file.Files;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Pattern;
@@ -293,4 +295,17 @@ protected static void verifyErrorFreeLog(Verifier verifier) throws VerificationE
}
}
+ protected void assertIncludesJustJ(File productDir) throws IOException {
+ File eclipseIni = assertFileExists(productDir, "**/eclipse.ini")[0];
+ List lines = Files.readAllLines(eclipseIni.toPath());
+ for (int i = 0; i < lines.size(); i++) {
+ if (lines.get(i).equals("-vm")) {
+ String vm = lines.get(i + 1);
+ assertTrue("VM (" + vm + ") is not JustJ!", vm.contains("plugins/org.eclipse.justj.openjdk."));
+ return;
+ }
+ }
+ fail("No VM installed in the product!");
+ }
+
}