From e20b2be1d3c34f9789c42796600de0070dcc0b68 Mon Sep 17 00:00:00 2001 From: Sajid Date: Tue, 13 Oct 2026 22:22:09 +0600 Subject: [PATCH] Use dotnet run for the build system --- .github/workflows/actions-pr.yml | 8 ++------ .github/workflows/actions-push.yml | 8 ++------ build.csx => build.cs | 12 +++++++----- 3 files changed, 11 insertions(+), 17 deletions(-) rename build.csx => build.cs (96%) diff --git a/.github/workflows/actions-pr.yml b/.github/workflows/actions-pr.yml index 68bb79ee..4ee85946 100644 --- a/.github/workflows/actions-pr.yml +++ b/.github/workflows/actions-pr.yml @@ -11,12 +11,8 @@ jobs: - name: Set up dotnet uses: actions/setup-dotnet@v3 with: - dotnet-version: 9.0.x - - - name: Install dependencies - run: | - dotnet tool install -g dotnet-script + dotnet-version: 10.0.x - name: Run test run: | - dotnet script build.csx -- test + dotnet run build.cs test diff --git a/.github/workflows/actions-push.yml b/.github/workflows/actions-push.yml index eb5fcf3b..77ee2946 100644 --- a/.github/workflows/actions-push.yml +++ b/.github/workflows/actions-push.yml @@ -17,15 +17,11 @@ jobs: - name: Set up dotnet uses: actions/setup-dotnet@v3 with: - dotnet-version: 9.0.x - - - name: Install dependencies - run: | - dotnet tool install -g dotnet-script + dotnet-version: 10.0.x - name: Run build run: | - dotnet script build.csx + dotnet run build.cs - name: Push to build branch run: | diff --git a/build.csx b/build.cs similarity index 96% rename from build.csx rename to build.cs index bfe803d6..9aaec81e 100644 --- a/build.csx +++ b/build.cs @@ -1,8 +1,10 @@ -#!/usr/bin/env dotnet-script -#r "nuget: Microsoft.CodeAnalysis.CSharp, 4.7.0" -#r "nuget: HedgeModManager.CodeCompiler, 0.2.37" +#!/usr/bin/dotnet run +#:package Microsoft.CodeAnalysis.CSharp@4.* +#:package HedgeModManager.CodeCompiler@0.2.150 using HedgeModManager.CodeCompiler; +using System.Text; + var StartDirectory = Environment.CurrentDirectory; var TestOnly = false; var Failures = new List(); @@ -13,7 +15,7 @@ Environment.CurrentDirectory = Path.Combine(StartDirectory, "Source"); -foreach(var arg in Args) +foreach(var arg in args) { if (arg.Equals("test", StringComparison.OrdinalIgnoreCase)) { @@ -120,7 +122,7 @@ string GetCodeFileName() } var outPath = Path.Combine(StartDirectory, "build", $"{GetCodeFileName()}.hmm"); - Directory.CreateDirectory(Path.GetDirectoryName(outPath)); + Directory.CreateDirectory(Path.GetDirectoryName(outPath)!); File.WriteAllText(outPath, result); } }