@@ -14,9 +14,18 @@ def cachedJarsFilePath = "$projectDir/cached.txt"
14
14
def jsParserP = " $projectDir /parser/js_parser.js"
15
15
def jsFilesParametersP = " $projectDir /jsFilesParameters.txt"
16
16
17
-
18
-
19
- // def absoluteOutDir = new File("./outDir")//project.outDir
17
+ def webpackWorkersExcludePath = " $projectDir /../../src/main/assets/app/__worker-chunks.json"
18
+ def webpackWorkersExcludesList = [];
19
+
20
+ def workersExcludeFile = file(webpackWorkersExcludePath);
21
+ if (workersExcludeFile. exists()) {
22
+ // in case the file exists but is malformed
23
+ try {
24
+ webpackWorkersExcludesList = new JsonSlurper (). parseText(workersExcludeFile. text)
25
+ } catch (all) {
26
+ println " Malformed workers exclude file at ${ webpackWorkersExcludePath} "
27
+ }
28
+ }
20
29
21
30
def absoluteOutDir;
22
31
if (project. hasProperty(" outDir" )) {
@@ -113,10 +122,9 @@ traverseDirectory = { dir, traverseExplicitly ->
113
122
}
114
123
115
124
currentDir. eachFile(FileType . FILES ) { File f ->
116
- def file = f. getAbsolutePath();
117
- if (file. substring(file. length() - 3 , file. length()). equals(" .js" )) {
118
- logger. info(" Task: traverseDirectory: Visiting JavaScript file: " + f. getName())
119
- inputJsFiles. add(f. getAbsolutePath())
125
+ def currFile = f. getAbsolutePath();
126
+ if (isJsFile(currFile) && ! isWorkerScript(currFile)) {
127
+ inputJsFiles. add(currFile)
120
128
}
121
129
}
122
130
@@ -125,6 +133,15 @@ traverseDirectory = { dir, traverseExplicitly ->
125
133
}
126
134
}
127
135
136
+ def isJsFile = { fileName -> return fileName. substring(fileName. length() - 3 , fileName. length()). equals(" .js" )
137
+ }
138
+
139
+ def isWorkerScript = { fileName ->
140
+ // Read __worker-chunks.json file containing a list of webpacked workers
141
+ // ignore worker scripts, so as to not attempt to generate bindings for them
142
+ return webpackWorkersExcludesList. any{element -> file(element). getAbsolutePath() == fileName}
143
+ }
144
+
128
145
task traverseJsFilesArgs << { // (jsCodeDir, bindingsFilePath, interfaceNamesFilePath, jsParserPath, jsFilesParameter) {
129
146
jsCodeAbsolutePath = jsCodeDir;
130
147
inputJsFiles = new LinkedList<String > ();
0 commit comments