-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle.kts
215 lines (165 loc) · 5.61 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
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
206
207
208
209
210
211
212
213
214
215
@file:Suppress("KDocUnresolvedReference")
plugins {
java
distribution
}
group = "io.sharptree"
version = "1.1.2"
val vendor = "Sharptree"
val product = "zebra-label"
val distro = "zebra-label"
project.version = "1.1.2"
tasks.compileJava {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
}
configurations.register("installation").configure {
extendsFrom(configurations.implementation.get())
isTransitive = false
}
repositories {
mavenCentral()
}
distributions {
val distribution by configurations.creating {
extendsFrom(configurations.implementation.get())
isCanBeResolved = true
}
main {
contents {
into("applications/maximo/lib") {
from("$buildDir/libs/${product.toLowerCase()}.jar")
}
into("applications/maximo/lib") {
from(distribution.filter { it.name.startsWith("guava") })
}
into("applications/maximo/maximouiweb/webmodule/WEB-INF/lib") {
from("$buildDir/libs/${product.toLowerCase()}-web.jar")
}
into("tools/maximo/classes") {
includeEmptyDirs = false
from(layout.buildDirectory.dir("classes/java/main")) {
include("psdi/zebralabel/en/*.class")
}
}
}
}
}
// Configure the distribution task to tar and gzip the results.
tasks.distTar {
rootSpec
exclude("tools/maximo/classes/psdi/zebralabel/en/images")
exclude("tools/maximo/classes/psdi/zebralabel/en/README.md")
exclude("tools/maximo/classes/psdi/zebralabel/en/resources/manifest.json")
compression = Compression.GZIP
archiveExtension.set("tar.gz")
}
tasks.distZip {
exclude("tools/maximo/classes/psdi/zebralabel/en/images")
exclude("tools/maximo/classes/psdi/zebralabel/en/README.md")
exclude("tools/maximo/classes/psdi/zebralabel/en/resources/manifest.json")
}
tasks.assembleDist {
finalizedBy("fixzip")
}
tasks.register("fixzip"){
dependsOn("rezip", "retar")
doLast{
delete(layout.buildDirectory.asFile.get().path + File.separator + "distributions" + File.separator + "tmp")
}
}
tasks.register("unzip") {
val distDir = layout.buildDirectory.asFile.get().path + File.separator + "distributions"
doLast {
copy {
from(zipTree(tasks.distZip.get().archiveFile.get().asFile))
into(distDir + File.separator + "tmp")
}
copy {
from(zipTree(configurations.getByName("installation").filter { it.name.startsWith("semver") }.singleFile))
into(distDir + File.separator + "tmp/${project.name}-${version}/tools/maximo/classes")
}
}
}
tasks.register<Zip>("rezip"){
dependsOn("unzip")
val archiveBaseName = project.name + "-" + project.version
val distDir = layout.buildDirectory.asFile.get().path + File.separator + "distributions"
val baseDir = File(distDir + File.separator + "tmp" + File.separator + archiveBaseName )
archiveFileName.set("$archiveBaseName.zip")
from(baseDir){
into("/")
exclude("maximo/**")
}
}
tasks.register<Tar>("retar"){
dependsOn("unzip")
val archiveBaseName = project.name + "-" + project.version
val distDir = layout.buildDirectory.asFile.get().path + File.separator + "distributions"
val baseDir = File(distDir + File.separator + "tmp" + File.separator + archiveBaseName )
compression = Compression.GZIP
archiveExtension.set("tar.gz")
from(baseDir){
into("/")
exclude("maximo/**")
}
}
tasks.getByName("unzip").dependsOn("assembleDist")
tasks.jar {
archiveFileName.set("${product.toLowerCase()}.jar")
}
tasks.getByName("distTar").dependsOn("jar", "jar-web")
tasks.getByName("distZip").dependsOn("jar", "jar-web")
tasks.register<Jar>("jar-web") {
archiveFileName.set("${product.toLowerCase()}-web.jar")
include("io/sharptree/maximo/webclient/**")
from(project.the<SourceSetContainer>()["main"].output)
}
tasks.getByName("assemble").dependsOn("jar-web")
tasks.assemble {
finalizedBy("fixzip")
}
tasks.jar {
manifest {
attributes(
mapOf(
"Implementation-Title" to product,
"Created-By" to vendor,
"Implementation-Version" to project.version
)
)
}
exclude("io/sharptree/maximo/webclient/**")
archiveBaseName.set(product.toLowerCase())
}
dependencies {
/*
* Library used for validating host names and IP addresses.
*/
implementation("com.google.guava:guava:31.1-jre")
/*
* The javax.servlet-api is required to compile DataBean classes, but is otherwise provided by WebSphere / WebLogic.
*/
compileOnly("javax.servlet:javax.servlet-api:4.0.1")
/**
* Maximo's libraries are needed for compiling the application.
*
* asset-management - the businessobjects.jar
* webclient - classes from the maximouiweb/WEB-INF/classes folder
* tools - classes from the [SMP_HOME]/maximo/tools/maximo/classes folder
*
*
* If you are not a Sharptree developer, but have access to a Maximo instance you can zip the required into jar files and
* places them in the libs directory on this project. The comment the non-local dependencies.
*/
compileOnly(fileTree( "libs") { listOf("*.jar") })
compileOnly("com.google.code.gson:gson:2.2.4")
/**
* Semantic versioning for checking script versions.
*/
compileOnly("com.google.code.gson:gson:2.2.4")
/**
* Semantic versioning for checking script versions.
*/
implementation("com.vdurmont:semver4j:3.1.0")
}