mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-16 16:02:33 +03:00
Implement forceversion and forcevercode for gradle projects
This commit is contained in:
parent
22a02a02c4
commit
1ef3e2408a
1 changed files with 20 additions and 8 deletions
|
@ -1502,19 +1502,31 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, sdk_path,
|
||||||
for path in manifest_paths(root_dir, flavour):
|
for path in manifest_paths(root_dir, flavour):
|
||||||
if not os.path.isfile(path):
|
if not os.path.isfile(path):
|
||||||
continue
|
continue
|
||||||
if subprocess.call(['sed','-i',
|
if path.endswith('.xml'):
|
||||||
's/android:versionName="[^"]*"/android:versionName="' + build['version'] + '"/g',
|
if subprocess.call(['sed','-i',
|
||||||
path]) != 0:
|
's/android:versionName="[^"]*"/android:versionName="' + build['version'] + '"/g',
|
||||||
raise BuildException("Failed to amend manifest")
|
path]) != 0:
|
||||||
|
raise BuildException("Failed to amend manifest")
|
||||||
|
elif path.endswith('.gradle'):
|
||||||
|
if subprocess.call(['sed','-i',
|
||||||
|
's/versionName[ ]*=[ ]*"[^"]*"/versionName = "' + build['version'] + '"/g',
|
||||||
|
path]) != 0:
|
||||||
|
raise BuildException("Failed to amend build.gradle")
|
||||||
if 'forcevercode' in build:
|
if 'forcevercode' in build:
|
||||||
print "Changing the version code..."
|
print "Changing the version code..."
|
||||||
for path in manifest_paths(root_dir, flavour):
|
for path in manifest_paths(root_dir, flavour):
|
||||||
if not os.path.isfile(path):
|
if not os.path.isfile(path):
|
||||||
continue
|
continue
|
||||||
if subprocess.call(['sed','-i',
|
if path.endswith('.xml'):
|
||||||
's/android:versionCode="[^"]*"/android:versionCode="' + build['vercode'] + '"/g',
|
if subprocess.call(['sed','-i',
|
||||||
path]) != 0:
|
's/android:versionCode="[^"]*"/android:versionCode="' + build['vercode'] + '"/g',
|
||||||
raise BuildException("Failed to amend manifest")
|
path]) != 0:
|
||||||
|
raise BuildException("Failed to amend manifest")
|
||||||
|
elif path.endswith('.gradle'):
|
||||||
|
if subprocess.call(['sed','-i',
|
||||||
|
's/versionCode[ ]*=[ ]*[0-9]*/versionCode = ' + build['vercode'] + '/g',
|
||||||
|
path]) != 0:
|
||||||
|
raise BuildException("Failed to amend build.gradle")
|
||||||
|
|
||||||
# Delete unwanted files...
|
# Delete unwanted files...
|
||||||
if 'rm' in build:
|
if 'rm' in build:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue