-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle.kts
171 lines (135 loc) · 5.03 KB
/
build.gradle.kts
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
import com.netflix.gradle.plugins.packaging.CopySpecEnhancement.permissionGroup
import com.netflix.gradle.plugins.packaging.CopySpecEnhancement.user
import com.netflix.gradle.plugins.rpm.Rpm
import org.asciidoctor.gradle.jvm.pdf.AsciidoctorPdfTask
plugins {
distribution
id("com.netflix.nebula.ospackage") version "11.4.0"
id("org.asciidoctor.jvm.convert") version "4.0.2"
id("org.asciidoctor.jvm.pdf") version "4.0.2"
}
allprojects {
group = "edu.jhuapl.sd.sig"
version = "1.6.0-SNAPSHOT"
repositories {
maven {
url = uri("https://repo.maven.apache.org/maven2/")
}
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
jvmArgs("-Djava.library.path=${project.rootProject.projectDir}/jnispice/JNISpice/lib/")
environment("MMTC_HOME", "${project.rootProject.projectDir}/mmtc-core/")
environment("TK_CONFIG_PATH", "${project.rootProject.projectDir}/mmtc-core/src/test/resources")
}
}
asciidoctorj {
fatalWarnings("Errno")
}
val asciidoctor = tasks.register<AsciidoctorPdfTask>("userGuidePdf") {
inputs.files("docs/MMTC_Users_Guide.adoc")
inputs.files("docs/themes/basic/basic-theme.yml")
setBaseDir(file("docs"))
setSourceDir(file("docs"))
setOutputDir(file("build/docs"))
setTheme("basic")
outputs.dir("build/docs")
}
pdfThemes {
local("basic") {
themeDir = file("docs/themes/basic")
themeName = "basic"
}
}
val createDistDir = tasks.register("createDistDir") {
inputs.files("mmtc-core/bin/mmtc")
inputs.files("mmtc-core/build/libs/mmtc-core-" + project.version + "-app.jar")
inputs.files("mmtc-plugin-ampcs/build/libs/mmtc-plugin-ampcs-" + project.version + ".jar")
dependsOn("mmtc-core:uberJar")
dependsOn("mmtc-plugin-ampcs:jar")
dependsOn(":userGuidePdf")
doLast {
exec {
commandLine("bash", "create-dist.sh", project.version)
}
}
outputs.dir("build/mmtc-dist-tmp")
}
val mmtcEl8Rpm = tasks.register<Rpm>("mmtcEl8Rpm") {
dependsOn(tasks.build)
distribution = "el8"
release = "1.$distribution"
archStr = "x86_64"
os = org.redline_rpm.header.Os.LINUX
preInstall(file(projectDir.toPath().resolve("rpm-scripts/pre-install.sh")))
postInstall(file(projectDir.toPath().resolve("rpm-scripts/post-install.sh")))
user(this, "mmtc")
permissionGroup(this, "mmtc")
//make the RPM relocatable using prefix(). however, also set the default location using into();
//otherwise, if you install without specifying a custom "--prefix", it gets installed in /usr
//(at least that's what happened in my local testing).
prefix("/opt/local/mmtc")
into("/opt/local/mmtc")
//copy the distribution folder, preserving permissions since they're already correct.
//NOTE: this doesn't seem to set *directory* permissions, so we use post-install.sh for that.
from(projectDir.toPath().resolve("build/mmtc-dist-tmp"))
//NOTE: create-dist.sh updates bin/mmtc to point to the correct (newly installed) jar file,
//so we no longer create a symlink at lib/mmtc.jar
}
val mmtcEl9Rpm = tasks.register<Rpm>("mmtcEl9Rpm") {
dependsOn(tasks.build)
distribution = "el9"
release = "1.$distribution"
archStr = "x86_64"
os = org.redline_rpm.header.Os.LINUX
preInstall(file(projectDir.toPath().resolve("rpm-scripts/pre-install.sh")))
postInstall(file(projectDir.toPath().resolve("rpm-scripts/post-install.sh")))
user(this, "mmtc")
permissionGroup(this, "mmtc")
//make the RPM relocatable using prefix(). however, also set the default location using into();
//otherwise, if you install without specifying a custom "--prefix", it gets installed in /usr
//(at least that's what happened in my local testing).
prefix("/opt/local/mmtc")
into("/opt/local/mmtc")
//copy the distribution folder, preserving permissions since they're already correct.
//NOTE: this doesn't seem to set *directory* permissions, so we use post-install.sh for that.
from(projectDir.toPath().resolve("build/mmtc-dist-tmp"))
//NOTE: create-dist.sh updates bin/mmtc to point to the correct (newly installed) jar file,
//so we no longer create a symlink at lib/mmtc.jar
}
// fix for Rpm task setting incorrect digests in RPM metadata
tasks.getByName("mmtcEl8Rpm") {
dependsOn(tasks.getByName("cleanMmtcEl8Rpm"))
}
tasks.getByName("mmtcEl9Rpm") {
dependsOn(tasks.getByName("cleanMmtcEl9Rpm"))
}
distributions {
main {
distributionBaseName.set(project.name)
contents {
from("build/mmtc-dist-tmp")
}
}
}
tasks.distZip {
dependsOn(createDistDir)
}
tasks.distTar {
dependsOn(createDistDir)
compression = Compression.GZIP
archiveExtension.set("tar.gz")
}
tasks.installDist {
dependsOn(createDistDir)
}
val demoZip = tasks.register("demoZip") {
dependsOn(tasks.build)
dependsOn(createDistDir)
doLast {
exec {
commandLine("bash", "create-demo-zip.sh", project.version)
}
}
outputs.dir("build/mmtc-demo-tmp")
}