Skip to content

Commit 42dec94

Browse files
authored
Merge pull request #7398 from xmake-io/csharp
Add csharp support
2 parents 1c5607a + 2134b93 commit 42dec94

File tree

58 files changed

+1998
-170
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1998
-170
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.xmake/
2+
build/
3+
bin/
4+
obj/
5+
vsxmake*/
6+
.vs/
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Console.WriteLine("hello xmake!");
2+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import("detect.sdks.find_dotnet")
2+
3+
function test_build(t)
4+
if is_subhost("msys") then
5+
return t:skip("csharp not supported on msys")
6+
end
7+
local dotnet = find_dotnet()
8+
if dotnet and dotnet.sdkver then
9+
t:build()
10+
else
11+
return t:skip("dotnet sdk not found")
12+
end
13+
end
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
add_rules("mode.debug", "mode.release")
2+
3+
target("test")
4+
set_kind("binary")
5+
add_rules("csharp")
6+
add_files("src/Program.cs")
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.xmake/
2+
build/
3+
bin/
4+
obj/
5+
vsxmake*/
6+
.vs/
7+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System.Text.Json;
2+
3+
var runtimeFile = Path.Combine(Directory.GetCurrentDirectory(), "runtime.json");
4+
if (!File.Exists(runtimeFile)) {
5+
Console.WriteLine("runtime.json missing");
6+
return;
7+
}
8+
9+
var json = File.ReadAllText(runtimeFile);
10+
using var doc = JsonDocument.Parse(json);
11+
var runtime = doc.RootElement.TryGetProperty("runtime", out var value)
12+
? value.GetString()
13+
: "unknown";
14+
15+
Console.WriteLine($"runtime={runtime}");
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"runtime": "xmake",
3+
"featureFlags": {
4+
"sample": true
5+
}
6+
}
7+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import("detect.sdks.find_dotnet")
2+
3+
function test_build(t)
4+
if is_subhost("msys") then
5+
return t:skip("csharp not supported on msys")
6+
end
7+
local dotnet = find_dotnet()
8+
if dotnet and dotnet.sdkver then
9+
t:build()
10+
else
11+
return t:skip("dotnet sdk not found")
12+
end
13+
end
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
add_rules("mode.debug", "mode.release")
2+
3+
target("app")
4+
set_kind("binary")
5+
add_rules("csharp")
6+
add_files("src/Program.cs")
7+
set_rundir("src")
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.xmake/
2+
build/
3+
bin/
4+
obj/
5+
vsxmake*/
6+
.vs/

0 commit comments

Comments
 (0)