{"action":"opened","issue":{"url":"https://api.github.com/repos/bazelbuild/bazel/issues/5633","repository_url":"https://api.github.com/repos/bazelbuild/bazel","labels_url":"https://api.github.com/repos/bazelbuild/bazel/issues/5633/labels{/name}","comments_url":"https://api.github.com/repos/bazelbuild/bazel/issues/5633/comments","events_url":"https://api.github.com/repos/bazelbuild/bazel/issues/5633/events","html_url":"https://github.com/bazelbuild/bazel/issues/5633","id":342615614,"node_id":"MDU6SXNzdWUzNDI2MTU2MTQ=","number":5633,"title":"Skylark http_file does not preserve downloaded file's extension","user":{"login":"mmorearty","id":207671,"node_id":"MDQ6VXNlcjIwNzY3MQ==","avatar_url":"https://avatars1.githubusercontent.com/u/207671?v=4","gravatar_id":"","url":"https://api.github.com/users/mmorearty","html_url":"https://github.com/mmorearty","followers_url":"https://api.github.com/users/mmorearty/followers","following_url":"https://api.github.com/users/mmorearty/following{/other_user}","gists_url":"https://api.github.com/users/mmorearty/gists{/gist_id}","starred_url":"https://api.github.com/users/mmorearty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmorearty/subscriptions","organizations_url":"https://api.github.com/users/mmorearty/orgs","repos_url":"https://api.github.com/users/mmorearty/repos","events_url":"https://api.github.com/users/mmorearty/events{/privacy}","received_events_url":"https://api.github.com/users/mmorearty/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-19T07:47:12Z","updated_at":"2018-07-19T07:47:12Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"### Description of the problem / feature request:\r\n\r\nThe title above may be a bit imprecise. Let me explain. If use the soon-to-be-deprecated `native.http_file` to download, say, a `.c` file, then I will be able to pass that file to rules that require C files, such as `cc_binary`.\r\n\r\nBut if I use the newer `http_file` that I load from `@bazel_tools//tools/build_defs/repo:http.bzl` (as described [here](https://docs.bazel.build/versions/master/skylark/backward-compatibility.html#remove-native-http-archive)), then `cc_binary` complains that the file does not have a `.c` extension.\r\n\r\nThe new `http_file` is described as a drop-in replacement for the old `native.http_file`. This behavior is different, so we probably need to either:\r\n\r\n1. (ideally) change the new one to mimic the old one's behavior, or\r\n2. document this difference, and how to work around it.\r\n\r\n### Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.\r\n\r\n`WORKSPACE`:\r\n\r\n```\r\nload(\":download.bzl\", \"download_files\")\r\n\r\ndownload_files()\r\n```\r\n\r\n`download.bzl`:\r\n\r\n```\r\nload(\"@bazel_tools//tools/build_defs/repo:http.bzl\", \"http_file\")\r\n\r\ndef download_files():\r\n    native.http_file(         # <---- this line is key\r\n        name = \"hello_c\",\r\n        urls = [\"https://raw.githubusercontent.com/laristra/c-makefile/be51f16936f81329f3c88924d70cda20a88576c3/helloworld.c\"],\r\n        sha256 = \"0a73a000d038412210a75184276966a97a5d0b8c128adf7f376b18564d4552c0\"\r\n    )\r\n```\r\n\r\n`BUILD`:\r\n\r\n```\r\ncc_binary(\r\n\tname = \"hello\",\r\n\tsrcs = [\"@hello_c//file\"],\r\n)\r\n```\r\n\r\n`$ bazel build :hello`\r\n\r\nThat will succeed (albeit with a warning from cc_binary). But then if you edit `download.bzl` to change `native.http_file` to just `http_file`, then you get this error message:\r\n\r\n```\r\nERROR: BUILD:3:9: in srcs attribute of cc_binary rule //:hello: '@hello_c//file:file' does not produce any cc_binary srcs files (expected .cc, .cpp, .cxx, .c++, .C, .c, .h, .hh, .hpp, .ipp, .hxx, .inc, .S, .s, .asm, .a, .lib, .pic.a, .lo, .lo.lib, .pic.lo, .so, .dylib, .dll, .o, .obj or .pic.o)\r\n```\r\n\r\n### What operating system are you running Bazel on?\r\n\r\nmacOS 10.13.6\r\n\r\n### What's the output of `bazel info release`?\r\n\r\nrelease 0.15.2-homebrew\r\n\r\n###  Have you found anything relevant by searching the web?\r\n\r\nNo"}}
{"actor":{"display_login":"mmorearty"}}