You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, this only runs the action if the file is missing - it won't know when to re-run it. I assume the intention is to specify (deps), but I can't do that (the dependencies aren't statically known), nor would I want to duplicate them since they're already specifid in the gup build rule.
Is it possible to specify that this rule should always run?
I understand that specifying deps accurately in jbuilder might make things faster, but in this case gup itself tracks dependencies accurately and finishes in a tenth of a second when there's nothing to do, so I'd be quite happy to pay that cost. I guess the other issue might be that it causes "everything depending on version.ml" to get rebuilt, even if the contents of version.ml don't change.
I understand that specifying deps accurately in jbuilder might make things faster
Note that this kind of thing doesn't just make things slower, it bakes in a notion of "always". This is a problem if jbuilder went on to support proper reactive builds -- i.e. using things like inotify or polling to rebuild whenever something changes. In that situation it is not clear what "always rebuild" means.
Really you want to accurately specify all dependencies. Is there no way you can convince this gup tool to tell you what it wants to read to make version.ml -- or even what it already read when making version.ml?
I guess the other issue might be that it causes "everything depending on version.ml" to get rebuilt, even if the contents of version.ml don't change.
This shouldn't happen since jbuilder will take a digest of version.ml and use that to decide if things need rebuilding.
Really you want to accurately specify all dependencies. Is there no way you can convince this gup tool to tell you what it wants to read to make version.ml
In this case the dependencies are dynamic. Before it's been built, gup knows it must need building. When it first builds it, the build script tracks the dependencies that it used. And then if they change, the builder is run again (at which point it may record different metadata).
if the contents of that file are a sha, we're done (at least in terms of deps)
if the contents of that file match refs/heads/*, then depend on that file too
It's not a big set of dependencies, but it is dynamic, so I was curious what my options were with jbuilder. I thought I'd have to recursively depend on all of .git (which is a bit lame) until I reread the script and realised I could get away with depending on HEAD and refs/heads/*. It's inaccurate, but it'll do.
-- or even what it already read when making version.ml?
That sounds like exactly what I want! If I can get a list of the files that my (now-built target) last depended on, how could I get jbuilder to use it? Can I use :include for deps?
From the perspective of fully reactive builds, it may be that a missing concept is that of a rule to generate a target which is executed only if there is some dependency on that target and that other dependent target needs to be rebuilt for some reason. That is, a rule that does not itself trigger rebuilds, but is executed if a rebuild is triggered for some other reason.
On Sep 14, 2017, at 3:47 PM, Leo White ***@***.***> wrote:
I understand that specifying deps accurately in jbuilder might make things faster
Note that this kind of thing doesn't just make things slower, it bakes in a notion of "always". This is a problem if jbuilder went on to support proper reactive builds -- i.e. using things like inotify or polling to rebuild whenever something changes. In that situation it is not clear what "always rebuild" means.
Really you want to accurately specify all dependencies. Is there no way you can convince this gup tool to tell you what it wants to read to make version.ml -- or even what it already read when making version.ml?
I guess the other issue might be that it causes "everything depending on version.ml" to get rebuilt, even if the contents of version.ml don't change.
This shouldn't happen since jbuilder will take a digest of version.ml and use that to decide if things need rebuilding.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#255 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ABZhztu6IMHwGmpOkrjWZLOHNZr3n7Xpks5siTyZgaJpZM4PXgNE>.
I'd be quite happy with that suggestion, @jberdine.
For what it's worth I found another issue with this same use case - my version.ml.gup script (linked above) can be executed from outside a git repo (e.g. a downloaded tarball), in which case it sets commit to None in the generated module.
My jbuilder rule which depends on .git/HEAD and .git/refs/heads/* doesn't hold up in this scenario, as jbuilder doesn't appear to support optional dependencies and fails with "File unavailable: .git/HEAD"
I tried to trick it into depending on a possibly-empty-set via (glob_files ${SCOPE_ROOT}/../../.git/HEAD*), but then it failed with "Description: Build.get_glob_result_exn: got unevaluated"
I've created an issue for this in #298, but I thought I'd mention it here since it breaks my current workaround for this issue.
A couple of thoughts about how this could be implemented. If you could depend on a magic token or singleton stanza (perhaps :world), where the behaviour is either:
1 - always dirty:
:world is always considered dirty when considering what to build (i.e. on first run, and whenever a build is triggered for any other reason)
it's impossible to trigger :worldbecoming dirty via file modification etc, because it doesn't map to a real file
2 - dirty on first run:
:world is considered dirty when getting the initial set of stuff to build
after that (on polling builds), :world has no effect (never dirty)
Honestly I'd be fine with either of these options.
ghost added a commit that references this issue on Mar 11, 2018
Activity
lpw25 commentedon Sep 14, 2017
Note that this kind of thing doesn't just make things slower, it bakes in a notion of "always". This is a problem if jbuilder went on to support proper reactive builds -- i.e. using things like inotify or polling to rebuild whenever something changes. In that situation it is not clear what "always rebuild" means.
Really you want to accurately specify all dependencies. Is there no way you can convince this
guptool to tell you what it wants to read to makeversion.ml-- or even what it already read when makingversion.ml?This shouldn't happen since jbuilder will take a digest of
version.mland use that to decide if things need rebuilding.timbertson commentedon Sep 15, 2017
Ah, that's a fair point.
In this case the dependencies are dynamic. Before it's been built, gup knows it must need building. When it first builds it, the build script tracks the dependencies that it used. And then if they change, the builder is run again (at which point it may record different metadata).
The build script is here:
https://github.com/timbertson/passe/blob/30e7992aee9f399d2ebd8bdcdaf54432c718372d/src/common/version.ml.gup
The dependency logic is:
refs/heads/*, then depend on that file tooIt's not a big set of dependencies, but it is dynamic, so I was curious what my options were with jbuilder. I thought I'd have to recursively depend on all of
.git(which is a bit lame) until I reread the script and realised I could get away with depending on HEAD and refs/heads/*. It's inaccurate, but it'll do.That sounds like exactly what I want! If I can get a list of the files that my (now-built target) last depended on, how could I get jbuilder to use it? Can I use
:includefor deps?[-]Rule which will always reuild[/-][+]Rule which will always rebuild[/+]jberdine commentedon Sep 22, 2017
timbertson commentedon Oct 26, 2017
I'd be quite happy with that suggestion, @jberdine.
For what it's worth I found another issue with this same use case - my version.ml.gup script (linked above) can be executed from outside a git repo (e.g. a downloaded tarball), in which case it sets
committo None in the generated module.My jbuilder rule which depends on .git/HEAD and
.git/refs/heads/*doesn't hold up in this scenario, as jbuilder doesn't appear to support optional dependencies and fails with "File unavailable: .git/HEAD"I tried to trick it into depending on a possibly-empty-set via
(glob_files ${SCOPE_ROOT}/../../.git/HEAD*), but then it failed with "Description: Build.get_glob_result_exn: got unevaluated"I've created an issue for this in #298, but I thought I'd mention it here since it breaks my current workaround for this issue.
timbertson commentedon Mar 8, 2018
A couple of thoughts about how this could be implemented. If you could depend on a magic token or singleton stanza (perhaps
:world), where the behaviour is either:1 - always dirty:
:worldis always considered dirty when considering what to build (i.e. on first run, and whenever a build is triggered for any other reason):worldbecoming dirty via file modification etc, because it doesn't map to a real file2 - dirty on first run:
:worldis considered dirty when getting the initial set of stuff to build:worldhas no effect (never dirty)Honestly I'd be fine with either of these options.
Add ${build-number}