new_http_archive refreshes archive when build_file_content changes
In an empty directory, create this WORKSPACE:
new_http_archive(
name='nodejs',
url='https://nodejs.org/dist/v4.3.1/node-v4.3.1-darwin-x64.tar.gz',
sha256='9c0751ee88a47c10269eb930d7ad7b103c2ba875c3a96204ca133dc52fc50826',
build_file_content="""
# comment1
genrule(
name='file',
outs=['file.txt'],
cmd='echo hello > $@',
visibility = ["//visibility:public"],
)
""",
)
Run bazel build @nodejs//:file. Then update the # comment1 line to another number and re-run the build.
Actual: The archive is downloaded again
INFO: Downloading from https://nodejs.org/dist/v4.3.1/node-v4.3.1-darwin-x64.tar.gz: 4MB
Expected: Don't re-download the archive if we've already downloaded an archive with the correct sha256.
$ bazel version
Build label: 0.2.0-homebrew
Build target: bazel-out/local_darwin-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Feb 23 14:12:29 2016 (1456236749)
Build timestamp: 1456236749
Build timestamp as int: 1456236749
Yeah, we can definitely get rid of that extra download.
Adding the optional sha256 field also causes the archive to re-download. It would be nice if bazel checked the cached archive first, before re-downloading it. Thanks :-)
Hi there! We're doing a clean up of old issues and will be closing this one. Please reopen if you’d like to discuss anything further. We’ll respond as soon as we have the bandwidth/resources to do so.