Skip to content
This repository has been archived by the owner on Sep 13, 2021. It is now read-only.

Commit

Permalink
(GH-31) Added BuildNumber to BuildParameters
Browse files Browse the repository at this point in the history
  • Loading branch information
RLittlesII committed Feb 16, 2019
1 parent a418d18 commit b2e12e3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Xamarin.Recipe/Content/android.cake
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -125,4 +125,4 @@ Task("Upload-AzureDevOps-Apk")
Verbose("Apk Path: {0}", apk.FullPath);

BuildSystem.TFBuild.Commands.UploadArtifact(artifactPath.ToString(), apk, apk.GetFilename().ToString());
});
});
2 changes: 1 addition & 1 deletion Xamarin.Recipe/Content/ios.cake
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
5 changes: 5 additions & 0 deletions Xamarin.Recipe/Content/parameters.cake
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b2e12e3

Please sign in to comment.