-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrecipe.cake
76 lines (62 loc) · 2.45 KB
/
recipe.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#load nuget:?package=Cake.Recipe&version=3.0.1
#load "./.build/*.cake"
Environment.SetVariableNames();
BuildParameters.SetParameters(
context: Context,
buildSystem: BuildSystem,
sourceDirectoryPath: "./src",
title: "Cake.Transifex",
repositoryOwner: "cake-contrib",
repositoryName: "Cake.Transifex",
appVeyorAccountName: "cakecontrib",
shouldRunDotNetCorePack: true,
solutionFilePath: "./Cake.Transifex.sln",
testFilePattern: "/**/*.Tests.csproj",
preferredBuildAgentOperatingSystem: PlatformFamily.Linux,
preferredBuildProviderType: BuildProviderType.GitHubActions,
shouldRunCodecov: true,
shouldRunCoveralls: false,
shouldUseDeterministicBuilds: true,
shouldUseTargetFrameworkPath: false);
ToolSettings.SetToolSettings(
context: Context,
testCoverageExcludeByFile: "**/*Designer.cs,*/*.g.cs;**/*.g.i.cs",
testCoverageExcludeByAttribute: "Obsolete;GeneratedCodeAttribute;CompilerGeneratedAttribute");
ToolSettings.SetToolPreprocessorDirectives(
codecovTool: "#tool nuget:?package=CodecovUploader&version=0.5.0"
);
BuildParameters.PrintParameters(Context);
// Temporary Overrides needed to work properly with TX.Exe
((CakeTask)BuildParameters.Tasks.TransifexSetupTask.Task).Actions.Clear();
((CakeTask)BuildParameters.Tasks.TransifexPushSourceResource.Task).Actions.Clear();
((CakeTask)BuildParameters.Tasks.TransifexPullTranslations.Task).Actions.Clear();
((CakeTask)BuildParameters.Tasks.TransifexPushTranslations.Task).Actions.Clear();
private static void AddGlobalOptions(TransifexRunnerSettings settings)
{
if (!string.IsNullOrEmpty(BuildParameters.Transifex.ApiToken))
{
settings.ArgumentCustomization = args => args.PrependSwitchQuotedSecret("--token", " ", BuildParameters.Transifex.ApiToken);
};
}
BuildParameters.Tasks.TransifexPushSourceResource.Does(() =>
{
var settings = new TransifexPushSettings
{
UploadSourceFiles = true,
Force = string.Equals(BuildParameters.Target, "Transifex-Push-SourceFiles", StringComparison.OrdinalIgnoreCase),
};
AddGlobalOptions(settings);
TransifexPush(settings);
});
BuildParameters.Tasks.TransifexPullTranslations.Does(() =>
{
var settings = new TransifexPullSettings
{
All = true,
Mode = BuildParameters.TransifexPullMode,
MinimumPercentage = BuildParameters.TransifexPullPercentage
};
AddGlobalOptions(settings);
TransifexPull(settings);
});
Build.RunDotNetCore();