@@ -39,65 +39,73 @@ task generateInterfaceNamesList() {
39
39
40
40
args str. toArray()
41
41
}
42
+ java.nio.file.Files . write(java.nio.file.Paths . get(cachedJarsFilePath), [current. toString()], utf8)
42
43
}
43
44
}
44
45
}
45
46
46
47
// won't run if node_modules are installed
47
48
task runNpmInstallForAstParser () {
49
+
50
+ // check this way so it doesn't slow down the build by snapshot-ing the node_modules
51
+ outputs. upToDateWhen {
52
+ (new File (" $astParserDir /node_modules" )). exists()
53
+ }
54
+
48
55
doFirst {
49
- if (shouldRun) {
50
- exec {
51
- workingDir astParserDir
52
-
53
- if (isWinOs) {
54
- commandLine " cmd" , " /c" , " npm" , " install"
55
- }
56
- else {
57
- commandLine " npm" , " install"
58
- }
56
+ exec {
57
+ workingDir astParserDir
58
+
59
+ if (isWinOs) {
60
+ commandLine " cmd" , " /c" , " npm" , " install"
61
+ }
62
+ else {
63
+ commandLine " npm" , " install"
59
64
}
60
65
}
61
66
}
62
67
}
63
68
64
69
// if there are new dependencies the parser will run again
65
70
task runAstParser () {
71
+ inputs. files fileTree(dir : absoluteJsCodeDir)
72
+ outputs. files(bindingsFilePath)
73
+
66
74
doFirst {
67
- if (shouldRun) {
68
- exec {
69
- workingDir astParserDir
70
-
71
- if (isWinOs) {
72
- commandLine " cmd" , " /c" , " node" , " js_parser.js" , absoluteJsCodeDir, " ../bindings.txt"
73
- }
74
- else {
75
- commandLine " node" , " js_parser.js" , absoluteJsCodeDir, " ../bindings.txt"
76
- }
75
+ exec {
76
+ workingDir astParserDir
77
+
78
+ if (isWinOs) {
79
+ commandLine " cmd" , " /c" , " node" , " js_parser.js" , absoluteJsCodeDir, " ../bindings.txt"
80
+ }
81
+ else {
82
+ commandLine " node" , " js_parser.js" , absoluteJsCodeDir, " ../bindings.txt"
77
83
}
78
84
}
79
85
}
80
86
}
81
87
// run the static binding generator
82
88
task generateBindings () {
89
+
90
+ inputs. files(bindingsFilePath)
91
+ outputs. dir(absoluteOutDir)
92
+
83
93
doFirst {
84
- if (shouldRun) {
85
- javaexec {
86
- main " -jar"
94
+ javaexec {
95
+ main " -jar"
87
96
88
- def str = new LinkedList <String > ();
89
- str. add(" staticbindinggenerator.jar" )
90
- str. add(bindingsFilePath)
91
- str. add(absoluteOutDir)
92
- str. addAll(project. jarFiles)
97
+ def str = new LinkedList <String > ();
98
+ str. add(" staticbindinggenerator.jar" )
99
+ str. add(bindingsFilePath)
100
+ str. add(absoluteOutDir)
101
+ str. addAll(project. jarFiles)
93
102
94
- args str. toArray()
95
- }
96
- java.nio.file.Files . write(java.nio.file.Paths . get(cachedJarsFilePath), [current. toString()], utf8)
103
+ args str. toArray()
97
104
}
98
105
}
99
106
}
100
107
101
108
runNpmInstallForAstParser. dependsOn(generateInterfaceNamesList)
102
109
runAstParser. dependsOn(runNpmInstallForAstParser)
103
- generateBindings. dependsOn(runAstParser)
110
+ generateBindings. dependsOn(runAstParser)
111
+
0 commit comments