This is an automated email from the ASF dual-hosted git repository.

sseifert pushed a commit to branch feature/SLING-12580-include-examples
in repository https://gitbox.apache.org/repos/asf/sling-project-archetype.git

commit 5c3269664ab2f710c29477f2d0cd80fa8a0611f3
Author: Stefan Seifert <[email protected]>
AuthorDate: Wed Dec 18 11:30:02 2024 +0100

    SLING-12580 include examples in feature launcher when enabled as "separate"
---
 .../META-INF/archetype-post-generate.groovy        |  3 ++
 src/main/resources/archetype-resources/all/pom.xml | 42 ++++++++++++++++++++++
 .../launcher/src/main/features/launcher.json       | 31 ++++++++++++++--
 .../archetype-resources/ui.apps.example/pom.xml    |  4 +--
 .../src/main/content/META-INF/vault/filter.xml     |  6 ++--
 .../etc/map/http/localhost_any/.content.xml        |  3 +-
 .../src/main/content/META-INF/vault/filter.xml     |  6 ++--
 7 files changed, 83 insertions(+), 12 deletions(-)

diff --git a/src/main/resources/META-INF/archetype-post-generate.groovy 
b/src/main/resources/META-INF/archetype-post-generate.groovy
index 4438707..9ddeb8a 100644
--- a/src/main/resources/META-INF/archetype-post-generate.groovy
+++ b/src/main/resources/META-INF/archetype-post-generate.groovy
@@ -33,6 +33,7 @@ def uiAppsExamplePackage = new File(rootDir, 
"ui.apps.example")
 def uiAppsExampleSrc = new File(uiAppsExamplePackage, "src")
 
 def uiAppsPom = new File(uiAppsPackage, "pom.xml")
+def uiAppsExamplePom = new File(uiAppsExamplePackage, "pom.xml")
 def allPackage = new File(rootDir, "all")
 def rootPom = new File(rootDir, "pom.xml")
 def readme = new File(rootDir, "README.md")
