-
Notifications
You must be signed in to change notification settings - Fork 412
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
Ability to tell jbuilder
where to place build artifacts.
#291
Comments
I think that this feature would be easy to add. The difficulty I see here is convincing the maintainers that this feature is desirable. |
@rgrinberg I'm not sure what you mean by "build root". The requested feature is that To make things simple, you could require that all invocations of |
To explain some more about why this is a really compelling feature for us: We're building a tool that allows packages to mark themselves as supporting out of source builds, and ones that do get to share original source files, and build artifacts across many/all projects on the system (in addition to sharing them across the network which will be supported anyways). If jbuilder supports this then projects that use jbuilder will get a significant speedup in our workflow. We want to showcase how fast building multiple projects can be, and jbuilder with out-of-source builds support would make a great demonstration of this. @rgrinberg what would you imagine an objection would be? |
This seems like a reasonable feature to support. I would use Implementation-wise, all we need to do is change
|
I think being able to override this in the environment is quite important
for this feature. As Jordan would really like to avoid hacking people's
jbuilder instructions. Should we use the cmdliner feature that lets us set
an option using an env var this?
…On Wed, Mar 21, 2018, 4:46 AM Jérémie Dimino ***@***.***> wrote:
This seems like a reasonable feature to support. I would use --build-dir
for the option name though.
Implementation-wise, all we need to do is change Path.to_string and
Path.reach to take into account the selected build directory. Though to
make sure we catch all cases, we should generalize the use of the Path
module. There are still a few cases in the code where we access _build
directly. So I suggest to do things in this order:
- move Path to stdune ***@***.*** <https://github.com/rgrinberg>
already suggested this)
- use Path.t instead of strings for all filenames in Io, Process,
etc... and do the conversion to a string as late as possible, i.e. just
before call to the stdlib/unix functions
- add a global variable for the build directory and use it for
Path.to_string/Path.reach
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#291 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAIe-275-ItgBl3mPPBftMrndiybbleDks5tgWrAgaJpZM4QB1bN>
.
|
Yeah, Rudi is right that for this feature, the important part is being able to set this automatically by the environment so that tooling can make sure that all packages build into the correct location without having to make every package owner of every dependency update their build config. |
Yep, using this feature of cmdliner seems good |
Okay, I'll try and to tackle this. It's easy enough but we do need to decide how to untangle some deps. For example, We just still need to decide what to do with Code_error. I think we can just change the meaning of this exception to be a "general programming error" rather than a jbuilder specific programming error. Then we can move it to |
First step in #716 |
@diml one property that might be interesting to enforce is to make sure that global variable for build root isn't set after it was already accessed. I'm thinking of something like: let build_root = ref None
let set_build_root br =
assert (!build_root = None);
build_root := br
let build_root () =
match !build_root with
| None -> build_root := Some ""; ""
| Some d -> d This is to address the possible inconsistencies that might arise from more than 1 The only issue that I see with this is that we'll need to make all those constant paths that are present around the codebase to be lazy about initializing themselves. But perhaps it would be useful to have a module Static : sig
val aliases : t Lazy.t
val db : t Lazy.t
val log : t Lazy.t
...
end |
Agreed, but I think For |
This is a great feature, thank you! |
Fixed in master. |
We're building a project workflow, and many build/cache optimizations are opened up if we are able to tell
jbuilder
, where to place the artifacts (as opposed to having it be hardcoded to the_build
directory). I'm curious how difficult this feature would be to add.The feature would not merely allow customization of the name of the build directory
_build
vs._jbuilder
etc, but would allow passing of an arbitrary location on the file system. We could then invokejbuilder
likejbuilder build --buildDest=/myPathTo/buildDir
. I believe Crate has a similar feature fwiw.The text was updated successfully, but these errors were encountered: