@atomicservice/ascf-toolkit-hvigor-plugin 1.0.9 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __awaiter=this&&this.__awaiter||function(e,o,n,t){return new(n||(n=Promise))(function(i,a){function r(e){try{u(t.next(e))}catch(e){a(e)}}function s(e){try{u(t.throw(e))}catch(e){a(e)}}function u(e){var o;e.done?i(e.value):(o=e.value,o instanceof n?o:new n(function(e){e(o)})).then(r,s)}u((t=t.apply(e,o||[])).next())})},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.doModifyShareInfoPlugin=doModifyShareInfoPlugin,exports.default=modifyShareInfoPlugin;const hvigor_1=require("@ohos/hvigor"),hvigor_ohos_plugin_1=require("@ohos/hvigor-ohos-plugin"),path_1=__importDefault(require("path")),fs_1=__importDefault(require("fs")),common_utils_1=require("../common/common-utils"),logger=hvigor_1.HvigorLogger.getLogger("modifyShareInfoPlugin"),ASCF_BUNDLENAME="com.huawei.hms.ascfruntime";function fixHspDep(e){null==e||e.forEach(e=>{if("ascf"===e.moduleName
|
|
1
|
+
"use strict";var __awaiter=this&&this.__awaiter||function(e,o,n,t){return new(n||(n=Promise))(function(i,a){function r(e){try{u(t.next(e))}catch(e){a(e)}}function s(e){try{u(t.throw(e))}catch(e){a(e)}}function u(e){var o;e.done?i(e.value):(o=e.value,o instanceof n?o:new n(function(e){e(o)})).then(r,s)}u((t=t.apply(e,o||[])).next())})},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.doModifyShareInfoPlugin=doModifyShareInfoPlugin,exports.default=modifyShareInfoPlugin;const hvigor_1=require("@ohos/hvigor"),hvigor_ohos_plugin_1=require("@ohos/hvigor-ohos-plugin"),path_1=__importDefault(require("path")),fs_1=__importDefault(require("fs")),common_utils_1=require("../common/common-utils"),logger=hvigor_1.HvigorLogger.getLogger("modifyShareInfoPlugin"),ASCF_BUNDLENAME="com.huawei.hms.ascfruntime";function fixHspDep(e){null==e||e.forEach(e=>{if("ascf"===e.moduleName&&(e.bundleName||(e.bundleName=ASCF_BUNDLENAME),(0,common_utils_1.isEmulator)())){const o=(0,common_utils_1.getRuntimeVersionCode)(e.bundleName);if(e.versionCode!==o){e.versionCode=o;const n=path_1.default.resolve(__dirname,"../config.json"),t=(0,common_utils_1.parseJsonSafe)(fs_1.default.readFileSync(n).toString(),{});logger.warn(`emulator ASCF versionCode is ${o} not matches @atomicservice/ascfapi dependency versionCode ${e.versionCode}, please upgrade by ${t.emulatorFaq}`)}}})}function updateSharedInfo(e){const o=path_1.default.resolve(e,"build");if(!fs_1.default.existsSync(o))return void logger.debug("buildFilePath:"+o);const n=fs_1.default.readdirSync(o);logger.debug("buildFileNames:"+n),n.filter(e=>e).forEach(e=>{logger.debug("productName: "+e);const n=path_1.default.resolve(o,`${e}/intermediates/res/${e}/module.json`);if(logger.debug("module.json filePath: "+n),fs_1.default.existsSync(n)){const e=(0,common_utils_1.readJson)(n);fixHspDep(e.module.dependencies),(0,common_utils_1.writeJson)(n,e),logger.debug(`final moduleJson ${JSON.stringify(e,null," ")}`)}else logger.debug("module.json filePath: "+n+" is not Exists");const t=path_1.default.resolve(o,`${e}/intermediates/hap_metadata/${e}/output_metadata.json`);if(logger.debug("output_metadata.json filePath: "+t),fs_1.default.existsSync(t)){const e=(0,common_utils_1.readJson)(t);null==e||e.forEach(e=>{var o;const n=null===(o=e.dependRemoteHsps)||void 0===o?void 0:o.findIndex(e=>{var o;return null===(o=e.hspName)||void 0===o?void 0:o.includes("ascf")});e.dependRemoteHsps&&-1!==n&&e.dependRemoteHsps.splice(n,1)}),(0,common_utils_1.writeJson)(t,e),logger.debug(`final metadataJson ${JSON.stringify(e,null," ")}`)}})}function doModifyShareInfoPlugin(e){return __awaiter(this,void 0,void 0,function*(){logger.debug("start exec modify share info plugin");const o=e.getContext(hvigor_ohos_plugin_1.OhosPluginId.OHOS_HAP_PLUGIN);null==o||o.targets(o=>{const n=o.getTargetName();logger.debug(`${e.getNodeName()}:${n}`),e.registerTask({name:"modifyShareInfoTask",run:e=>{logger.debug("moduleName="+e.moduleName+" modulePath="+e.modulePath),updateSharedInfo(e.modulePath)},dependencies:[`${n}@CompileArkTS`],postDependencies:[`${n}@PackageHap`]})}),logger.debug("exec modify share info plugin completed")})}function modifyShareInfoPlugin(){return{pluginId:"modifyShareInfoPlugin",apply:doModifyShareInfoPlugin}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atomicservice/ascf-toolkit-hvigor-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"title": "ASCF toolkit hvigor plugin for atomicservice",
|
|
5
5
|
"description": "ASCF toolkit hvigor plugin for atomicservice",
|
|
6
6
|
"main": "index.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"gulp-terser": "2.1.0"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@atomicservice/ascf-toolkit": "1.0.
|
|
18
|
+
"@atomicservice/ascf-toolkit": "1.0.11",
|
|
19
19
|
"json5": "2.2.3"
|
|
20
20
|
},
|
|
21
21
|
"overrides": {
|