From ba48334e48eae65a1fc6587433316fab129363f8 Mon Sep 17 00:00:00 2001 From: Kelson Date: Wed, 2 Aug 2017 22:25:57 +0200 Subject: [PATCH] Add option --version --- build_custom_app.pl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/build_custom_app.pl b/build_custom_app.pl index 8d63863..5985652 100755 --- a/build_custom_app.pl +++ b/build_custom_app.pl @@ -10,18 +10,20 @@ my $zim_url; my $custom_app; my $keystore; my $api_key; +my $version = "0"; my $cmd; # Get console line arguments GetOptions('zim_url=s' => \$zim_url, - 'custom_app=s' => \$custom_app, + 'custom_app=s' => \$custom_app, 'keystore=s' => \$keystore, - 'api_key=s' => \$api_key + 'api_key=s' => \$api_key, + 'version=s' => \$version ); # Print usage() if necessary if (!$zim_url || !$custom_app || !$keystore || !$api_key) { - print "usage: ./build_custom_app.pl --keystore=kiwix-android.keystore --api_key=google.json --zim_url=\"https://download.kiwix.org/zim/wikipedia_en_medicine_novid.zim\" --custom_app=wikimed\n"; + print "usage: ./build_custom_app.pl --keystore=kiwix-android.keystore --api_key=google.json --zim_url=\"https://download.kiwix.org/zim/wikipedia_en_medicine_novid.zim\" --custom_app=wikimed [--version=1]\n"; exit; } @@ -38,7 +40,7 @@ $ENV{ZIM_SIZE} = $zim_size; # Compute version code base $cmd = "date +%y%j"; -my $version_code_base = `$cmd` =~ s/\n//gr . "0"; +my $version_code_base = `$cmd` =~ s/\n//gr . $version; # Compute content version code my $content_version_code = $version_code_base; @@ -46,7 +48,7 @@ $ENV{CONTENT_VERSION_CODE} = $content_version_code; # Compute custom app date $cmd = "date +%Y-%m"; -my $date = `$cmd` =~ s/\n//gr; +my $date = `$cmd` =~ s/\n//gr; $ENV{VERSION_NAME} = $date; # Compile apps