-
Notifications
You must be signed in to change notification settings - Fork 65
/
build.gradle
121 lines (95 loc) · 2.69 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
plugins {
id 'java'
id 'com.github.node-gradle.node' version '7.0.2'
}
node {
version = '18.20.3'
npmVersion = '10.7.0'
download = true
}
npm_run_build {
dependsOn spotlessCheck
inputs.files fileTree("src")
inputs.file 'angular.json'
inputs.file 'package.json'
inputs.file 'package-lock.json'
outputs.dir 'build'
}
npm_run_test {
inputs.files fileTree("src")
inputs.file 'angular.json'
inputs.file 'package.json'
inputs.file 'package-lock.json'
}
tasks.register('buildPages', NpmTask) {
args = ['run', 'build_pages']
inputs.files fileTree("src")
inputs.file 'angular.json'
inputs.file 'package.json'
inputs.file 'package-lock.json'
doLast {
copy {
from "./dist/springwolf-ui/asyncapi-ui.html"
into "dist/springwolf-ui"
rename("asyncapi-ui.html", "index.html")
}
}
}
jar {
dependsOn 'npm_run_build'
metaInf { from 'dist/springwolf-ui' into 'resources/springwolf' }
}
java {
withSourcesJar()
}
spotless {
encoding 'UTF-8'
def npmExec = System.getProperty('os.name').toLowerCase().contains('windows') ? '/npm.cmd' : '/bin/npm'
def nodeExec = System.getProperty('os.name').toLowerCase().contains('windows') ? '/node.exe' : '/bin/node'
format 'html', {
target 'src/**/*.html'
prettier()
.npmExecutable("${tasks.named('npmSetup').get().npmDir.get()}${npmExec}")
.nodeExecutable("${tasks.named('nodeSetup').get().nodeDir.get()}${nodeExec}")
licenseHeader("<!-- SPDX-License-Identifier: Apache-2.0 -->", "<[^!].*>")
trimTrailingWhitespace()
endWithNewline()
}
format 'json', {
target 'src/**/*.json'
prettier()
.npmExecutable("${tasks.named('npmSetup').get().npmDir.get()}${npmExec}")
.nodeExecutable("${tasks.named('nodeSetup').get().nodeDir.get()}${nodeExec}")
trimTrailingWhitespace()
endWithNewline()
}
format 'styling', {
target 'src/**/*.ts', 'src/**/*.js', 'src/**/*.css', 'src/**/*.scss'
prettier()
.npmExecutable("${tasks.named('npmSetup').get().npmDir.get()}${npmExec}")
.nodeExecutable("${tasks.named('nodeSetup').get().nodeDir.get()}${nodeExec}")
licenseHeader("/* SPDX-License-Identifier: Apache-2.0 */", "import|export|.* \\{")
trimTrailingWhitespace()
endWithNewline()
}
}
sourcesJar.dependsOn(npm_run_build)
tasks.named('spotlessStyling').configure {
it.dependsOn('nodeSetup', 'npmSetup')
}
tasks.named('spotlessHtml').configure {
it.dependsOn('nodeSetup', 'npmSetup')
}
tasks.named('spotlessJson').configure {
it.dependsOn('nodeSetup', 'npmSetup')
}
publishing {
publications {
mavenJava(MavenPublication) {
pom {
name = 'springwolf-ui'
description = 'Web UI for Springwolf'
}
}
}
}