support gn build for third/parse5.

Signed-off-by: lihong <lihong67@huawei.com>
Change-Id: I39af0a8f7e4923b6d27d4e63d6c561c1e1cbd2f1
This commit is contained in:
lihong 2023-12-19 15:11:10 +08:00
parent 03858120e3
commit 612b6ebf0c
3 changed files with 3 additions and 30 deletions

View File

@ -27,8 +27,6 @@ action("build_ace_loader_library") {
_module_source_js = _ace_loader_dir + "/module-source.js" _module_source_js = _ace_loader_dir + "/module-source.js"
_parse5_project_dir = "//third_party/parse5/packages/parse5"
if (is_standard_system) { if (is_standard_system) {
_ace_config_dir = "ace-loader" _ace_config_dir = "ace-loader"
} else { } else {
@ -37,12 +35,10 @@ action("build_ace_loader_library") {
_babel_js = _ace_config_dir + "/node_modules/@babel/cli/bin/babel.js" _babel_js = _ace_config_dir + "/node_modules/@babel/cli/bin/babel.js"
_babel_config_js = _ace_config_dir + "/babel.config.js" _babel_config_js = _ace_config_dir + "/babel.config.js"
_uglify_source_js = _ace_config_dir + "/uglify-source.js" _uglify_source_js = _ace_config_dir + "/uglify-source.js"
_tsc_js = _parse5_project_dir + "/node_modules/typescript/bin/tsc"
inputs = [ inputs = [
_babel_config_js, _babel_config_js,
_babel_js, _babel_js,
_tsc_js,
_module_source_js, _module_source_js,
_uglify_source_js, _uglify_source_js,
] ]
@ -60,12 +56,6 @@ action("build_ace_loader_library") {
rebase_path(_ace_loader_dir + "/src", root_build_dir), rebase_path(_ace_loader_dir + "/src", root_build_dir),
"--babel-config-js", "--babel-config-js",
rebase_path(_babel_config_js, root_build_dir), rebase_path(_babel_config_js, root_build_dir),
"--tsc-js",
rebase_path(_tsc_js, root_build_dir),
"--parse5-project",
rebase_path(_parse5_project_dir, root_build_dir),
"--parse5-output-dir",
rebase_path(_parse5_project_dir + "/dist/cjs", root_build_dir),
"--module-source-js", "--module-source-js",
rebase_path(_module_source_js, root_build_dir), rebase_path(_module_source_js, root_build_dir),
"--uglify-source-js", "--uglify-source-js",
@ -94,7 +84,6 @@ ohos_copy("ace_loader") {
outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ] outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ]
module_source_dir = target_out_dir + "/$target_name/" module_source_dir = target_out_dir + "/$target_name/"
module_install_name = "" module_install_name = ""
license_file = "//third_party/parse5/LICENSE"
} }
ohos_copy("ace_loader_library") { ohos_copy("ace_loader_library") {
@ -103,7 +92,6 @@ ohos_copy("ace_loader_library") {
outputs = [ target_out_dir + "/$target_name" ] outputs = [ target_out_dir + "/$target_name" ]
module_source_dir = target_out_dir + "/$target_name" module_source_dir = target_out_dir + "/$target_name"
module_install_name = "" module_install_name = ""
license_file = "//third_party/weex-loader/NOTICE"
} }
# copy previewer # copy previewer
@ -139,5 +127,4 @@ ohos_copy("ace_loader_ark_hap") {
] ]
sources = [ ace_loader_lib_dir ] sources = [ ace_loader_lib_dir ]
outputs = [ ace_loader_ark_dir + "/lib" ] outputs = [ ace_loader_ark_dir + "/lib" ]
license_file = "//third_party/parse5/LICENSE"
} }

View File

@ -70,4 +70,3 @@ copyResource(path.resolve(__dirname, './plugin/theme'), process.argv[2] + '/them
copyResource(path.resolve(__dirname, './plugin/codegen'), process.argv[2] + '/codegen'); 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-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/weex-loader/deps/weex-styler'), process.argv[2] + '/styler');
copyResource(path.resolve(__dirname, './third_party/parse5/packages/parse5/dist/cjs'), process.argv[2] + '/parse');

View File

@ -40,9 +40,6 @@ def parse_args():
parser.add_argument('--babel-js', help='path to babel.js') parser.add_argument('--babel-js', help='path to babel.js')
parser.add_argument('--ace-loader-src-dir', help='path to ace-loader/src') parser.add_argument('--ace-loader-src-dir', help='path to ace-loader/src')
parser.add_argument('--babel-config-js', help='path babel.config.js') parser.add_argument('--babel-config-js', help='path babel.config.js')
parser.add_argument('--tsc-js', help='path to parse5 module tsc')
parser.add_argument('--parse5-project', help='path to parse5 project')
parser.add_argument('--parse5-output-dir', help='path to parse5 output')
parser.add_argument('--module-source-js', help='path module-source.js') parser.add_argument('--module-source-js', help='path module-source.js')
parser.add_argument('--uglify-source-js', help='path uglify-source.js') parser.add_argument('--uglify-source-js', help='path uglify-source.js')
parser.add_argument('--output-dir', help='path to output') parser.add_argument('--output-dir', help='path to output')
@ -51,8 +48,8 @@ def parse_args():
return options return options
def do_build(build_cmd, buildparse5_cmd, copy_cmd, uglify_cmd): def do_build(build_cmd, copy_cmd, uglify_cmd):
for cmd in [build_cmd, buildparse5_cmd, copy_cmd, uglify_cmd]: for cmd in [build_cmd, copy_cmd, uglify_cmd]:
build_utils.check_output(cmd) build_utils.check_output(cmd)
@ -66,16 +63,6 @@ def main():
depfile_deps = [options.node, options.babel_js, options.babel_config_js] depfile_deps = [options.node, options.babel_js, options.babel_config_js]
depfile_deps.extend(build_utils.get_all_files(options.ace_loader_src_dir)) depfile_deps.extend(build_utils.get_all_files(options.ace_loader_src_dir))
buildparse5_cmd = [
options.node, options.tsc_js
]
buildparse5_cmd.extend(['--project', options.parse5_project])
buildparse5_cmd.extend(['--outDir', options.parse5_output_dir])
buildparse5_cmd.extend(['--module', 'CommonJS'])
buildparse5_cmd.extend(['--target', 'ES6'])
depfile_deps.append(options.tsc_js)
depfile_deps.extend(build_utils.get_all_files(options.parse5_project))
copy_cmd = [options.node, options.module_source_js, options.output_dir] copy_cmd = [options.node, options.module_source_js, options.output_dir]
depfile_deps.append(options.module_source_js) depfile_deps.append(options.module_source_js)
@ -83,7 +70,7 @@ def main():
depfile_deps.append(options.uglify_source_js) depfile_deps.append(options.uglify_source_js)
build_utils.call_and_write_depfile_if_stale( build_utils.call_and_write_depfile_if_stale(
lambda: do_build(build_cmd, buildparse5_cmd, copy_cmd, uglify_cmd), lambda: do_build(build_cmd, copy_cmd, uglify_cmd),
options, options,
depfile_deps=depfile_deps, depfile_deps=depfile_deps,
input_paths=depfile_deps, input_paths=depfile_deps,