1
+ /**
2
+ * Copyright 2023 Sven Loesekann
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
12
+ */
13
+ plugins {
14
+ id ' java'
15
+ }
16
+
17
+ group = ' ch.xxx'
18
+ version = ' 0.0.1-SNAPSHOT'
19
+
20
+ task cleanAngular {
21
+ if (project. hasProperty(' withAngular' )) {
22
+ logger. info(' Task cleanAngular' )
23
+ delete(' src/angular/node_modules' )
24
+ }
25
+ }
26
+
27
+ task buildAngular {
28
+ if (project. hasProperty(' withAngular' )) {
29
+ exec {
30
+ logger. info(' Task buildAngular - npm install' )
31
+ workingDir ' src/angular'
32
+ if (System . getProperty(" os.name" ). toUpperCase(). contains(" WINDOWS" )){
33
+ commandLine(' npm.cmd' , ' install' )
34
+ } else {
35
+ commandLine(' npm' , ' install' )
36
+ }
37
+ }
38
+ exec {
39
+ logger. info(' Task buildAngular - npm run build' )
40
+ workingDir ' src/angular'
41
+ if (System . getProperty(" os.name" ). toUpperCase(). contains(" WINDOWS" )){
42
+ commandLine(' npm.cmd' , ' run' , ' build' )
43
+ } else {
44
+ commandLine(' npm' , ' run' , ' build' )
45
+ }
46
+ }
47
+ }
48
+ }
49
+
50
+ task testAngular {
51
+ if (project. hasProperty(' withAngular' )) {
52
+ exec {
53
+ workingDir ' src/angular'
54
+ if (System . getProperty(" os.name" ). toUpperCase(). contains(" WINDOWS" )){
55
+ logger. info(' Task buildAngular - npm run test' )
56
+ commandLine(' npm.cmd' , ' run' , ' test' )
57
+ } else {
58
+ if (project. hasProperty(" useChromium" )) {
59
+ logger. info(' Task buildAngular - npm run test-chromium' )
60
+ commandLine(' npm' , ' run' , ' test-chromium' )
61
+ } else {
62
+ logger. info(' Task buildAngular - npm run test' )
63
+ commandLine(' npm' , ' run' , ' test' )
64
+ }
65
+ }
66
+ }
67
+ }
68
+ }
0 commit comments