mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2024-11-23 07:10:19 +00:00
Desc:解耦simulator,将jsmock的js打入动态库 Signed-off-by: jiangzhijun8 <jiangzhijun7@huawei.com>
This commit is contained in:
parent
2efb809492
commit
265b46dd67
@ -88,6 +88,7 @@
|
||||
"os_account",
|
||||
"power_manager",
|
||||
"preferences",
|
||||
"previewer",
|
||||
"qos_manager",
|
||||
"relational_store",
|
||||
"resource_management",
|
||||
|
@ -11,35 +11,10 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//build/config/components/ets_frontend/es2abc_config.gni")
|
||||
import("//build/ohos.gni")
|
||||
import("//foundation/ability/ability_runtime/ability_runtime.gni")
|
||||
import("//foundation/arkui/ace_engine/build/ace_gen_obj.gni")
|
||||
|
||||
es2abc_gen_abc("gen_abc_js_mock") {
|
||||
js_mock_path =
|
||||
get_label_info("${previewer_path}/automock:gen_snapshot_jsmock",
|
||||
"target_out_dir") + "/dist/jsMockSystemPlugin.js"
|
||||
src_js = rebase_path(js_mock_path)
|
||||
dst_file = rebase_path(target_out_dir + "/jsMockSystemPlugin.abc")
|
||||
in_puts = [ js_mock_path ]
|
||||
out_puts = [ target_out_dir + "/jsMockSystemPlugin.abc" ]
|
||||
extra_dependencies = [ "${previewer_path}/automock:gen_snapshot_jsmock" ]
|
||||
}
|
||||
|
||||
gen_obj("js_mock_abc") {
|
||||
input = get_label_info(":gen_abc_js_mock", "target_out_dir") +
|
||||
"/jsMockSystemPlugin.abc"
|
||||
|
||||
if (is_mac || is_mingw) {
|
||||
output = target_out_dir + "/js_mock_abc.c"
|
||||
} else {
|
||||
output = target_out_dir + "/js_mock_abc.o"
|
||||
}
|
||||
|
||||
snapshot_dep = [ ":gen_abc_js_mock" ]
|
||||
}
|
||||
|
||||
config("ability_simulator_public_config") {
|
||||
include_dirs = [ "include" ]
|
||||
cflags_cc = [ "-Wno-unused-variable" ]
|
||||
@ -104,8 +79,6 @@ ohos_shared_library("ability_simulator_inner") {
|
||||
|
||||
configs = [ "${windowmanager_path}/previewer:previewer_window_config" ]
|
||||
|
||||
deps = [ ":gen_obj_src_js_mock_abc" ]
|
||||
|
||||
external_deps = [
|
||||
"ability_base:string_utils",
|
||||
"ets_runtime:libark_jsruntime",
|
||||
@ -115,6 +88,7 @@ ohos_shared_library("ability_simulator_inner") {
|
||||
"json:nlohmann_json_static",
|
||||
"jsoncpp:jsoncpp_static",
|
||||
"napi:ace_napi",
|
||||
"previewer:ide_extension",
|
||||
]
|
||||
|
||||
if (ability_runtime_graphics) {
|
||||
|
@ -38,14 +38,13 @@
|
||||
#include "js_timer.h"
|
||||
#include "js_window_stage.h"
|
||||
#include "json_serializer.h"
|
||||
#include "JsMockUtil.h"
|
||||
#include "launch_param.h"
|
||||
#include "native_engine/impl/ark/ark_native_engine.h"
|
||||
#include "resource_manager.h"
|
||||
#include "window_scene.h"
|
||||
#include "sys_timer.h"
|
||||
|
||||
extern const char _binary_jsMockSystemPlugin_abc_start[];
|
||||
extern const char _binary_jsMockSystemPlugin_abc_end[];
|
||||
|
||||
namespace OHOS {
|
||||
namespace AbilityRuntime {
|
||||
@ -806,10 +805,9 @@ bool SimulatorImpl::LoadRuntimeEnv(napi_env env, napi_value globalObj)
|
||||
napi_create_object(env, &object);
|
||||
napi_set_named_property(env, globalObj, "group", object);
|
||||
|
||||
uintptr_t bufferStart = reinterpret_cast<uintptr_t>(_binary_jsMockSystemPlugin_abc_start);
|
||||
uintptr_t bufferEnd = reinterpret_cast<uintptr_t>(_binary_jsMockSystemPlugin_abc_end);
|
||||
const uint8_t *buffer = reinterpret_cast<const uint8_t*>(bufferStart);
|
||||
size_t size = bufferEnd - bufferStart;
|
||||
const OHOS::Ide::JsMockUtil::AbcInfo info = OHOS::Ide::JsMockUtil::GetAbcBufferInfo();
|
||||
const uint8_t *buffer = info.buffer;
|
||||
std::size_t size = info.bufferSize;
|
||||
panda::JSNApi::Execute(vm_, buffer, size, "_GLOBAL::func_main_0");
|
||||
|
||||
napi_value mockRequireNapi = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user