diff --git a/test-app/build-tools/static-binding-generator/src/main/java/org/nativescript/staticbindinggenerator/Main.java b/test-app/build-tools/static-binding-generator/src/main/java/org/nativescript/staticbindinggenerator/Main.java index 447a305e6..b0d5c2541 100644 --- a/test-app/build-tools/static-binding-generator/src/main/java/org/nativescript/staticbindinggenerator/Main.java +++ b/test-app/build-tools/static-binding-generator/src/main/java/org/nativescript/staticbindinggenerator/Main.java @@ -1,6 +1,7 @@ package org.nativescript.staticbindinggenerator; import org.apache.commons.io.FileUtils; +import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -25,6 +26,7 @@ public class Main { private static File outputDir; private static File inputDir; private static String dependenciesFile; + private static String webpackWorkersExcludePath; static { inputJsFiles = new ArrayList<>(); @@ -73,6 +75,8 @@ private static void validateInput() throws IOException { List inputFile = Generator.getRows(SBG_INPUT_FILE); inputDir = new File(inputFile.get(0).getRow()); + webpackWorkersExcludePath = Paths.get(inputDir.getAbsolutePath(), "__worker-chunks.json").toString(); + if (!inputDir.exists() || !inputDir.isDirectory()) { throw new IllegalArgumentException(String.format("Couldn't find the output dir %s or it wasn't a directory", inputDir.getAbsolutePath())); } @@ -159,7 +163,6 @@ private static void traverseDirectory(File currentDir, boolean traverseExplicitl } } - private static String webpackWorkersExcludePath = System.getProperty("user.dir") + "/app/src/main/assets/app/__worker-chunks.json"; private static List webpackWorkersExcludesList; /* @@ -172,7 +175,11 @@ private static void getWorkerExcludeFile() { if (workersExcludeFile.exists()) { try { String workersExcludeFileContent = FileUtils.readFileToString(workersExcludeFile, Charset.defaultCharset()); - webpackWorkersExcludesList = (List) new JSONObject(workersExcludeFileContent); + JSONArray jsonarray = new JSONArray(workersExcludeFileContent); + for (int i = 0; i < jsonarray.length(); i++) { + String excludeFile = (String) jsonarray.get(i); + webpackWorkersExcludesList.add(excludeFile); + } } catch (Exception e) { e.printStackTrace(); System.out.println("Malformed workers exclude file at ${webpackWorkersExcludePath}");