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)

1  
sbool javaxToDex_verbose;
2  
3  
// src = JavaX source without the "!752" on top
4  
static void javaxToDex(S src, File dexFile) {
5  
  if (javaxToDex_verbose) print("Downloading libraries");
6  
  File dxJar = loadLibrary("#1004106"); // 1 MB
7  
  File supportJar = loadLibrary("#1004107"); // 1 MB
8  
  File androidJar = loadLibrary("#1004108"); // Huge (26 MB)
9  
  
10  
  S libs = "lib 1004106\n" + "lib 1004107\n " + "lib 1004108\n";
11  
  src = libs + src;
12  
  if (javaxToDex_verbose) print("\n" + indent(libs + src) + "\n");
13  
  
14  
  if (javaxToDex_verbose) print("Transpiling & compiling");
15  
  File classesDir = javaxToClasses(libs + src);
16  
  
17  
  if (javaxToDex_verbose) print("Making dex");
18  
  S cmd = "java -jar " + bashQuote(dxJar)
19  
    + " --dex --output=" + bashQuote(dexFile) 
20  
    + " " + bashQuote(classesDir + "/") 
21  
    + " 2>&1";
22  
  if (javaxToDex_verbose) print(cmd);
23  
  S output = backtick(cmd);
24  
  if (javaxToDex_verbose) print(output);
25  
  if (javaxToDex_verbose) print();
26  
    
27  
  if (!dexFile.exists())
28  
    fail("Crazy! No dex made.\n" + output);
29  
30  
  if (javaxToDex_verbose) print("Dex made! " + dexFile.getAbsolutePath() + " (" + dexFile.length() + " bytes)");
31  
}

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: 504 / 506
Referenced in: [show references]