noir-lang / noir

Noir is a domain specific language for zero knowledge proofs
https://noir-lang.org
Apache License 2.0
833 stars 178 forks source link

Compiler should be able to recompile a file #1892

Open phated opened 1 year ago

phated commented 1 year ago

Problem

Currently, the compiler expects a clean-slate environment and builds the entire program from scratch. However, in the LSP, we want to build the project once and then recompile individual files with the same Context. This isn't possible currently because the compiler returns immediately if it sees a CrateID in the def_map.

Happy Case

We should be able to create a Context once and build the entire project once, then afterwards we should be able to compile a single file given the stored Context.

Alternatives Considered

No response

Additional Context

Ref https://github.com/noir-lang/noir/pull/1891

Would you like to submit a PR for this Issue?

No

Support Needs

No response

jfecher commented 1 year ago

I assume this is because of the recent change to avoid recompiling the same file when it is required by multiple crate dependencies. We'll still want to avoid recompiling in that case so perhaps we need to store timestamps and check when each file was last changed as well.

kevaundray commented 1 year ago

+1 Having a checksum for build artifacts is a good stepping-stone here