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

42
LINES

< > BotCompany Repo | #1005578 // hotwire_overInternalBot

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

Libraryless. Click here for Pure Java version (7824L/51K).

1  
static O hotwire_onCompile; // voidfunc(Pair<jarFile, transpiledSource>)
2  
sbool hotwire_serially;
3  
static Lock hotwire_overInternalBot_lock = lock();
4  
sbool hotwire_compileOnServer;
5  
6  
static Class<?> hotwire_overInternalBot(S progID) {
7  
  ret hotwire_overInternalBot(progID, "main");
8  
}
9  
10  
static Class<?> hotwire_overInternalBot(S progID, S mainClass) {
11  
  ret hotwire_overInternalBot(progID, _ -> mainClass);
12  
}
13  
14  
static Class<?> hotwire_overInternalBot(S progID, IF1<ClassLoader, S> calculateMainClass) ctex {
15  
  Pair<File, S> p;
16  
  try {
17  
    p = hotwire_compile(progID);
18  
  } catch e {
19  
    throw rethrow("Error hotwiring " + progID, e);
20  
  }
21  
  File jar = p.a;
22  
  assertTrue(jar.getAbsolutePath(), jar.isFile());
23  
  
24  
  L<File> files = hotwire_collectJars(jar);
25  
26  
  // make class loader
27  
  JavaXClassLoader classLoader = hotwire_makeClassLoader(files);
28  
  classLoader.progID = progID;
29  
  
30  
  S mainClass = calculateMainClass == null ? "main" : calculateMainClass.get(classLoader);
31  
  ret hotwire_finish(classLoader, progID, p.b, mainClass);
32  
}
33  
34  
// returns pair(jar, transpiled src)
35  
static Pair<File, S> hotwire_compile(S progID) {
36  
  Pair<File, S> p = hotwire_compileOnServer && !isLocalSnippetID(progID)
37  
    ? compileSnippetThroughServer(progID)
38  
    : CompilerBot.compileSnippet2(progID);
39  
  lock hotwire_serially ? hotwire_overInternalBot_lock : null;
40  
  callF(hotwire_onCompile, p);
41  
  ret p;
42  
}

Author comment

Began life as a copy of #1002246

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1005578
Snippet name: hotwire_overInternalBot
Eternal ID of this version: #1005578/24
Text MD5: 94b9f7e0293776a379efe28e286c2861
Transpilation MD5: d3bf1ace6b14adb6ef2831e288648bca
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-04 22:35:08
Source code size: 1412 bytes / 42 lines
Pitched / IR pitched: No / No
Views / Downloads: 756 / 1086
Version history: 23 change(s)
Referenced in: [show references]