forked from microsoft/appcenter-sdk-unity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathversion.cake
38 lines (30 loc) · 1.23 KB
/
version.cake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#addin nuget:?package=Cake.FileHelpers
#addin nuget:?package=Cake.Git
#load "utility.cake"
using System.Text.RegularExpressions;
// Task TARGET for build
var Target = Argument("target", Argument("t", ""));
Task("StartNewVersion").Does(()=>
{
var newVersion = Argument<string>("NewVersion");
// Replace wrapper sdk version.
UpdateWrapperSdkVersion(newVersion);
// Replace versions in unitypackagespecs.
var specFiles = GetFiles("UnityPackageSpecs/*.unitypackagespec");
foreach (var spec in specFiles)
{
XmlPoke(spec.ToString(), "package/@version", newVersion);
}
// Increment app versions (they will use wrappersdkversion). The platform doesn't matter.
ExecuteUnityMethod("BuildPuppet.SetVersionNumber", "ios");
ExecuteUnityMethod("BuildDemo.SetVersionNumber", "ios", "AppCenterDemoApp");
});
// Changes the Version field in WrapperSdk.cs to the given version
void UpdateWrapperSdkVersion(string newVersion)
{
var path = "Assets/AppCenter/Plugins/AppCenterSDK/Core/Shared/WrapperSdk.cs";
var patternString = "WrapperSdkVersion = \"[^\"]+\";";
var newString = "WrapperSdkVersion = \"" + newVersion + "\";";
ReplaceRegexInFiles(path, patternString, newString);
}
RunTarget(Target);