forked from Stirling-Tools/Stirling-PDF
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.gradle
More file actions
98 lines (85 loc) · 3.14 KB
/
Copy pathsettings.gradle
File metadata and controls
98 lines (85 loc) · 3.14 KB
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
pluginManagement {
repositories {
var gradlePluginPortalUrl = System.getenv("MAVEN_PUBLIC_URL") ?: ""
if (!gradlePluginPortalUrl.isEmpty()){
maven {
url gradlePluginPortalUrl + "/gradle"
credentials(PasswordCredentials) {
username System.getenv('MAVEN_USER') ?: ""
password System.getenv('MAVEN_PASSWORD') ?: ""
}
authentication {
basic(BasicAuthentication)
}
allowInsecureProtocol true
}
}
gradlePluginPortal()
}
}
plugins {
// Apply the foojay-resolver plugin to allow automatic download of JDKs
id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0'
}
rootProject.name = 'Stirling PDF'
// Flavors: core | proprietary (default) | saas.
// Selectable via STIRLING_FLAVOR or by setting DISABLE_ADDITIONAL_FEATURES/ENABLE_SAAS directly.
// Accepts env var, -D system property, or -P gradle property (camelCase alias too).
def lookupEnvOrProperty = { String name ->
def value = System.getenv(name)
if (value == null || value.isEmpty()) {
value = System.getProperty(name)
}
if (value == null || value.isEmpty()) {
def projectProps = settings.startParameter.projectProperties
value = projectProps.get(name)
if (value == null || value.isEmpty()) {
def camel = name.toLowerCase().split('_').inject('') { acc, part ->
acc.isEmpty() ? part : acc + part.capitalize()
}
value = projectProps.get(camel)
}
}
return value
}
def asBool = { String value -> 'true'.equalsIgnoreCase(value) }
def stirlingFlavor = lookupEnvOrProperty('STIRLING_FLAVOR')?.toLowerCase()
boolean disableAdditional
boolean enableSaas
if (stirlingFlavor != null && !stirlingFlavor.isEmpty()) {
switch (stirlingFlavor) {
case 'core':
disableAdditional = true
enableSaas = false
break
case 'proprietary':
disableAdditional = false
enableSaas = false
break
case 'saas':
disableAdditional = false
enableSaas = true
break
default:
throw new GradleException(
"Unknown STIRLING_FLAVOR='${stirlingFlavor}'. Expected one of: core, proprietary, saas.")
}
} else {
disableAdditional = asBool(lookupEnvOrProperty('DISABLE_ADDITIONAL_FEATURES'))
enableSaas = asBool(lookupEnvOrProperty('ENABLE_SAAS'))
}
if (enableSaas && disableAdditional) {
throw new GradleException(
"ENABLE_SAAS=true requires DISABLE_ADDITIONAL_FEATURES=false " +
"(SaaS builds on top of :proprietary and cannot stand alone).")
}
gradle.ext.disableAdditional = disableAdditional
gradle.ext.enableSaas = enableSaas
include 'stirling-pdf', 'common', 'proprietary'
project(':stirling-pdf').projectDir = file('app/core')
project(':common' ).projectDir = file('app/common')
project(':proprietary' ).projectDir = file('app/proprietary')
if (enableSaas) {
include 'saas'
project(':saas').projectDir = file('app/saas')
}