Skip to content

Commit 481b94f

Browse files
committed
Static linking and linux-arm improvements
1 parent 20d42fa commit 481b94f

File tree

4 files changed

+31
-6
lines changed

4 files changed

+31
-6
lines changed

Resources/Program.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ public class {X}
2828
}
2929
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
3030
{
31-
return Path.Combine(baseDir, "linux-x64", commandid);
31+
return RuntimeInformation.ProcessArchitecture switch
32+
{
33+
Architecture.Arm or Architecture.Arm64 => Path.Combine(baseDir, "linux-arm64", commandid),
34+
_ => Path.Combine(baseDir, "linux-x64", commandid)
35+
};
3236
}
3337

3438
return commandid;

Tasks/PackageTask.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ public override async Task RunAsync(BuildContext context)
4444
}
4545
else if (context.IsRunningOnLinux())
4646
{
47-
rid = "linux-x64";
47+
rid = RuntimeInformation.ProcessArchitecture switch
48+
{
49+
Architecture.Arm or Architecture.Arm64 => "linux-arm64",
50+
_ => "linux-x64"
51+
};
4852
}
4953
else if (context.IsRunningOnMacOs())
5054
{

Tasks/TestLinuxTask.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,16 @@ out IEnumerable<string> processOutput
6262
}
6363
else
6464
{
65-
context.Information($"INVALID: {libPath}");
66-
passedTests = false;
65+
var pathToCheck = System.IO.Path.Combine(context.ArtifactsDir, libPath);
66+
if (!libPath.Contains('/') && File.Exists(pathToCheck))
67+
{
68+
context.Information($"VALID linkage: {libPath}");
69+
}
70+
else
71+
{
72+
context.Information($"INVALID linkage: {libPath}");
73+
passedTests = false;
74+
}
6775
}
6876
}
6977

Tasks/TestMacOSTask.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,17 @@ out IEnumerable<string> processOutput
4545
}
4646
else
4747
{
48-
context.Information($"INVALID linkage: {libPath}");
49-
passedTests = false;
48+
var libName = libPath.Replace("@rpath/", "");
49+
var pathToCheck = System.IO.Path.Combine(context.ArtifactsDir, libName);
50+
if (!libName.Contains('/') && File.Exists(pathToCheck))
51+
{
52+
context.Information($"VALID linkage: {libPath}");
53+
}
54+
else
55+
{
56+
context.Information($"INVALID linkage: {libPath}");
57+
passedTests = false;
58+
}
5059
}
5160
}
5261

0 commit comments

Comments
 (0)