scaffolding for compiling typescript with cli
This commit is contained in:
parent
cafc5f25c8
commit
64ca5e186f
@ -1879,12 +1879,11 @@ Floating world origin
|
||||
- Separately simulated regions of physics that dynamically merge/unmerge based on chunk loading
|
||||
|
||||
Bug Fixes
|
||||
- Fix characters stored in db not saving items because the items aren't being stored to db
|
||||
- Fix hitbox placement does not scale with entity scale on server
|
||||
- Calculate bounding sphere for meshes by deforming vertices with bone default pose instead of no bone deform
|
||||
- Fix light cluster mapping for foliage shader
|
||||
- Fix flickering when applying yoga signal (may need to rethink arch here)
|
||||
- Fix virtual scrollables not working
|
||||
- Fix particles not placing correctly on spawning
|
||||
|
||||
Startup Performance
|
||||
- Allow texture map to bind multiple model paths to a single set of mesh->textures
|
||||
|
||||
@ -247,7 +247,7 @@ public class ScriptContext {
|
||||
/**
|
||||
* Compiles the project
|
||||
*/
|
||||
protected void compile(){
|
||||
protected void compileInContext(){
|
||||
ScriptFileChecksumMap checksumMap = this.parent.getChecksumMap();
|
||||
//actually compile
|
||||
this.invokeMemberFunction("COMPILER", "run");
|
||||
@ -286,6 +286,54 @@ public class ScriptContext {
|
||||
this.parent.writeChecksumMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* Compiles the project
|
||||
*/
|
||||
protected void compileOutsideContext(){
|
||||
ScriptFileChecksumMap checksumMap = this.parent.getChecksumMap();
|
||||
//actually compile
|
||||
this.invokeMemberFunction("COMPILER", "run");
|
||||
try {
|
||||
Process process = Runtime.getRuntime().exec("tsc");
|
||||
process.wait();
|
||||
} catch (IOException | InterruptedException e) {
|
||||
throw new Error("Failed to execute typescript!", e);
|
||||
}
|
||||
Value fileMap = this.topLevelValue.getMember("COMPILER").getMember("fileMap");
|
||||
//register new files, update cache where appropriate
|
||||
for(String key : fileMap.getMemberKeys()){
|
||||
Value fileData = fileMap.getMember(key);
|
||||
String content = fileData.getMember("content").asString();
|
||||
String cacheFilePath = ScriptEngine.TS_SOURCE_CACHE_DIR + key;
|
||||
File toWriteFile = new File(cacheFilePath);
|
||||
|
||||
//make sure all containing folders exist
|
||||
try {
|
||||
Files.createDirectories(toWriteFile.getParentFile().toPath());
|
||||
} catch (IOException e) {
|
||||
LoggerInterface.loggerFileIO.ERROR(e);
|
||||
}
|
||||
|
||||
//update cached timestamp
|
||||
{
|
||||
String pathRaw = toWriteFile.toPath() + "";
|
||||
pathRaw = pathRaw.replace(".\\.cache\\tscache\\src\\", "./assets/");
|
||||
File correspondingFile = new File(pathRaw.replace(".\\.cache\\tscache\\src\\", "./assets/"));
|
||||
String cacheKey = pathRaw.replace("./assets", "").replace("\\", "/");
|
||||
checksumMap.getFileLastModifyMap().put(cacheKey, correspondingFile.lastModified() + "");
|
||||
}
|
||||
|
||||
//write the actual file
|
||||
try {
|
||||
Files.writeString(toWriteFile.toPath(), content);
|
||||
} catch (IOException e) {
|
||||
LoggerInterface.loggerFileIO.ERROR(e);
|
||||
}
|
||||
}
|
||||
//write out cache map file
|
||||
this.parent.writeChecksumMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* Recompiles the scripting engine
|
||||
*/
|
||||
|
||||
@ -178,7 +178,7 @@ public class ScriptEngine extends SignalServiceImpl {
|
||||
|
||||
//compile
|
||||
if(!readCache){
|
||||
scriptContext.compile();
|
||||
scriptContext.compileInContext();
|
||||
}
|
||||
|
||||
//post init logic
|
||||
|
||||
Loading…
Reference in New Issue
Block a user