Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upGenerate strings instead of AST #239
Conversation
tomaka
changed the title
Generate strings instead of AST
[WIP] Generate strings instead of AST
Dec 15, 2014
cmr
reviewed
Dec 15, 2014
| fn main() { | ||
| let dest = Path::new(os::getenv("OUT_DIR").unwrap()); | ||
|
|
||
| let bindings = gl_generator::generate(gl_generator::generators::global_gen::GlobalGenerator, gl_generator::registry::Ns::Gl, khronos_api::GL_XML, vec![], "4.5", "core"); |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
cc @bvssvni @csherratt @hannobraun this might affect you |
This comment has been minimized.
This comment has been minimized.
|
This is looking awesome! It's a big review though. Is it under integration tests? |
This comment has been minimized.
This comment has been minimized.
|
I'm wondering if it would be better to be using writers instead of all the strings to cut down on the allocation, but I would rather get this merged soon so that @tomaka doesn't have to deal with breakages when we inevitably have patch changes to the AST. |
This comment has been minimized.
This comment has been minimized.
|
Don't merge this for now. The build command doesn't work on my local machine (missing DLL symbol when executing it), I don't know where it comes from and didn't investigate yet. |
tomaka
force-pushed the
tomaka:ast-to-strings
branch
3 times, most recently
from
5a5dcd9
to
5c28bbe
Dec 16, 2014
This comment has been minimized.
This comment has been minimized.
|
Investigation wasn't long, it was because I was linking to the The only thing not done yet is fixing the tests (which is important, because I noticed that I made a few mistakes in global_gen, but didn't test the other generators yet). |
This comment has been minimized.
This comment has been minimized.
|
Awesome! Thanks again for your hard work @tomaka! |
tomaka
force-pushed the
tomaka:ast-to-strings
branch
4 times, most recently
from
9d384cc
to
152ffc0
Dec 17, 2014
This comment has been minimized.
This comment has been minimized.
|
Because of rust-lang/cargo#1058, the build time of gl-rs is a lot higher than it could be. Except this, everything is done. |
tomaka
changed the title
[WIP] Generate strings instead of AST
Generate strings instead of AST
Dec 17, 2014
This comment has been minimized.
This comment has been minimized.
|
Have you tried passing around writers instead of constantly allocating strings? |
This comment has been minimized.
This comment has been minimized.
|
@bjz Done |
tomaka
force-pushed the
tomaka:ast-to-strings
branch
from
8013ee9
to
5140fe3
Dec 18, 2014
This comment has been minimized.
This comment has been minimized.
|
r? |
This comment has been minimized.
This comment has been minimized.
|
@bvssvni @csherratt @hannobraun: what are your thoughts? |
This comment has been minimized.
This comment has been minimized.
|
+1 |
This comment has been minimized.
This comment has been minimized.
hannobraun
commented
Dec 20, 2014
|
Sorry, no thoughts at the moment. I haven't really had a chance to look into what code generation is supposed to look like post-1.0. |
This comment has been minimized.
This comment has been minimized.
erickt
commented
Dec 21, 2014
|
I'm working on a proposal for a code generation strategy for 1.0. I'll have it out in a week or so. |
This comment has been minimized.
This comment has been minimized.
ghost
commented
Dec 21, 2014
|
One surprising effect of this change is that it dramatically increases the build times. |
This comment has been minimized.
This comment has been minimized.
|
@csherratt No, it's only because this line is commented out. |
This comment has been minimized.
This comment has been minimized.
|
@erickt Any idea what it will look like? How easy will it be to deploy to crates.io? |
This comment has been minimized.
This comment has been minimized.
erickt
commented
Dec 22, 2014
|
@bjz: the rough idea is to pull the rust 1.0 libsyntax out into a separate crate, and use it to expand syntax extensions and macros into a generated file. Since Rust 1.x+ will be backwards compatible with 1.0, this should be safe to do. You can see my very rough prototype here, specifically the hello_world example. It should be very easy to deploy to crates.io :) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
I don't exactly see how that would work in pratice, but as far as I understand:
Therefore I don't see any advantage in using @erickt's prototype for gl-rs. |
This comment has been minimized.
This comment has been minimized.
|
@tomaka I basically agree right now, |
tomaka
added some commits
Dec 15, 2014
tomaka
force-pushed the
tomaka:ast-to-strings
branch
from
5140fe3
to
02afee7
Dec 23, 2014
This comment has been minimized.
This comment has been minimized.
erickt
commented
Dec 23, 2014
|
No worries, what you're doing is fine. syntex is really will have two goals:
Since it looks like you've already rewritten the code generator, and it looks like you're generating the whole file, then there's no need to use something like syntex. |
This comment has been minimized.
This comment has been minimized.
ghost
commented
Dec 23, 2014
|
|
1 similar comment
This comment has been minimized.
This comment has been minimized.
|
|
brendanzab
added a commit
that referenced
this pull request
Dec 24, 2014
brendanzab
merged commit efd4aca
into
brendanzab:master
Dec 24, 2014
1 check passed
This comment has been minimized.
This comment has been minimized.
|
Thanks for all the feedback everyone! |
tomaka commentedDec 15, 2014
This change will totally remove the
generate_gl_bindingsmacro, in favor of Cargo build scripts.If you simply use the
gllibrary, nothing changes.If, however, you use
gl_generator, then instead of:Replace this by:
And create a file named
build.rs:You will also need to tweak your
Cargo.toml: