Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upPost-build script execution #545
Comments
This comment has been minimized.
This comment has been minimized.
|
This will likely happen as part of an implementation of |
This comment has been minimized.
This comment has been minimized.
|
What about integration tests? For example, PNaCl modules can be run on the host machine, but they have to be translated into a NaCl beforehand and then run with sel_ldr (from the NaCl SDK). |
alexcrichton
added
the
A-configuration
label
Jan 14, 2015
This comment has been minimized.
This comment has been minimized.
jan-hudec
commented
Mar 12, 2015
|
@DiamondLovesYou, would #1411 work for the tests? |
This comment has been minimized.
This comment has been minimized.
caitp
commented
Jul 5, 2015
|
A "post_build" script would be useful for things like creating a MacOS bundle, rather than having a separate script to do that work separately. "install" could do this too, but maybe not as useful for testing there? |
This comment has been minimized.
This comment has been minimized.
vvanders
commented
Sep 26, 2015
|
+1 For rust projects that linked dynamically from other languages being able to deploy(move) the .so after a successful build would be nice. |
This comment has been minimized.
This comment has been minimized.
tbelaire
commented
Nov 22, 2015
|
This would be useful for running
To fix up the headers and such after building my project. |
This comment has been minimized.
This comment has been minimized.
Boscop
commented
Jun 16, 2016
|
+1 for post build scripts |
moises-silva
added a commit
to friends-of-freeswitch/mod_prometheus
that referenced
this issue
Aug 6, 2016
This comment has been minimized.
This comment has been minimized.
It doesn't have to mean that cargo will be a general purpose build system. Crate B depends on crate A, and is in a sub-directory of crate A, and it automatically gets built every time crate A has been built. |
This comment has been minimized.
This comment has been minimized.
Boscop
commented
Sep 4, 2016
|
But what if crate B also depends on sub crates C and D? Shouldn't the build of dependencies be caused by building the crate that depends on them in a "by need" manner? |
This comment has been minimized.
This comment has been minimized.
JinShil
commented
Oct 29, 2016
|
This would be useful for embedded systems programming. I often run |
This comment has been minimized.
This comment has been minimized.
|
Don't forget that there's nothing that says you have to use a non-Rust solution for these kinds of things; any "cargo-foo" executable on your $PATH works as "cargo foo", and can be written in any language, including Rust. Your custom command could invoke "cargo build" as a step first and then do anything. On Oct 29, 2016, 13:35 -0400, Mike notifications@github.com, wrote:
|
This comment has been minimized.
This comment has been minimized.
JinShil
commented
Oct 30, 2016
Yes, that is what I, and probably others, are already doing. It would just be more convenient to integrate this into the already familiar |
This comment has been minimized.
This comment has been minimized.
ssokolow
commented
Oct 30, 2016
•
|
Not to mention that, in my experience, if you try to enforce your will too strongly, you start to get behaviours similar to what has been standard in the home inkjet printer market for well over a decade now. (Where the first thing you see when you open the box is a slip that warns you, in big letters, to never plug the printer in until after you've installed the software off their CD, because Microsoft's automated driver installation workflow doesn't allow them to install their fancy, tray-resident, bloated, talking print drivers and their official position is that, if Microsoft's installer has had a chance to run, your OS is now broken and must be repaired first.) Better to have an official way to run a post-build script than to see everyone and their dog reinventing broken wheels... especially since, as a Stubborn Person™, I can easily foresee these horrors:
(Also, keep in mind that, as Rust sees more corporate uptake, we'll see more "I'm too busy to learn the 'proper' way, so I'll just hack something in" WTFs. That's just a basic rule of programming in general.) |
KalitaAlexey
referenced this issue
Jan 16, 2017
Closed
Extending `cargo test` with extra steps #3541
This comment has been minimized.
This comment has been minimized.
Kixunil
commented
Jan 29, 2017
|
In embedded development it's useful to run |
This comment has been minimized.
This comment has been minimized.
yasammez
commented
Mar 19, 2017
|
This would be useful for stuff like
when developing Windows drivers in Testmode. |
This comment has been minimized.
This comment has been minimized.
|
This would be useful for packaging debian applications, especially when combined with configuration |
This comment has been minimized.
This comment has been minimized.
|
|
kinetiknz
referenced this issue
Apr 10, 2017
Merged
Build example/test FFI integration test via a Cargo integration test. #87
This comment has been minimized.
This comment has been minimized.
Boscop
commented
Apr 20, 2017
•
|
Why not do this: |
This comment has been minimized.
This comment has been minimized.
Kixunil
commented
Apr 22, 2017
|
@Boscop I like that idea but I worry that executing another binary every compilation might slow down iterative development. Maybe using |
This comment has been minimized.
This comment has been minimized.
Boscop
commented
Apr 22, 2017
|
I think there won't really be a slowdown compared to having different scripts for success/failure because if your postbuid.rs script checks the build status first and then returns if it's not success/failure, it won't really slow things down. The postbuild.rs script won't have to be recompiled every time, only when it changes. So calling it will just incur the cost of starting an executable that immediately returns. |
This comment has been minimized.
This comment has been minimized.
Kixunil
commented
Apr 24, 2017
|
That sounds reasonable. |
This comment has been minimized.
This comment has been minimized.
tanis2000
commented
Jun 9, 2017
|
@Boscop idea of the |
This comment has been minimized.
This comment has been minimized.
JoeyAcc
commented
Jun 26, 2017
|
Not that I'm advocating for it per se, but Cargo already is a general purpose build system due to the cargo plugins (e.g. So the real question becomes: How ergonomic do we want to make this general-purpose build system? |
This comment has been minimized.
This comment has been minimized.
Boscop
commented
Jun 26, 2017
|
Cargo is not a general purpose build system in the sense that e.g. cmake is. |
This comment has been minimized.
This comment has been minimized.
JoeyAcc
commented
Jun 26, 2017
•
|
Cargo is more restricted than e.g. CMake in the sense that there are assumptions about e.g. where to download dependencies, that each such dependency is a rust crate etc. That doesn't mean it's not general purpose, since again each cargo "plugin" (AFAIK just some binary that masquerades as a part of Cargo) can do whatever it wants to, including downloading arbitrary projects (including non-rust ones), and mangling them in arbitrary ways, including building them. That is why I view this as a discussion about ergonomicity rather than capability. |
This comment has been minimized.
This comment has been minimized.
ssokolow
commented
Jun 26, 2017
Agreed. I won't restate my previous comment, but I highly recommend that anyone who hasn't seen/doesn't remember it should scroll up and read it. There are a couple of ways in which I can very easily imagine people who "just need to get work done" foisting a a monstrosity of a bodge on the rest of us. |
This comment has been minimized.
This comment has been minimized.
|
Just to make sure folks are aware, there are at least two Rust projects which make executing stuff in addition to cargo build simpler: https://github.com/casey/just |
This comment has been minimized.
This comment has been minimized.
JoeyAcc
commented
Aug 25, 2017
|
Especially While that is certainly a workable solution for a lot of projects, I still have to wonder if long-term we want to incorporate that kind of functionality directly into Cargo. |
This comment has been minimized.
This comment has been minimized.
ssokolow
commented
Aug 25, 2017
•
|
The problem with For example, suppose you want to build a Rust binary that depends on a The only solution, currently, is to manually build the |
This comment has been minimized.
This comment has been minimized.
JoeyAcc
commented
Aug 25, 2017
|
Couldn't a build dependency on Even though Cargo may not be explicitly aware of |
This comment has been minimized.
This comment has been minimized.
ssokolow
commented
Aug 25, 2017
|
How would that help to run something after the dependency is compiled without either forcing all downstream dependencies to also explicitly use/call |
This comment has been minimized.
This comment has been minimized.
JoeyAcc
commented
Aug 25, 2017
|
After the dependency is compiled this solution wouldn't do a thing of course. So this wouldn't help with e.g. pre-existing native (C/C++) dependencies, but it could help with some Cargo projects I think. |
This comment has been minimized.
This comment has been minimized.
ssokolow
commented
Aug 25, 2017
|
And the whole point I've been trying to make is that, in certain contexts, there are tasks which (eg. modifications to the built ELF/Mach-O/PE files where To summarize my first comment, if you don't accomodate these enough, you'll get horrendous hacks from people who care more about getting work done than tying themselves in knots to make the perfect codebase. (Such as the example I mentioned of firing off something in |
This comment has been minimized.
This comment has been minimized.
|
RFC for build system integration may be relevant to this. |
This comment has been minimized.
This comment has been minimized.
Boscop
commented
Dec 2, 2017
|
What would be the best way to do post build script execution by starting a process that waits in the background; should that process use the notify crate to wait for a write event on Would it make sense to publish a generic post build task runner tool, installable as a cargo binary? |
This comment has been minimized.
This comment has been minimized.
Kixunil
commented
Dec 5, 2017
|
@Boscop sounds very hacky to me. Anyone wanting to implement it would spend their time better by writing PR agains Cargo. |
This comment has been minimized.
This comment has been minimized.
SoniEx2
commented
Dec 9, 2017
|
Need to cat a zip to a bin. This would be useful, even if restricted to application/binary builds. |
mgattozzi
referenced this issue
Jan 17, 2018
Closed
Need to be able to link against other `.wasm` files #22
This comment has been minimized.
This comment has been minimized.
gnzlbg
commented
Feb 23, 2018
|
I need to do something with my binary after I build it and before it is installed. Without a post build script |
This comment has been minimized.
This comment has been minimized.
FredrikAleksander
commented
Mar 26, 2018
|
In one of my projects, I need to generate a symbol map after building, and it is pretty annoying this cannot be done via Cargo. My current solution is using gnu make instead of Cargo, and have make call cargo when it needs to build rust. This is a really hacky solution, and it would be easily solved with a post build script |
This comment has been minimized.
This comment has been minimized.
dancrossnyc
commented
Jun 18, 2018
|
+1 on the need for this or something very like it. I need to run |
This comment has been minimized.
This comment has been minimized.
timburks
commented
Jul 6, 2018
|
I'm also using rust to build macOS apps, currently by calling cargo from a shell script. A suggestion that I haven't seen yet is to name the post-build script
|
This comment has been minimized.
This comment has been minimized.
|
cc #3483 |
vosen commentedSep 10, 2014
Currently, cargo execute scrips before the build starts with the
buildfield. I propose renamingbuildtopre_buildand addingpost_build(which would run after every successful build). It's useful for general postprocessing: running executable packers, zipping files, copying stuff, logging, etc.