HarmonyOS 鸿蒙Next开发中,模块的版本号怎么统一配置啊?
HarmonyOS 鸿蒙Next开发中,模块的版本号怎么统一配置啊?
有要学HarmonyOS AI的同学吗,联系我:https://www.itying.com/goods-1206.html
关于HarmonyOS 鸿蒙Next开发中,模块的版本号怎么统一配置啊?的问题,您也可以访问:https://www.itying.com/category-93-b0.html 联系官网客服。
2 回复
可以写个脚本来打包,打包的时候读取版本号变量来统一配置:
版本号文件:
{
"project": {
"sdk_version": "4.75.1-rc.2",
}
}
修改版本号:
def changexxxSdkVersion():
with open('version.json5', 'r') as f:
data = json5.load(f)
versionName = data['project']['sdk_version']
with open('xxx/oh-package.json5', 'r') as f:
xxxData = json5.load(f)
xxxData['version'] = versionName
with open('xxx/oh-package.json5', 'w') as f:
json.dump(xxxData, f, indent=4)
with open('dependencies.json5', 'r') as f:
depData = json5.load(f)
depData['version_base']['base-xxx'] = versionName
with open('dependencies.json5', 'w') as depf:
json.dump(depData, depf, indent=4)