forked from wttech/gradle-aem-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPackageOptions.kt
118 lines (101 loc) · 4.39 KB
/
PackageOptions.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
package com.cognifide.gradle.aem.common.pkg
import com.cognifide.gradle.aem.AemExtension
import com.cognifide.gradle.aem.common.instance.service.pkg.Package
import com.cognifide.gradle.aem.common.pkg.vlt.NodeTypesSync
import com.fasterxml.jackson.annotation.JsonIgnore
import java.io.File
import java.io.Serializable
class PackageOptions(aem: AemExtension) : Serializable {
/**
* Package root directory containing 'jcr_root' and 'META-INF' directories.
*/
var contentDir: File = aem.project.file("src/main/content")
/**
* JCR root directory.
*/
@get:JsonIgnore
val jcrRootDir: File
get() = File(contentDir, Package.JCR_ROOT)
/**
* Vault metadata files directory (package definition).
*/
@get:JsonIgnore
val vltDir: File
get() = File(contentDir, Package.VLT_PATH)
/**
* Custom path to Vault files that will be used to build CRX package.
* Useful to share same files for all packages, like package thumbnail.
*/
var metaCommonDir: File = File(aem.configCommonDir, Package.META_RESOURCES_PATH)
/**
* Content path for OSGi bundle jars being placed in CRX package.
*
* Default convention assumes that subprojects have separate bundle paths, because of potential re-installation of subpackages.
* When all subprojects will have same bundle path, reinstalling one subpackage may end with deletion of other bundles coming from another subpackage.
*
* Beware that more nested bundle install directories are not supported by AEM by default (up to 4th depth level).
* That's the reason of using dots in subproject names to avoid that limitation.
*/
var installPath: String = if (aem.project == aem.project.rootProject) {
"/apps/${aem.project.rootProject.name}/install"
} else {
"/apps/${aem.project.rootProject.name}/${aem.projectName}/install"
}
/**
* Content path at which CRX Package Manager is storing uploaded packages.
*/
var storagePath: String = "/etc/packages"
/**
* Calculate directory under storage path for each CRX package.
*/
@get:JsonIgnore
var storageDir: PackageFile.() -> String = { group }
/**
* Configures a local repository from which unreleased JARs could be added as 'compileOnly' dependency
* and be deployed within CRX package deployment.
*/
var installRepository: Boolean = true
/**
* Define patterns for known exceptions which could be thrown during package installation
* making it impossible to succeed.
*
* When declared exception is encountered during package installation process, no more
* retries will be applied.
*/
var errors: List<String> = (aem.props.list("package.errors") ?: listOf(
"javax.jcr.nodetype.*Exception",
"org.apache.jackrabbit.oak.api.*Exception",
"org.apache.jackrabbit.vault.packaging.*Exception",
"org.xml.sax.*Exception"
))
/**
* CRX package name conventions (with wildcard) indicating that package can change over time
* while having same version specified. Affects CRX packages composed and satisfied.
*/
var snapshots: List<String> = aem.props.list("package.snapshots") ?: listOf()
/**
* Determines number of lines to process at once during reading Package Manager HTML responses.
*
* The higher the value, the bigger consumption of memory but shorter execution time.
* It is a protection against exceeding max Java heap size.
*/
var responseBuffer = aem.props.int("package.responseBuffer") ?: 4096
/**
* Customize default validation options.
*/
fun validator(options: PackageValidator.() -> Unit) {
this.validatorOptions = options
}
@get:JsonIgnore
internal var validatorOptions: PackageValidator.() -> Unit = {}
/**
* Controls automatic node types exporting from available instance to be later used in package validation.
*/
var nodeTypesSync = aem.props.string("package.nodeTypesSync")
?.let { NodeTypesSync.of(it) } ?: if (aem.offline) NodeTypesSync.NEVER else NodeTypesSync.WHEN_MISSING
/**
* Provides predefined / fallback node types if node types sync is disabled
* or cannot be done when AEM instance is unavailable and exported file is not yet created / saved in VCS.
*/
var nodeTypesFallback = aem.props.boolean("package.nodeTypesFallback") ?: true
}