When a build process for a non trivial project is implemented in Buck, a lot of customscripts/recipes are created. It turns out that substantial part of these scripts/recipes isvery useful and urgently needed for other projects.Currently there is no built in way in Buck to share/reuse scripts/recipes between projects.One option would be to use bucklets: number of build.defs and python_scripts files.Project foo defines for example bucklet local_jar() [1] and publishes it with deploy_bucklet('local_jar')Project bar (unrelated to project foo) reuses that bucklet with: import_bucklet('local_jar')Question: how can deploy_bucklet() and import_bucklet() be implemented?1. upload/download it to a common bucklets-central repository2. use git submodule(s) to push/pull it into own repository
--
You received this message because you are subscribed to the Google Groups "Buck" group.
To unsubscribe from this group and stop receiving emails from it, send an email to buck-build+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Hi,This post was pointed out to me recently. Sorry for not replying before.One of the options we've discussed on the team before has been the addition of a "buck fetch" command that would walk the Target Graph and download "stuff" identified by "remote_artifact" targets to the local disk. This initial came up as a mechanism for doing something similar to what shaven-maven[1] does. We'd include an md5 as part of the rule too.
When "buck build" was run, you'd be able to treat a "remote_artifact" in much the same way you'd treat "export_file".
The important thing here is that "remote_artifact" would fail the build if "buck fetch" hadn't already grabbed the file. We want your builds to be as fast as possible, and randomly pausing to meander across the Internet for files doesn't seem to really fit with that goal.
For more options, visit https://groups.google.com/d/optout.
On Wed, Aug 13, 2014 at 6:38 AM, Simon Stewart <simon.m...@gmail.com> wrote:
Hi,This post was pointed out to me recently. Sorry for not replying before.One of the options we've discussed on the team before has been the addition of a "buck fetch" command that would walk the Target Graph and download "stuff" identified by "remote_artifact" targets to the local disk. This initial came up as a mechanism for doing something similar to what shaven-maven[1] does. We'd include an md5 as part of the rule too.Use SHA1 not MD5. Most sites like search.maven.org export the SHA1 right now.
If buck wants md5 shape internally, rebuild the hash yourself after you have fetched the payload, or (*shudder*) hash the SHA1 using MD5...
When "buck build" was run, you'd be able to treat a "remote_artifact" in much the same way you'd treat "export_file".Nice, but a super common way to use these is to have them be a prebuilt_jar(). An easy way to also say this is a JAR would be great:remote_artifact(name = "guava",mvn = "com.google.guava:guava:jar:18.0-rc1",sha1 = "9bd0d5bc8a4269bb2b5584d5498e281633c677eb",export_jar = True,)Or some such, with remote_artifact accepting either url or mvn to identify the source on the network and export_jar being optionally set to export the result as a prebuilt_jar(), without having to write another prebuilt_jar() target.
The important thing here is that "remote_artifact" would fail the build if "buck fetch" hadn't already grabbed the file. We want your builds to be as fast as possible, and randomly pausing to meander across the Internet for files doesn't seem to really fit with that goal.That would be annoying. Every time the project rolls its deps you would need to:git pullif ! buck build; then buck fetch && buck build; fiarrgh. That is annoying.
Gerrit has been working with Buck auto-downloading missing remote artifacts during the build ever since our conversion to buck. It works as well as buck caching does pulling prebuilt rules from a cache server. So long as you are well connected and the work is done in parallel, its fast.
Maven remote resources suck because Maven searches all over the Internet for something at many different URLs, and it does so without any threading. Eliminate the searching part by forcing the remote_artifact() to say exactly one URL to attempt, and fix the parallelization by using Buck's native rule parallelization.
On Wed, Aug 13, 2014 at 3:57 PM, Shawn Pearce <s...@google.com> wrote:On Wed, Aug 13, 2014 at 6:38 AM, Simon Stewart <simon.m...@gmail.com> wrote:
Hi,This post was pointed out to me recently. Sorry for not replying before.One of the options we've discussed on the team before has been the addition of a "buck fetch" command that would walk the Target Graph and download "stuff" identified by "remote_artifact" targets to the local disk. This initial came up as a mechanism for doing something similar to what shaven-maven[1] does. We'd include an md5 as part of the rule too.Use SHA1 not MD5. Most sites like search.maven.org export the SHA1 right now.
Even better. We use SHA1 throughout, but the last time I was trying to download random stuff of the Net, MD5 appeared to be the preferred way of doing things. Glad that's changed :)If buck wants md5 shape internally, rebuild the hash yourself after you have fetched the payload, or (*shudder*) hash the SHA1 using MD5...Ha. Let's not do that.When "buck build" was run, you'd be able to treat a "remote_artifact" in much the same way you'd treat "export_file".Nice, but a super common way to use these is to have them be a prebuilt_jar(). An easy way to also say this is a JAR would be great:remote_artifact(name = "guava",mvn = "com.google.guava:guava:jar:18.0-rc1",sha1 = "9bd0d5bc8a4269bb2b5584d5498e281633c677eb",export_jar = True,)Or some such, with remote_artifact accepting either url or mvn to identify the source on the network and export_jar being optionally set to export the result as a prebuilt_jar(), without having to write another prebuilt_jar() target.I can imagine each language having something similar (python would be the obvious one, but anything that has a centralized distribution point for grabbing packages or their equivalents would run into the same issue. Ruby? NodeJS?) It may be easier, if we were to do this, to allow a "remote_jar" target or perhaps add a "url" and "sha1" field to prebuilt_jar.
The important thing here is that "remote_artifact" would fail the build if "buck fetch" hadn't already grabbed the file. We want your builds to be as fast as possible, and randomly pausing to meander across the Internet for files doesn't seem to really fit with that goal.That would be annoying. Every time the project rolls its deps you would need to:git pullif ! buck build; then buck fetch && buck build; fiarrgh. That is annoying.I guess I do more disconnected work than most. My general habit before a long flight is to do a git pull and nothing else. A separate "fetch" command would mean that I'd be able to build anything in the target graph, not just what I happened to touch with a build command that may have failed.
My experience with central points holding deps hosted by a company is that central server has an uptime that can be (generously speaking) erratic. I'd much rather download things ahead of time rather than mid-build in that case. Maybe things have improved since the last time I was in The Real World? That way, a CI server can highlight that the CI target's failure was caused by third party infra choking, and not because someone has checked in something that's causing "buck build" to choke.A possible compromise would be to have both options, and allow mid-build downloads to be a failure state via a config option.Gerrit has been working with Buck auto-downloading missing remote artifacts during the build ever since our conversion to buck. It works as well as buck caching does pulling prebuilt rules from a cache server. So long as you are well connected and the work is done in parallel, its fast.Interesting data point.Maven remote resources suck because Maven searches all over the Internet for something at many different URLs, and it does so without any threading. Eliminate the searching part by forcing the remote_artifact() to say exactly one URL to attempt, and fix the parallelization by using Buck's native rule parallelization.That's what shaven-maven does. Transitive dependency resolution and only specifying one URL might help.
On Thu, Aug 14, 2014 at 7:21 AM, Simon Stewart <simon.m...@gmail.com> wrote:
On Wed, Aug 13, 2014 at 3:57 PM, Shawn Pearce <s...@google.com> wrote:On Wed, Aug 13, 2014 at 6:38 AM, Simon Stewart <simon.m...@gmail.com> wrote:
Agreed, it would be handy on prebuilt_jar(), but we also download .zip of JS so it would be handy to also have a generic remote_artifact() rule.
I am not arguing against a fetch command. For all the reasons you state a fetch command is useful; `git pull && buck fetch` *slam lid board plane* is super useful workflow.I was trying to suggest that we allow incomplete or missing fetches to run during the build itself, so the user doesn't always have to run fetch first.
If you want to support auto-discovery of Maven transitive dependencies, I would suggest doing this as a subcommand that spits out BUCK build rules you append to a build file. Don't do magically in the build.
Hi,This post was pointed out to me recently. Sorry for not replying before.One of the options we've discussed on the team before has been the addition of a "buck fetch" command that would walk the Target Graph and download "stuff" identified by "remote_artifact" targets to the local disk. This initial came up as a mechanism for doing something similar to what shaven-maven[1] does. We'd include an md5 as part of the rule too.When "buck build" was run, you'd be able to treat a "remote_artifact" in much the same way you'd treat "export_file".
As much as i can see the value for native support ror remote_jar() and remote_artifact() rules in Buck,it doesn't solve my problem. The question was, how can we extend Buck's rules set, make it pluggableand reusable. So that new recipes can be easily deployed, found and used. All this natively supported in Buck.
Currently Buck provides only base building block. To become universal build system it must be extendable.Recently one domain specific rule (GWT library) was natively added to Buck, gwt_binary(), so it can be used, a lá:gwt_binary(name = 'ui_gerrit',modules = [MODULE],style = 'OBF',optimize = 9,module_deps = [':ui_module'],deps = ['//lib/gwt:dev'],local_workers = cpu_count(),strict = True,experimental_args = GWT_COMPILER_ARGS,vm_args = GWT_JVM_ARGS,)How can Buck be extended in such a way, that such rules can be added without extending the Buck core,
and not only be added, but also be published and discovered by end users.The idea is to be able to define gwt_binary.bucklet, with saydefine_bucklet(group="facebook", name="gwt_binary", version="1.0)def gwt_binary(...):[...]And the consumer can include it in natively supported .bucklets, e. g.[providers][bucklets]facebook:gwt_binary:1.0And then it can be used as when this rule was natively built in.The implementation could implicitly fetch (cage aware, obviously) the referenced bucklet from providedlocation, say in $HOME/.buck/bucklets directory, and "mount" this directory, so that it just works.To be Swiss Army Knife build system Buck should be extendable in reusable way.Published/deployed recipes must be easily discoverable. Always patch the core or copy/paste (or include)recipes between projects/repositories doesn't scale.