You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/11/27 22:03:00 UTC

[jira] [Commented] (CB-8976) platforms/android/build.gradle modifies android versionCode

    [ https://issues.apache.org/jira/browse/CB-8976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16267668#comment-16267668 ] 

ASF GitHub Bot commented on CB-8976:
------------------------------------

infil00p closed pull request #401: CB-8976: Added the `cdvVersionCodeForceAbiDigit` property
URL: https://github.com/apache/cordova-android/pull/401
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/bin/templates/project/build.gradle b/bin/templates/project/build.gradle
index ef2297194..b87840bef 100644
--- a/bin/templates/project/build.gradle
+++ b/bin/templates/project/build.gradle
@@ -70,6 +70,10 @@ ext {
     if (!project.hasProperty('cdvBuildMultipleApks')) {
         cdvBuildMultipleApks = null
     }
+    // Whether to append a 0 "abi digit" to versionCode when only a single APK is build 
+    if (!project.hasProperty('cdvVersionCodeForceAbiDigit')) {
+        cdvVersionCodeForceAbiDigit = null
+    }
     // .properties files to use for release signing.
     if (!project.hasProperty('cdvReleaseSigningPropertiesFile')) {
         cdvReleaseSigningPropertiesFile = null
@@ -111,6 +115,7 @@ if (ext.cdvReleaseSigningPropertiesFile == null && file('release-signing.propert
 
 // Cast to appropriate types.
 ext.cdvBuildMultipleApks = cdvBuildMultipleApks == null ? false : cdvBuildMultipleApks.toBoolean();
+ext.cdvVersionCodeForceAbiDigit = cdvVersionCodeForceAbiDigit == null ? false : cdvVersionCodeForceAbiDigit.toBoolean();
 ext.cdvMinSdkVersion = cdvMinSdkVersion == null ? null : Integer.parseInt('' + cdvMinSdkVersion)
 ext.cdvVersionCode = cdvVersionCode == null ? null : Integer.parseInt('' + cdvVersionCode)
 
@@ -138,6 +143,7 @@ task cdvPrintProps << {
     println('cdvCompileSdkVersion=' + cdvCompileSdkVersion)
     println('cdvBuildToolsVersion=' + cdvBuildToolsVersion)
     println('cdvVersionCode=' + cdvVersionCode)
+    println('cdvVersionCodeForceAbiDigit=' + cdvVersionCodeForceAbiDigit)
     println('cdvMinSdkVersion=' + cdvMinSdkVersion)
     println('cdvBuildMultipleApks=' + cdvBuildMultipleApks)
     println('cdvReleaseSigningPropertiesFile=' + cdvReleaseSigningPropertiesFile)
@@ -199,6 +205,11 @@ android {
                 }
             }
         }
+    } else if (Boolean.valueOf(cdvVersionCodeForceAbiDigit)) {
+        // This provides compatibility to the default logic for versionCode before cordova-android 5.2.0
+        defaultConfig {
+            versionCode defaultConfig.versionCode*10
+        }
     }
     /*
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> platforms/android/build.gradle modifies android versionCode
> -----------------------------------------------------------
>
>                 Key: CB-8976
>                 URL: https://issues.apache.org/jira/browse/CB-8976
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-android
>         Environment: Android
>            Reporter: zack dykes
>            Assignee: Joe Bowser
>            Priority: Minor
>
> cordova 5.0.0
> platforms/android/build.gradle modifies android versionCode at ln 178
> as I understand it max size for versionCode is (2^31)-1 
> http://stackoverflow.com/a/24246191/126600
> in my config.xml: 
> {code}
> android-versionCode="1385039613"
> {code}
> when I run {{cordova build android}}, I get:
> {code}
> FAILURE: Build failed with an exception.
> * Where:
> Build file '/Users/zackd/dev/code/cordova/cordova-ansr-fat-client/ondeviceresearch/platforms/android/build.gradle' line: 178
> * What went wrong:
> A problem occurred evaluating root project 'android'.
> > For input string: "13850396130"
> {code}
> and build.gradle, ln 178
> {code}
> versionCode cdvVersionCode ?: Integer.parseInt("" + privateHelpers.extractIntFromManifest("versionCode") + "0")
> {code}
> looks like this is appending "0" to my versionCode, producing 13850396130 which is larger than max size for android versionCode
> if I mod ln 178 as follows, build succeeds
> {code}
> versionCode cdvVersionCode ?: Integer.parseInt("" + privateHelpers.extractIntFromManifest("versionCode"))
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org