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

sseifert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-project-archetype.git


The following commit(s) were added to refs/heads/master by this push:
     new 81c1d53  SLING-12580 Sling Project Archetype: Include Examples by 
default in Launcher (#21)
81c1d53 is described below

commit 81c1d5326ecd593be3e0b35440681963c09e654c
Author: Stefan Seifert <[email protected]>
AuthorDate: Wed Dec 18 12:03:30 2024 +0100

    SLING-12580 Sling Project Archetype: Include Examples by default in 
Launcher (#21)
    
    - do not include bundle into ui.apps project - install it either directly 
via feature file (parallel to package), or as part of the all package, if 
enabled
    - in "examples separated" mode, include examples by default in feature file 
and/or all package, and comment out the main but empty modules with a comment
    - fix issue with initial redirect to examples home page
---
 .../META-INF/archetype-post-generate.groovy        |  3 ++
 src/main/resources/archetype-resources/all/pom.xml | 39 +++++++++++++++++++++-
 .../launcher/src/main/features/launcher.json       | 32 ++++++++++++++++++
 .../archetype-resources/ui.apps.example/pom.xml    | 20 -----------
 .../src/main/content/META-INF/vault/filter.xml     | 10 +++---
 .../apps/__appsFolderName__/install/.content.xml   | 26 ---------------
 .../etc/map/http/localhost_any/.content.xml        |  3 +-
 .../resources/archetype-resources/ui.apps/pom.xml  | 20 -----------
 .../src/main/content/META-INF/vault/filter.xml     | 11 +++---
 .../apps/__appsFolderName__/install/.content.xml   | 26 ---------------
 10 files changed, 83 insertions(+), 107 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..a6327e5 100644
--- a/src/main/resources/archetype-resources/all/pom.xml
+++ b/src/main/resources/archetype-resources/all/pom.xml
@@ -53,6 +53,19 @@
             <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>
@@ -62,20 +75,44 @@
                 <artifactId>filevault-package-maven-plugin</artifactId>
                 <configuration>
                     <packageType>container</packageType>
-                    
<embeddedTarget>/apps/\${appsFolderName}/install</embeddedTarget>
+                    
<embeddedTarget>/apps/\${appsFolderName}-all/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 78bd13b..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,13 +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}/all/${version}/zip"
+    }
+#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..b1922e2 100644
--- a/src/main/resources/archetype-resources/ui.apps.example/pom.xml
+++ b/src/main/resources/archetype-resources/ui.apps.example/pom.xml
@@ -55,16 +55,6 @@
         deployments.
     -->
 
-    <!-- @startForNotAll@ This is used for the Post Generation Handling. Do 
not alter or remove -->
-    <dependencies>
-        <dependency>
-            <groupId>\${project.groupId}</groupId>
-            <artifactId>core</artifactId>
-            <version>\${project.version}</version>
-        </dependency>
-    </dependencies>
-    <!-- @endForNotAll@ This is used for the Post Generation Handling. Do not 
alter or remove -->
-
     <build>
         <plugins>
             <plugin>
@@ -72,16 +62,6 @@
                 <artifactId>filevault-package-maven-plugin</artifactId>
                 <configuration>
                     
<filterSource>\${basedir}/src/main/content/META-INF/vault/filter.xml</filterSource>
-                    <!-- @startForNotAll@ This is used for the Post Generation 
Handling. Do not alter or remove -->
-                    
<embeddedTarget>/apps/\${appsFolderName}/install</embeddedTarget>
-                    <embeddeds>
-                        <embedded>
-                            <groupId>\${project.groupId}</groupId>
-                            <artifactId>core</artifactId>
-                            <filter>true</filter>
-                        </embedded>
-                    </embeddeds>
-                    <!-- @endForNotAll@ This is used for the Post Generation 
Handling. Do not alter or remove -->
                 </configuration>
             </plugin>
         </plugins>
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..0b8f551 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}"/>
@@ -37,9 +37,7 @@
         as it is in the '/apps/${appsFolderName}/install' folder (see the 'all'
         package).
     -->
