Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/Core/RemoteRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Devlooped;

public class RemoteRunner(RemoteRef location, string toolName)
{
public async Task<int> RunAsync(string[] args)
public async Task<int> RunAsync(string[] args, bool aot)
{
var config = Config.Build(Config.GlobalLocation);
var etag = config.GetString(toolName, location.ToString(), "etag");
Expand Down Expand Up @@ -86,11 +86,15 @@ await AnsiConsole.Status().StartAsync($":open_file_folder: {location} :backhand_
Process.Start(DotnetMuxer.Path.FullName, ["clean", "-v:q", program]).WaitForExit();
}

string[] runargs = aot
? ["run", "-v:q", program, .. args]
: ["run", "-v:q", "-p:PublishAot=false", program, .. args];

#if DEBUG
AnsiConsole.MarkupLine($":rocket: {DotnetMuxer.Path.FullName} run -v:q {program} {string.Join(' ', args)}");
AnsiConsole.MarkupLine($":rocket: {DotnetMuxer.Path.FullName} {string.Join(' ', runargs)}");
#endif

var start = new ProcessStartInfo(DotnetMuxer.Path.FullName, ["run", "-v:q", program, .. args]);
var start = new ProcessStartInfo(DotnetMuxer.Path.FullName, runargs);
var process = Process.Start(start);
process?.WaitForExit();

Expand Down
15 changes: 13 additions & 2 deletions src/gist/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,20 @@
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
Console.InputEncoding = Console.OutputEncoding = Encoding.UTF8;

// Default PublishAot=false since it severely limits the code that can run (i.e. no reflection, STJ even)
var aot = false;
if (args.Any(x => x == "--aot"))
{
aot = true;
args = [.. args.Where(x => x != "--aot")];
}

if (args.Length == 0 || !RemoteRef.TryParse("gist.github.com/" + args[0], out var location))
{
AnsiConsole.MarkupLine(
$"""
Usage:
[grey][[dnx]][/] [lime]{ThisAssembly.Project.ToolCommandName}[/] [bold]<gistRef>[/] [grey italic][[<appArgs>...]][/]
[grey][[dnx]][/] [lime]{ThisAssembly.Project.ToolCommandName}[/] [grey][[--aot]][/] [bold]<gistRef>[/] [grey italic][[<appArgs>...]][/]

Arguments:
[bold]<GIST_REF>[/] Reference to gist file to run, with format [yellow]owner/gist[[@commit]][[:path]][/]
Expand All @@ -24,6 +32,9 @@
* kzu/0ac826dc7de666546aaedd38e5965381@d8079cf:run.cs (explicit commit and file path)

[bold]<appArgs>[/] Arguments passed to the C# program that is being run.

Options:
[bold]--aot[/] (optional) Enable dotnet AOT defaults for run file.cs. Defaults to false.
""");
return;
}
Expand All @@ -38,7 +49,7 @@
// to process the dispatcher's job queue.
var main = Task
.Run(() => new RemoteRunner(location, ThisAssembly.Project.ToolCommandName)
.RunAsync(args[1..]))
.RunAsync(args[1..], aot))
.ContinueWith(t =>
{
Dispatcher.MainThread.Shutdown();
Expand Down
15 changes: 13 additions & 2 deletions src/runcs/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,20 @@
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
Console.InputEncoding = Console.OutputEncoding = Encoding.UTF8;

// Default PublishAot=false since it severely limits the code that can run (i.e. no reflection, STJ even)
var aot = false;
if (args.Any(x => x == "--aot"))
{
aot = true;
args = [.. args.Where(x => x != "--aot")];
}

if (args.Length == 0 || !RemoteRef.TryParse(args[0], out var location))
{
AnsiConsole.MarkupLine(
$"""
Usage:
[grey][[dnx]][/] [lime]{ThisAssembly.Project.ToolCommandName}[/] [bold]<repoRef>[/] [grey italic][[<appArgs>...]][/]
[grey][[dnx]][/] [lime]{ThisAssembly.Project.ToolCommandName}[/] [grey][[--aot]][/] [bold]<repoRef>[/] [grey italic][[<appArgs>...]][/]

Arguments:
[bold]<REPO_REF>[/] Reference to remote file to run, with format [yellow][[host/]]owner/repo[[@ref]][[:path]][/]
Expand All @@ -26,6 +34,9 @@
* kzu/sandbox (implied host github.com, ref and path defaults)

[bold]<appArgs>[/] Arguments passed to the C# program that is being run.

Options:
[bold]--aot[/] (optional) Enable dotnet AOT defaults for run file.cs. Defaults to false.
""");
return;
}
Expand All @@ -40,7 +51,7 @@
// to process the dispatcher's job queue.
var main = Task
.Run(() => new RemoteRunner(location, ThisAssembly.Project.ToolCommandName)
.RunAsync(args[1..]))
.RunAsync(args[1..], aot))
.ContinueWith(t =>
{
Dispatcher.MainThread.Shutdown();
Expand Down
2 changes: 1 addition & 1 deletion src/runcs/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"args": {
"commandName": "Project",
"commandLineArgs": "kzu/runcs@v0.1.0 dotnet rocks"
"commandLineArgs": "--aot kzu/runcs@v1 dotnet rocks"
},
"github": {
"commandName": "Project",
Expand Down