Thanks. I've found this statement:
The Skylark http_archive is also a drop-in replacement for the native new_http_archive (with the same proviso).
to be very helpful.
> Also, to allow more time for the transition, the mentioned change will not
> be submitted before the 0.15.0 release is cut. Still, please adapt your repositories
> to this upcoming change.
It seems not as straight forward as expected.
I tried to switch gerrit code review to consume
Skylark based {http,git}_archive rules. It turns
out, that we cannot fix that "ourself" only, but
also depends on other projects, most notably
rules_closure.
I've sent that PR: [1]. But let assume, this PR is
not merged at the time when 0.16.0 version is
released, that deprecates native rules. Now what?
a) freeze Bazel version at 0.15.0 on our side
b) add --incompatible_remove_native_{git_repository,http_archive}
to tools/bazel.rc in gerrit tree, and hope that rules_closure
switched to the Skylark rules before support for --incompatible...
option is removed from Bazel
c) fork rules_closure with [1] applied
...
OK.
> Depending on how you import rules_closure, there might also be
> option "(c') patch on import" using the patches or patch_cmds
> attributes of the skylark http_archive and git_respository rules.
Ah, I missed that feature in Skylark http_archive rule.
Untill now, it was rather cumbersome to patch third
party dependencies. I will look into doing it in this
non-intrusive way. Thanks.
It works as advertised: [1]. Patching third party dependency,
rules_closure in our case, "patch on import" is very impressive
feature, thanks so much for adding it!
Things I've noticed during migration:
1. I'm seeing some left over debug print statements
that could probably be removed:
DEBUG: /home/davido/.cache/bazel/_bazel_davido/5c01f4f713b675540b8b424c5c647f63/external/bazel_tools/tools/build_defs/repo/http.bzl:46:5: patch file //:0001-Replace-native-http-git-_archive-with-Skylark-rules.patch, path /home/davido/projects/gerrit2/0001-Replace-native-http-git-_archive-with-Skylark-rules.patch
2. http_file Skylark variant is not a drop in replacement for
native http_file rule, unfortunately. The provided file name is
now hard coded to always be "downloaded": [2]. So in our case,
native http_file was previously "polymer_closure.js". To satisfy
the follow-up processing (closure compiler) we have to add an
intermediate steps to rename "downloaded" to required file
with ".js" suffix: [3]. This could be probably improved.
[1] https://gerrit-review.googlesource.com/c/gerrit/+/182491
[2] https://github.com/bazelbuild/bazel/blob/master/tools/build_defs/repo/http.bzl#L77
[3] http://paste.openstack.org/show/722557