diff --git a/BUILD.gn b/BUILD.gn index 98b23e9..29a23c4 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -8,18 +8,23 @@ ace_loader_lib_dir = get_label_info(":build_ace_loader_library", "target_out_dir") + "/lib" action("build_ace_loader_library") { - script = "//developtools/ace-js2bundle/build_ace_loader_library.py" + script = "build_ace_loader_library.py" depfile = "$target_gen_dir/$target_name.d" outputs = [ ace_loader_lib_dir ] - _ace_loader_dir = "//developtools/ace-js2bundle/ace-loader" + _ace_loader_dir = "ace-loader" _module_source_js = _ace_loader_dir + "/module-source.js" - - _babel_js = _ace_loader_dir + "/node_modules/@babel/cli/bin/babel.js" _babel_config_js = _ace_loader_dir + "/babel.config.js" _uglify_source_js = _ace_loader_dir + "/uglify-source.js" + if (is_standard_system) { + _ace_config_dir = "ace-loader" + } else { + _ace_config_dir = "//prebuilts/ace-toolkit/ace-loader/linux-x64" + } + _babel_js = _ace_config_dir + "/node_modules/@babel/cli/bin/babel.js" + inputs = [ _babel_config_js, _babel_js, @@ -29,10 +34,17 @@ action("build_ace_loader_library") { # different host platform nodejs tool directory if (host_os == "linux") { - nodejs_path = - "//prebuilts/build-tools/common/nodejs/node-v12.18.4-linux-x64/bin/node" + if (is_standard_system) { + nodejs_path = "//prebuilts/build-tools/common/nodejs/node-v12.18.4-linux-x64/bin/node" + } else { + nodejs_path = "//prebuilts/ace-toolkit/nodejs/node-v12.18.4-linux-x64/bin/node" + } } else if (host_os == "mac") { - nodejs_path = "//prebuilts/build-tools/common/nodejs/node-v12.18.4-darwin-x64/bin/node" + if (is_standard_system) { + nodejs_path = "//prebuilts/build-tools/common/nodejs/node-v12.18.4-darwin-x64/bin/node" + } else { + nodejs_path = "//prebuilts/ace-toolkit/nodejs/node-v12.18.4-darwin-x64/bin/node" + } } else { assert(false, "Unsupported host_os: $host_os") } diff --git a/ace-loader/module-source.js b/ace-loader/module-source.js index 02a17a3..05644ed 100644 --- a/ace-loader/module-source.js +++ b/ace-loader/module-source.js @@ -68,6 +68,6 @@ function copyResource(src, dist) { copyResource(path.resolve(__dirname, './plugin/templater'), process.argv[2] + '/templater'); copyResource(path.resolve(__dirname, './plugin/theme'), process.argv[2] + '/theme'); copyResource(path.resolve(__dirname, './plugin/codegen'), process.argv[2] + '/codegen'); -copyResource(path.resolve(__dirname, '../../../third_party/weex-loader/deps/weex-scripter'), process.argv[2] + '/scripter'); -copyResource(path.resolve(__dirname, '../../../third_party/weex-loader/deps/weex-styler'), process.argv[2] + '/styler'); -copyResource(path.resolve(__dirname, '../../../third_party/parse5/packages/parse5/lib'), process.argv[2] + '/parse'); +copyResource(path.resolve(__dirname, './third_party/weex-loader/deps/weex-scripter'), process.argv[2] + '/scripter'); +copyResource(path.resolve(__dirname, './third_party/weex-loader/deps/weex-styler'), process.argv[2] + '/styler'); +copyResource(path.resolve(__dirname, './third_party/parse5/packages/parse5/lib'), process.argv[2] + '/parse'); diff --git a/ace-loader/third_party/parse5 b/ace-loader/third_party/parse5 new file mode 120000 index 0000000..279d4f2 --- /dev/null +++ b/ace-loader/third_party/parse5 @@ -0,0 +1 @@ +../../../../third_party/parse5/ \ No newline at end of file diff --git a/build_ace_loader_library.py b/build_ace_loader_library.py index d04e374..7b249d8 100755 --- a/build_ace_loader_library.py +++ b/build_ace_loader_library.py @@ -18,9 +18,15 @@ import sys import subprocess import argparse -sys.path.append( - os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, 'build')) -from scripts.util import build_utils # noqa: E402 +standard_system_build_dir = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, 'build') +build_dir = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, + os.pardir, os.pardir, os.pardir, 'build') +if os.path.exists(standard_system_build_dir): + sys.path.append(standard_system_build_dir) + from scripts.util import build_utils # noqa: E402 +if os.path.exists(build_dir): + sys.path.append(build_dir) + from maple.java.util import build_utils # noqa: E402 def parse_args():