mirror of
https://github.com/openharmony/bundlemanager_bundle_framework_lite.git
synced 2026-07-20 23:55:24 -04:00
IssueNo:#I3O061
Description:Add transform bytecode. Sig:startup Feature or Bugfix:Feature Binary Source:No
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "generate-bytecode.h"
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#include "generate-bytecode.h"
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
@@ -235,12 +234,12 @@ uint8_t GtBundleInstaller::ProcessBundleInstall(const char *path, const char *ra
|
||||
BundleInfo *bundleInfo = nullptr;
|
||||
(void) GtManagerService::GetInstance().ReportInstallCallback(OPERATION_DOING, 0, BMS_FIRST_FINISHED_PROCESS, installerCallback);
|
||||
uint8_t errorCode = PreCheckBundle(path, fp, signatureInfo, fileSize, bundleStyle);
|
||||
(void) GtManagerService::GetInstance().ReportInstallCallback(OPERATION_DOING, 0, BMS_SECOND_FINISHED_PROCESS, installerCallback);
|
||||
CHECK_PRO_RESULT(errorCode, fp, permissions, bundleInfo, signatureInfo);
|
||||
// parse HarmoyProfile.json, get permissions and bundleInfo
|
||||
errorCode = GtBundleParser::ParseHapProfile(fp, fileSize, permissions, bundleRes, &bundleInfo);
|
||||
CHECK_PRO_RESULT(errorCode, fp, permissions, bundleInfo, signatureInfo);
|
||||
SetCurrentBundle(bundleInfo->bundleName);
|
||||
(void) GtManagerService::GetInstance().ReportInstallCallback(OPERATION_DOING, 0, BMS_SECOND_FINISHED_PROCESS, installerCallback);
|
||||
// terminate current runing app
|
||||
uint32_t labelId = (bundleRes.abilityRes != nullptr) ? bundleRes.abilityRes->labelId : 0;
|
||||
uint32_t iconId = (bundleRes.abilityRes != nullptr) ? bundleRes.abilityRes->iconId : 0;
|
||||
@@ -471,6 +470,12 @@ uint8_t GtBundleInstaller::TransformJsToBc(const char *codePath, InstallRecord &
|
||||
if (jsPath == nullptr) {
|
||||
return ERR_APPEXECFWK_INSTALL_FAILED_INTERNAL_ERROR;
|
||||
}
|
||||
EXECRES result = walk_directory(jsPath);
|
||||
HILOG_INFO(HILOG_MODULE_AAFWK, "[BMS] transform js to bc when install, result is %d", result);
|
||||
if (result != EXCE_ACE_JERRY_EXEC_OK) {
|
||||
AdapterFree(jsPath);
|
||||
return ERR_APPEXECFWK_INSTALL_FAILED_TRANSFORM_BC_FILE_ERROR;
|
||||
}
|
||||
AdapterFree(jsPath);
|
||||
#ifdef BC_TRANS_ENABLE
|
||||
record.transformResult = 0;
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "gt_bundle_extractor.h"
|
||||
#include "gt_bundle_parser.h"
|
||||
#include "gt_extractor_util.h"
|
||||
#include "jerryscript_adapter.h"
|
||||
#include "los_tick.h"
|
||||
#include "stdio.h"
|
||||
#include "sys/stat.h"
|
||||
@@ -335,6 +336,12 @@ void GtManagerService::ClearSystemBundleInstallMsg()
|
||||
|
||||
void GtManagerService::ScanPackages()
|
||||
{
|
||||
JerryBmsPsRamMemInit();
|
||||
bms_task_context_init();
|
||||
jsEngineVer_ = get_jerry_version_no();
|
||||
if (jsEngineVer_ == nullptr) {
|
||||
HILOG_WARN(HILOG_MODULE_AAFWK, "[BMS] get jsEngine version fail when restart!");
|
||||
}
|
||||
if (!BundleUtil::IsDir(JSON_PATH_NO_SLASH_END)) {
|
||||
BundleUtil::MkDirs(JSON_PATH_NO_SLASH_END);
|
||||
InstallAllSystemBundle();
|
||||
@@ -742,6 +749,14 @@ void GtManagerService::TransformJsToBc(const char *codePath, const char *bundleJ
|
||||
return;
|
||||
}
|
||||
|
||||
EXECRES result = walk_directory(jsPath);
|
||||
HILOG_INFO(HILOG_MODULE_AAFWK, "[BMS] transform js to bc, result is %d", result);
|
||||
if (result != EXCE_ACE_JERRY_EXEC_OK) {
|
||||
result = walk_del_bytecode(jsPath);
|
||||
HILOG_INFO(HILOG_MODULE_AAFWK, "[BMS] delete byte code, result is %d", result);
|
||||
AdapterFree(jsPath);
|
||||
return;
|
||||
}
|
||||
AdapterFree(jsPath);
|
||||
|
||||
cJSON *resultObj = cJSON_CreateNumber(0);
|
||||
|
||||
Reference in New Issue
Block a user