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

32
LINES

< > BotCompany Repo | #1020142 // compileSnippetThroughServer - drop-in for CompilerBot.compileSnippet2

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (14310L/85K).

// returns (jar, transpiled src)
static Pair<File, S> compileSnippetThroughServer(S progID) {
  S transpiledSrc = getServerTranspiled2(progID);
  S md5 = md5(transpiledSrc + "\n" + progID);
  File jar = CompilerBot.getJarFile(md5);
  if (jar == null || jar.length() <= 22) {
    byte[] jarData = null;
    bool dontLoad = false;
    
    ifndef NoResourceLoader
    IResourceLoader rl = vm_getResourceLoader();
    if (rl != null) {
      set dontLoad;
      File jar2 = rl.getSnippetJar(progID, transpiledSrc);
      if (jar2 != null) ret pair(jar2, transpiledSrc); 
    }
    
    if (!dontLoad) pcall {
      jarData = loadBinaryPage(jarBotURL() + psI(progID) + "?md5=" + md5(transpiledSrc));
    }
      
    if (!isJAR(jarData)) {
      if (jarData != null) {
        print(bytesToHex(takeFirstOfByteArray(8, jarData)));
        print("fallback to CompilerBot: " + fromUtf8(takeFirstOfByteArray(80, jarData)));
      }
      ret CompilerBot.compileSnippet2(progID);
    }
    saveBinaryFile(jar, jarData);
  }
  ret pair(jar, transpiledSrc);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020142
Snippet name: compileSnippetThroughServer - drop-in for CompilerBot.compileSnippet2
Eternal ID of this version: #1020142/19
Text MD5: 18aecddf47eb937300cd678152a24ade
Transpilation MD5: 5f76bd0ae54600b2516eb01665182f59
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-09-25 22:15:10
Source code size: 1079 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 432 / 577
Version history: 18 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)