[HTML5] Reorganize build script.
Simplify helper functions, fix env/sys_env confusion and depends for externs and pre-js.
This commit is contained in:
parent
33e914b1eb
commit
c327f42b0a
|
@ -27,8 +27,13 @@ if env["tools"]:
|
||||||
sys_env.AddJSLibraries(["js/libs/library_godot_editor_tools.js"])
|
sys_env.AddJSLibraries(["js/libs/library_godot_editor_tools.js"])
|
||||||
if env["javascript_eval"]:
|
if env["javascript_eval"]:
|
||||||
sys_env.AddJSLibraries(["js/libs/library_godot_eval.js"])
|
sys_env.AddJSLibraries(["js/libs/library_godot_eval.js"])
|
||||||
|
|
||||||
for lib in sys_env["JS_LIBS"]:
|
for lib in sys_env["JS_LIBS"]:
|
||||||
sys_env.Append(LINKFLAGS=["--js-library", lib])
|
sys_env.Append(LINKFLAGS=["--js-library", lib])
|
||||||
|
for js in env["JS_PRE"]:
|
||||||
|
sys_env.Append(LINKFLAGS=["--pre-js", env.File(js).path])
|
||||||
|
for ext in env["JS_EXTERNS"]:
|
||||||
|
sys_env["ENV"]["EMCC_CLOSURE_ARGS"] += " --externs " + ext.path
|
||||||
|
|
||||||
build = []
|
build = []
|
||||||
if env["gdnative_enabled"]:
|
if env["gdnative_enabled"]:
|
||||||
|
@ -66,16 +71,8 @@ else:
|
||||||
build = sys_env.Program(build_targets, javascript_files + ["javascript_runtime.cpp"])
|
build = sys_env.Program(build_targets, javascript_files + ["javascript_runtime.cpp"])
|
||||||
|
|
||||||
sys_env.Depends(build[0], sys_env["JS_LIBS"])
|
sys_env.Depends(build[0], sys_env["JS_LIBS"])
|
||||||
|
sys_env.Depends(build[0], sys_env["JS_PRE"])
|
||||||
if "JS_PRE" in env:
|
sys_env.Depends(build[0], sys_env["JS_EXTERNS"])
|
||||||
for js in env["JS_PRE"]:
|
|
||||||
env.Append(LINKFLAGS=["--pre-js", env.File(js).path])
|
|
||||||
env.Depends(build, env["JS_PRE"])
|
|
||||||
|
|
||||||
if "JS_EXTERNS" in env:
|
|
||||||
for ext in env["JS_EXTERNS"]:
|
|
||||||
env["ENV"]["EMCC_CLOSURE_ARGS"] += " --externs " + ext.path
|
|
||||||
env.Depends(build, env["JS_EXTERNS"])
|
|
||||||
|
|
||||||
engine = [
|
engine = [
|
||||||
"js/engine/preloader.js",
|
"js/engine/preloader.js",
|
||||||
|
|
|
@ -131,7 +131,10 @@ def configure(env):
|
||||||
jscc = env.Builder(generator=run_closure_compiler, suffix=".cc.js", src_suffix=".js")
|
jscc = env.Builder(generator=run_closure_compiler, suffix=".cc.js", src_suffix=".js")
|
||||||
env.Append(BUILDERS={"BuildJS": jscc})
|
env.Append(BUILDERS={"BuildJS": jscc})
|
||||||
|
|
||||||
# Add helper method for adding libraries.
|
# Add helper method for adding libraries, externs, pre-js.
|
||||||
|
env["JS_LIBS"] = []
|
||||||
|
env["JS_PRE"] = []
|
||||||
|
env["JS_EXTERNS"] = []
|
||||||
env.AddMethod(add_js_libraries, "AddJSLibraries")
|
env.AddMethod(add_js_libraries, "AddJSLibraries")
|
||||||
env.AddMethod(add_js_pre, "AddJSPre")
|
env.AddMethod(add_js_pre, "AddJSPre")
|
||||||
env.AddMethod(add_js_externs, "AddJSExterns")
|
env.AddMethod(add_js_externs, "AddJSExterns")
|
||||||
|
|
|
@ -22,18 +22,12 @@ def create_engine_file(env, target, source, externs):
|
||||||
|
|
||||||
|
|
||||||
def add_js_libraries(env, libraries):
|
def add_js_libraries(env, libraries):
|
||||||
if "JS_LIBS" not in env:
|
|
||||||
env["JS_LIBS"] = []
|
|
||||||
env.Append(JS_LIBS=env.File(libraries))
|
env.Append(JS_LIBS=env.File(libraries))
|
||||||
|
|
||||||
|
|
||||||
def add_js_pre(env, js_pre):
|
def add_js_pre(env, js_pre):
|
||||||
if "JS_PRE" not in env:
|
|
||||||
env["JS_PRE"] = []
|
|
||||||
env.Append(JS_PRE=env.File(js_pre))
|
env.Append(JS_PRE=env.File(js_pre))
|
||||||
|
|
||||||
|
|
||||||
def add_js_externs(env, externs):
|
def add_js_externs(env, externs):
|
||||||
if "JS_EXTERNS" not in env:
|
|
||||||
env["JS_EXTERNS"] = []
|
|
||||||
env.Append(JS_EXTERNS=env.File(externs))
|
env.Append(JS_EXTERNS=env.File(externs))
|
||||||
|
|
Loading…
Reference in New Issue