-    <filter root="/apps/${appsFolderName}">
-        <exclude pattern="/apps/${appsFolderName}/install/.*"/>
-    </filter>
+    <filter root="/apps/${appsFolderName}"/>
 
     <!--
         Sets up redirects to make the application easier to access. Can
diff --git 
a/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/apps/__appsFolderName__/install/.content.xml
 
b/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/apps/__appsFolderName__/install/.content.xml
deleted file mode 100644
index 5f7ce25..0000000
--- 
a/src/main/resources/archetype-resources/ui.apps.example/src/main/content/jcr_root/apps/__appsFolderName__/install/.content.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-#set( $symbol_pound = '#' )
-#set( $symbol_dollar = '$' )
-#set( $symbol_escape = '\' )
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
--->
-<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0"; 
xmlns:jcr="http://www.jcp.org/jcr/1.0";
-          jcr:primaryType="sling:Folder"
-          jcr:title="Install Folder"
-/>
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/pom.xml 
b/src/main/resources/archetype-resources/ui.apps/pom.xml
index b786dd0..d035605 100644
--- a/src/main/resources/archetype-resources/ui.apps/pom.xml
+++ b/src/main/resources/archetype-resources/ui.apps/pom.xml
@@ -54,16 +54,6 @@
         and errorneous situations.
     -->
 
-    <!-- @startForNotAll@ This is used for the Post Generation Handling. Do 
not alter or remove -->
-    <dependencies>
-        <dependency>
-            <groupId>\${project.groupId}</groupId>
-            <artifactId>core</artifactId>
-            <version>\${project.version}</version>
-        </dependency>
-    </dependencies>
-    <!-- @endForNotAll@ This is used for the Post Generation Handling. Do not 
alter or remove -->
-
     <build>
         <plugins>
             <plugin>
@@ -71,16 +61,6 @@
                 <artifactId>filevault-package-maven-plugin</artifactId>
                 <configuration>
                     
<filterSource>\${basedir}/src/main/content/META-INF/vault/filter.xml</filterSource>
-                    <!-- @startForNotAll@ This is used for the Post Generation 
Handling. Do not alter or remove -->
-                    
<embeddedTarget>/apps/\${appsFolderName}/install</embeddedTarget>
-                    <embeddeds>
-                        <embedded>
-                            <groupId>\${project.groupId}</groupId>
-                            <artifactId>core</artifactId>
-                            <filter>true</filter>
-                        </embedded>
-                    </embeddeds>
-                    <!-- @endForNotAll@ This is used for the Post Generation 
Handling. Do not alter or remove -->
                 </configuration>
             </plugin>
         </plugins>
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..df7c9bb 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}"/>
@@ -36,7 +36,6 @@
         as it is in the '/apps/${appsFolderName}/install' folder (see the 'all'
         package).
     -->
-    <filter root="/apps/${appsFolderName}">
-        <exclude pattern="/apps/${appsFolderName}/install/.*"/>
-    </filter>
+    <filter root="/apps/${appsFolderName}"/>
+
 </workspaceFilter>
diff --git 
a/src/main/resources/archetype-resources/ui.apps/src/main/content/jcr_root/apps/__appsFolderName__/install/.content.xml
 
b/src/main/resources/archetype-resources/ui.apps/src/main/content/jcr_root/apps/__appsFolderName__/install/.content.xml
deleted file mode 100644
index 5f7ce25..0000000
--- 
a/src/main/resources/archetype-resources/ui.apps/src/main/content/jcr_root/apps/__appsFolderName__/install/.content.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-#set( $symbol_pound = '#' )
-#set( $symbol_dollar = '$' )
-#set( $symbol_escape = '\' )
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
--->
-<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0"; 
xmlns:jcr="http://www.jcp.org/jcr/1.0";
-          jcr:primaryType="sling:Folder"
-          jcr:title="Install Folder"
-/>

Reply via email to