Also ,i use fork of extension. It much easy to work with not minified code in development.
@britzl is it possible to read here game.project? mb it is not hard to add game.project-> prometheus → enable = 1 flag?
@Override
public String obfuscate(String input, String path, String buildVariant) throws Exception {
if(buildVariant.equals(Bob.VARIANT_RELEASE)) {
try {
Bob.initLua();
unpackPrometheusSource();
File inputFile = writeToTempFile(input);
File outputFile = createTempFile();
// command line arguments to launch prometheus
List<String> options = new ArrayList<String>();
options.add(Bob.getExe(Platform.getHostPlatform(), "luajit-64"));
options.add(getCliPath().toString());
options.add("--config");
options.add("prometheus.lua");
options.add("--out");
options.add(outputFile.getAbsolutePath());
options.add(inputFile.getAbsolutePath());
// launch the process
ProcessBuilder pb = new ProcessBuilder(options).redirectErrorStream(true);
java.util.Map<String, String> env = pb.environment();
env.put("LUA_PATH", Bob.getPath("share/luajit/") + "/?.lua");
Process p = pb.start();
int ret = p.waitFor();
// get all of the output from the process
InputStream is = p.getInputStream();
byte[] output_bytes = new byte[is.available()];
is.read(output_bytes);
is.close();
if (ret != 0) {
System.err.println(new String(output_bytes));
throw new Exception("Unable to run prometheus, return code: " + ret);
}
return readFile(outputFile);
} catch (Exception e) {
e.printStackTrace();
throw new Exception("Unable to run prometheus, ", e);
}
}else{
return input;
}
}