Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

31
LINES

< > BotCompany Repo | #1004115 // javaxToDex - produce a .dex file locally

JavaX fragment (include)

sbool javaxToDex_verbose;

// src = JavaX source without the "!752" on top
static void javaxToDex(S src, File dexFile) {
  if (javaxToDex_verbose) print("Downloading libraries");
  File dxJar = loadLibrary("#1004106"); // 1 MB
  File supportJar = loadLibrary("#1004107"); // 1 MB
  File androidJar = loadLibrary("#1004108"); // Huge (26 MB)
  
  S libs = "lib 1004106\n" + "lib 1004107\n " + "lib 1004108\n";
  src = libs + src;
  if (javaxToDex_verbose) print("\n" + indent(libs + src) + "\n");
  
  if (javaxToDex_verbose) print("Transpiling & compiling");
  File classesDir = javaxToClasses(libs + src);
  
  if (javaxToDex_verbose) print("Making dex");
  S cmd = "java -jar " + bashQuote(dxJar)
    + " --dex --output=" + bashQuote(dexFile) 
    + " " + bashQuote(classesDir + "/") 
    + " 2>&1";
  if (javaxToDex_verbose) print(cmd);
  S output = backtick(cmd);
  if (javaxToDex_verbose) print(output);
  if (javaxToDex_verbose) print();
    
  if (!dexFile.exists())
    fail("Crazy! No dex made.\n" + output);

  if (javaxToDex_verbose) print("Dex made! " + dexFile.getAbsolutePath() + " (" + dexFile.length() + " bytes)");
}

Author comment

Began life as a copy of #1004109

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1004115
Snippet name: javaxToDex - produce a .dex file locally
Eternal ID of this version: #1004115/1
Text MD5: 38f3429770d432a071e79f3a98ad5c8b
Author: stefan
Category: javax / compiling
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-08-07 18:20:19
Source code size: 1165 bytes / 31 lines
Pitched / IR pitched: No / No
Views / Downloads: 554 / 563
Referenced in: [show references]