mirror of
https://gitee.com/openharmony/appexecfwk_standard
synced 2024-11-27 15:11:03 +00:00
!1120 新增依赖配置字段的解析
Merge pull request !1120 from wangtiantian/dependencies
This commit is contained in:
commit
cdb0e10c1f
@ -53,6 +53,7 @@ struct HapModuleInfo : public Parcelable {
|
||||
|
||||
std::vector<std::string> reqCapabilities;
|
||||
std::vector<std::string> deviceTypes;
|
||||
std::vector<std::string> dependencies;
|
||||
std::vector<AbilityInfo> abilityInfos;
|
||||
ModuleColorMode colorMode = ModuleColorMode::AUTO;
|
||||
// new version fields
|
||||
|
@ -54,6 +54,7 @@ const std::string HAP_MODULE_INFO_IS_STAGE_BASED_MODEL = "isStageBasedModel";
|
||||
const std::string HAP_MODULE_INFO_MODULE_TYPE = "moduleType";
|
||||
const std::string HAP_MODULE_INFO_EXTENSION_INFOS = "extensionInfos";
|
||||
const std::string HAP_MODULE_INFO_META_DATA = "metadata";
|
||||
const std::string HAP_MODULE_INFO_DEPENDENCIES = "dependencies";
|
||||
}
|
||||
|
||||
bool HapModuleInfo::ReadFromParcel(Parcel &parcel)
|
||||
@ -145,7 +146,8 @@ void to_json(nlohmann::json &jsonObject, const HapModuleInfo &hapModuleInfo)
|
||||
{HAP_MODULE_INFO_IS_STAGE_BASED_MODEL, hapModuleInfo.isStageBasedModel},
|
||||
{HAP_MODULE_INFO_MODULE_TYPE, hapModuleInfo.moduleType},
|
||||
{HAP_MODULE_INFO_EXTENSION_INFOS, hapModuleInfo.extensionInfos},
|
||||
{HAP_MODULE_INFO_META_DATA, hapModuleInfo.metadata}
|
||||
{HAP_MODULE_INFO_META_DATA, hapModuleInfo.metadata},
|
||||
{HAP_MODULE_INFO_DEPENDENCIES, hapModuleInfo.dependencies}
|
||||
};
|
||||
}
|
||||
|
||||
@ -393,6 +395,14 @@ void from_json(const nlohmann::json &jsonObject, HapModuleInfo &hapModuleInfo)
|
||||
false,
|
||||
parseResult,
|
||||
ArrayType::OBJECT);
|
||||
GetValueIfFindKey<std::vector<std::string>>(jsonObject,
|
||||
jsonObjectEnd,
|
||||
HAP_MODULE_INFO_DEPENDENCIES,
|
||||
hapModuleInfo.dependencies,
|
||||
JsonType::ARRAY,
|
||||
false,
|
||||
parseResult,
|
||||
ArrayType::STRING);
|
||||
}
|
||||
} // namespace AppExecFwk
|
||||
} // namespace OHOS
|
||||
|
@ -93,6 +93,7 @@ const std::string BUNDLE_MODULE_PROFILE_KEY_PACKAGE = "package";
|
||||
const std::string BUNDLE_MODULE_PROFILE_KEY_SUPPORTED_MODES = "supportedModes";
|
||||
const std::string BUNDLE_MODULE_PROFILE_KEY_REQ_CAPABILITIES = "reqCapabilities";
|
||||
const std::string BUNDLE_MODULE_PROFILE_KEY_SUPPORTED_REQ_CAPABILITIES = "reqCapabilities";
|
||||
const std::string BUNDLE_MODULE_DEPENDENCIES = "dependencies";
|
||||
const std::string MODULE_SUPPORTED_MODES_VALUE_DRIVE = "drive";
|
||||
const std::string BUNDLE_MODULE_PROFILE_KEY_DEVICE_TYPE = "deviceType";
|
||||
const std::string BUNDLE_MODULE_PROFILE_KEY_COLOR_MODE = "colorMode";
|
||||
@ -351,6 +352,7 @@ const std::string MODULE_ABILITIES = "abilities";
|
||||
const std::string MODULE_EXTENSION_ABILITIES = "extensionAbilities";
|
||||
const std::string MODULE_REQUEST_PERMISSIONS = "requestPermissions";
|
||||
const std::string MODULE_DEFINE_PERMISSIONS = "definePermissions";
|
||||
const std::string MODULE_DEPENDENCIES = "dependencies";
|
||||
// module type
|
||||
const std::string MODULE_TYPE_ENTRY = "entry";
|
||||
const std::string MODULE_TYPE_FEATURE = "feature";
|
||||
|
@ -89,6 +89,7 @@ struct InnerModuleInfo {
|
||||
std::vector<std::string> extensionKeys;
|
||||
std::vector<std::string> extensionSkillKeys;
|
||||
std::vector<Metadata> metadata;
|
||||
std::vector<std::string> dependencies;
|
||||
};
|
||||
|
||||
struct SkillUri {
|
||||
|
@ -304,6 +304,7 @@ struct Module {
|
||||
std::vector<std::string> supportedModes;
|
||||
std::vector<std::string> reqCapabilities;
|
||||
std::vector<std::string> deviceType;
|
||||
std::vector<std::string> dependencies;
|
||||
Distro distro;
|
||||
MetaData metaData;
|
||||
std::vector<Ability> abilities;
|
||||
@ -1715,6 +1716,14 @@ void from_json(const nlohmann::json &jsonObject, Module &module)
|
||||
false,
|
||||
parseResult,
|
||||
ArrayType::NOT_ARRAY);
|
||||
GetValueIfFindKey<std::vector<std::string>>(jsonObject,
|
||||
jsonObjectEnd,
|
||||
BUNDLE_MODULE_DEPENDENCIES,
|
||||
module.dependencies,
|
||||
JsonType::ARRAY,
|
||||
false,
|
||||
parseResult,
|
||||
ArrayType::STRING);
|
||||
}
|
||||
|
||||
void from_json(const nlohmann::json &jsonObject, ConfigJson &configJson)
|
||||
@ -2067,6 +2076,7 @@ bool ToInnerModuleInfo(const ProfileReader::ConfigJson &configJson, InnerModuleI
|
||||
innerModuleInfo.isEntry = true;
|
||||
}
|
||||
}
|
||||
innerModuleInfo.dependencies = configJson.module.dependencies;
|
||||
|
||||
innerModuleInfo.isModuleJson = false;
|
||||
return true;
|
||||
|
@ -64,6 +64,7 @@ const std::string MODULE_FORMS = "formInfos";
|
||||
const std::string MODULE_SHORTCUT = "shortcutInfos";
|
||||
const std::string MODULE_COMMON_EVENT = "commonEvents";
|
||||
const std::string MODULE_MAIN_ABILITY = "mainAbility";
|
||||
const std::string MODULE_DEPENDENCIES = "dependencies";
|
||||
const std::string NEW_BUNDLE_NAME = "newBundleName";
|
||||
const std::string MODULE_SRC_PATH = "srcPath";
|
||||
const std::string SCHEME_SEPARATOR = "://";
|
||||
@ -361,7 +362,8 @@ void to_json(nlohmann::json &jsonObject, const InnerModuleInfo &info)
|
||||
{MODULE_EXTENSION_KEYS, info.extensionKeys},
|
||||
{MODULE_EXTENSION_SKILL_KEYS, info.extensionSkillKeys},
|
||||
{MODULE_IS_MODULE_JSON, info.isModuleJson},
|
||||
{MODULE_IS_STAGE_BASED_MODEL, info.isStageBasedModel}
|
||||
{MODULE_IS_STAGE_BASED_MODEL, info.isStageBasedModel},
|
||||
{MODULE_DEPENDENCIES, info.dependencies},
|
||||
};
|
||||
}
|
||||
|
||||
@ -693,6 +695,14 @@ void from_json(const nlohmann::json &jsonObject, InnerModuleInfo &info)
|
||||
false,
|
||||
parseResult,
|
||||
ArrayType::NOT_ARRAY);
|
||||
GetValueIfFindKey<std::vector<std::string>>(jsonObject,
|
||||
jsonObjectEnd,
|
||||
MODULE_DEPENDENCIES,
|
||||
info.dependencies,
|
||||
JsonType::ARRAY,
|
||||
false,
|
||||
ProfileReader::parseResult,
|
||||
ArrayType::STRING);
|
||||
if (parseResult != ERR_OK) {
|
||||
APP_LOGE("read InnerModuleInfo from database error, error code : %{public}d", parseResult);
|
||||
}
|
||||
@ -1262,6 +1272,7 @@ std::optional<HapModuleInfo> InnerBundleInfo::FindHapModuleInfo(const std::strin
|
||||
ApplicationFlag::GET_APPLICATION_INFO_WITH_PERMISSION, userId, abilityInfo.applicationInfo);
|
||||
}
|
||||
}
|
||||
hapInfo.dependencies = it->second.dependencies;
|
||||
return hapInfo;
|
||||
}
|
||||
|
||||
|
@ -213,6 +213,7 @@ struct Module {
|
||||
std::vector<Extension> extensionAbilities;
|
||||
std::vector<RequestPermission> requestPermissions;
|
||||
std::vector<DefinePermission> definePermissions;
|
||||
std::vector<std::string> dependencies;
|
||||
};
|
||||
|
||||
struct ModuleJson {
|
||||
@ -1021,6 +1022,14 @@ void from_json(const nlohmann::json &jsonObject, Module &module)
|
||||
false,
|
||||
parseResult,
|
||||
ArrayType::OBJECT);
|
||||
GetValueIfFindKey<std::vector<std::string>>(jsonObject,
|
||||
jsonObjectEnd,
|
||||
MODULE_DEPENDENCIES,
|
||||
module.dependencies,
|
||||
JsonType::ARRAY,
|
||||
false,
|
||||
parseResult,
|
||||
ArrayType::STRING);
|
||||
}
|
||||
|
||||
void from_json(const nlohmann::json &jsonObject, ModuleJson &moduleJson)
|
||||
@ -1390,6 +1399,7 @@ bool ToInnerModuleInfo(const Profile::ModuleJson &moduleJson, InnerModuleInfo &i
|
||||
}
|
||||
innerModuleInfo.pages = moduleJson.module.pages;
|
||||
GetPermissions(moduleJson, innerModuleInfo, isSystemApp, isPreInstallApp);
|
||||
innerModuleInfo.dependencies = moduleJson.module.dependencies;
|
||||
innerModuleInfo.isModuleJson = true;
|
||||
innerModuleInfo.isStageBasedModel = true;
|
||||
// abilities and extensionAbilities store in InnerBundleInfo
|
||||
|
Loading…
Reference in New Issue
Block a user