diff --git a/Xamarin.Recipe/Content/android.cake b/Xamarin.Recipe/Content/android.cake index 7b6dd0b..7362a03 100644 --- a/Xamarin.Recipe/Content/android.cake +++ b/Xamarin.Recipe/Content/android.cake @@ -57,7 +57,7 @@ Task("Android-Manifest") var manifest = DeserializeAppManifest(BuildParameters.AndroidManifest); manifest.VersionName = BuildParameters.Version.Version; - manifest.VersionCode = Convert.ToInt32(BuildParameters.Version.BuildMetaData); + manifest.VersionCode = BuildParameters.BuildNumber == 0 ? manifest.VersionCode ++ : BuildParameters.BuildNumber; Verbose("Version Name: {0}", BuildParameters.Version.Version); Verbose("Version Code: {0}", BuildParameters.Version.PreReleaseNumber); @@ -125,4 +125,4 @@ Task("Upload-AzureDevOps-Apk") Verbose("Apk Path: {0}", apk.FullPath); BuildSystem.TFBuild.Commands.UploadArtifact(artifactPath.ToString(), apk, apk.GetFilename().ToString()); - }); \ No newline at end of file + }); diff --git a/Xamarin.Recipe/Content/ios.cake b/Xamarin.Recipe/Content/ios.cake index 43acf6f..7823667 100644 --- a/Xamarin.Recipe/Content/ios.cake +++ b/Xamarin.Recipe/Content/ios.cake @@ -43,7 +43,7 @@ Task("iPhone-Info-Plist") Verbose("CFBundleShortVersionString: {0}", BuildParameters.Version.Version); Verbose("CFBundleVersion: {0}", BuildParameters.Version.PreReleaseNumber); plist["CFBundleShortVersionString"] = BuildParameters.Version.Version; - plist["CFBundleVersion"] = BuildParameters.Version.BuildMetaData; + plist["CFBundleVersion"] = BuildParameters.BuildNumber == 0 ? BuildParameters.Version.BuildMetaData : BuildParameters.BuildNumber.ToString(); var bundleIdentifier = EnvironmentVariable(Environment.BundleIdentifierVariable); if(!string.IsNullOrEmpty(bundleIdentifier)) diff --git a/Xamarin.Recipe/Content/parameters.cake b/Xamarin.Recipe/Content/parameters.cake index e68cf2e..deb7ebf 100644 --- a/Xamarin.Recipe/Content/parameters.cake +++ b/Xamarin.Recipe/Content/parameters.cake @@ -27,6 +27,8 @@ public static class BuildParameters public static bool IsNuGetBuild { get; set; } public static bool TransifexEnabled { get; set; } public static bool PrepareLocalRelease { get; set; } + + public static int BuildNumber { get; private set; } public static bool ShouldRunGitVersion { get; private set; } public static bool ShouldDeployAppCenter { get; private set; } @@ -94,6 +96,7 @@ public static class BuildParameters bool? shouldRunxUnit = null, bool? shouldRunUnitTests = null, bool shouldRunFastlaneMatch = false, + int buildNumber = 0, string mainBranch = "main", string devBranch = "dev", FilePath androidManifest = null, @@ -169,6 +172,8 @@ public static class BuildParameters ShouldRunFastlaneDeliver = context.DirectoryExists(BuildParameters.Paths.Directories.Metadata) && (IsReleaseBranch || IsHotFixBranch || (IsMainBranch && IsTagged)); ShouldRunFastlaneMatch = IsiOSBuild && IsRunningOnUnix && shouldRunFastlaneMatch; + + BuildNumber = buildNumber; } public static void SetBuildVersion(BuildVersion version)