@@ -9,6 +9,7 @@ class BuildScaffolder(private val launcher: Launcher) {
99 saveProperties()
1010 saveSettings()
1111 saveRootBuildScript()
12+ savePropertiesTemplate()
1213 when (aemVersion) {
1314 " cloud" -> EnvCloudScaffolder (launcher).scaffold()
1415 null -> EnvScaffolder (launcher).scaffold()
@@ -28,11 +29,9 @@ class BuildScaffolder(private val launcher: Launcher) {
2829 println (" Saving Gradle properties file '$this '" )
2930 outputStream().use { output ->
3031 Properties ().apply {
31- putAll(defaultProps)
3232 if (savePropsFlag) {
3333 putAll(saveProps)
3434 }
35- putAll(projectProps)
3635 store(output, null )
3736 }
3837 }
@@ -44,27 +43,123 @@ class BuildScaffolder(private val launcher: Launcher) {
4443 .map { it.removePrefix(Launcher .ARG_SAVE_PREFIX ) }
4544 .associate { it.substringBefore(" =" ) to it.substringAfter(" =" ) }
4645
47- private val defaultProps get() = mapOf (
48- " org.gradle.logging.level" to " info" ,
49- " org.gradle.daemon" to " true" ,
50- " org.gradle.parallel" to " true" ,
51- " org.gradle.caching" to " true" ,
52- " org.gradle.jvmargs" to " -Xmx2048m -Dfile.encoding=UTF-8"
53- )
54-
55- private val projectProps get() = mapOf (" javaSupport.version" to " 11" )
56-
5746 private fun saveRootBuildScript () = launcher.workFileOnce(" build.gradle.kts" ) {
5847 println (" Saving root Gradle build script file '$this '" )
5948 writeText(
6049 """
50+ import com.cognifide.gradle.aem.common.instance.local.OpenMode
51+
6152 plugins {
53+ id("io.wttech.config")
6254 id("com.cognifide.aem.common")
63- id("com.neva.fork")
6455 }
6556
66- apply(from = "gradle/fork/props.gradle.kts")
67- if (file("gradle.user.properties").exists()) {
57+ config {
58+ define {
59+ labelAbbrs("aem")
60+ valueSaveGradleProperties()
61+
62+ group("instance") {
63+ prop("instanceType") {
64+ options("local", "remote")
65+ description("Local - instance will be created on local file system\nRemote - connecting to remote instance only")
66+ }
67+ prop("instanceAuthorHttpUrl") {
68+ default("http://localhost:4502")
69+ visible { boolValue("instanceAuthorEnabled") }
70+ optional()
71+ }
72+ prop("instanceAuthorEnabled") {
73+ checkbox(true)
74+ }
75+ prop("instancePublishHttpUrl") {
76+ default("http://localhost:4503")
77+ visible { boolValue("instancePublishEnabled") }
78+ optional()
79+ }
80+ prop("instancePublishEnabled") {
81+ checkbox(true)
82+ }
83+ prop("instancePassword") {
84+ default("admin")
85+ optional()
86+ }
87+ prop("instanceServiceCredentialsUri") {
88+ label("Service Credentials Uri")
89+ description("JSON file downloaded from AEMaaCS developer console")
90+ optional()
91+ }
92+ prop("localInstanceRunModes") {
93+ label("Run Modes")
94+ optional()
95+ }
96+ prop("localInstanceQuickstartDistUri") {
97+ label("AEM distribution URI")
98+ description("Typically AEM SDK zip file or AEM jar file")
99+ }
100+ prop("localInstanceQuickstartLicenseUri") {
101+ label("Quickstart License URI")
102+ description("Typically file named 'license.properties'")
103+ }
104+ prop("localInstanceSpUri") {
105+ description("Only for on-prem AEM instances. Typically file named 'aem-service-pkg-*.zip'")
106+ optional()
107+ }
108+ prop("localInstanceCoreComponentsUri") {
109+ description("Only for on-prem AEM instances. Typically file named 'core.wcm.components.all-*.zip'")
110+ optional()
111+ }
112+ prop("localInstanceOpenMode") {
113+ label("Open Automatically")
114+ description("Open web browser when instances are up.")
115+ options(OpenMode.values().map { it.name.toLowerCase() })
116+ default(OpenMode.ALWAYS.name.toLowerCase())
117+ }
118+ }
119+ group("build") {
120+ prop("mvnBuildProfiles") {
121+ default("fedDev")
122+ description("Comma delimited")
123+ optional()
124+ }
125+ prop("mvnBuildArgs") {
126+ description("Added extra")
127+ optional()
128+ }
129+ }
130+ group("deploy") {
131+ prop("packageDeployAvoidance") {
132+ label("Avoidance")
133+ description("Avoids uploading and installing package if identical is already deployed on instance.")
134+ checkbox(true)
135+ }
136+ prop("packageDamAssetToggle") {
137+ label("Toggle DAM Worklows")
138+ description("Turns on/off temporary disablement of assets processing for package deployment time.\n" +
139+ "Useful to avoid redundant rendition generation when package contains renditions synchronized earlier.")
140+ checkbox(true)
141+ }
142+ }
143+ group("authorization") {
144+ prop("companyUser") {
145+ default(System.getProperty("user.name").orEmpty())
146+ description("For resolving AEM files from authorized URL")
147+ optional()
148+ }
149+ prop("companyPassword") {
150+ optional()
151+ }
152+ prop("companyDomain") {
153+ default(System.getenv("USERDOMAIN").orEmpty())
154+ description("For files resolved using SMB")
155+ optional()
156+ }
157+ }
158+
159+ }
160+ }
161+
162+ if (config.captured) {
68163 if (aem.mvnBuild.available) defaultTasks(":env:setup")
69164 else defaultTasks(":env:instanceSetup")
70165 }
@@ -87,6 +182,58 @@ class BuildScaffolder(private val launcher: Launcher) {
87182 )
88183 }
89184
185+ private fun savePropertiesTemplate () = launcher.workFileOnce(" gradle.properties.peb" ) {
186+ println (" Saving user-specific properties template '$this '" )
187+ writeText(
188+ """
189+ # === Gradle
190+
191+ org.gradle.logging.level=info
192+ org.gradle.daemon=true
193+ org.gradle.parallel=true
194+ org.gradle.caching=true
195+ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
196+
197+ # === Gradle AEM Plugin ===
198+
199+ package.manager.deployAvoidance={{ config.packageDeployAvoidance }}
200+ {% if packageDamAssetToggle == 'true' %}
201+ package.manager.workflowToggle=[dam_asset=false]
202+ {% endif %}
203+
204+ localInstance.quickstart.distUrl={{ config.localInstanceQuickstartDistUri }}
205+ localInstance.quickstart.licenseUrl={{ config.localInstanceQuickstartLicenseUri }}
206+ localInstance.openMode={{ config.localInstanceOpenMode }}
207+
208+ localInstance.spUrl={{ config.localInstanceSpUri }}
209+ localInstance.coreComponentsUrl={{ config.localInstanceCoreComponentsUri }}
210+
211+ instance.default.runModes={{ config.localInstanceRunModes }}
212+ instance.default.password={{ config.instancePassword }}
213+
214+ instance.{{ config.instanceType }}-author.serviceCredentialsUrl={{ config.instanceServiceCredentialsUri }}
215+ instance.{{ config.instanceType }}-author.enabled={{ config.instanceAuthorEnabled }}
216+ instance.{{ config.instanceType }}-author.httpUrl={{ config.instanceAuthorHttpUrl }}
217+ instance.{{ config.instanceType }}-author.openPath=/aem/start.html
218+ instance.{{ config.instanceType }}-publish.enabled={{ config.instancePublishEnabled }}
219+ instance.{{ config.instanceType }}-publish.httpUrl={{ config.instancePublishHttpUrl }}
220+ instance.{{ config.instanceType }}-publish.openPath=/crx/packmgr
221+
222+ mvnBuild.args={{ config.mvnBuildArgs }}
223+
224+ # === Gradle Common Plugin ===
225+
226+ javaSupport.version=11
227+
228+ notifier.enabled=true
229+
230+ fileTransfer.user={{ config.companyUser }}
231+ fileTransfer.password={{ config.companyPassword }}
232+ fileTransfer.domain={{ config.companyDomain }}
233+ """ .trimIndent()
234+ )
235+ }
236+
90237 private fun saveSettings () = launcher.workFileOnce(" settings.gradle.kts" ) {
91238 println (" Saving Gradle settings file '$this '" )
92239 writeText(
0 commit comments