-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.cake
77 lines (62 loc) · 1.75 KB
/
build.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
77
//
// Copyright Seth Hendrick 2015-2021.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// ----------------- Constants ----------------
const string devopsTarget = "run_devops";
const string buildTask = "build";
bool forceBuild = Argument<bool>( "force_build", false );
string target = Argument( "target", buildTask );
FilePath devopsExe = File( "./DevOps/bin/Debug/net6.0/DevOps.dll" );
FilePath sln = File( "./SethCS.sln" );
// ----------------- Build Targets ----------------
Task( buildTask )
.Does(
() =>
{
if( forceBuild == false )
{
if( target != buildTask )
{
Information( "DevOps.dll not found, compiling" );
}
}
var settings = new DotNetBuildSettings
{
};
DotNetBuild( sln.ToString(), settings );
}
);
var runTask = Task( devopsTarget )
.Does(
() =>
{
List<string> args = new List<string>( System.Environment.GetCommandLineArgs() );
args.RemoveAt( 0 );
args.Insert( 0, devopsExe.ToString() );
ProcessSettings processSettings = new ProcessSettings
{
Arguments = ProcessArgumentBuilder.FromStrings( args )
};
int exitCode = StartProcess( "dotnet", processSettings );
if( exitCode != 0 )
{
throw new Exception( $"DevOps.exe Exited with exit code: {exitCode}" );
}
}
);
if( forceBuild || ( FileExists( devopsExe ) == false ) )
{
runTask.IsDependentOn( buildTask );
}
// ---------------- Run ----------------
if( target == buildTask )
{
RunTarget( target );
}
else
{
RunTarget( devopsTarget );
}