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..13ba0f911e --- /dev/null +++ b/demo/justj/automaticInstall/product-with-features.product @@ -0,0 +1,31 @@ + + + + + + + + + + -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts + + + + + + + + + + + + + + + + + + + + + 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..4df095a0e2 100644 --- a/demo/justj/product/product-with-features.product +++ b/demo/justj/product/product-with-features.product @@ -1,7 +1,7 @@ - + @@ -11,6 +11,15 @@ + + + + + + + + + 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-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..ce68ac03b2 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.startsWith("plugins/org.eclipse.justj.openjdk.")); + return; + } + } + fail("No VM installed in the product!"); + } + }