Skip to content

Commit 6c59211

Browse files
Maven in subdir (#937)
* Maven subdir support * Disp align * Validation * Nesting with VCS ignore * Bugfix * Alignment * Launcher cloud works * Fix * Cloud launcher works * Regression fix * Empty dir fix
1 parent 2602bff commit 6c59211

File tree

9 files changed

+817
-345
lines changed

9 files changed

+817
-345
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ dependencies {
6060
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.21.0")
6161
testImplementation("org.junit.jupiter:junit-jupiter:5.8.2")
6262

63-
implementation("com.cognifide.gradle:common-plugin:1.1.14")
63+
implementation("com.cognifide.gradle:common-plugin:1.1.15")
6464

6565
// External dependencies
6666
implementation("org.jsoup:jsoup:1.14.3")

docs/launcher.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,21 @@ Moreover, to run GAP, it is needed to have a project which has at least Gradle W
2626
To eliminate such ceremony, GAP standalone launcher could be used to be able to use its features with minimal effort, anywhere.
2727
Simply, using e.g bash script - download the GAP launcher run it with regular GAP arguments - all tasks and properties are available to be used.
2828

29+
## Compatibility
30+
31+
| GAP Launcher | AEM Project Archetype |
32+
|--------------|-----------------------|
33+
| 16.0.1 | 39 |
34+
35+
See also [plugin compatibility](../README.MD#compatibility).
36+
37+
Note that GAP launcher is trying to scaffold AEM configuration that will work with both versions of AEM (OnPrem & Cloud).
38+
However, the changes made in the AEM archetype are being done independently by Adobe team. This requires that from time to time GAP Launcher need to be aligned to the changes made by Adobe.
39+
40+
**Contributions in this area are highly welcomed! :)**
41+
42+
Simply saying - don't hesitate to make pull requests to make GAP Launcher compatible again when a new version of Adobe AEM Archetype is available or at least report an issue!
43+
2944
## Downloads
3045

3146
Grab most recent version of launcher from GitHub [releases](https://github.com/Cognifide/gradle-aem-plugin/releases) section.

launcher/src/main/kotlin/com/cognifide/gradle/aem/launcher/BuildScaffolder.kt

Lines changed: 2 additions & 197 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
package com.cognifide.gradle.aem.launcher
22

3-
import java.io.File
43
import java.util.Properties
54

65
class BuildScaffolder(private val launcher: Launcher) {
76

87
fun scaffold() {
98
saveProperties()
109
saveSettings()
11-
saveRootBuildScript()
12-
savePropertiesTemplate()
1310
when (aemVersion) {
1411
"cloud" -> EnvCloudScaffolder(launcher).scaffold()
15-
null -> EnvScaffolder(launcher).scaffold()
12+
null -> EnvInstanceOnlyScaffolder(launcher).scaffold()
1613
else -> EnvOnPremScaffolder(launcher).scaffold()
1714
}
1815
}
@@ -23,7 +20,7 @@ class BuildScaffolder(private val launcher: Launcher) {
2320
archetypePropertiesFile.inputStream().buffered().use { load(it) }
2421
} else null
2522

26-
private val archetypePropertiesFile get() = File("archetype.properties")
23+
private val archetypePropertiesFile get() = launcher.appDir.resolve("archetype.properties")
2724

2825
private fun saveProperties() = launcher.workFileOnce("gradle.properties") {
2926
println("Saving Gradle properties file '$this'")
@@ -43,198 +40,6 @@ class BuildScaffolder(private val launcher: Launcher) {
4340
.map { it.removePrefix(Launcher.ARG_SAVE_PREFIX) }
4441
.associate { it.substringBefore("=") to it.substringAfter("=") }
4542

46-
@Suppress("LongMethod")
47-
private fun saveRootBuildScript() = launcher.workFileOnce("build.gradle.kts") {
48-
println("Saving root Gradle build script file '$this'")
49-
writeText(
50-
"""
51-
import com.cognifide.gradle.aem.common.instance.local.OpenMode
52-
53-
plugins {
54-
id("io.wttech.config")
55-
id("com.cognifide.aem.common")
56-
}
57-
58-
config {
59-
define {
60-
labelAbbrs("aem")
61-
valueSaveGradleProperties()
62-
63-
group("instance") {
64-
prop("instanceType") {
65-
options("local", "remote")
66-
description("Local - instance will be created on local file system\nRemote - connecting to remote instance only")
67-
}
68-
prop("instanceAuthorHttpUrl") {
69-
default("http://localhost:4502")
70-
visible { boolValue("instanceAuthorEnabled") }
71-
optional()
72-
}
73-
prop("instanceAuthorEnabled") {
74-
checkbox(true)
75-
}
76-
prop("instancePublishHttpUrl") {
77-
default("http://localhost:4503")
78-
visible { boolValue("instancePublishEnabled") }
79-
optional()
80-
}
81-
prop("instancePublishEnabled") {
82-
checkbox(true)
83-
}
84-
prop("instancePassword") {
85-
default("admin")
86-
optional()
87-
}
88-
prop("instanceServiceCredentialsUri") {
89-
label("Service Credentials Uri")
90-
description("JSON file downloaded from AEMaaCS developer console")
91-
optional()
92-
}
93-
prop("localInstanceRunModes") {
94-
label("Run Modes")
95-
optional()
96-
}
97-
prop("localInstanceQuickstartDistUri") {
98-
label("AEM distribution URI")
99-
description("Typically AEM SDK zip file or AEM jar file")
100-
}
101-
prop("localInstanceQuickstartLicenseUri") {
102-
label("Quickstart License URI")
103-
description("Typically file named 'license.properties'")
104-
}
105-
prop("localInstanceSpUri") {
106-
description("Only for on-prem AEM instances. Typically file named 'aem-service-pkg-*.zip'")
107-
optional()
108-
}
109-
prop("localInstanceCoreComponentsUri") {
110-
description("Only for on-prem AEM instances. Typically file named 'core.wcm.components.all-*.zip'")
111-
optional()
112-
}
113-
prop("localInstanceOpenMode") {
114-
label("Open Automatically")
115-
description("Open web browser when instances are up.")
116-
options(OpenMode.values().map { it.name.toLowerCase() })
117-
default(OpenMode.ALWAYS.name.toLowerCase())
118-
}
119-
}
120-
group("build") {
121-
prop("mvnBuildProfiles") {
122-
default("fedDev")
123-
description("Comma delimited")
124-
optional()
125-
}
126-
prop("mvnBuildArgs") {
127-
description("Added extra")
128-
optional()
129-
}
130-
}
131-
group("deploy") {
132-
prop("packageDeployAvoidance") {
133-
label("Avoidance")
134-
description("Avoids uploading and installing package if identical is already deployed on instance.")
135-
checkbox(true)
136-
}
137-
prop("packageDamAssetToggle") {
138-
label("Toggle DAM Worklows")
139-
description("Turns on/off temporary disablement of assets processing for package deployment time.\n" +
140-
"Useful to avoid redundant rendition generation when package contains renditions synchronized earlier.")
141-
checkbox(true)
142-
}
143-
}
144-
group("authorization") {
145-
prop("companyUser") {
146-
default(System.getProperty("user.name").orEmpty())
147-
description("For resolving AEM files from authorized URL")
148-
optional()
149-
}
150-
prop("companyPassword") {
151-
optional()
152-
}
153-
prop("companyDomain") {
154-
default(System.getenv("USERDOMAIN").orEmpty())
155-
description("For files resolved using SMB")
156-
optional()
157-
}
158-
}
159-
160-
}
161-
}
162-
163-
if (config.captured) {
164-
if (aem.mvnBuild.available) defaultTasks(":env:setup")
165-
else defaultTasks(":env:instanceSetup")
166-
}
167-
168-
allprojects {
169-
repositories {
170-
mavenCentral()
171-
}
172-
}
173-
174-
aem {
175-
mvnBuild {
176-
depGraph {
177-
// softRedundantModule("ui.content" to "ui.apps")
178-
}
179-
discover()
180-
}
181-
}
182-
""".trimIndent()
183-
)
184-
}
185-
186-
private fun savePropertiesTemplate() = launcher.workFileOnce("gradle.properties.peb") {
187-
println("Saving user-specific properties template '$this'")
188-
writeText(
189-
"""
190-
# === Gradle
191-
192-
org.gradle.logging.level=info
193-
org.gradle.daemon=true
194-
org.gradle.parallel=true
195-
org.gradle.caching=true
196-
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
197-
198-
# === Gradle AEM Plugin ===
199-
200-
package.manager.deployAvoidance={{ config.packageDeployAvoidance }}
201-
{% if packageDamAssetToggle == 'true' %}
202-
package.manager.workflowToggle=[dam_asset=false]
203-
{% endif %}
204-
205-
localInstance.quickstart.distUrl={{ config.localInstanceQuickstartDistUri }}
206-
localInstance.quickstart.licenseUrl={{ config.localInstanceQuickstartLicenseUri }}
207-
localInstance.openMode={{ config.localInstanceOpenMode }}
208-
209-
localInstance.spUrl={{ config.localInstanceSpUri }}
210-
localInstance.coreComponentsUrl={{ config.localInstanceCoreComponentsUri }}
211-
212-
instance.default.runModes={{ config.localInstanceRunModes }}
213-
instance.default.password={{ config.instancePassword }}
214-
215-
instance.{{ config.instanceType }}-author.serviceCredentialsUrl={{ config.instanceServiceCredentialsUri }}
216-
instance.{{ config.instanceType }}-author.enabled={{ config.instanceAuthorEnabled }}
217-
instance.{{ config.instanceType }}-author.httpUrl={{ config.instanceAuthorHttpUrl }}
218-
instance.{{ config.instanceType }}-author.openPath=/aem/start.html
219-
instance.{{ config.instanceType }}-publish.enabled={{ config.instancePublishEnabled }}
220-
instance.{{ config.instanceType }}-publish.httpUrl={{ config.instancePublishHttpUrl }}
221-
instance.{{ config.instanceType }}-publish.openPath=/crx/packmgr
222-
223-
mvnBuild.args={{ config.mvnBuildArgs }}
224-
225-
# === Gradle Common Plugin ===
226-
227-
javaSupport.version=11
228-
229-
notifier.enabled=true
230-
231-
fileTransfer.user={{ config.companyUser }}
232-
fileTransfer.password={{ config.companyPassword }}
233-
fileTransfer.domain={{ config.companyDomain }}
234-
""".trimIndent()
235-
)
236-
}
237-
23843
private fun saveSettings() = launcher.workFileOnce("settings.gradle.kts") {
23944
println("Saving Gradle settings file '$this'")
24045
writeText(

0 commit comments

Comments
 (0)