-
Notifications
You must be signed in to change notification settings - Fork 156
Provide library access to code generation #214
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Can you put Target
inside util instead?
Rebased and updated for v0.13.0 |
cc @japaric I want to get an ok from you before merging |
Rebased for v0.13.1. Instead of returning a tuple a struct with named fields is used to remove ambiguity over the tuple ordering. |
ping @Emilgardis @japaric I'm still interested in landing this PR. rebased against the current master branch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but ALAS we can't make any changes because CI is broken.
I found myself hacking this in as well. A lof of crates have shell scripts that attempt to cargo install binaries at specific versions. Until thats more doable, making form, svd2rust etc all library usable means we can lock to the correct version in the cargo manifest. |
generate isnt probably the best user facing api, but I have a pretty rough fork that exposes that function, though I wouldn't pr it, as I had to hack on the (i guess now deprecated?) error style used here that I don't really understand how/if theres a good replacement for yet. It works in concert with a PR into form as well Which leads to a cargo alias style script that looks pretty decent and should cross platform and versioned better than the update.sh scripts most people are using Or could be its own full featured crate but Im ambivalent on that atm. |
After I cleaned my version up, it became the naive solution exposing internals tried here and rejected. oops. Sorry for the noise. Ive successfully utilized this PR now, though it does seem to be missing the build_rs file generation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm 👍 , I do still want an approval from @japaric before merging though
One simple thing thats missing here is the build_rs output. I added it to my commit here and could pr: |
My ultimate goal for this effort is to finish the implementation for stm32-rs/stm32-rs#5 Wouldn't generating the build.rs file prevent the crate from providing its own? In the case of stm32-rs, the crate would be able to cover a large number of devices and the user selects the target with a feature flag. In that case the build.rs file has a bunch of other work to accomplish like extracting the correct svd file from one of the archives in the repo. |
From looking at the tool, it seems like the code path for cortex m targets at the very least wants the (currently hardcoded) build.rs to load the memory.x If you dont want it you could not save it. Also you should check out my script (which I wasnt intending to run as a build.rs) where I run a pinned programmatic version of rustfmt instead of using command |
Thanks for the PR @tones111. I agree with @jacobrosenthal that the Finally, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just some tiny nit-picks.
I tested this for my use cases and it is working well. Well done @tones111 |
Any last requests @therealprof or @japaric can we get a merge (and a point release) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
bors try |
tryBuild failed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. @tones111 thanks for working on this!
try timed out, seems the version of the backtrace crate causing the previous ci fails has been yanked however. |
bors try |
tryBuild succeeded |
bors r+ |
214: Provide library access to code generation r=therealprof a=tones111 This change implements the minimal API described in #207 to allow downstream build.rs scripts to generate the svd2rust output. Co-authored-by: Paul Sbarra <sbarra.paul@gmail.com> Co-authored-by: Jacob Rosenthal <jacobrosenthal@gmail.com>
Build succeeded |
This change implements the minimal API described in #207 to allow downstream build.rs scripts to generate the svd2rust output.