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

39
LINES

< > BotCompany Repo | #1001150 // Compiler Bot (loves to compile)

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (862L/7K/22K).

!747

m {
  p {
    makeAndroid("Compiler bot!");
  }
  
  static synchronized S answer(S s) {
    new Matches m;
    if (match3("Please compile this JavaX snippet: *", s, m)) {
      S snippetID = unquote(m.m[0]);
      S transpiledSrc = getServerTranspiled(snippetID);
      int i = transpiledSrc.indexOf('\n');
      String libs = transpiledSrc.substring(0, Math.max(0, i));
      transpiledSrc = transpiledSrc.substring(i+1);
      return compile(transpiledSrc);
    }
    
    if (match3("Please compile this Java text: *", s, m)) {
      String src = unquote(m.m[0]);
      return compile(src);
    }
    return null;
  }
  
  static S compile(S src) {
    Class j = getJavaX();
    File srcDir = cast call(j, "TempDirMaker_make");
    saveTextFile(new File(srcDir, "main.java"), src);
    File classesDir = cast call(j, "TempDirMaker_make");
    new L<File> libraries;
    try {
      call(j, "compileJava", srcDir, libraries, classesDir);
    } catch (Exception e) {
      return "Compile Error. " + getOpt(j, "javaCompilerOutput");
    }
    return "ok, " + quote(classesDir.getAbsolutePath());
  }
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1001150
Snippet name: Compiler Bot (loves to compile)
Eternal ID of this version: #1001150/1
Text MD5: e5f6adf4584592c2d1be9b7e4766fa00
Transpilation MD5: 59df4c20e3ed318dc0ac239cc88f6a71
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-09-24 20:56:30
Source code size: 1147 bytes / 39 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 541 / 584
Referenced in: [show references]