-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.cake
130 lines (104 loc) · 3.39 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#addin "Cake.Incubator"
#addin "Cake.Docker"
#addin nuget:?package=Cake.Unity3D
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
//////////////////////////////////////////////////////////////////////
// PREPARATION
//////////////////////////////////////////////////////////////////////
// Define directories.
var buildDir = Directory("./src/AlmVR.Server/AlmVR.Server/bin") + Directory(configuration);
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
CleanDirectory(buildDir);
});
Task("Build-Server")
.IsDependentOn("Clean")
.Does(() =>
{
var dotNetCoreSettings = new DotNetCoreBuildSettings
{
Configuration = configuration
};
DotNetCoreBuild("./src/AlmVR.Server/AlmVR.Server.sln", dotNetCoreSettings);
});
Task("Publish-Server")
.IsDependentOn("Build-Server")
.Does(() =>
{
var settings = new DotNetCorePublishSettings
{
Configuration = "Release",
OutputDirectory = "./src/AlmVR.Server/artifacts/"
};
DotNetCorePublish("./src/AlmVR.Server/AlmVR.Server.sln", settings);
});
Task("Copy-Plugins")
.IsDependentOn("Publish-Server")
.Does(() =>
{
CreateDirectory("./src/AlmVR.Server/artifacts/Plugins/");
CopyFiles("./src/AlmVR.Server/build/Plugins/*", "./src/AlmVR.Server/artifacts/Plugins/");
});
Task("Docker-Build-Server")
.IsDependentOn("Copy-Plugins")
.Does(() =>
{
var dockerImageBuildSettings = new DockerImageBuildSettings
{
Tag = new string[] { "almvr" }
};
DockerBuild(dockerImageBuildSettings, "./src/AlmVR.Server");
});
Task("Build-Client")
.IsDependentOn("Clean")
.Does(() =>
{
var dotNetCoreSettings = new DotNetCoreBuildSettings
{
Configuration = configuration
};
DotNetCoreBuild("./src/AlmVR.Server/AlmVR.Server.sln", dotNetCoreSettings);
});
Task("Build-Unity")
.IsDependentOn("Build-Client")
.Does(() =>
{
var unityEditorLocation = EnvironmentVariable("UNITY_EDITOR_LOCATION") ?? @"C:\Program Files\Unity\Editor\Unity.exe";
Information($"Unity Editor Location: {unityEditorLocation}");
// Presuming the build.cake file is within the Unity3D project folder.
var projectPath = System.IO.Path.GetFullPath("./src/AlmVR.Headset");
// The location we want the build application to go
var outputPath = System.IO.Path.Combine(projectPath, "Build", "x64", "alm-vr.exe");
// Create our build options.
var options = new Unity3DBuildOptions()
{
Platform = Unity3DBuildPlatform.StandaloneWindows64,
OutputPath = outputPath,
UnityEditorLocation = unityEditorLocation,
ForceScriptInstall = true,
BuildVersion = "1.0.0"
};
// Perform the Unity3d build.
BuildUnity3DProject(projectPath, options);
});
Task("Build")
.IsDependentOn("Docker-Build-Server")
.IsDependentOn("Build-Client");
//.IsDependentOn("Build-Unity");
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("Build");
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);