diff --git a/BUILD.gn b/BUILD.gn index 1a43576f782e691a196d29846bba3a3cd1003074..7b2edc5b515349c9947fce26f36f9a7180384a9b 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1,29 +1,44 @@ -/* - * Copyright (c) 2024 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. - */ +# Copyright (c) 2024 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/config/clang/clang.gni") import("//build/ohos.gni") import("jsvm.gni") +action("copy_v8") { + external_deps = [] + deps = [] + script = "copy_v8.sh" + sources = [] + outputs = [ + "$target_gen_dir/libv8_shared.so", + "$target_gen_dir/v8-include", + ] + args = [ + "--target_gen_dir", + rebase_path("$target_gen_dir"), + ] +} + config("libv8_config") { include_dirs = - [ "//vendor/huawei/binary/artifacts/js_engine_url/v8-include/v8-include" ] + [ "$target_gen_dir/v8-include" ] } ohos_prebuilt_shared_library("libv8") { - source = "//vendor/huawei/binary/artifacts/js_engine_url/libv8_shared.so" + deps = [ ":copy_v8" ] + source = "$target_gen_dir/libv8_shared.so" output = "libv8_shared.so" public_configs = [ ":libv8_config" ] diff --git a/bundle.json b/bundle.json index 86bb2db2d6e9354c6246aff6dfe6e69d98ecf2ad..7468cc8461a29dc99ee32e68381fb771639563f6 100644 --- a/bundle.json +++ b/bundle.json @@ -31,26 +31,28 @@ "icu", "init", "libuv", - "resource_schedule_service" + "openssl", + "resource_schedule_service", + "zlib" ] }, "build": { "sub_component": [ - "//arkcompiler/jsvm_longque:jsvm_package" + "//arkcompiler/jsvm_longque:jsvm_packages" ], "inner_kits": [ { "header": { - "header_base": "//arkcompiler/jsvm_longque/interfaces/kits", + "header_base": "//arkcompiler/jsvm_longque/interface/kits", "header_files": [ "jsvm_types.h", "jsvm.h" ] }, - "name": "//arkcompiler/jsvm_longque:jsvm_package" + "name": "//arkcompiler/jsvm_longque:jsvm_packages" } ], "test": [] } } -} \ No newline at end of file +} diff --git a/copy_v8.sh b/copy_v8.sh new file mode 100755 index 0000000000000000000000000000000000000000..7f5d18a7cee42b4088c6df61cc00383417e67fb2 --- /dev/null +++ b/copy_v8.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# Copyright (c) 2024 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. + +export SCRIPT_PATCH=$(dirname $(readlink -f "$0")) +export TARGET_GEN_DIR=$2 + +cp -u ${SCRIPT_PATCH}/../../third_party/node/deps/v8/libv8_shared.so ${TARGET_GEN_DIR}/libv8_shared.so +cp -r ${SCRIPT_PATCH}/../../third_party/node/deps/v8/include/v8-include ${TARGET_GEN_DIR}/v8-include + diff --git a/jsvm.gni b/jsvm.gni index c84d32c9c312c05bb348860590e67f5363c3e10b..e70e4beb9a8afc03b6b3324dcf57dd9644ed1500 100644 --- a/jsvm.gni +++ b/jsvm.gni @@ -1,17 +1,15 @@ -/* - * Copyright (c) 2024 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. - */ +# Copyright (c) 2024 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. jsvm_path = "//arkcompiler/jsvm_longque" diff --git a/src/js_native_api_v8.cpp b/src/js_native_api_v8.cpp index 1f9bb79ef8e6c8142dafef230d0c97c9fef81fb6..d014cbe7e22056985dae98c083cec601b6d2f231 100644 --- a/src/js_native_api_v8.cpp +++ b/src/js_native_api_v8.cpp @@ -5550,7 +5550,7 @@ JSVM_Status OH_JSVM_DefineClassWithOptions(JSVM_Env env, if ((p->attributes & JSVM_STATIC) != 0) { // attributes // Static properties are handled separately below. - static_property_count++; + staticPropertyCount++; continue; } v8::Local propertyName; @@ -5609,7 +5609,7 @@ JSVM_Status OH_JSVM_DefineClassWithOptions(JSVM_Env env, if (staticPropertyCount > 0) { std::vector static_descriptors; - static_descriptors.reserve(static_property_count); + static_descriptors.reserve(staticPropertyCount); for (size_t i = 0; i < propertyCount; i++) { const JSVM_PropertyDescriptor* p = properties + i; diff --git a/src/js_native_api_v8.h b/src/js_native_api_v8.h index 7bcb45b6bae3590e20401d2b626723575d1bc21e..0c30c8bd5d61cf440b022e249189ecaba4b6f8cb 100644 --- a/src/js_native_api_v8.h +++ b/src/js_native_api_v8.h @@ -232,7 +232,7 @@ struct JSVM_PropertyHandlerCfgStruct { JSVM_Ref indexedPropertyData; }; -JSVM_PropertyHandlerCfgStruct* CreatePropertyCfg(JSVM_Env env, JSVM_PropertyHandlerCfg propertyCfg) +inline JSVM_PropertyHandlerCfgStruct* CreatePropertyCfg(JSVM_Env env, JSVM_PropertyHandlerCfg propertyCfg) { JSVM_PropertyHandlerCfgStruct* newPropertyCfg = new JSVM_PropertyHandlerCfgStruct; if (newPropertyCfg != nullptr && propertyCfg != nullptr) {