1 Star 0 Fork 4

mudheaven/Captura

forked from silence/Captura 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
build.cake 3.98 KB
一键复制 编辑 原始数据 按行查看 历史
#tool nuget:?package=xunit.runner.console&version=2.4.1
#l "scripts/backup.cake"
#l "scripts/constants.cake"
#l "scripts/choco.cake"
#l "scripts/apikeys.cake"
#l "scripts/version.cake"
using System.Collections.Generic;
#region Fields
readonly var target = Argument("target", "Default");
readonly var configuration = Argument("configuration", Release);
#endregion
#region Functions
void PopulateOutput()
{
// Copy License files
CopyDirectory(licensesFolder, distFolder + Directory("licenses"));
var consoleBinFolder = sourceFolder + Directory("Captura.Console/bin") + Directory(configuration);
var uiBinFolder = sourceFolder + Directory("Captura/bin") + Directory(configuration);
// Copy Languages
CopyDirectory(uiBinFolder + Directory("Languages"), distFolder + Directory("languages"));
// Copy executables and config files
CopyFiles(consoleBinFolder.Path + "/*.exe*", distFolder);
CopyFiles(uiBinFolder.Path + "/*.exe*", distFolder);
// Copy Keymap files
CopyDirectory(uiBinFolder + Directory("keymaps"), distFolder + Directory("keymaps"));
// For Debug builds
if (configuration != Release)
{
// Assemblies, Symbol Files and XML Documentation
foreach (var extension in new [] { ".dll", ".pdb", ".xml" })
{
CopyFiles(consoleBinFolder.Path + "/*" + extension, distFolder);
CopyFiles(uiBinFolder.Path + "/*" + extension, distFolder);
}
}
else
{
CopyDirectory(consoleBinFolder + Directory("lib"), distFolder + Directory("lib"));
CopyDirectory(uiBinFolder + Directory("lib"), distFolder + Directory("lib"));
}
}
void PackPortable()
{
// Portable build directories
var settingsDir = distFolder + Directory("Settings");
var codecsDir = distFolder + Directory("Codecs");
CreateDirectory(settingsDir);
CreateDirectory(codecsDir);
Zip(distFolder, PortablePath);
var dirDeleteSettings = new DeleteDirectorySettings {
Recursive = true,
Force = true
};
DeleteDirectory(settingsDir, dirDeleteSettings);
DeleteDirectory(codecsDir, dirDeleteSettings);
}
#endregion
#region Setup / Teardown
Setup(context =>
{
EnsureDirectoryExists(tempFolder);
EnsureDirectoryExists(distFolder);
HandleVersion();
if (configuration == Release)
{
EmbedApiKeys();
}
});
Teardown(context =>
{
RestoreBackups();
});
#endregion
#region Tasks
var buildTask = Task("Build")
.Does(() =>
{
MSBuild(slnPath, settings =>
{
settings.SetConfiguration(configuration)
.SetVerbosity(Verbosity.Minimal)
.WithTarget("Rebuild")
.WithRestore()
.UseToolVersion(MSBuildToolVersion.VS2019);
});
});
var cleanOutputTask = Task("Clean-Output").Does(() => CleanDirectory(distFolder));
var populateOutputTask = Task("Populate-Output")
.IsDependentOn(cleanOutputTask)
.IsDependentOn(buildTask)
.Does(() => PopulateOutput());
var packPortableTask = Task("Pack-Portable")
.IsDependentOn(populateOutputTask)
.Does(() => PackPortable());
var packSetupTask = Task("Pack-Setup")
.IsDependentOn(populateOutputTask)
.Does(() =>
{
const string InnoScriptPath = "Inno.iss";
InnoSetup(InnoScriptPath, new InnoSetupSettings
{
QuietMode = InnoSetupQuietMode.Quiet,
ArgumentCustomization = Args => Args.Append($"/DMyAppVersion={version}")
});
});
var packChocoTask = Task("Pack-Choco")
.IsDependentOn(packPortableTask)
.Does(() => PackChoco());
var testTask = Task("Test")
.IsDependentOn(buildTask)
.Does(() => XUnit2(sourceFolder + File($"Tests/bin/{configuration}/**/Captura.Tests.dll")));
var defaultTask = Task("Default")
.IsDependentOn(packPortableTask)
.IsDependentOn(packSetupTask)
.IsDependentOn(packChocoTask);
#endregion
Task("CI")
.IsDependentOn(testTask)
.IsDependentOn(packPortableTask)
.IsDependentOn(packSetupTask)
.IsDependentOn(packChocoTask)
.Does(() => { });
// Start
RunTarget(target);
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mudheaven/Captura.git
git@gitee.com:mudheaven/Captura.git
mudheaven
Captura
Captura
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385