diff --git a/BUILD.gn b/BUILD.gn index 98b23e912d3c98a674191cc25ecab4cd4ed61ede..a416f8c4d80a24152f74a285dc4124db125e245f 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -8,17 +8,22 @@ 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" + _babel_config_js = _ace_config_dir + "/babel.config.js" + _uglify_source_js = _ace_config_dir + "/uglify-source.js" inputs = [ _babel_config_js, @@ -29,10 +34,19 @@ 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 02a17a30c4d44f0cb6e38a127cb1d8ffb6838143..05644ed56fffbbda833a1174c75c0678c5468f4b 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 0000000000000000000000000000000000000000..279d4f278a73bbd4c554b1bbd203bc541460029c --- /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 d04e3746165fd61ad9ed44c25557be1c74a0c8cb..d43ca0051914e60350957c957a5e160de5524bfd 100755 --- a/build_ace_loader_library.py +++ b/build_ace_loader_library.py @@ -18,9 +18,16 @@ 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():