[CUSTOM_APP] Correctly set the version_name.
The version_name need to be set a compilation time. By default the version_name is taken from json info file. But a user may want to change it.
This commit is contained in:
parent
39501fe724
commit
f16c909090
|
@ -51,6 +51,8 @@ def parse_args():
|
|||
|
||||
advance = parser.add_argument_group('advance', "Some advanced options.")
|
||||
advance.add_argument('--extra-code', type=int, default=0)
|
||||
advance.add_argument('--version-name', default=None,
|
||||
help="The version of the application (seen by user). Get from json info file by default.")
|
||||
advance.add_argument('--check-certificate', default=True)
|
||||
advance.add_argument('--zim-url', default=None)
|
||||
advance.add_argument('--no-android-upload', action='store_false', dest='android_upload')
|
||||
|
@ -58,7 +60,6 @@ def parse_args():
|
|||
# Hidden options
|
||||
parser.add_argument('--step', default='launch', choices=['launch', 'publish'], help=argparse.SUPPRESS)
|
||||
parser.add_argument('--apks-dir', help=argparse.SUPPRESS)
|
||||
parser.add_argument('--version', default="0", help=argparse.SUPPRESS)
|
||||
parser.add_argument('--zim-path', default=None, help=argparse.SUPPRESS)
|
||||
parser.add_argument('--content-version-code', type=int)
|
||||
parser.add_argument('--package-name', default=None, help=argparse.SUPPRESS)
|
||||
|
@ -66,11 +67,15 @@ def parse_args():
|
|||
|
||||
options = parser.parse_args()
|
||||
|
||||
if not options.package_name or not (options.zim_url or options.zim_path):
|
||||
if (not options.package_name
|
||||
or not (options.zim_url or options.zim_path)
|
||||
or not options.version_name):
|
||||
if not options.package_name:
|
||||
print("Try to get package name from info.json file")
|
||||
if not options.zim_url:
|
||||
print("Try to get zim url from info.json file")
|
||||
if not options.version_name:
|
||||
print("Try to get version_name form info.json file")
|
||||
request_url = ('https://raw.githubusercontent.com/kiwix/kiwix-android-custom/master/{}/info.json'
|
||||
.format(options.custom_app))
|
||||
json_request = requests.get(request_url)
|
||||
|
@ -85,6 +90,9 @@ def parse_args():
|
|||
if not options.zim_url:
|
||||
print("Found zim_url '{}'".format(json_data['zim_url']))
|
||||
options.zim_url = json_data['zim_url']
|
||||
if not options.version_name:
|
||||
print("Found version_name '{}'".format(json_data['version_name']))
|
||||
options.version_name = json_data['version_name']
|
||||
|
||||
options.base_version = "{}{}".format(
|
||||
datetime.date.today().strftime('%y%j'),
|
||||
|
@ -179,7 +187,7 @@ def travis_launch_build(organisation, repository, options, zim_size):
|
|||
{ 'ZIM_URL': options.zim_url},
|
||||
{ 'EXTRA_CODE': options.extra_code},
|
||||
{ 'CONTENT_VERSION_CODE': gen_version_code(0, options.base_version)},
|
||||
{ 'VERSION': options.version},
|
||||
{ 'VERSION_NAME': options.version_name},
|
||||
# google_key
|
||||
{ 'secure': ('VAgKBMx0KEIyJlSnpM4YrHKLALIbaibkhlsgiv19ITa6dODoEIqeYHz'
|
||||
'wFTiL3mRHU6HwtXtdNb/JeMle9NfHJVFSV56ZgFzX7ev9zr0YG0qZQv'
|
||||
|
|
|
@ -413,11 +413,13 @@ class KiwixCustomApp(Dependency):
|
|||
template = ("-i -P customDir={customDir}"
|
||||
" -P zim_file_size={zim_size}"
|
||||
" -P version_code={version_code}"
|
||||
" -P version_name={version_name}"
|
||||
" -P content_version_code={content_version_code}")
|
||||
return template.format(
|
||||
customDir=pj(self.build_path, 'custom'),
|
||||
zim_size=self._get_zim_size(),
|
||||
version_code=os.environ['VERSION_CODE'],
|
||||
version_name=os.environ['VERSION_NAME'],
|
||||
content_version_code=os.environ['CONTENT_VERSION_CODE'])
|
||||
|
||||
@property
|
||||
|
|
|
@ -22,7 +22,6 @@ ${TRAVIS_BUILD_DIR}/build_custom_app.py \
|
|||
--custom-app ${CUSTOM_APP} \
|
||||
--package-name ${PACKAGE_NAME} \
|
||||
--google-api-key ${GOOGLE_API_KEY} \
|
||||
--version ${VERSION} \
|
||||
--zim-url ${ZIM_URL} \
|
||||
--apks-dir ${HOME}/APKS \
|
||||
--content-version-code ${CONTENT_VERSION_CODE}
|
||||
|
|
Loading…
Reference in New Issue