From d8ceb5db17440d38f377346629b8cf32b7ff475f Mon Sep 17 00:00:00 2001 From: Stefano Moioli Date: Sun, 4 Apr 2021 23:07:28 +0200 Subject: [PATCH 1/6] Added RCP product sub-module, renamed core -> plugin --- README.md | 4 +- .../META-INF/maven/archetype-metadata.xml | 13 +- .../resources/archetype-resources/README.md | 2 +- .../__rootArtifactId__.feature/feature.xml | 2 +- .../META-INF/MANIFEST.MF | 6 +- .../build.properties | 0 .../icons/sample.gif | Bin .../plugin.xml | 2 +- .../pom.xml | 0 .../src/main/java/core/Activator.java | 4 +- .../src/main/java/core/SampleHandler.java | 2 +- .../application.product | 214 ++++++++++++++++++ .../build.properties | 6 + .../__rootArtifactId__.product/pom.xml | 12 + .../META-INF/MANIFEST.MF | 2 +- .../src/main/java/core/ActivatorTest.java | 4 +- .../resources/archetype-resources/pom.xml | 19 +- .../projects/2020-12/archetype.properties | 2 +- .../projects/basic/archetype.properties | 2 +- 19 files changed, 279 insertions(+), 17 deletions(-) rename src/main/resources/archetype-resources/{__rootArtifactId__.core => __rootArtifactId__.plugin}/META-INF/MANIFEST.MF (77%) rename src/main/resources/archetype-resources/{__rootArtifactId__.core => __rootArtifactId__.plugin}/build.properties (100%) rename src/main/resources/archetype-resources/{__rootArtifactId__.core => __rootArtifactId__.plugin}/icons/sample.gif (100%) rename src/main/resources/archetype-resources/{__rootArtifactId__.core => __rootArtifactId__.plugin}/plugin.xml (96%) rename src/main/resources/archetype-resources/{__rootArtifactId__.core => __rootArtifactId__.plugin}/pom.xml (100%) rename src/main/resources/archetype-resources/{__rootArtifactId__.core => __rootArtifactId__.plugin}/src/main/java/core/Activator.java (93%) rename src/main/resources/archetype-resources/{__rootArtifactId__.core => __rootArtifactId__.plugin}/src/main/java/core/SampleHandler.java (97%) create mode 100755 src/main/resources/archetype-resources/__rootArtifactId__.product/application.product create mode 100755 src/main/resources/archetype-resources/__rootArtifactId__.product/build.properties create mode 100755 src/main/resources/archetype-resources/__rootArtifactId__.product/pom.xml diff --git a/README.md b/README.md index bd0f051..416ec2d 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,9 @@ This archetype will create a multi-module project with a nested structure : __artifactId__ : parent pom project | - |---__artifactId__.core : eclipse-plugin + |---__artifactId__.plugin : eclipse-plugin + | + |---__artifactId__.product: eclipse-repositorye | |---__artifactId__.feature: eclipse-feature | diff --git a/src/main/resources/META-INF/maven/archetype-metadata.xml b/src/main/resources/META-INF/maven/archetype-metadata.xml index a9a8757..157f2ad 100644 --- a/src/main/resources/META-INF/maven/archetype-metadata.xml +++ b/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -24,7 +24,7 @@ - + src/main/java @@ -86,6 +86,17 @@ + + + + + + build.properties + application.product + + + + diff --git a/src/main/resources/archetype-resources/README.md b/src/main/resources/archetype-resources/README.md index 902722e..de8f086 100644 --- a/src/main/resources/archetype-resources/README.md +++ b/src/main/resources/archetype-resources/README.md @@ -11,7 +11,7 @@ The first run will take quite a while since maven will download all the required In order to use the generated eclipse plugins in Eclipse, you will need m2e (https://www.eclipse.org/m2e) and the m2eclipse-tycho plugin (https://github.com/tesla/m2eclipse-tycho/). Update sites to install these plugins : -* m2e stable update site : http://download.eclipse.org/technology/m2e/releases/ +* m2e stable update site : https://download.eclipse.org/technology/m2e/releases/ * m2eclipse-tycho dev update site : http://repo1.maven.org/maven2/.m2e/connectors/m2eclipse-tycho/0.7.0/N/0.7.0.201309291400/ #if ($signing_support == "true" || $signing_support == "y" || $signing_support == "yes" ) diff --git a/src/main/resources/archetype-resources/__rootArtifactId__.feature/feature.xml b/src/main/resources/archetype-resources/__rootArtifactId__.feature/feature.xml index 7743be9..68df78e 100644 --- a/src/main/resources/archetype-resources/__rootArtifactId__.feature/feature.xml +++ b/src/main/resources/archetype-resources/__rootArtifactId__.feature/feature.xml @@ -30,7 +30,7 @@ + class="${package}.plugin.SampleHandler"> diff --git a/src/main/resources/archetype-resources/__rootArtifactId__.core/pom.xml b/src/main/resources/archetype-resources/__rootArtifactId__.plugin/pom.xml similarity index 100% rename from src/main/resources/archetype-resources/__rootArtifactId__.core/pom.xml rename to src/main/resources/archetype-resources/__rootArtifactId__.plugin/pom.xml diff --git a/src/main/resources/archetype-resources/__rootArtifactId__.core/src/main/java/core/Activator.java b/src/main/resources/archetype-resources/__rootArtifactId__.plugin/src/main/java/core/Activator.java similarity index 93% rename from src/main/resources/archetype-resources/__rootArtifactId__.core/src/main/java/core/Activator.java rename to src/main/resources/archetype-resources/__rootArtifactId__.plugin/src/main/java/core/Activator.java index c7c0d53..4f77f9d 100644 --- a/src/main/resources/archetype-resources/__rootArtifactId__.core/src/main/java/core/Activator.java +++ b/src/main/resources/archetype-resources/__rootArtifactId__.plugin/src/main/java/core/Activator.java @@ -1,7 +1,7 @@ #set( $symbol_pound = '#' ) #set( $symbol_dollar = '$' ) #set( $symbol_escape = '\' ) -package ${package}.core; +package ${package}.plugin; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.ui.plugin.AbstractUIPlugin; @@ -13,7 +13,7 @@ public class Activator extends AbstractUIPlugin { // The plug-in ID - public static final String PLUGIN_ID = "${parentArtifactId}.core"; + public static final String PLUGIN_ID = "${parentArtifactId}.plugin"; // The shared instance private static Activator plugin; diff --git a/src/main/resources/archetype-resources/__rootArtifactId__.core/src/main/java/core/SampleHandler.java b/src/main/resources/archetype-resources/__rootArtifactId__.plugin/src/main/java/core/SampleHandler.java similarity index 97% rename from src/main/resources/archetype-resources/__rootArtifactId__.core/src/main/java/core/SampleHandler.java rename to src/main/resources/archetype-resources/__rootArtifactId__.plugin/src/main/java/core/SampleHandler.java index 3f647ed..d3af2e7 100644 --- a/src/main/resources/archetype-resources/__rootArtifactId__.core/src/main/java/core/SampleHandler.java +++ b/src/main/resources/archetype-resources/__rootArtifactId__.plugin/src/main/java/core/SampleHandler.java @@ -1,7 +1,7 @@ #set( $symbol_pound = '#' ) #set( $symbol_dollar = '$' ) #set( $symbol_escape = '\' ) -package ${package}.core; +package ${package}.plugin; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; diff --git a/src/main/resources/archetype-resources/__rootArtifactId__.product/application.product b/src/main/resources/archetype-resources/__rootArtifactId__.product/application.product new file mode 100755 index 0000000..7278e4a --- /dev/null +++ b/src/main/resources/archetype-resources/__rootArtifactId__.product/application.product @@ -0,0 +1,214 @@ + + + + + + + + + + + + -console 1337 -debug -consoleLog -clean -clearPersistedState + + -Dequinox.ds.print=true -Dequinox.ds.debug=true + -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/archetype-resources/__rootArtifactId__.product/build.properties b/src/main/resources/archetype-resources/__rootArtifactId__.product/build.properties new file mode 100755 index 0000000..1b96f10 --- /dev/null +++ b/src/main/resources/archetype-resources/__rootArtifactId__.product/build.properties @@ -0,0 +1,6 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +source.. = src/main/java/ +output.. = target/classes/ +bin.includes = application.product diff --git a/src/main/resources/archetype-resources/__rootArtifactId__.product/pom.xml b/src/main/resources/archetype-resources/__rootArtifactId__.product/pom.xml new file mode 100755 index 0000000..1aafc2f --- /dev/null +++ b/src/main/resources/archetype-resources/__rootArtifactId__.product/pom.xml @@ -0,0 +1,12 @@ + + + 4.0.0 + + ${rootArtifactId} + ${groupId} + ${version} + + application + eclipse-repository + ${rootArtifactId} :: product + diff --git a/src/main/resources/archetype-resources/__rootArtifactId__.test/META-INF/MANIFEST.MF b/src/main/resources/archetype-resources/__rootArtifactId__.test/META-INF/MANIFEST.MF index ddb562a..56aee72 100644 --- a/src/main/resources/archetype-resources/__rootArtifactId__.test/META-INF/MANIFEST.MF +++ b/src/main/resources/archetype-resources/__rootArtifactId__.test/META-INF/MANIFEST.MF @@ -16,7 +16,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: ${rootArtifactId} Test Fragment Bundle-SymbolicName: ${rootArtifactId}.test Bundle-Version: ${futureVersion}.qualifier -Fragment-Host: ${rootArtifactId}.core;bundle-version="${futureVersion}" +Fragment-Host: ${rootArtifactId}.plugin;bundle-version="${futureVersion}" Bundle-RequiredExecutionEnvironment: JavaSE-$java_version Require-Bundle: org.eclipse.jdt.junit4.runtime;bundle-version="1.1.0", ${junitBundle} diff --git a/src/main/resources/archetype-resources/__rootArtifactId__.test/src/main/java/core/ActivatorTest.java b/src/main/resources/archetype-resources/__rootArtifactId__.test/src/main/java/core/ActivatorTest.java index 540a9f1..2bc9aed 100644 --- a/src/main/resources/archetype-resources/__rootArtifactId__.test/src/main/java/core/ActivatorTest.java +++ b/src/main/resources/archetype-resources/__rootArtifactId__.test/src/main/java/core/ActivatorTest.java @@ -1,4 +1,4 @@ -package ${package}.core; +package ${package}.plugin; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -13,7 +13,7 @@ public class ActivatorTest { @Test public void veryStupidTest() { - assertEquals("${parentArtifactId}.core",Activator.PLUGIN_ID); + assertEquals("${parentArtifactId}.plugin",Activator.PLUGIN_ID); assertTrue("Plugin should be started", Activator.getDefault().started); } } \ No newline at end of file diff --git a/src/main/resources/archetype-resources/pom.xml b/src/main/resources/archetype-resources/pom.xml index 3f2aac4..e38dbd0 100644 --- a/src/main/resources/archetype-resources/pom.xml +++ b/src/main/resources/archetype-resources/pom.xml @@ -32,7 +32,7 @@ ${eclipse_platform} p2 - http://download.eclipse.org/releases/${eclipse_platform} + https://download.eclipse.org/releases/${eclipse_platform} @@ -51,6 +51,23 @@ p2 consider true + + + win32 + win32 + x86_64 + + + linux + gtk + x86_64 + + + macosx + cocoa + x86_64 + + diff --git a/src/test/resources/projects/2020-12/archetype.properties b/src/test/resources/projects/2020-12/archetype.properties index 5b2dd95..3df8885 100644 --- a/src/test/resources/projects/2020-12/archetype.properties +++ b/src/test/resources/projects/2020-12/archetype.properties @@ -3,6 +3,6 @@ version=1.0.0-SNAPSHOT groupId=foo.bar.myplugin artifactId=2020-12 tycho_version=1.7.0 -eclipse_platform=2020-12 +eclipse_platform=2021-03 signing_support=true java_version=1.8 diff --git a/src/test/resources/projects/basic/archetype.properties b/src/test/resources/projects/basic/archetype.properties index 43fc5b1..b6648e3 100644 --- a/src/test/resources/projects/basic/archetype.properties +++ b/src/test/resources/projects/basic/archetype.properties @@ -3,6 +3,6 @@ version=1.0.0-SNAPSHOT groupId=foo.bar.myplugin artifactId=basic tycho_version=1.6.0 -eclipse_platform=2019-12 +eclipse_platform=2021-03 signing_support=false java_version=1.8 From e7ca0616ac21a2f5875738a8a186b52ea0f26735 Mon Sep 17 00:00:00 2001 From: Stefano Moioli Date: Sun, 4 Apr 2021 23:10:21 +0200 Subject: [PATCH 2/6] product: removed unneeded attributes from build.properties --- .../__rootArtifactId__.product/build.properties | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/resources/archetype-resources/__rootArtifactId__.product/build.properties b/src/main/resources/archetype-resources/__rootArtifactId__.product/build.properties index 1b96f10..1767076 100755 --- a/src/main/resources/archetype-resources/__rootArtifactId__.product/build.properties +++ b/src/main/resources/archetype-resources/__rootArtifactId__.product/build.properties @@ -1,6 +1,4 @@ #set( $symbol_pound = '#' ) #set( $symbol_dollar = '$' ) #set( $symbol_escape = '\' ) -source.. = src/main/java/ -output.. = target/classes/ bin.includes = application.product From cca1088111578eac4598899ad4f4d2f984064036 Mon Sep 17 00:00:00 2001 From: Stefano Moioli Date: Sun, 4 Apr 2021 23:26:59 +0200 Subject: [PATCH 3/6] Added kotlin support --- .../__rootArtifactId__.plugin/plugin.xml | 4 + .../__rootArtifactId__.plugin/pom.xml | 86 +++++++++++++++++++ .../src/main/kotlin/SampleHandlerKt.kt | 36 ++++++++ .../resources/archetype-resources/pom.xml | 1 - .../projects/kotlin/archetype.properties | 9 ++ src/test/resources/projects/kotlin/goal.txt | 1 + 6 files changed, 136 insertions(+), 1 deletion(-) create mode 100755 src/main/resources/archetype-resources/__rootArtifactId__.plugin/src/main/kotlin/SampleHandlerKt.kt create mode 100755 src/test/resources/projects/kotlin/archetype.properties create mode 100755 src/test/resources/projects/kotlin/goal.txt diff --git a/src/main/resources/archetype-resources/__rootArtifactId__.plugin/plugin.xml b/src/main/resources/archetype-resources/__rootArtifactId__.plugin/plugin.xml index 6c87744..a25d681 100644 --- a/src/main/resources/archetype-resources/__rootArtifactId__.plugin/plugin.xml +++ b/src/main/resources/archetype-resources/__rootArtifactId__.plugin/plugin.xml @@ -21,6 +21,10 @@ point="org.eclipse.ui.handlers"> +#else +#end class="${package}.plugin.SampleHandler"> diff --git a/src/main/resources/archetype-resources/__rootArtifactId__.plugin/pom.xml b/src/main/resources/archetype-resources/__rootArtifactId__.plugin/pom.xml index c7918c3..60f4bbd 100644 --- a/src/main/resources/archetype-resources/__rootArtifactId__.plugin/pom.xml +++ b/src/main/resources/archetype-resources/__rootArtifactId__.plugin/pom.xml @@ -10,4 +10,90 @@ eclipse-plugin ${rootArtifactId} :: core ${rootArtifactId} Core Plugin + +#if ($kotlin_support == "true" || $kotlin_support == "y" || $kotlin_support == "yes") + 1.4.32 +#end + + + +#if ($kotlin_support == "true" || $kotlin_support == "y" || $kotlin_support == "yes") + + org.jetbrains.kotlin + kotlin-stdlib + ${kotlin.version} + +#end + + + + +#if ($kotlin_support == "true" || $kotlin_support == "y" || $kotlin_support == "yes") + + org.jetbrains.kotlin + kotlin-maven-plugin + ${kotlin.version} + + + compile + + compile + + + + ${project.basedir}/src/main/kotlin + ${project.basedir}/src/main/java + + + + + test-compile + test-compile + + + ${project.basedir}/src/test/kotlin + ${project.basedir}/src/test/java + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.5.1 + + ${java_version} + ${java_version} + + + + + default-compile + none + + + + default-testCompile + none + + + java-compile + compile + + compile + + + + java-test-compile + test-compile + + testCompile + + + + +#end + + diff --git a/src/main/resources/archetype-resources/__rootArtifactId__.plugin/src/main/kotlin/SampleHandlerKt.kt b/src/main/resources/archetype-resources/__rootArtifactId__.plugin/src/main/kotlin/SampleHandlerKt.kt new file mode 100755 index 0000000..29b413c --- /dev/null +++ b/src/main/resources/archetype-resources/__rootArtifactId__.plugin/src/main/kotlin/SampleHandlerKt.kt @@ -0,0 +1,36 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +package ${package}.plugin; + +import org.eclipse.core.commands.AbstractHandler +import org.eclipse.core.commands.ExecutionEvent +import org.eclipse.core.commands.ExecutionException +import org.eclipse.jface.dialogs.MessageDialog +import org.eclipse.ui.IWorkbench +import org.eclipse.ui.IWorkbenchWindow +import org.eclipse.ui.PlatformUI + +/** + * Executed by click menu.

+ */ +class SampleHandlerKt : AbstractHandler() { + private val window: IWorkbenchWindow + + /** + * {@inheritDoc} + */ + @kotlin.Throws(ExecutionException::class) + fun execute(event: ExecutionEvent?): Any? { + MessageDialog.openInformation(window.getShell(), "Eclipse Plugin Archetype", "Hello, Maven+Eclipse world,\n \${parentArtifactId} is built with Tycho") + return null + } + + /** + * constructor. + */ + init { + val workbench: IWorkbench = PlatformUI.getWorkbench() + window = workbench.getActiveWorkbenchWindow() + } +} \ No newline at end of file diff --git a/src/main/resources/archetype-resources/pom.xml b/src/main/resources/archetype-resources/pom.xml index e38dbd0..e0492ce 100644 --- a/src/main/resources/archetype-resources/pom.xml +++ b/src/main/resources/archetype-resources/pom.xml @@ -25,7 +25,6 @@ #if ($signing_support == "true" || $signing_support == "y" || $signing_support == "yes" ) 1.4 #end - diff --git a/src/test/resources/projects/kotlin/archetype.properties b/src/test/resources/projects/kotlin/archetype.properties new file mode 100755 index 0000000..3ab88c1 --- /dev/null +++ b/src/test/resources/projects/kotlin/archetype.properties @@ -0,0 +1,9 @@ +package=foo.bar.myplugin.basic +version=1.0.0-SNAPSHOT +groupId=foo.bar.myplugin +artifactId=basic +tycho_version=1.6.0 +eclipse_platform=2021-03 +signing_support=false +java_version=1.8 +kotlin_support=true \ No newline at end of file diff --git a/src/test/resources/projects/kotlin/goal.txt b/src/test/resources/projects/kotlin/goal.txt new file mode 100755 index 0000000..d59d337 --- /dev/null +++ b/src/test/resources/projects/kotlin/goal.txt @@ -0,0 +1 @@ +clean verify \ No newline at end of file From 1204a5ac5f4b33b5b563c4de9fe3928b8f750b23 Mon Sep 17 00:00:00 2001 From: Stefano Moioli Date: Sun, 4 Apr 2021 23:35:24 +0200 Subject: [PATCH 4/6] Renamed Eclipse 2020-12 -> 2021-03 --- .../resources/projects/{2020-12 => 2021-03}/archetype.properties | 0 src/test/resources/projects/{2020-12 => 2021-03}/goal.txt | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename src/test/resources/projects/{2020-12 => 2021-03}/archetype.properties (100%) rename src/test/resources/projects/{2020-12 => 2021-03}/goal.txt (100%) diff --git a/src/test/resources/projects/2020-12/archetype.properties b/src/test/resources/projects/2021-03/archetype.properties similarity index 100% rename from src/test/resources/projects/2020-12/archetype.properties rename to src/test/resources/projects/2021-03/archetype.properties diff --git a/src/test/resources/projects/2020-12/goal.txt b/src/test/resources/projects/2021-03/goal.txt similarity index 100% rename from src/test/resources/projects/2020-12/goal.txt rename to src/test/resources/projects/2021-03/goal.txt From f268e6e174c2b3de08f1570cb3374859673a95f4 Mon Sep 17 00:00:00 2001 From: Stefano Moioli Date: Sun, 4 Apr 2021 23:43:33 +0200 Subject: [PATCH 5/6] Added kotlin_support to requiredProperty --- src/main/resources/META-INF/maven/archetype-metadata.xml | 3 +++ src/test/resources/projects/2021-03/archetype.properties | 1 + src/test/resources/projects/basic/archetype.properties | 1 + 3 files changed, 5 insertions(+) diff --git a/src/main/resources/META-INF/maven/archetype-metadata.xml b/src/main/resources/META-INF/maven/archetype-metadata.xml index 157f2ad..833e2ef 100644 --- a/src/main/resources/META-INF/maven/archetype-metadata.xml +++ b/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -13,6 +13,9 @@ false + + false + diff --git a/src/test/resources/projects/2021-03/archetype.properties b/src/test/resources/projects/2021-03/archetype.properties index 3df8885..1c2172e 100644 --- a/src/test/resources/projects/2021-03/archetype.properties +++ b/src/test/resources/projects/2021-03/archetype.properties @@ -6,3 +6,4 @@ tycho_version=1.7.0 eclipse_platform=2021-03 signing_support=true java_version=1.8 +kotlin_support=false \ No newline at end of file diff --git a/src/test/resources/projects/basic/archetype.properties b/src/test/resources/projects/basic/archetype.properties index b6648e3..4ade747 100644 --- a/src/test/resources/projects/basic/archetype.properties +++ b/src/test/resources/projects/basic/archetype.properties @@ -6,3 +6,4 @@ tycho_version=1.6.0 eclipse_platform=2021-03 signing_support=false java_version=1.8 +kotlin_support=false \ No newline at end of file From ecf267f87bf131d6d291886bcc0150913ce753d4 Mon Sep 17 00:00:00 2001 From: Stefano Moioli Date: Sun, 4 Apr 2021 23:48:31 +0200 Subject: [PATCH 6/6] Renamed artifactId for 2021-03 --- src/test/resources/projects/2021-03/archetype.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/resources/projects/2021-03/archetype.properties b/src/test/resources/projects/2021-03/archetype.properties index 1c2172e..7dd9a65 100644 --- a/src/test/resources/projects/2021-03/archetype.properties +++ b/src/test/resources/projects/2021-03/archetype.properties @@ -1,7 +1,7 @@ package=foo.bar.myplugin.kepler version=1.0.0-SNAPSHOT groupId=foo.bar.myplugin -artifactId=2020-12 +artifactId=2021-03 tycho_version=1.7.0 eclipse_platform=2021-03 signing_support=true