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
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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<>();
Expand Down Expand Up @@ -73,6 +75,8 @@ private static void validateInput() throws IOException {

List<DataRow> 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()));
}
Expand Down Expand Up @@ -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<String> webpackWorkersExcludesList;

/*
Expand All @@ -172,7 +175,11 @@ private static void getWorkerExcludeFile() {
if (workersExcludeFile.exists()) {
try {
String workersExcludeFileContent = FileUtils.readFileToString(workersExcludeFile, Charset.defaultCharset());
webpackWorkersExcludesList = (List<String>) 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}");
Expand Down