@@ -110,6 +111,7 @@ if(optionAll == "n") {
     removeModule(rootPom, "all")
     // Remove content for 'All' and remove tag lines for Not All
     removeTags(uiAppsPom, false)
+    removeTags(uiAppsExamplePom, false)
     // Delete the Readme.md for All
     assert readmeAll.delete()
     // Rename the Not For All Readme to the Readme.md file
@@ -117,6 +119,7 @@ if(optionAll == "n") {
 } else {
     // Remove content for 'Not All' and remove tag lines for All
     removeTags(uiAppsPom, true)
+    removeTags(uiAppsExamplePom, true)
     // Delete the Readme.md for Not All
     assert readmeNotAll.delete()
     // Rename the For All Readme to the Readme.md file
diff --git a/src/main/resources/archetype-resources/all/pom.xml 
b/src/main/resources/archetype-resources/all/pom.xml
index b567044..d8be963 100644
--- a/src/main/resources/archetype-resources/all/pom.xml
+++ b/src/main/resources/archetype-resources/all/pom.xml
@@ -42,6 +42,10 @@
     </properties>
 
     <dependencies>
+#if ($optionExample=='s')
+<!--
+        Includes examples instead of the main modules. Once you are ready with 
your own code, remove the examples below and include the main modules instead.
+#end
         <dependency>
             <groupId>\${project.groupId}</groupId>
             <artifactId>core</artifactId>
@@ -53,6 +57,20 @@
             <version>\${project.version}</version>
             <type>content-package</type>
         </dependency>
+#if ($optionExample=='s')
+-->
+        <dependency>
+            <groupId>\${project.groupId}</groupId>
+            <artifactId>core.example</artifactId>
+            <version>\${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>\${project.groupId}</groupId>
+            <artifactId>ui.apps.example</artifactId>
+            <version>\${project.version}</version>
+            <type>content-package</type>
+        </dependency>
+#end
     </dependencies>
 
     <build>
@@ -64,18 +82,42 @@
                     <packageType>container</packageType>
                     
<embeddedTarget>/apps/\${appsFolderName}/install</embeddedTarget>
                     <embeddeds>
+#if ($optionExample=='s')
+<!--
+        Includes examples instead of the main modules. Once you are ready with 
your own code, remove the examples below and include the main modules instead.
+#end
                         <embedded>
                             <groupId>\${project.groupId}</groupId>
                             <artifactId>core</artifactId>
                             <filter>true</filter>
                         </embedded>
+#if ($optionExample=='s')
+-->
+                        <embedded>
+                            <groupId>\${project.groupId}</groupId>
+                            <artifactId>core.example</artifactId>
+                            <filter>true</filter>
+                        </embedded>
+#end
                     </embeddeds>
                     <subPackages>
+#if ($optionExample=='s')
+<!--
+        Includes examples instead of the main modules. Once you are ready with 
your own code, remove the examples below and include the main modules instead.
+#end
                         <subPackage>
                             <groupId>\${project.groupId}</groupId>
                             <artifactId>ui.apps</artifactId>
                             <filter>true</filter>
                         </subPackage>
+#if ($optionExample=='s')
+-->
+                        <subPackage>
+                            <groupId>\${project.groupId}</groupId>
+                            <artifactId>ui.apps.example</artifactId>
+                            <filter>true</filter>
+                        </subPackage>
+#end
                     </subPackages>
                     <!-- This gives the Package a recognizable name in the 
Package Manager by prepending the Artifact Id of the Project -->
                     <name>\${rootArtifactId}-\${artifactId}</name>
diff --git 
a/src/main/resources/archetype-resources/launcher/src/main/features/launcher.json
 
b/src/main/resources/archetype-resources/launcher/src/main/features/launcher.json
index 4566b5e..929e624 100644
--- 
a/src/main/resources/archetype-resources/launcher/src/main/features/launcher.json
+++ 
b/src/main/resources/archetype-resources/launcher/src/main/features/launcher.json
@@ -1,18 +1,45 @@
 {
+#if ($optionAll!='y')
   "bundles": [
+#if ($optionExample=='s')
+    /*
+    Includes examples instead of the main modules. Once you are ready with 
your own code, remove the examples below and include the main modules instead.
     {
         "id": "${groupId}/core/${version}",
         "start-order": 20
+    },
+    */
+    {
+        "id": "${groupId}/core.example/${version}",
+        "start-order": 20
     }
+#else
+    {
+        "id": "${groupId}/core/${version}",
+        "start-order": 20
+    }
+#end
   ],
+#end
   "content-packages:ARTIFACTS|required": [
+#if ($optionAll=='y')
     {
-        "id":"${groupId}/ui.apps/${version}/zip"
+        "id":"${groupId}/all/${version}/zip"
     }
-#if($optionExample=='s'),
+#elseif ($optionExample=='s')
+    /*
+    Includes examples instead of the main modules. Once you are ready with 
your own code, remove the examples below and include the main modules instead.
+    {
+      "id":"${groupId}/ui.apps.example/${version}/zip"
+    },
+    */
     {
         "id":"${groupId}/ui.apps.example/${version}/zip"
     }
+#else
+    {
+        "id":"${groupId}/ui.apps/${version}/zip"
+    }
 #end
   ]
 }
\ No newline at end of file
diff --git a/src/main/resources/archetype-resources/ui.apps.example/pom.xml 
b/src/main/resources/archetype-resources/ui.apps.example/pom.xml
index 7fdcc27..ac382e2 100644
--- a/src/main/resources/archetype-resources/ui.apps.example/pom.xml
+++ b/src/main/resources/archetype-resources/ui.apps.example/pom.xml
@@ -59,7 +59,7 @@
     <dependencies>
         <dependency>
             <groupId>\${project.groupId}</groupId>
-            <artifactId>core</artifactId>
+            <artifactId>core.example</artifactId>
             <version>\${project.version}</version>
         </dependency>
     </dependencies>
@@ -77,7 +77,7 @@
                     <embeddeds>
                         <embedded>
                             <groupId>\${project.groupId}</groupId>
-                            <artifactId>core</artifactId>
+                            <artifactId>core.example</artifactId>
                             <filter>true</filter>
                         </embedded>
                     </embeddeds>
diff --git 
a/src/main/resources/archetype-resources/ui.apps.example/src/main/content/META-INF/vault/filter.xml
 
b/src/main/resources/archetype-resources/ui.apps.example/src/main/content/META-INF/vault/filter.xml
index 23488a4..fc4b203 100644
--- 
a/src/main/resources/archetype-resources/ui.apps.example/src/main/content/META-INF/vault/filter.xml
+++ 
b/src/main/resources/archetype-resources/ui.apps.example/src/main/content/META-INF/vault/filter.xml
@@ -18,7 +18,7 @@
 <workspaceFilter version="1.0">
     <!--
         Any node that will contain customer data needs to be excluded
-        otherwise a Pacakge Installation will wipe them.
+        otherwise a Package Installation will wipe them.
 
         If there is a mix then all provided nodes must be included and
         all custom nodes excluded.
@@ -26,9 +26,9 @@
         If unsure what to do then go to the Composum Package Manager
         (/bin/packages.html) and create a test package. To to the package
         filter list and add filter entries until all of the app provides
-        nodes are included but none of the customer generatedd nodes.
+        nodes are included but none of the customer generated nodes.
 
-        Also any sub pckage of this module needs to exclude 
/apps/${appsFolderName}/install
+        Also any sub package of this module needs to exclude 
/apps/${appsFolderName}/install
         folder otherwise they wipe all installed bundles.
     -->
     <filter root="/content/${contentFolderName}"/>
diff --git 
a/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/etc/map/http/localhost_any/.content.xml
 
b/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/etc/map/http/localhost_any/.content.xml
index dc54dac..bc166aa 100644
--- 
a/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/etc/map/http/localhost_any/.content.xml
+++ 
b/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/etc/map/http/localhost_any/.content.xml
@@ -14,5 +14,4 @@
 <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0"; 
xmlns:sling="http://sling.apache.org/jcr/sling/1.0";
     jcr:primaryType="sling:Mapping"
     sling:match="localhost\\.\\d*/$"
-    sling:redirect="/content/${appsFolderName}/home.html"/>
-
+    sling:redirect="/content/${contentFolderName}/home.html"/>
diff --git 
a/src/main/resources/archetype-resources/ui.apps/src/main/content/META-INF/vault/filter.xml
 
b/src/main/resources/archetype-resources/ui.apps/src/main/content/META-INF/vault/filter.xml
index 207c148..4b12740 100644
--- 
a/src/main/resources/archetype-resources/ui.apps/src/main/content/META-INF/vault/filter.xml
+++ 
b/src/main/resources/archetype-resources/ui.apps/src/main/content/META-INF/vault/filter.xml
@@ -17,7 +17,7 @@
 <workspaceFilter version="1.0">
     <!--
         Any node that will contain customer data needs to be excluded
-        otherwise a Pacakge Installation will wipe them.
+        otherwise a Package Installation will wipe them.
 
         If there is a mix then all provided nodes must be included and
         all custom nodes excluded.
@@ -25,9 +25,9 @@
         If unsure what to do then go to the Composum Package Manager
         (/bin/packages.html) and create a test package. To to the package
         filter list and add filter entries until all of the app provides
-        nodes are included but none of the customer generatedd nodes.
+        nodes are included but none of the customer generated nodes.
 
-        Also any sub pckage of this module needs to exclude 
/apps/${appsFolderName}/install
+        Also any sub package of this module needs to exclude 
/apps/${appsFolderName}/install
         folder otherwise they wipe all installed bundles.
     -->
     <filter root="/content/${contentFolderName}"/>

Reply via email to