Adapts to ts2abc for ark_standalone_build

Signed-off-by: lordwithcc <zhoucong40@huawei.com>
This commit is contained in:
lordwithcc 2022-10-28 14:26:00 +08:00
parent e33a2ffd0c
commit 6533edbf20
6 changed files with 112 additions and 8 deletions

View File

@ -197,8 +197,8 @@ def RunTest(template):
test = template[5]
test_dir = arch + "." + mode
test262_code = '''cd arkcompiler/ets_frontend
python3 test262/run_test262.py --es2021 all --timeout 180000 --libs-dir ../../out/%s/clang_x64/thirdparty/icu:../../prebuilts/clang/ohos/linux-x86_64/llvm/lib --ark-tool=../../out/%s/clang_x64/arkcompiler/ets_runtime/ark_js_vm --ark-frontend-binary=../../out/%s/clang_x64/arkcompiler/ets_frontend/es2abc --merge-abc-binary=../../out/%s/clang_x64/arkcompiler/ets_frontend/merge_abc --ark-frontend=es2panda
'''%(test_dir, test_dir, test_dir, test_dir)
python3 test262/run_test262.py --es2021 all --timeout 180000 --libs-dir ../../prebuilts/clang/ohos/linux-x86_64/llvm/lib --ark-tool=../../out/%s/clang_x64/arkcompiler/ets_runtime/ark_js_vm --ark-frontend-binary=../../out/%s/clang_x64/arkcompiler/ets_frontend/es2abc --merge-abc-binary=../../out/%s/clang_x64/arkcompiler/ets_frontend/merge_abc --ark-frontend=es2panda
'''%(test_dir, test_dir, test_dir)
if ("test262" == test):
print("=== come to test ===")
return _Call(test262_code)

View File

@ -16,7 +16,6 @@ config("complier_defaults") {
cflags = [
"-fPIC",
"-pthread",
"-fno-rtti",
]
}
}
@ -27,11 +26,7 @@ config("executable_ldconfig") {
"-Wl,-rpath=\$ORIGIN/",
"-Wl,-rpath-link=",
"-fPIE",
"-ldl",
"-lpthread",
"-lrt",
"-lc++",
"-latomic",
"-pthread",
]
}
}

View File

@ -48,5 +48,6 @@ group("ets_frontend") {
deps = [
"//arkcompiler/ets_frontend/es2panda:es2panda",
"//arkcompiler/ets_frontend/merge_abc:merge_abc",
"//arkcompiler/ets_frontend/ts2panda:ts2abc_build",
]
}

View File

@ -179,6 +179,19 @@ def _npm_install(args, code_dir, unzip_dir, unzip_filename):
if proc.returncode:
raise Exception(err.decode())
def _node_modules_copy(config, code_dir):
for config_info in config:
src_dir = os.path.join(code_dir, config_info.get('src'))
dest_dir = os.path.join(code_dir, config_info.get('dest'))
use_symlink = config_info.get('use_symlink')
if os.path.exists(os.path.dirname(dest_dir)):
shutil.rmtree(os.path.dirname(dest_dir))
if use_symlink == 'True':
os.makedirs(os.path.dirname(dest_dir))
os.symlink(src_dir, dest_dir)
else:
shutil.copytree(src_dir, dest_dir, symlinks=True)
def _file_handle(config, code_dir):
for config_info in config:
src_dir = ''.join([code_dir, config_info.get('src')])
@ -238,6 +251,7 @@ def main():
copy_config.extend(darwin_copy_config)
_hwcloud_download(args, copy_config, args.bin_dir, args.code_dir)
_file_handle(file_handle_config, args.code_dir)
_node_modules_copy(node_modules_copy_config, args.code_dir)
if __name__ == '__main__':
sys.exit(main())

View File

@ -1,5 +1,13 @@
{
"prebuilts_download_dir": "../OpenHarmony_canary_prebuilts",
"npm_install_path": ["arkcompiler/ets_frontend/ts2panda"],
"node_modules_copy": [
{
"src": "arkcompiler/ets_frontend/ts2panda/node_modules",
"dest": "prebuilts/build-tools/common/ts2abc/node_modules",
"use_symlink": "True"
}
],
"file_handle_config": [
{
"src": "/prebuilts/clang/ohos/linux-x86_64/clang_linux-x86_64-942740-20220927",
@ -25,6 +33,11 @@
"unzip_dir": "prebuilts/ark_tools",
"file_path": "/openharmony/compiler/llvm_prebuilt_libs/ark_js_prebuilts_20220923.tar.gz",
"unzip_filename": "ark_js_prebuilts"
},
{
"unzip_dir": "prebuilts/build-tools/common/nodejs",
"file_path": "/nodejs/v12.18.4/node-v12.18.4-linux-x64.tar.gz",
"unzip_filename": "node-v12.18.4-linux-x64"
}
],
"linux_copy_config": [

View File

@ -0,0 +1,81 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("$build_root/ark.gni")
config("config_static") {
cflags = [
"-std=c++17",
"-Wno-error=implicit-fallthrough",
"-Wno-deprecated-declarations",
]
visibility = [ ":*" ]
include_dirs = [ "//third_party/jsoncpp/include" ]
}
config("jsoncpp_config") {
cflags = [
"-std=c++17",
"-Wno-error=implicit-fallthrough",
"-Wno-deprecated-declarations",
]
}
config("flag_config") {
cflags_cc = [ "-fexceptions" ]
}
config("jsoncpp_public_config") {
include_dirs = [ "//third_party/jsoncpp/include/" ]
}
ohos_shared_library("jsoncpp") {
visibility = [ "*" ]
sources = [
"//third_party/jsoncpp/src/lib_json/json_reader.cpp",
"//third_party/jsoncpp/src/lib_json/json_value.cpp",
"//third_party/jsoncpp/src/lib_json/json_writer.cpp",
]
use_exceptions = true
configs = [ ":jsoncpp_config" ]
include_dirs = [
"//third_party/jsoncpp/include/json/",
"//third_party/jsoncpp/include/",
]
public_configs = [ ":jsoncpp_public_config" ]
part_name = "jsoncpp"
subsystem_name = "thirdparty"
}
ohos_static_library("jsoncpp_static") {
sources = [
"//third_party/jsoncpp/src/lib_json/json_reader.cpp",
"//third_party/jsoncpp/src/lib_json/json_value.cpp",
"//third_party/jsoncpp/src/lib_json/json_writer.cpp",
]
use_exceptions = true
configs = [ ":config_static" ]
public_configs = [ ":jsoncpp_public_config" ]
include_dirs = [
"//third_party/jsoncpp/include/json/",
"//third_party/jsoncpp/include/",
]
cflags_cc = [
"-DJSON_USE_EXCEPTION=0",
"-Wall",
"-Werror",
"-Wno-implicit-fallthrough",
]
part_name = "jsoncpp"
subsystem_name = "thirdparty"
}