-
Notifications
You must be signed in to change notification settings - Fork 14
/
build-js.gradle
58 lines (49 loc) · 1.88 KB
/
build-js.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
node {
version = '12.14.1'
download = true
// Set the work directory for unpacking node
workDir = file("${project.buildDir}/nodejs")
// Set the work directory for NPM
npmWorkDir = file("${project.buildDir}/npm")
// Set the work directory for Yarn
yarnWorkDir = file("${project.buildDir}/yarn")
}
task yarn_build(type: YarnTask, dependsOn: 'yarn_install') {
inputs.dir "${ project.projectDir }/src/main/resources/src"
outputs.dir "${ project.projectDir }/src/main/resources/static/js/build"
args = ['build']
}
task yarn_build_dev(type: YarnTask, dependsOn: 'yarn_install') {
inputs.dir "${ project.projectDir }/src/main/resources/src"
outputs.dir "${ project.projectDir }/src/main/resources/static/js/build"
args = ['build-dev']
}
task yarn_watch(type: YarnTask, dependsOn: 'yarn_install') {
inputs.dir "${ project.projectDir }/src/main/resources/src"
outputs.dir "${ project.projectDir }/src/main/resources/static/js/build"
args = ['watch']
}
task copyResources(type: Copy) {
def sourceFolder = "${ project.projectDir }/src/main/resources/static/js/build"
def destinationFolder = "${ project.buildDir }/resources/main/static/js/build"
inputs.dir sourceFolder
outputs.dir destinationFolder
from sourceFolder
into destinationFolder
}
task copyResourcesDev(type: Copy) {
def sourceFolder = "${ project.projectDir }/src/main/resources/static/js/build"
def destinationFolder = "out/production/resources/static/js/build"
inputs.dir sourceFolder
outputs.dir destinationFolder
from sourceFolder
into destinationFolder
}
task cleanResources(type: Delete) {
delete "${ project.projectDir }/src/main/resources/static/js/build"
}
processResources.dependsOn yarn_build_dev
copyResources.dependsOn yarn_build
copyResourcesDev.dependsOn yarn_build_dev
bootJar.dependsOn copyResources
clean.dependsOn cleanResources