Skip to content

Revert "replace --task with --output" #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 7, 2025
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
6 changes: 3 additions & 3 deletions EmpireCompiler/Models/Module/AgentTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ private void CompileDotNet35()
})
);

File.WriteAllBytes(this.OutputPath,
File.WriteAllBytes(Common.EmpireTaskCSharpCompiledNet35Directory + this.Name + ".exe",
Compiler.Compile(new Compiler.CsharpFrameworkCompilationRequest
{
Language = this.Language,
Expand Down Expand Up @@ -265,7 +265,7 @@ private void CompileDotNet40()
return new Compiler.Reference { File = Common.EmpireAssemblyReferenceDirectory + RA.Location, Framework = Common.DotNetVersion.Net40, Enabled = true };
})
);
File.WriteAllBytes(this.OutputPath,
File.WriteAllBytes(Common.EmpireTaskCSharpCompiledNet40Directory + this.Name + ".exe",
Compiler.Compile(new Compiler.CsharpFrameworkCompilationRequest
{
Language = this.Language,
Expand Down Expand Up @@ -326,7 +326,7 @@ private void CompileDotNet45()
return new Compiler.Reference { File = Common.EmpireAssemblyReferenceDirectory + RA.Location, Framework = Common.DotNetVersion.Net45, Enabled = true };
})
);
File.WriteAllBytes(this.OutputPath,
File.WriteAllBytes(Common.EmpireTaskCSharpCompiledNet45Directory + this.Name + ".exe",
Compiler.Compile(new Compiler.CsharpFrameworkCompilationRequest
{
Language = this.Language,
Expand Down
22 changes: 11 additions & 11 deletions EmpireCompiler/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
{
static async Task Main(string[] args)
{
var outputPathOption = new Option<string>(
"--output",
description: "The output path for the compiled task.");
var taskOption = new Option<string>(
"--task",
description: "The name of the task to execute");

var yamlOption = new Option<string>(
"--yaml",
Expand All @@ -34,7 +34,7 @@

var rootCommand = new RootCommand
{
outputPathOption,
taskOption,
yamlOption,
confuseOption,
debugOption
Expand All @@ -42,25 +42,25 @@

rootCommand.Description = "Empire Compiler";

rootCommand.SetHandler(async (InvocationContext context) =>

Check warning on line 45 in EmpireCompiler/Program.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-24.04)

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 45 in EmpireCompiler/Program.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-24.04-arm)

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 45 in EmpireCompiler/Program.cs

View workflow job for this annotation

GitHub Actions / build (macos-13)

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 45 in EmpireCompiler/Program.cs

View workflow job for this annotation

GitHub Actions / build (macos-15)

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
var outputPath = context.ParseResult.GetValueForOption(outputPathOption);
var task = context.ParseResult.GetValueForOption(taskOption);
var yaml = context.ParseResult.GetValueForOption(yamlOption);
var confuse = context.ParseResult.GetValueForOption(confuseOption);
var debug = context.ParseResult.GetValueForOption(debugOption);

DebugUtility.IsDebugEnabled = debug;

DebugUtility.DebugPrint("Debug mode enabled.");
DebugUtility.DebugPrint($"Output Path: {outputPath}");
DebugUtility.DebugPrint($"Task: {task}");
DebugUtility.DebugPrint($"YAML: {yaml}");
DebugUtility.DebugPrint($"Confuse: {confuse}");

try
{
if (string.IsNullOrEmpty(outputPath) || string.IsNullOrEmpty(yaml))
if (string.IsNullOrEmpty(task) || string.IsNullOrEmpty(yaml))
{
Console.WriteLine("Output and YAML are required.");
Console.WriteLine("Task name and YAML are required.");
return;
}

Expand All @@ -70,11 +70,11 @@

DebugUtility.DebugPrint("Compiling task...");
var agentTask = new AgentTask().FromSerializedGruntTask(serializedTasks[0]);
agentTask.OutputPath = outputPath;
agentTask.Name = task;
agentTask.Compile();

DebugUtility.DebugPrint($"Final Task Path: {outputPath}");
Console.WriteLine($"Final Task Path: {outputPath}");
DebugUtility.DebugPrint($"Final Task Name: {task}");
Console.WriteLine($"Final Task Name: {task}");
}
catch (System.Exception ex)
{
Expand Down
Loading