forked from jonathanpeppers/glidex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
helpers.cake
60 lines (50 loc) · 1.69 KB
/
helpers.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
void package(string version, string nuspec, string file, string output)
{
string configuration = Argument("configuration", "Release");
var settings = new NuGetPackSettings
{
Verbosity = NuGetVerbosity.Detailed,
Version = version,
Files = new[]
{
new NuSpecContent { Source = Directory("bin") + Directory(configuration) + File(file), Target = "lib/monoandroid81" },
},
OutputDirectory = output
};
NuGetPack(nuspec, settings);
}
void push(string file)
{
var apiKey = TransformTextFile ("./.nugetapikey").ToString();
NuGetPush(file, new NuGetPushSettings
{
Verbosity = NuGetVerbosity.Detailed,
Source = "nuget.org",
ApiKey = apiKey
});
}
MSBuildSettings MSBuildSettings()
{
var settings = new MSBuildSettings { Configuration = configuration };
if (IsRunningOnWindows())
{
// Find MSBuild for Visual Studio 2019 and newer
DirectoryPath vsLatest = VSWhereLatest();
FilePath msBuildPath = vsLatest?.CombineWithFilePath("./MSBuild/Current/Bin/MSBuild.exe");
// Find MSBuild for Visual Studio 2017
if (msBuildPath != null && !FileExists(msBuildPath))
msBuildPath = vsLatest.CombineWithFilePath("./MSBuild/15.0/Bin/MSBuild.exe");
// Have we found MSBuild yet?
if (!FileExists(msBuildPath))
{
throw new Exception($"Failed to find MSBuild: {msBuildPath}");
}
Information("Building using MSBuild at " + msBuildPath);
settings.ToolPath = msBuildPath;
}
else
{
settings.ToolPath = Context.Tools.Resolve("msbuild");
}
return settings.WithRestore();
}