private void performVersionCodeUpdateFromVersion ( Element manifestElement ) throws MojoExecutionException { String verString = project . getVersion ( ) ; getLog ( ) . debug ( "Generating versionCode for " + verString ) ; String verCode = generateVersionCodeFromVersionName ( verString ) ; getLog ( ) . info ( "Setting " + ATTR_VERSION_CODE + " to " + verCode ) ; manifestElement . setAttribute ( ATTR_VERSION_CODE , verCode ) ; project . getProperties ( ) . setProperty ( "android.manifest.versionCode" , String . valueOf ( verCode ) ) ; }
If the specified version name cannot be properly parsed then fall back to an automatic method . If the version can be parsed then generate a version code from the version components . In an effort to preseve uniqueness two digits are allowed for both the minor and incremental versions .