Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanseifert committed May 22, 2023
2 parents 959dbca + 6fd0200 commit 48d1237
Show file tree
Hide file tree
Showing 82 changed files with 19,711 additions and 9,405 deletions.
15 changes: 15 additions & 0 deletions changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@
xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 https://maven.apache.org/plugins/maven-changes-plugin/xsd/changes-1.0.0.xsd">
<body>

<release version="3.8.0" date="2023-05-22">
<action type="add" dev="sseifert"><![CDATA[
Add new option "optionWcmioSiteApi" which allows to setup an AEM headless project based <a href="https://wcm.io/site-api/">wcm.io Site API</a>.
]]></action>
<action type="update" dev="sseifert">
Add Sling Model Exporter definition for CustomCarousel sample component.
</action>
<action type="update" dev="sseifert">
Switch to acs-aem-commons-all artifact for ACS AEM Commons deployment.
</action>
<action type="update" dev="sseifert">
Update dependencies.
</action>
</release>

<release version="3.7.2" date="2023-03-27">
<action type="update" dev="sseifert" issue="WTOOL-72">
AEMaaCS: Remove workaround for deploying "Sling-Initial-Content" for OSGi bundles via separate content packages for all OSGi bundles -
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

<groupId>io.wcm.maven.archetypes</groupId>
<artifactId>io.wcm.maven.archetypes.aem</artifactId>
<version>3.7.2</version>
<version>3.8.0</version>
<packaging>maven-archetype</packaging>

<name>wcm.io Maven Archetype for AEM</name>
Expand Down
26 changes: 25 additions & 1 deletion src/main/resources/META-INF/archetype-post-generate.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import groovy.util.XmlSlurper

