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

Build snapshot directly from build.rs rather than through GN #2711

Closed
ry opened this issue Aug 2, 2019 · 1 comment · Fixed by #2825
Closed

Build snapshot directly from build.rs rather than through GN #2711

ry opened this issue Aug 2, 2019 · 1 comment · Fixed by #2825
Labels
build build system or continuous integration related

Comments

@ry
Copy link
Member

ry commented Aug 2, 2019

Currently we build an executable in core called snapshot_creator, which is then run with the bundled TypeScript code (gen/cli/bundle/main.js) as input to produce the snapshot binary (target/debug/gen/cli/snapshot_deno.bin). This binary file is included into the final executable using include_bytes!().

While this is easy to accomplish in GN, Cargo is a woefully naive build system that has not foreseen such situations (other than giving the ability to call arbitrary code in build.rs - I am working on a general way to call into GN from Cargo's build.rs in cargo_gn - that effort is related and necessary but would still be aided by this issue). Nevertheless we would like Deno to be more Rust-y than Chrome-y, and use cargo as the build frontend - #2608.

In the Rust, there is a mechanism of running code at compile time which does not involve creating a separate executable: procedural macros. It seems possible that we could generate the snapshot at compile time using this functionality. If possible, this could drastically simplify our build setup, and allow Deno to act like a normal Rust project.

@ry ry added the build build system or continuous integration related label Aug 2, 2019
@ry
Copy link
Member Author

ry commented Aug 8, 2019

I have a working demo of this now https://github.com/ry/deno_typescript

@ry ry changed the title Use proc macros for the snapshot Build snapshot directly from build.rs rather than through GN Aug 28, 2019
@ry ry closed this as completed in #2825 Sep 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build build system or continuous integration related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant