bazel icon indicating copy to clipboard operation
bazel copied to clipboard

new_http_archive refreshes archive when build_file_content changes

Open dfabulich opened this issue 10 years ago • 3 comments

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

dfabulich avatar Mar 01 '16 09:03 dfabulich

Yeah, we can definitely get rid of that extra download.

kchodorow avatar Mar 01 '16 16:03 kchodorow

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 :-)

jemdiggity avatar Feb 24 '17 09:02 jemdiggity

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.

sgowroji avatar Jan 20 '23 10:01 sgowroji