• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef DEVELOPTOOLS_PACKING_TOOL_APT_FRAMEWORKS_INCLUDE_PACKAGE_NORMALIZE_H
17 #define DEVELOPTOOLS_PACKING_TOOL_APT_FRAMEWORKS_INCLUDE_PACKAGE_NORMALIZE_H
18 
19 #include "json/module_json.h"
20 #include "json/normalize_version.h"
21 #include "packager.h"
22 #include "unzip_wrapper.h"
23 #include "zip_wrapper.h"
24 namespace OHOS {
25 namespace AppPackingTool {
26 class PackageNormalize : public Packager {
27 public:
28     PackageNormalize(const std::map<std::string, std::string> &parameterMap, std::string &resultReceiver);
~PackageNormalize()29     ~PackageNormalize() override {}
30 
31 protected:
32     int32_t InitAllowedParam() override;
33     int32_t PreProcess() override;
34     int32_t Process() override;
35     int32_t PostProcess() override;
36 
37 private:
38     bool ModifyModuleJson(const std::string &moduleJsonPath,
39         const int32_t &newVersionCode, const std::string &newBundleName);
40     bool ModifyPackInfo(const std::string &moduleJsonPath,
41         const int32_t &newVersionCode, const std::string &newBundleName);
42     ZipWrapper zipWrapper_;
43     UnzipWrapper unzipWrapper_;
44     std::list<std::string> hspList_;
45 };
46 }  // namespace AppExecFwk
47 }  // namespace OHOS
48 #endif  // DEVELOPTOOLS_PACKING_TOOL_APT_FRAMEWORKS_INCLUDE_PACKAGE_NORMALIZE_H