From 4f891d4dd1e7b54b12d01664ed6d649b7b93f17e Mon Sep 17 00:00:00 2001 From: Barshat Rai Date: Thu, 2 Mar 2023 17:33:52 +0530 Subject: [PATCH] Forms 3632 (#1047) * FORMS-3632 include adaptive forms core components in 6.5 * FORMS-3632 include adaptive forms core components in 6.5 * FORMS-3632 include adaptive forms core components in 6.5 * FORMS-3632 include adaptive forms core components in 6.5 * FORMS-3632 include adaptive forms core components in 6.5 * FORMS-3632 include adaptive forms core components in 6.5 * FORMS-3632 include adaptive forms core components in 6.5 * FORMS-3632 include adaptive forms core components in 6.5 * FORMS-3632 exclude portal components for 6.5 * FORMS-3632 exclude only formsportal * FORMS-3632 fetch latest sdk version for 6.5 * FORMS-3632 fetch latest sdk version for 6.5 * FORMS-3632 fix cm build for ui.frontend.react.forms.af --------- Co-authored-by: barshatr Co-authored-by: Rishi Mehta <69448117+rismehta@users.noreply.github.com> --- src/main/archetype/all/pom.xml | 23 ++++++++++++---- src/main/archetype/core/pom.xml | 21 ++++++++++----- src/main/archetype/pom.xml | 21 ++++++++++++--- src/main/archetype/ui.apps/pom.xml | 27 ++++++++++++------- .../adaptiveForm/formcontainer/.content.xml | 3 ++- .../main/content/META-INF/vault/filter.xml | 4 +-- .../settings/wcm/policies/.content.xml | 4 +-- .../ui.frontend.react.forms.af/pom.xml | 4 +-- .../META-INF/archetype-post-generate.groovy | 22 +++++++++++++-- 9 files changed, 94 insertions(+), 35 deletions(-) diff --git a/src/main/archetype/all/pom.xml b/src/main/archetype/all/pom.xml index 7701f6081..20a357cad 100644 --- a/src/main/archetype/all/pom.xml +++ b/src/main/archetype/all/pom.xml @@ -174,7 +174,7 @@ /apps/${appId}-vendor-packages/application/install #end -#if ( ($includeForms == "y" or $includeFormsenrollment == "y" or $includeFormscommunications == "y" or $includeFormsheadless == "y") and $aemVersion == "cloud") +#if ($includeForms == "y" or $includeFormsenrollment == "y" or $includeFormscommunications == "y" or $includeFormsheadless == "y") com.adobe.aem core-forms-components-af-apps @@ -186,6 +186,19 @@ core-forms-components-af-core /apps/${appId}-vendor-packages/application/install + #if ( $aemVersion != "cloud" ) + + com.adobe.aem + core-forms-components-apps + zip + /apps/${appId}-vendor-packages/application/install + + + com.adobe.aem + core-forms-components-core + /apps/${appId}-vendor-packages/application/install + + #end #if ($includeExamples == "y") com.adobe.aem @@ -396,12 +409,12 @@ zip #end -#if ( ($includeForms == "y" or $includeFormsenrollment == "y" or $includeFormscommunications == "y" or $includeFormsheadless == "y") and $aemVersion == "cloud" ) +#if ($includeForms == "y" or $includeFormsenrollment == "y" or $includeFormscommunications == "y" or $includeFormsheadless == "y") - com.adobe.aem - core-forms-components-apps - zip + com.adobe.aem + core-forms-components-apps + zip com.adobe.aem diff --git a/src/main/archetype/core/pom.xml b/src/main/archetype/core/pom.xml index 77d1eae8c..e48407e43 100644 --- a/src/main/archetype/core/pom.xml +++ b/src/main/archetype/core/pom.xml @@ -198,15 +198,22 @@ Import-Package: javax.annotation;version=0.0.0,* #end -#if ( ($includeForms == "y" or $includeFormsenrollment == "y" or $includeFormscommunications == "y" or $includeFormsheadless == "y") and $aemVersion == "cloud") +#if ($includeForms == "y" or $includeFormsenrollment == "y" or $includeFormscommunications == "y" or $includeFormsheadless == "y") + #if ($aemVersion == "cloud") + + com.adobe.aem + aem-forms-sdk-api + + #else + + com.adobe.aemfd + aemfd-client-sdk + + #end - com.adobe.aem - aem-forms-sdk-api - - - com.adobe.aem - core-forms-components-core + com.adobe.aem + core-forms-components-core com.adobe.aem diff --git a/src/main/archetype/pom.xml b/src/main/archetype/pom.xml index 838f3358a..e10675f1d 100644 --- a/src/main/archetype/pom.xml +++ b/src/main/archetype/pom.xml @@ -81,9 +81,14 @@ 2022.08.02.00 #end -#if ( ($includeForms == "y" or $includeFormsenrollment == "y" or $includeFormscommunications == "y" or $includeFormsheadless == "y") and $aemVersion == "cloud" ) - 2.0.4 - 2.0.4 +#if ($includeForms == "y" or $includeFormsenrollment == "y" or $includeFormscommunications == "y" or $includeFormsheadless == "y") +#if ($aemVersion == "cloud") + 2.0.6 + 2.0.6 +#else + 1.1.12 + 1.1.12 +#end SDK_FORMS_VERSION #end 5.1.2 @@ -863,13 +868,21 @@ Bundle-DocURL: provided #end -#if ( ($includeForms == "y" or $includeFormsenrollment == "y" or $includeFormscommunications == "y" or $includeFormsheadless == "y") and $aemVersion == "cloud") +#if ($includeForms == "y" or $includeFormsenrollment == "y" or $includeFormscommunications == "y" or $includeFormsheadless == "y") + #if ($aemVersion == "cloud") com.adobe.aem aem-forms-sdk-api ${aem.forms.sdk.api} + #else + + com.adobe.aemfd + aemfd-client-sdk + ${aem.forms.sdk.api} + + #end com.adobe.aem core-forms-components-apps diff --git a/src/main/archetype/ui.apps/pom.xml b/src/main/archetype/ui.apps/pom.xml index be4dac462..b145094e3 100644 --- a/src/main/archetype/ui.apps/pom.xml +++ b/src/main/archetype/ui.apps/pom.xml @@ -320,20 +320,27 @@ Require-Capability: osgi.extender;filter:="(&(osgi.extender=sling.scripting)(ver provided #end -#if ( ($includeForms == "y" or $includeFormsenrollment == "y" or $includeFormscommunications == "y" or $includeFormsheadless == "y") and $aemVersion == "cloud") +#if ($includeForms == "y" or $includeFormsenrollment == "y" or $includeFormscommunications == "y" or $includeFormsheadless == "y") + #if ($aemVersion == "cloud") + + com.adobe.aem + aem-forms-sdk-api + + #else + + com.adobe.aemfd + aemfd-client-sdk + + #end - com.adobe.aem - aem-forms-sdk-api - - - com.adobe.aem - core-forms-components-apps - zip + com.adobe.aem + core-forms-components-apps + zip - com.adobe.aem - core-forms-components-core + com.adobe.aem + core-forms-components-core com.adobe.aem diff --git a/src/main/archetype/ui.apps/src/main/content/jcr_root/apps/__appId__/components/adaptiveForm/formcontainer/.content.xml b/src/main/archetype/ui.apps/src/main/content/jcr_root/apps/__appId__/components/adaptiveForm/formcontainer/.content.xml index e066c12e3..f0fa734cd 100644 --- a/src/main/archetype/ui.apps/src/main/content/jcr_root/apps/__appId__/components/adaptiveForm/formcontainer/.content.xml +++ b/src/main/archetype/ui.apps/src/main/content/jcr_root/apps/__appId__/components/adaptiveForm/formcontainer/.content.xml @@ -1,7 +1,8 @@ - diff --git a/src/main/archetype/ui.content/src/main/content/META-INF/vault/filter.xml b/src/main/archetype/ui.content/src/main/content/META-INF/vault/filter.xml index da9a3c623..8fe602957 100644 --- a/src/main/archetype/ui.content/src/main/content/META-INF/vault/filter.xml +++ b/src/main/archetype/ui.content/src/main/content/META-INF/vault/filter.xml @@ -11,13 +11,13 @@ #if ( $includeCommerce == "y" and $aemVersion != "cloud") #end -#if ( ($includeForms == "y" or $includeFormsenrollment == "y" or $includeFormscommunications == "y" or $includeFormsheadless == "y" ) and $aemVersion == "cloud") +#if ($includeForms == "y" or $includeFormsenrollment == "y" or $includeFormscommunications == "y" or $includeFormsheadless == "y") #end -#if ( ($includeFormsheadless == "y" ) and $aemVersion == "cloud") +#if ($includeFormsheadless == "y" ) #end diff --git a/src/main/archetype/ui.content/src/main/content/jcr_root/conf/__appId__/settings/wcm/policies/.content.xml b/src/main/archetype/ui.content/src/main/content/jcr_root/conf/__appId__/settings/wcm/policies/.content.xml index 0e575cdc2..b4baa0831 100644 --- a/src/main/archetype/ui.content/src/main/content/jcr_root/conf/__appId__/settings/wcm/policies/.content.xml +++ b/src/main/archetype/ui.content/src/main/content/jcr_root/conf/__appId__/settings/wcm/policies/.content.xml @@ -3,7 +3,7 @@ jcr:mixinTypes="[rep:AccessControllable]" jcr:primaryType="cq:Page"> -#if ( ($includeForms == "y" or $includeFormsenrollment == "y" or $includeFormscommunications == "y" or $includeFormsheadless == "y") and $aemVersion == "cloud") +#if ($includeForms == "y" or $includeFormsenrollment == "y" or $includeFormscommunications == "y" or $includeFormsheadless == "y") @@ -561,7 +561,7 @@ #end -#if ( ($includeForms == "y" or $includeFormsenrollment == "y" or $includeFormscommunications == "y" or $includeFormsheadless == "y") and $aemVersion == "cloud") +#if ($includeForms == "y" or $includeFormsenrollment == "y" or $includeFormscommunications == "y" or $includeFormsheadless == "y") com.github.eirslett frontend-maven-plugin - v18.9.0 - 8.19.1 + v16.17.0 + 8.15.0 diff --git a/src/main/resources/META-INF/archetype-post-generate.groovy b/src/main/resources/META-INF/archetype-post-generate.groovy index 9c95b9d29..2b2ccc24d 100644 --- a/src/main/resources/META-INF/archetype-post-generate.groovy +++ b/src/main/resources/META-INF/archetype-post-generate.groovy @@ -205,6 +205,10 @@ if (includeForms == "n" && includeFormsenrollment == "n" && includeFormscommunic assert new File("$confFolder/settings/wcm/templates/blank-af-v2").deleteDir() assert new File("$confFolder/forms").deleteDir() } +if ((includeForms == "y" || includeFormsenrollment == "y" || includeFormscommunications == "y" || includeFormsheadless == "y") && aemVersion != "cloud") { + assert new File("$appsFolder/components/formsandcommunicationportal").deleteDir(); +} + // For Headless Only if (includeFormsheadless == "n") { @@ -216,10 +220,15 @@ if (includeFormsheadless == "n") { } // if forms is included and aem version is set to cloud, set the forms sdk version -if ((includeForms == "y" || includeFormsenrollment == "y" || includeFormscommunications == "y" || includeFormsheadless == "y") && aemVersion == "cloud") { +if (includeForms == "y" || includeFormsenrollment == "y" || includeFormscommunications == "y" || includeFormsheadless == "y") { if (sdkFormsVersion == "latest") { println "No Forms SDK version specified, trying to fetch latest" - sdkFormsVersion = getLatestFormsSDK(request.getArchetypeVersion()) + if (aemVersion == "cloud") { + sdkFormsVersion = getLatestFormsSDK(request.getArchetypeVersion()) + } else { + sdkFormsVersion = getLatestNonCloudFormsSDK(request.getArchetypeVersion()); + } + } println "Using AEM Forms as a Cloud Service SDK version: " + sdkFormsVersion rootPom.text = rootPom.text.replaceAll('SDK_FORMS_VERSION', sdkFormsVersion.toString()) @@ -392,3 +401,12 @@ def getLatestFormsSDK(archetypeVersion) { } return sdkVersion } + +def getLatestNonCloudFormsSDK(archetypeVersion) { + def metadata = new XmlSlurper().parse("https://repo1.maven.org/maven2/com/adobe/aemfd/aemfd-client-sdk/maven-metadata.xml") + def sdkVersion = metadata.versioning.latest + if (sdkVersion == null || sdkVersion == "") { + sdkVersion = System.console().readLine("Cannot get latest SDK version, please provide it manually: ") + } + return sdkVersion +}