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).

1  
// returns (jar, transpiled src)
2  
static Pair<File, S> compileSnippetThroughServer(S progID) {
3  
  S transpiledSrc = getServerTranspiled2(progID);
4  
  S md5 = md5(transpiledSrc + "\n" + progID);
5  
  File jar = CompilerBot.getJarFile(md5);
6  
  if (jar == null || jar.length() <= 22) {
7  
    byte[] jarData = null;
8  
    bool dontLoad = false;
9  
    
10  
    ifndef NoResourceLoader
11  
    IResourceLoader rl = vm_getResourceLoader();
12  
    if (rl != null) {
13  
      set dontLoad;
14  
      File jar2 = rl.getSnippetJar(progID, transpiledSrc);
15  
      if (jar2 != null) ret pair(jar2, transpiledSrc); 
16  
    }
17  
    
18  
    if (!dontLoad) pcall {
19  
      jarData = loadBinaryPage(jarBotURL() + psI(progID) + "?md5=" + md5(transpiledSrc));
20  
    }
21  
      
22  
    if (!isJAR(jarData)) {
23  
      if (jarData != null) {
24  
        print(bytesToHex(takeFirstOfByteArray(8, jarData)));
25  
        print("fallback to CompilerBot: " + fromUtf8(takeFirstOfByteArray(80, jarData)));
26  
      }
27  
      ret CompilerBot.compileSnippet2(progID);
28  
    }
29  
    saveBinaryFile(jar, jarData);
30  
  }
31  
  ret pair(jar, transpiledSrc);
32  
}

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: 433 / 578
Version history: 18 change(s)
Referenced in: [show references]