1
+ <Project Sdk =" Microsoft.Build.NoTargets" >
2
+
3
+ <PropertyGroup >
4
+ <TargetFramework >net8.0</TargetFramework >
5
+ <ResolvedRuntimeIdentifier Condition =" '$(RuntimeIdentifier)' != ''" >$(RuntimeIdentifier)</ResolvedRuntimeIdentifier >
6
+ </PropertyGroup >
7
+
8
+ <ItemGroup >
9
+ <GoZipSource Include =" gozip\**\*.go" />
10
+ </ItemGroup >
11
+
12
+ <Target Name =" SetGoZipPath" >
13
+ <PropertyGroup >
14
+ <GoOS Condition =" '$(ResolvedRuntimeIdentifier)' == 'win-x86'" >windows</GoOS >
15
+ <GoArch Condition =" '$(ResolvedRuntimeIdentifier)' == 'win-x86'" >386</GoArch >
16
+
17
+ <GoOS Condition =" '$(ResolvedRuntimeIdentifier)' == 'win-x64'" >windows</GoOS >
18
+ <GoArch Condition =" '$(ResolvedRuntimeIdentifier)' == 'win-x64'" >amd64</GoArch >
19
+
20
+ <GoOS Condition =" '$(ResolvedRuntimeIdentifier)' == 'win-arm64'" >windows</GoOS >
21
+ <GoArch Condition =" '$(ResolvedRuntimeIdentifier)' == 'win-arm64'" >arm64</GoArch >
22
+
23
+ <GoOS Condition =" '$(ResolvedRuntimeIdentifier)' == 'linux-x64'" >linux</GoOS >
24
+ <GoArch Condition =" '$(ResolvedRuntimeIdentifier)' == 'linux-x64'" >amd64</GoArch >
25
+
26
+ <GoOS Condition =" '$(ResolvedRuntimeIdentifier)' == 'osx-x64'" >darwin</GoOS >
27
+ <GoArch Condition =" '$(ResolvedRuntimeIdentifier)' == 'osx-x64'" >amd64</GoArch >
28
+
29
+ <GoOS Condition =" '$(ResolvedRuntimeIdentifier)' == 'osx-arm64'" >darwin</GoOS >
30
+ <GoArch Condition =" '$(ResolvedRuntimeIdentifier)' == 'osx-arm64'" >arm64</GoArch >
31
+
32
+ <ExeSuffix Condition =" '$(GoOS)' == 'windows'" >.exe</ExeSuffix >
33
+ <GoZipPath >$(IntermediateOutputPath)gozip$(ExeSuffix)</GoZipPath >
34
+ </PropertyGroup >
35
+
36
+ <Error Condition =" '$(GoOS)' == '' Or '$(GoArch)' == ''"
37
+ Text =" Unsupported runtime: $(GoOS) - $(GoArch). RID: $(ResolvedRuntimeIdentifier)" />
38
+
39
+ </Target >
40
+
41
+ <Target Name =" BuildGoZip" Condition =" '$(NoBuild)' != 'true'" Inputs =" @(GoZipSource)" Outputs =" $(GoZipPath)" >
42
+ <Exec
43
+ Command =" go build -o $(GoZipPath) @(GoZipSource)"
44
+ EnvironmentVariables =" GOOS=$(GoOS);GOARCH=$(GoArch);CGO_ENABLED=0" />
45
+ </Target >
46
+
47
+ <Target Name =" CollectGoZipOutput" DependsOnTargets =" SetGoZipPath;BuildGoZip" BeforeTargets =" AssignTargetPaths" Condition =" '$(ResolvedRuntimeIdentifier)' != ''" >
48
+ <Message Importance =" low" Text =" Collecting GoZip output: $(GoZipPath)" />
49
+ <ItemGroup >
50
+ <None Include =" $(GoZipPath)" CopyToOutputDirectory =" PreserveNewest" />
51
+ </ItemGroup >
52
+ </Target >
53
+
54
+ </Project >
0 commit comments