forked from e-Spirit-Usergroup/module-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
executable file
·205 lines (178 loc) · 6.87 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java Library project to get you started.
* For more details take a look at the Java Libraries chapter in the Gradle
* User Manual available at https://docs.gradle.org/current/userguide/java_library_plugin.html
*/
buildscript {
ext {
fsRuntimeVersion = '5.2.241009'
}
}
plugins {
id 'java-library'
id 'maven-publish'
id 'de.espirit.firstspirit-module' version '6.2.1'
id 'net.researchgate.release' version '2.8.1'
}
configurations {
javaClient
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.release.set(11)
}
group = project.property('groupId')
repositories {
maven {
url = 'https://artifactory.e-spirit.hosting/artifactory/repo/'
credentials {
// Do NOT edit these lines since the credentials will be read from the local Gradle configuration.
username = artifactory_hosting_username
password = artifactory_hosting_password
}
}
}
dependencies {
compileOnly group: 'de.espirit.firstspirit', name: 'fs-isolated-runtime', version: "${fsRuntimeVersion}"
compileOnly group: 'org.jetbrains', name: 'annotations', version: '23.0.0'
javaClient group: 'de.espirit.firstspirit', name: 'fs-isolated-client', version: "${fsRuntimeVersion}"
fsModuleCompile group: 'com.espirit.ps.psci.module', name: 'generic-configuration', version: '2.8.0'
testImplementation 'junit:junit:4.13.2'
}
/*
* FirstSpirit Module Plugin configuration
*/
firstSpiritModule {
moduleName = project.property('firstSpiritModule.moduleName')
displayName = project.property('firstSpiritModule.displayName')
description = project.property('firstSpiritModule.description')
vendor = project.property('firstSpiritModule.vendor')
}
/*
* Maven Publish Plugin configuration
*/
publishing {
repositories {
maven {
credentials {
// Do NOT edit these lines since the credentials will be read from the local Gradle configuration.
username = artifactory_hosting_username
password = artifactory_hosting_password
}
url "https://artifactory.e-spirit.hosting/artifactory/${version.endsWith("SNAPSHOT") ? project.property('publishing.snapshotRepository') : project.property('publishing.releaseRepository') }"
}
}
publications {
fsm(MavenPublication) {
artifactId project.name
artifact assembleFSM
}
}
}
/*
* Release Plugin configuration
*/
release {
ignoredSnapshotDependencies = ['de.espirit.firstspirit:fs-license']
}
// publish artifacts after release
allprojects { p ->
afterEvaluate {
rootProject.afterReleaseBuild.dependsOn p.tasks.matching { it.name == 'publish' }
}
}
/*
* Verify gradle.properties values
*/
afterEvaluate {
['groupId', 'firstSpiritModule.moduleName', 'firstSpiritModule.displayName', 'firstSpiritModule.vendor' , 'publishing.releaseRepository', 'publishing.snapshotRepository'].each {
if (!project.hasProperty(it) || (project.property(it) as String).trim().empty) {
throw new GradleException("Property '${it}' in gradle.properties must not be empty!")
}
}
}
task replaceNames() {
doLast {
copy {
from("src") {
include "**/*.properties"
include "**/*.java"
include "**/*.xml"
}
// Have to use a new path for modified files
into("tmp")
filter {
String line ->
line.replaceAll("To_be_renamed", "${project.property('firstSpiritModule.moduleName').trim()}").replaceAll("to_be_renamed", "${project.property('firstSpiritModule.moduleName').trim().toLowerCase()}")
}
rename { String filename ->
filename.replace("To_be_renamed", "${project.property('firstSpiritModule.moduleName').trim()}").replace("to_be_renamed", "${project.property('firstSpiritModule.moduleName').trim().toLowerCase()}")
}
filesMatching("**/to_be_renamed/**") {
it.path = it.path.replace("to_be_renamed", "${project.property('firstSpiritModule.moduleName').trim().toLowerCase()}")
}
}
}
}
task copyFromTemp(dependsOn: [replaceNames]) {
doLast {
copy {
from("tmp") {
include "**"
}
into("src")
}
}
}
// Finally, delete the files in folder B
task initModule(type: Delete, dependsOn: copyFromTemp) {
delete("tmp")
delete "src/main/java/com/espirit/modules/to_be_renamed"
delete "src/test/java/com/espirit/modules/to_be_renamed"
delete "src/main/fsm-resources/to_be_renamed"
delete "src/main/resources/to_be_renamed.properties"
delete "src/main/resources/to_be_renamed_de.properties"
delete "src/main/resources/to_be_renamed_en.properties"
}
/*
* Debug task to start a FirstSpirit SiteArchitect
*/
task startSiteArchitect(type: JavaExec) {
['firstSpirit.debug.host', 'firstSpirit.debug.projectId'].each {
if (!project.hasProperty(it) || (project.property(it) as String).trim().empty) {
logger.warn("Debugging not configured. Property '${it}' in gradle.properties is empty!")
}
}
mainClass = "de.espirit.common.bootstrap.Bootstrap"
classpath += files(configurations.javaClient.files)
jvmArgs = [
"-Dlogin.user=" + project.property("artifactory_hosting_username"),
"-Dlogin.password=" + project.property("artifactory_hosting_password"),
"-DprojectId=" + project.property("firstSpirit.debug.projectId"),
"-Dmode=HTTP",
"-DservletZone=/",
"-Dhost=" + project.property("firstSpirit.debug.host"),
"-Dregistry.file=FactoryRegistry.properties",
"-Dport=443",
"-Dcompression=2",
"-Dlogin.type=MAIN",
"-Dlocale=de",
"-Dlogin=client",
"-Djava-vm-args= --add-opens=java.base/java.lang=ALL-UNNAMED",
"--add-opens=java.desktop/java.awt.event=ALL-UNNAMED",
"--add-opens=java.desktop/javax.swing.plaf.basic=ALL-UNNAMED",
"--add-opens=java.desktop/javax.swing.plaf.synth=ALL-UNNAMED",
"--add-exports=java.base/sun.security.action=ALL-UNNAMED",
"--add-exports=java.desktop/com.apple.eawt=ALL-UNNAMED",
"--add-exports=java.desktop/sun.awt=ALL-UNNAMED",
"--add-exports=java.desktop/sun.awt.shell=ALL-UNNAMED",
"--add-exports=java.desktop/sun.swing=ALL-UNNAMED",
"--add-exports=java.desktop/sun.swing.plaf.synth=ALL-UNNAMED",
"--add-exports=java.desktop/sun.swing.table=ALL-UNNAMED",
"-Dencryption=1",
"-Dusehttps=true",
"-Durl=https://" + project.property("firstSpirit.debug.host"),
]
}