Skip to content
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

Allow access to Loader's graph without creating a n2 db #138

Merged
merged 1 commit into from
Mar 14, 2025

Conversation

hinshun
Copy link
Contributor

@hinshun hinshun commented Mar 10, 2025

Would you be amendable to this change?

I'm interesting in depending on n2's ninja parser & loader to access a build.ninja's build graph but I don't want a n2 db created.

@evmar
Copy link
Owner

evmar commented Mar 10, 2025

Hm... I'd like to better understand what you're doing. I don't want to support an n2 crate on crates.io, so if you're using this code I think you'll need to vendor it. And if you're doing that, maybe you could carry the modification in your copy? But also this seems harmless so maybe you have a better idea?

PS the person holding 'n2' on crates.io said they'd give me the name a while back but when I followed up they never responded...

@hinshun
Copy link
Contributor Author

hinshun commented Mar 10, 2025

I'm doing an experiment where I wanted to parse build.ninja files and generate Nix dynamic derivations (i.e. incremental compilation in Nix, which previously wasn't possible), following the footsteps of https://github.com/obsidiansystems/sandstone. Since Nix itself is built with meson, this will let Nix be self-hosting.

Essentially, I'll need to generate a Nix derivation per ninja build action.

When I found out that the original author of ninja build was writing it again in Rust, I wanted to leverage it as it'll likely be the most well maintained Rust ninja parser. Happy to maintain my own fork.

@evmar
Copy link
Owner

evmar commented Mar 10, 2025

What I’m trying to understand is how you can write code that uses n2 code without forking it in the first place, I think I am misunderstanding something! :)

@hinshun
Copy link
Contributor Author

hinshun commented Mar 14, 2025

You mean how am I using n2 code without it being published to crates.io?

[dependencies]
n2 = { git = "https://github.com/evmar/n2" }

Or is your question about something else?

@evmar
Copy link
Owner

evmar commented Mar 14, 2025

Ah, that makes sense. I guess if you're ok with being broken if things in n2 change, this is fine!

@evmar evmar merged commit d67d508 into evmar:main Mar 14, 2025
2 of 3 checks passed
@hinshun hinshun deleted the feature/loader-pub-graph branch March 14, 2025 19:01
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