-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
executable file
·135 lines (114 loc) · 3.81 KB
/
build.gradle
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
import static java.lang.Boolean.parseBoolean
buildscript {
repositories {
mavenCentral()
maven {url 'https://plugins.gradle.org/m2/'}
maven {url 'https://repo.grails.org/grails/core'}
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion"
classpath "org.grails.plugins:hibernate5:$grailsHibernatePluginVersion"
}
}
version xhAppVersion
group xhAppPackage
apply plugin:'idea'
apply plugin:'war'
apply plugin:'org.grails.grails-web'
repositories {
mavenCentral()
maven {url 'https://repo.grails.org/grails/core'}
maven {url 'https://repo.xh.io/content/groups/public/'}
}
configurations {
all {
// Ensure any SNAPSHOT dependencies are always resolved to the latest available version.
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
}
springBoot {
mainClass = xhAppPackage + ".Application"
}
if (parseBoolean(runHoistInline)) {
println "${xhAppName}: running with Hoist Core INLINE...."
grails.plugins {
implementation project(":hoist-core")
}
} else {
println "${xhAppName}: running with Hoist Core PACKAGED at v${hoistCoreVersion}...."
dependencies {
implementation "io.xh:hoist-core:$hoistCoreVersion"
}
}
dependencies {
// For server-side JWT validation.
implementation "org.bitbucket.b_c:jose4j:0.9.6"
// Database drivers - H2 for temporary in-memory DB with `useH2: true` in instanceConfig YAML
// MySQL for deployed instances, or more stateful local workstation setups.
runtimeOnly "com.h2database:h2:2.2.224"
runtimeOnly "mysql:mysql-connector-java:8.0.33"
// For hot reloading
developmentOnly "io.methvin:directory-watcher:0.15.0"
if (parseBoolean(enableHotSwap)) {
developmentOnly "io.xh:groovyReset:1.0"
}
}
// Avoid unexpected errors with overly-long classpath on Windows development machines.
grails {
pathingJar = true
}
Map hoistMetaData = [
'info.xh.appCode': xhAppCode,
'info.xh.appName': xhAppName,
'info.xh.appPackage': xhAppPackage,
'info.xh.appBuild': findProperty('xhAppBuild') ?: 'UNKNOWN'
]
def allJvmArgs = [
'-Dspring.output.ansi.enabled=always',
'-XX:TieredStopAtLevel=1',
'-Xmx1024m',
"--add-modules=java.se",
"--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED",
"--add-opens=java.base/java.lang=ALL-UNNAMED",
"--add-opens=java.base/sun.nio.ch=ALL-UNNAMED",
"--add-opens=java.management/sun.management=ALL-UNNAMED",
"--add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED",
"--add-opens=java.base/java.util=ALL-UNNAMED"
]
if (parseBoolean(enableHotSwap)) {
def groovyReset = configurations.developmentOnly.resolve().find {it.name.contains("groovyReset")}
allJvmArgs += [
'-XX:HotswapAgent=fatjar',
'-XX:+AllowEnhancedClassRedefinition',
'-javaagent:' + groovyReset.absolutePath
]
}
bootRun {
ignoreExitValue true
systemProperties System.properties
jvmArgs(allJvmArgs)
sourceResources sourceSets.main
systemProperties hoistMetaData
}
tasks.withType(GroovyCompile) {
configure(groovyOptions) {
forkOptions.jvmArgs = allJvmArgs
}
}
// Ask IntelliJ to download sources and javadocs for Gradle-managed dependencies.
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
//--------------------------------------------------
// Extensions to build.info (Hoist-Core requirement)
//--------------------------------------------------
tasks.war.doFirst {
File infoFile = layout.buildDirectory.file('resources/main/META-INF/grails.build.info').get().asFile
Properties properties = new Properties()
infoFile.withInputStream {properties.load(it)}
properties.putAll(hoistMetaData)
infoFile.withOutputStream {properties.store(it, null)}
}