def rootDir = new File(request.getOutputDirectory() + "/" + request.getArtifactId())
def javaPackage = request.getProperties().get("package")
def javaPackagePath = javaPackage.replace('.','/')
def optionAemVersion = request.getProperties().get("optionAemVersion")
def optionAemServicePack = request.getProperties().get("optionAemServicePack")
def optionAemServicePackAPI = request.getProperties().get("optionAemServicePackAPI")
Expand All @@ -15,10 +16,12 @@ def optionEditableTemplates = request.getProperties().get("optionEditableTemplat
def optionMultiBundleLayout = request.getProperties().get("optionMultiBundleLayout")
def optionContextAwareConfig = request.getProperties().get("optionContextAwareConfig")
def optionWcmioHandler = request.getProperties().get("optionWcmioHandler")
def optionWcmioSiteApi = request.getProperties().get("optionWcmioSiteApi")
def optionIntegrationTests = request.getProperties().get("optionIntegrationTests")

def coreBundle = new File(rootDir, "bundles/core")
def clientlibsBundle = new File(rootDir, "bundles/clientlibs")
def siteApiSpecBundle = new File(rootDir, "bundles/site-api-spec")
def completeContentPackage = new File(rootDir, "content-packages/complete")
def confContentPackage = new File(rootDir, "content-packages/conf-content")
def sampleContentPackage = new File(rootDir, "content-packages/sample-content")
Expand All @@ -28,6 +31,7 @@ def frontend = new File(rootDir, "frontend")
def rootPom = new File(rootDir, "pom.xml")
def parentPom = new File(rootDir, "parent/pom.xml")
def tests = new File(rootDir, "tests")
def integrationTests = new File(rootDir, "tests/integration")

// validate parameters - throw exceptions for invalid combinations
if ((optionAemServicePack=="y" || optionAemServicePackAPI=="y") && optionAemVersion == "cloud") {
Expand All @@ -42,6 +46,9 @@ if (optionWcmioHandler == "y" && optionContextAwareConfig == "n") {
if (optionEditableTemplates == "n" && optionWcmioHandler == "n") {
throw new RuntimeException("You have to specify either parameter optionEditableTemplates='y' or optionWcmioHandler='y'.")
}
if (optionWcmioSiteApi == "y" && optionWcmioHandler == "n") {
throw new RuntimeException("Parameter optionSiteApi='y' is only supported with optionWcmioHandler='y'.")
}
if (!(javaPackage ==~ /^[a-z0-9\.]+$/)) {
throw new RuntimeException("Java package name is invalid: " + javaPackage)
}
Expand Down Expand Up @@ -80,7 +87,7 @@ else {

// remove files only relevant for wcm.io Handler projects
if (optionWcmioHandler == "n") {
assert new File(coreBundle, "src/main/java/" + javaPackage.replace('.','/') + "/config").deleteDir()
assert new File(coreBundle, "src/main/java/${javaPackagePath}/config").deleteDir()

assert new File(coreBundle, "src/main/webapp/app-root/templates/admin/redirect").deleteDir()
assert new File(coreBundle, "src/main/webapp/app-root/templates/admin/redirect.json").delete()
Expand Down Expand Up @@ -223,10 +230,27 @@ else {
assert new File(configDefinition, "src/main/environments/cloud.yaml").delete()
}

if (optionWcmioSiteApi == "n") {
assert new File(coreBundle, "src/main/java/${javaPackagePath}/reference").deleteDir()
assert new File(coreBundle, "src/test/java/${javaPackagePath}/reference").deleteDir()
removeModule(rootPom, "bundles/site-api-spec")
siteApiSpecBundle.deleteDir()
}

if (optionIntegrationTests == "n") {
removeModule(rootPom, "tests/integration")
tests.deleteDir()
}
else if (optionWcmioSiteApi == "y") {
// remove non-Site API integration test code
assert new File(integrationTests, "src/main/java/${javaPackagePath}/it/components").deleteDir()
assert new File(integrationTests, "src/main/java/${javaPackagePath}/it/rules").deleteDir()
assert new File(integrationTests, "src/main/java/${javaPackagePath}/it/tests").deleteDir()
}
else {
// remove Site API integration test code
assert new File(integrationTests, "src/main/java/${javaPackagePath}/it/siteapi").deleteDir()
}


// convert all line endings to unix-style
Expand Down
33 changes: 33 additions & 0 deletions src/main/resources/META-INF/maven/archetype-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@
<defaultValue>n</defaultValue>
<validationRegex>^(y|n)$</validationRegex>
</requiredProperty>
<!-- Setup AEM headless project based on wcm.io Site API. Requires optionWcmioHandler='y'. -->
<requiredProperty key="optionWcmioSiteApi">
<defaultValue>n</defaultValue>
<validationRegex>^(y|n)$</validationRegex>
</requiredProperty>
<!-- Use latest Sling Models versions (ignored for AEMaaCS) -->
<requiredProperty key="optionSlingModelsLatest">
<defaultValue>n</defaultValue>
Expand Down Expand Up @@ -262,6 +267,33 @@
</fileSets>
</module>

<module id="${rootArtifactId}.site-api-spec" dir="bundles/site-api-spec" name="${rootArtifactId}.site-api-spec">
<fileSets>
<fileSet filtered="true" encoding="UTF-8">
<directory>src/spec</directory>
<includes>
<include>**/*.yaml</include>
</includes>
</fileSet>
<fileSet filtered="true" packaged="true" encoding="UTF-8">
<directory>src/test/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8">
<directory></directory>
<includes>
<include>index.html</include>
<include>package.json</include>
<include>README.md</include>
<include>webpack.config.js</include>
<include>src/index.js</include>
</includes>
</fileSet>
</fileSets>
</module>

<module id="${rootArtifactId}.ui.apps" dir="content-packages/ui.apps" name="${rootArtifactId}.ui.apps">
<fileSets>
<fileSet filtered="true" encoding="UTF-8">
Expand Down Expand Up @@ -406,6 +438,7 @@
<directory></directory>
<includes>
<include>README.md</include>
<include>run-integration-tests-locally.sh</include>
</includes>
</fileSet>
<fileSet filtered="true" packaged="true" encoding="UTF-8">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ optionContextAwareConfig=${optionContextAwareConfig}
optionFrontend=${optionFrontend}
optionNodeJsPlugin=${optionNodeJsPlugin}
optionWcmioHandler=${optionWcmioHandler}
optionWcmioSiteApi=${optionWcmioSiteApi}
optionAcsCommons=${optionAcsCommons}
optionIntegrationTests=${optionIntegrationTests}
Loading

0 comments on commit 48d1237

Please sign in to comment.