Skip to content

Enable --native-aot flag during spacetime init and spacetime publish for NativeAOT-LLVM support#4672

Open
rekhoff wants to merge 5 commits intotyler/update-nativeaot-llvm-infrastructurefrom
rekhoff/update-nativeaot-llvm-infrastructure
Open

Enable --native-aot flag during spacetime init and spacetime publish for NativeAOT-LLVM support#4672
rekhoff wants to merge 5 commits intotyler/update-nativeaot-llvm-infrastructurefrom
rekhoff/update-nativeaot-llvm-infrastructure

Conversation

@rekhoff
Copy link
Contributor

@rekhoff rekhoff commented Mar 19, 2026

Description of Changes

Adds --native-aot flag to spacetime init command for creating NativeAOT-LLVM enabled C# projects. This automatically adds the required LLVM package references to the generated .csproj file and sets "native-aot": true in spacetime.json.

This also adds --native-aot flag to spacetime publish. This is optional because the developer will still need to add the required LLVM package references to their .csproj file, and the provided instructions also include adding "native-aot": true to their spacetime.json which will already apply the flag.

API and ABI breaking changes

None.

Expected complexity level and risk

1 (Low). Adds new optional flag to init command and post-processing of generated .csproj files.

Testing

  • Verified spacetime init --lang csharp --native-aot creates projects with required LLVM package references
  • Confirmed spacetime.json is generated with "native-aot": true
  • Tested publish command works with both --native-aot flag and spacetime.json configuration

@rekhoff rekhoff self-assigned this Mar 19, 2026
@rekhoff rekhoff marked this pull request as ready for review March 19, 2026 18:55
Copy link
Collaborator

@jdetter jdetter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few things for now - I ran into the issue that I DM'd you about so I'll do another review pass later today

### Prerequisites:
NativeAOT-LLVM compiles C# modules to native WebAssembly (WASM) instead of using the Mono runtime.

This is currently only supported for Windows server modules and is experimental. Please test your modules throughly.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would change this to use a warning block, and just let users know that they need to use windows for this. It seems to me that this doesn't really impose any new risk to users so I would probably omit the second sentence unless you've seen something in testing that makes you think this is risky.

Suggested change
This is currently only supported for Windows server modules and is experimental. Please test your modules throughly.
> [!WARNING]
> This is currently only supported for Windows server modules and is experimental.

Comment on lines +58 to +59

### Manual Configuration
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a redundant header, no?

Suggested change
### Manual Configuration

// Print warning about Windows-only support
println!(
"{}",
"Note: NativeAOT-LLVM is experimental and currently only supported for Windows server modules.".yellow()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Note: NativeAOT-LLVM is experimental and currently only supported for Windows server modules.".yellow()
"Note: NativeAOT-LLVM is experimental and building for this platform is currently only supported on Windows.".yellow()

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