1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-16 02:53:11 +01:00
MLEM/build.cake

78 lines
2.4 KiB
Text
Raw Normal View History

#addin Cake.DocFx&version=1.0.0
2021-11-30 11:46:06 +01:00
#tool docfx.console&version=2.58.9
2020-05-21 22:50:38 +02:00
// this is the upcoming version, for prereleases
var version = Argument("version", "6.0.0");
2020-05-21 22:50:38 +02:00
var target = Argument("target", "Default");
2020-11-07 00:52:04 +01:00
var branch = Argument("branch", "main");
2020-05-21 22:50:38 +02:00
var config = Argument("configuration", "Release");
Task("Prepare").Does(() => {
DotNetCoreRestore("MLEM.sln");
2022-06-24 14:01:26 +02:00
2020-05-21 22:50:38 +02:00
if (branch != "release") {
var buildNum = EnvironmentVariable("BUILD_NUMBER");
if (buildNum != null)
version += "-" + buildNum;
2020-05-21 22:50:38 +02:00
}
2022-06-24 14:01:26 +02:00
2020-05-21 22:50:38 +02:00
DeleteFiles("**/*.nupkg");
});
Task("Build").IsDependentOn("Prepare").Does(() =>{
var settings = new DotNetCoreBuildSettings {
Configuration = config,
ArgumentCustomization = args => args.Append($"/p:Version={version}")
};
foreach (var project in GetFiles("**/MLEM*.csproj"))
DotNetCoreBuild(project.FullPath, settings);
DotNetCoreBuild("Demos/Demos.csproj", settings);
2022-06-24 14:01:26 +02:00
DotNetCoreBuild("Demos/Demos.FNA.csproj", settings);
2020-05-21 22:50:38 +02:00
});
2021-03-18 17:28:08 +01:00
Task("Test").IsDependentOn("Build").Does(() => {
2022-06-24 14:01:26 +02:00
var settings = new DotNetCoreTestSettings {
2021-03-18 17:28:08 +01:00
Configuration = config,
Collectors = {"XPlat Code Coverage"}
2022-06-24 14:01:26 +02:00
};
DotNetCoreTest("Tests/Tests.csproj", settings);
DotNetCoreTest("Tests/Tests.FNA.csproj", settings);
2021-03-18 17:28:08 +01:00
});
Task("Pack").IsDependentOn("Test").Does(() => {
2020-05-21 22:50:38 +02:00
var settings = new DotNetCorePackSettings {
Configuration = config,
ArgumentCustomization = args => args.Append($"/p:Version={version}")
};
foreach (var project in GetFiles("**/MLEM*.csproj"))
DotNetCorePack(project.FullPath, settings);
});
2020-11-07 00:52:04 +01:00
Task("Push").WithCriteria(branch == "main" || branch == "release").IsDependentOn("Pack").Does(() => {
2020-05-21 22:50:38 +02:00
NuGetPushSettings settings;
if (branch == "release") {
settings = new NuGetPushSettings {
Source = "https://api.nuget.org/v3/index.json",
ApiKey = EnvironmentVariable("NUGET")
};
} else {
settings = new NuGetPushSettings {
Source = "http://localhost:5000/v3/index.json",
ApiKey = EnvironmentVariable("BAGET")
};
}
settings.SkipDuplicate = true;
2020-05-21 22:50:38 +02:00
NuGetPush(GetFiles("**/*.nupkg"), settings);
});
Task("Document").Does(() => {
var path = "Docs/docfx.json";
DocFxMetadata(path);
DocFxBuild(path);
});
2020-05-21 22:50:38 +02:00
Task("Default").IsDependentOn("Pack");
2020-05-22 01:44:47 +02:00
Task("Publish").IsDependentOn("Push");
2020-05-21 22:50:38 +02:00
2022-06-24 14:01:26 +02:00
RunTarget(target);