Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions android-static-binding-generator/project/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,18 @@ def cachedJarsFilePath = "$projectDir/cached.txt"
def jsParserP = "$projectDir/parser/js_parser.js"
def jsFilesParametersP = "$projectDir/jsFilesParameters.txt"



//def absoluteOutDir = new File("./outDir")//project.outDir
def webpackWorkersExcludePath = "$projectDir/../../src/main/assets/app/__worker-chunks.json"
def webpackWorkersExcludesList = [];

def workersExcludeFile = file(webpackWorkersExcludePath);
if (workersExcludeFile.exists()) {
// in case the file exists but is malformed
try {
webpackWorkersExcludesList = new JsonSlurper().parseText(workersExcludeFile.text)
} catch (all) {
println "Malformed workers exclude file at ${webpackWorkersExcludePath}"
}
}

def absoluteOutDir;
if (project.hasProperty("outDir")) {
Expand Down Expand Up @@ -113,10 +122,9 @@ traverseDirectory = { dir, traverseExplicitly ->
}

currentDir.eachFile(FileType.FILES) { File f ->
def file = f.getAbsolutePath();
if (file.substring(file.length() - 3, file.length()).equals(".js")) {
logger.info("Task: traverseDirectory: Visiting JavaScript file: " + f.getName())
inputJsFiles.add(f.getAbsolutePath())
def currFile = f.getAbsolutePath();
if (isJsFile(currFile) && !isWorkerScript(currFile)) {
inputJsFiles.add(currFile)
}
}

Expand All @@ -125,6 +133,15 @@ traverseDirectory = { dir, traverseExplicitly ->
}
}

def isJsFile = { fileName -> return fileName.substring(fileName.length() - 3, fileName.length()).equals(".js")
}

def isWorkerScript = { fileName ->
// Read __worker-chunks.json file containing a list of webpacked workers
// ignore worker scripts, so as to not attempt to generate bindings for them
return webpackWorkersExcludesList.any{element -> file(element).getAbsolutePath() == fileName}
}

task traverseJsFilesArgs << { //(jsCodeDir, bindingsFilePath, interfaceNamesFilePath, jsParserPath, jsFilesParameter) {
jsCodeAbsolutePath = jsCodeDir;
inputJsFiles = new LinkedList<String>();
Expand Down