-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.cake
More file actions
66 lines (54 loc) · 1.52 KB
/
build.cake
File metadata and controls
66 lines (54 loc) · 1.52 KB
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
// ---------------- Constants ----------------
const string target = "run_devops";
const string buildTask = "build";
bool forceBuild = Argument<bool>( "force_build", false );
string targetArg = Argument( "target", string.Empty );
FilePath devopsExe = File( "./src/DevOps/bin/Debug/net6.0/DevOps.dll" );
FilePath sln = File( "./src/PiPictureFrame.sln" );
// ---------------- Targets ----------------
Task( buildTask )
.Does(
( context ) =>
{
if( forceBuild == false )
{
Information( "DevOps.dll not found, compiling" );
}
var settings = new DotNetBuildSettings
{
};
DotNetBuild( sln.ToString(), settings );
}
)
.Description( "Builds with Debug turned on." );
var runTask = Task( target )
.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( targetArg == buildTask )
{
RunTarget( targetArg );
}
else
{
RunTarget( target );
}