Skip to content

Comptime Improvements - #2417

Closed
Rune-Magic wants to merge 28 commits into
beefytech:masterfrom
Rune-Magic:cfi
Closed

Rune-Magic wants to merge 28 commits into
beefytech:masterfrom
Rune-Magic:cfi

Conversation

@Rune-Magic

@Rune-Magic Rune-Magic commented Mar 25, 2026 •

Copy link
Copy Markdown
Contributor

adds:

  • Console.Write[Line] to comptime
  • Environment.[G|S]etVariable to comptime
  • make Compiler.Options.* eval to their enum type instead of to int32
  • add Console.RunCommand

@Rune-Magic Rune-Magic mentioned this pull request Mar 25, 2026
3 tasks done
@Rune-Magic

Rune-Magic commented Mar 26, 2026 •

Copy link
Copy Markdown
Contributor Author

btw something like Console.RunShellCommand is neccersary because currently the only way to replicate its functionality is: (which doesn't run at comptime)

// I tried for an hour and was not able to get anything working :(

not sure if this is the best exposure of such a feature though

@bfiete

bfiete commented Mar 27, 2026

Copy link
Copy Markdown
Collaborator

And what about what I had mentioned earlier - write out a script/batch file and then run it in prebuild?

@bfiete

bfiete commented Mar 27, 2026

Copy link
Copy Markdown
Collaborator

RunShellCommand is not a feature I am prepared to add at the moment, as I had previously mentioned. It goes into a deeper feature or controlling the build process via code, which I had said I was not ready to do.

@Rune-Magic

Rune-Magic commented Mar 29, 2026 •

Copy link
Copy Markdown
Contributor Author

I mean you can already do this at comptime: (UseShellExecute doesn't work though)

let startInfo = scope ProcessStartInfo();
startInfo.SetFileNameAndArguments("<command>");
startInfo.UseShellExecute = false;
startInfo.RedirectStandardOutput = true;
startInfo.CreateNoWindow = true;

let proc = scope SpawnedProcess();
if (proc.Start(startInfo) case .Err)
    return;

let output = scope FileStream();
let sr = scope StreamReader(output);
proc.AttachStandardOutput(output);

while (!proc.HasExited)
{
	let str = sr.ReadToEnd(.. scope .());
	Console.Write(str);
}

it's just a more convinenient way of doing that

@bfiete

bfiete commented Mar 29, 2026

Copy link
Copy Markdown
Collaborator

It's not the "executing things" that I object to, it's the "interacting with the build system via comptime" that I object to.

@Rune-Magic

Rune-Magic commented Mar 29, 2026 •

Copy link
Copy Markdown
Contributor Author

but RunShellCommand just runs a shell command, it doesn't run an ide command or a script manager command

@bfiete

bfiete commented Mar 29, 2026

Copy link
Copy Markdown
Collaborator

https://github.com/beefytech/Beef/pull/2417/changes#diff-b6a56ea0c901990ffc877cad40196069f530a9aa0c1418c94a40cce1e98b87f7R800
let inst = app.DoRun("", StringView(cmd), app.mWorkspace.mDir, .None, null, null, .ShellCommand);

DoRun is the part of the "build system". This is "interacting with the build system via coptime". Why does everything with you have to be so argumentative?

@Rune-Magic

Copy link
Copy Markdown
Contributor Author

I thought it only starts a process and streams it's stdout to the output window, but I can change the implementation if you like

@bfiete

bfiete commented Mar 29, 2026

Copy link
Copy Markdown
Collaborator

I don't think you're hearing me, here. This feature is not happening.

@Rune-Magic

Copy link
Copy Markdown
Contributor Author

now all it does is execute the code I posted. No IDE interactions at all

@Rune-Magic

Copy link
Copy Markdown
Contributor Author
ERROR: Unqualified dot syntax cannot be used with type 'int32'
   case .Og, .OgPlus:
         ^^

@Rune-Magic Rune-Magic closed this Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants