forked from actions/runner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dir.proj
87 lines (77 loc) · 5.43 KB
/
dir.proj
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
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="GenerateConstant">
<Exec Command="git rev-parse HEAD" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="GitInfoCommitHash" />
</Exec>
<Message Text="Building $(Product): $(GitInfoCommitHash) --- $(PackageRuntime)" Importance="high"/>
<ItemGroup>
<BuildConstants Include="namespace GitHub.Runner.Sdk"/>
<BuildConstants Include="{"/>
<BuildConstants Include="%20%20%20%20public static class BuildConstants"/>
<BuildConstants Include="%20%20%20%20{"/>
<BuildConstants Include="%20%20%20%20%20%20%20%20public static class Source"/>
<BuildConstants Include="%20%20%20%20%20%20%20%20{"/>
<BuildConstants Include="%20%20%20%20%20%20%20%20%20%20%20%20public static readonly string CommitHash = %22$(GitInfoCommitHash)%22%3B"/>
<BuildConstants Include="%20%20%20%20%20%20%20%20}%0A"/>
<BuildConstants Include="%20%20%20%20%20%20%20%20public static class RunnerPackage"/>
<BuildConstants Include="%20%20%20%20%20%20%20%20{"/>
<BuildConstants Include="%20%20%20%20%20%20%20%20%20%20%20%20public static readonly string PackageName = %22$(PackageRuntime)%22%3B"/>
<BuildConstants Include="%20%20%20%20%20%20%20%20%20%20%20%20public static readonly string Version = %22$(RunnerVersion)%22%3B"/>
<BuildConstants Include="%20%20%20%20%20%20%20%20}"/>
<BuildConstants Include="%20%20%20%20}"/>
<BuildConstants Include="}"/>
</ItemGroup>
<WriteLinesToFile File="Runner.Sdk/BuildConstants.cs" Lines="@(BuildConstants)" Overwrite="true" Encoding="Unicode"/>
</Target>
<ItemGroup>
<ProjectFiles Include="Sdk/Sdk.csproj" />
<ProjectFiles Include="Runner.Common/Runner.Common.csproj" />
<ProjectFiles Include="Runner.Listener/Runner.Listener.csproj" />
<ProjectFiles Include="Runner.Worker/Runner.Worker.csproj" />
<ProjectFiles Include="Runner.PluginHost/Runner.PluginHost.csproj" />
<ProjectFiles Include="Runner.Sdk/Runner.Sdk.csproj" />
<ProjectFiles Include="Runner.Plugins/Runner.Plugins.csproj" />
</ItemGroup>
<Target Name="Build" DependsOnTargets="GenerateConstant">
<MSBuild Targets="Restore" Projects="@(ProjectFiles)" StopOnFirstFailure="true" />
<MSBuild Targets="Publish" Projects="@(ProjectFiles)" BuildInParallel="false" StopOnFirstFailure="true" Properties="Configuration=$(BUILDCONFIG);PackageRuntime=$(PackageRuntime);Version=$(RunnerVersion);RuntimeIdentifier=$(PackageRuntime);PublishDir=$(MSBuildProjectDirectory)/../_layout/bin" />
<Exec Command="%22$(DesktopMSBuild)%22 Runner.Service/Windows/RunnerService.csproj /p:Configuration=$(BUILDCONFIG) /p:OutputPath=%22$(MSBuildProjectDirectory)/../_layout/bin%22" ConsoleToMSBuild="true" Condition="'$(PackageRuntime)' == 'win-x64' Or '$(PackageRuntime)' == 'win-x86'" />
</Target>
<Target Name="Test" DependsOnTargets="GenerateConstant">
<Exec Command="dotnet build Test/Test.csproj -c $(BUILDCONFIG) /p:PackageRuntime=$(PackageRuntime)" ConsoleToMSBuild="true" />
<Exec Command="dotnet test Test/Test.csproj --no-build --logger:trx" ConsoleToMSBuild="true" />
</Target>
<Target Name="Layout" DependsOnTargets="Clean;Build">
<ItemGroup>
<LayoutRootFiles Include="$(MSBuildProjectDirectory)/Misc/layoutroot/**"/>
<LayoutBinFiles Include="$(MSBuildProjectDirectory)/Misc/layoutbin/**"/>
</ItemGroup>
<Copy SourceFiles="@(LayoutRootFiles)" DestinationFolder="$(MSBuildProjectDirectory)/../_layout/%(RecursiveDir)"/>
<Copy SourceFiles="@(LayoutBinFiles)" DestinationFolder="$(MSBuildProjectDirectory)/../_layout/bin/%(RecursiveDir)"/>
<ItemGroup>
<LayoutRootFilesToDelete Include="$(MSBuildProjectDirectory)/../_layout/*.cmd" Condition="'$(PackageRuntime)' != 'win-x64' And '$(PackageRuntime)' != 'win-x86'"/>
<LayoutRootFilesToDelete Include="$(MSBuildProjectDirectory)/../_layout/*.sh" Condition="'$(PackageRuntime)' == 'win-x64' Or '$(PackageRuntime)' == 'win-x86'"/>
<LayoutRootFilesToDelete Include="$(MSBuildProjectDirectory)/../_layout/bin/RunnerService.js" Condition="'$(PackageRuntime)' == 'win-x64' Or '$(PackageRuntime)' == 'win-x86'"/>
</ItemGroup>
<Delete Files="@(LayoutRootFilesToDelete)" />
</Target>
<Target Name="Clean">
<RemoveDir Directories="$(MSBuildProjectDirectory)/../_layout" ContinueOnError="WarnAndContinue" />
<RemoveDir Directories="Runner.Common/bin" />
<RemoveDir Directories="Runner.Common/obj" />
<RemoveDir Directories="Runner.Listener/bin" />
<RemoveDir Directories="Runner.Listener/obj" />
<RemoveDir Directories="Runner.Worker/bin" />
<RemoveDir Directories="Runner.Worker/obj" />
<RemoveDir Directories="Runner.PluginHost/bin" />
<RemoveDir Directories="Runner.PluginHost/obj" />
<RemoveDir Directories="Runner.Sdk/bin" />
<RemoveDir Directories="Runner.Sdk/obj" />
<RemoveDir Directories="Runner.Plugins/bin" />
<RemoveDir Directories="Runner.Plugins/obj" />
<RemoveDir Directories="Test/bin" />
<RemoveDir Directories="Test/obj" />
</Target>
</Project>