Skip to content

Commit

Permalink
Trying to setup xmake to work via github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
tomspilman committed Jul 7, 2024
1 parent 7f3bc9d commit 6554b98
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ jobs:
with:
dotnet-version: '8.0.x'

- name: Setup Xmake
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: latest

- name: Setup Java
uses: actions/setup-java@v4
with:
Expand Down
14 changes: 14 additions & 0 deletions build/BuildContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,18 @@ out IEnumerable<string> processOutput

return processOutput.Any(match => match.StartsWith($"{workload} "));
}

public int XMake(string workingDir, params string[] args)
{
return this.StartProcess(
"xmake",
new ProcessSettings()
{
WorkingDirectory = workingDir,
Arguments = string.Join(" ", args),
RedirectStandardOutput = false,
},
out IEnumerable<string> processOutput
);
}
}
40 changes: 40 additions & 0 deletions build/BuildFrameworksTasks/BuildDesktopVKTask.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

namespace BuildScripts;

[TaskName("Build DesktopVK")]
public sealed class BuildDesktopVKTask : FrostingTask<BuildContext>
{
// TEMP: Until OSX and Linux is setup to work.
public override bool ShouldRun(BuildContext context) => context.IsRunningOnWindows();

public override void Run(BuildContext context)
{
int exit = context.XMake(@"src\monogame\", "f -m debug");
if (exit != 0)
{
context.Log.Error("Setting debug config failed! {0}", exit);
return;
}

exit = context.XMake(@"src\monogame\", "-r");
if (exit != 0)
{
context.Log.Error("Rebuild debug failed! {0}", exit);
return;
}

exit = context.XMake(@"src\monogame\", "f -m release");
if (exit != 0)
{
context.Log.Error("Setting release config failed! {0}", exit);
return;
}

exit = context.XMake(@"src\monogame\", "-r");
if (exit != 0)
{
context.Log.Error("Rebuild release failed! {0}", exit);
return;
}
}
}
1 change: 1 addition & 0 deletions build/Tasks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace BuildScripts;
[TaskName("Build Frameworks")]
[IsDependentOn(typeof(BuildConsoleCheckTask))]
[IsDependentOn(typeof(BuildNativeTask))]
[IsDependentOn(typeof(BuildDesktopVKTask))]
[IsDependentOn(typeof(BuildDesktopGLTask))]
[IsDependentOn(typeof(BuildWindowsDXTask))]
[IsDependentOn(typeof(BuildAndroidTask))]
Expand Down

0 comments on commit 6554b98

Please sign in to comment.