独立编译整改解耦

Signed-off-by: zhangzezhong <zhangzezhong8@huawei-partners.com>
This commit is contained in:
zhangzezhong
2025-04-14 17:01:18 +08:00
parent bdd8910240
commit 25996576b8
14 changed files with 73 additions and 37 deletions
+2 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2024 Huawei Device Co., Ltd.
* Copyright (c) 2021-2025 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
@@ -60,6 +60,7 @@
#include "system_ability_definition.h"
#include "source_map.h"
#include "source_map_operator.h"
#include "worker_info.h"
#ifdef SUPPORT_SCREEN
#include "hot_reloader.h"
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Copyright (c) 2024-2025 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
@@ -28,6 +28,7 @@
#include "parameters.h"
#include "system_ability_definition.h"
#include "native_engine/native_create_env.h"
#include "worker_info.h"
using Extractor = OHOS::AbilityBase::Extractor;
using ExtractorUtil = OHOS::AbilityBase::ExtractorUtil;
+11 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022-2024 Huawei Device Co., Ltd.
* Copyright (c) 2022-2025 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
@@ -43,6 +43,8 @@
#include "singleton.h"
#include "syscap_ts.h"
#include "system_ability_definition.h"
#include "js_environment_impl.h"
#include "worker_info.h"
#ifdef SUPPORT_SCREEN
using OHOS::Ace::ContainerScope;
#endif
@@ -169,6 +171,14 @@ std::string AssetHelper::NormalizedFileName(const std::string& fileName) const
return normalizedFilePath;
}
AssetHelper::AssetHelper(std::shared_ptr<JsEnv::WorkerInfo> workerInfo) : workerInfo_(workerInfo)
{
panda::panda_file::StringPacProtect codePath = panda::panda_file::StringPacProtect(workerInfo_->codePath);
if (!(codePath.GetOriginString()).empty() && (codePath.GetOriginString()).back() != '/') {
(workerInfo_->codePath).Append('/');
}
}
AssetHelper::~AssetHelper()
{
TAG_LOGD(AAFwkTag::JSRUNTIME, "destroyed");
+2 -8
View File
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
* Copyright (c) 2022-2025 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
@@ -34,13 +34,7 @@ void SetJsFramework();
class AssetHelper final {
public:
explicit AssetHelper(std::shared_ptr<JsEnv::WorkerInfo> workerInfo) : workerInfo_(workerInfo)
{
panda::panda_file::StringPacProtect codePath = panda::panda_file::StringPacProtect(workerInfo_->codePath);
if (!(codePath.GetOriginString()).empty() && (codePath.GetOriginString()).back() != '/') {
(workerInfo_->codePath).Append('/');
}
}
explicit AssetHelper(std::shared_ptr<JsEnv::WorkerInfo> workerInfo);
virtual ~AssetHelper();
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Copyright (c) 2023-2025 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
@@ -21,6 +21,7 @@
#include "js_worker.h"
#include "ohos_loop_handler.h"
#include "sys_timer.h"
#include "worker_info.h"
namespace OHOS {
namespace AbilityRuntime {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2025 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
@@ -20,13 +20,13 @@
#include <mutex>
#include "continuation_state.h"
#include "ability_info.h"
#include "event_handler.h"
#include "iremote_object.h"
#include "want.h"
using OHOS::AAFwk::WantParams;
namespace OHOS {
namespace AppExecFwk {
class EventHandler;
class Ability;
class ContinuationHandler;
class IAbilityContinuation;
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2025 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
@@ -23,6 +23,7 @@
#include "js_environment_impl.h"
#include "native_engine/impl/ark/ark_native_engine.h"
#include "uncaught_exception_callback.h"
#include "worker_info.h"
namespace OHOS {
namespace JsEnv {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2025 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
@@ -26,6 +26,7 @@
namespace OHOS {
namespace JsEnv {
struct WorkerInfo;
class JsEnvironmentImpl;
using DebuggerPostTask = std::function<void(std::function<void()>&&)>;
using RequestAotCallback =
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2025 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
@@ -20,24 +20,9 @@
#include "event_handler.h"
#include "native_engine/native_engine.h"
#include "native_engine/native_engine.h"
#include "data_protect.h"
namespace OHOS {
namespace JsEnv {
struct WorkerInfo {
panda::panda_file::StringPacProtect codePath;
bool isDebugVersion = false;
bool isBundle = true;
std::string packagePathStr;
std::vector<std::string> assetBasePathStr;
panda::panda_file::StringPacProtect hapPath;
panda::panda_file::BoolPacProtect isStageModel = panda::panda_file::BoolPacProtect(true);
std::string moduleName;
panda::panda_file::DataProtect apiTargetVersion = panda::panda_file::DataProtect();
};
struct WorkerInfo;
class JsEnvironmentImpl {
public:
JsEnvironmentImpl() {}
@@ -0,0 +1,38 @@
/*
* Copyright (c) 2025 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.
*/
#ifndef OHOS_ABILITY_JS_ENVIRONMENT_WORKER_INFO_H
#define OHOS_ABILITY_JS_ENVIRONMENT_WORKER_INFO_H
#include <string>
#include "data_protect.h"
namespace OHOS {
namespace JsEnv {
struct WorkerInfo {
panda::panda_file::StringPacProtect codePath;
bool isDebugVersion = false;
bool isBundle = true;
std::string packagePathStr;
std::vector<std::string> assetBasePathStr;
panda::panda_file::StringPacProtect hapPath;
panda::panda_file::BoolPacProtect isStageModel = panda::panda_file::BoolPacProtect(true);
std::string moduleName;
panda::panda_file::DataProtect apiTargetVersion = panda::panda_file::DataProtect();
};
} // namespace JsEnv
} // namespace OHOS
#endif // OHOS_ABILITY_JS_ENVIRONMENT_WORKER_INFO_H
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2025 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
@@ -25,6 +25,7 @@
#include "ecmascript/napi/include/jsnapi.h"
#include "ohos_js_env_logger.h"
#include "ohos_js_environment_impl.h"
#include "worker_info.h"
using namespace testing;
using namespace testing::ext;
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Copyright (c) 2024-2025 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
@@ -26,6 +26,7 @@
#include "ability_record.h"
#include "securec.h"
#include "worker_info.h"
using namespace OHOS::AAFwk;
using namespace OHOS::AppExecFwk;
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Copyright (c) 2024-2025 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
@@ -26,6 +26,7 @@
#undef private
#undef protected
#include "native_engine.h"
#include "worker_info.h"
using namespace testing;
using namespace testing::ext;
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2025 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
@@ -21,6 +21,7 @@
#include "hilog_tag_wrapper.h"
#include "js_runtime.h"
#include "worker_info.h"
using namespace testing;
using namespace testing::ext;