{"action":"created","issue":{"url":"https://api.github.com/repos/bazelbuild/bazel/issues/694","labels_url":"https://api.github.com/repos/bazelbuild/bazel/issues/694/labels{/name}","comments_url":"https://api.github.com/repos/bazelbuild/bazel/issues/694/comments","events_url":"https://api.github.com/repos/bazelbuild/bazel/issues/694/events","html_url":"https://github.com/bazelbuild/bazel/issues/694","id":120934044,"number":694,"title":"Unable to generate thrift and proto files","user":{"login":"kramasamy","id":367684,"avatar_url":"https://avatars.githubusercontent.com/u/367684?v=3","gravatar_id":"","url":"https://api.github.com/users/kramasamy","html_url":"https://github.com/kramasamy","followers_url":"https://api.github.com/users/kramasamy/followers","following_url":"https://api.github.com/users/kramasamy/following{/other_user}","gists_url":"https://api.github.com/users/kramasamy/gists{/gist_id}","starred_url":"https://api.github.com/users/kramasamy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kramasamy/subscriptions","organizations_url":"https://api.github.com/users/kramasamy/orgs","repos_url":"https://api.github.com/users/kramasamy/repos","events_url":"https://api.github.com/users/kramasamy/events{/privacy}","received_events_url":"https://api.github.com/users/kramasamy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-08T05:29:47Z","updated_at":"2015-12-08T05:47:44Z","closed_at":null,"body":"We used to use a version of bazel compiled from source around June 2015. I recently upgraded it to use bazel 0.1.2. Now bazel complains that it genthrift.bzl and genproto.bzl rules do not generate any files.\r\n\r\nbazel build src/thrift:thrift-java \r\nERROR: /Users/kramasamy/Software/heron44/src/thrift/BUILD:13:12: in srcs attribute of java_library rule //src/thrift:thrift-java: '//src/thrift:thrift_scribe_java' does not produce any java_library srcs files (expected .java, .srcjar or .properties).\r\nERROR: Analysis of target '//src/thrift:thrift-java' failed; build aborted.\r\nINFO: Elapsed time: 0.199s.\r\n\r\ngenthrift.bzl is located in tools/rules/genthrift.bzl and the contents are here\r\n\r\ndef thrift_package_impl(ctx):\r\n  return struct(thrift_src = ctx.file.src)\r\n\r\ngenthrift_base_attrs = {\r\n    \"src\": attr.label(\r\n        allow_files = FileType([\".thrift\"]),\r\n        single_file = True,\r\n    ),\r\n    \"deps\": attr.label_list(\r\n        allow_files = False,\r\n        providers = [\"thrift_src\"],\r\n    ),\r\n}\r\n\r\nthrift_package = rule(\r\n    thrift_package_impl,\r\n    attrs = genthrift_base_attrs,\r\n)\r\n\r\ndef genthrift_java_impl(ctx):\r\n  src = ctx.file.src\r\n  thrift = ctx.file._thrift\r\n\r\n  srcjar = ctx.new_file(ctx.configuration.genfiles_dir, ctx.label.name + \".srcjar\")\r\n  java_srcs = srcjar.path + \".srcs\"\r\n\r\n  inputs = [src, thrift]\r\n  java_cmd = '\\n'.join([\r\n      \"set -e\",\r\n      \"rm -rf \" + java_srcs,\r\n      \"mkdir \" + java_srcs,\r\n      thrift.path + \" -r --gen java -o \" + java_srcs + \" \" + src.path,\r\n      \"jar cMf \" + srcjar.path + \" -C \" + java_srcs + \" .\",\r\n      \"rm -rf \" + java_srcs,\r\n  ])\r\n  ctx.action(\r\n      inputs = inputs,\r\n      outputs = [srcjar],\r\n      mnemonic = 'ThriftJava',\r\n      command = java_cmd,\r\n      use_default_shell_env = True)\r\n\r\n  return struct(files = set([srcjar]))\r\n\r\ngenthrift_java = rule(\r\n    genthrift_java_impl,\r\n    attrs = genthrift_base_attrs + {\r\n        \"_thrift\": attr.label(\r\n            default = Label(\"//3rdparty/thrift:thrift\"),\r\n            allow_files = True,\r\n            single_file = True,\r\n        ),\r\n    },\r\n)\r\n\r\ndef thrift_library(name, src=None, deps=[], visibility=None,\r\n                  gen_java=False, gen_cc=False):\r\n  if not src:\r\n    if name.endswith(\"_thrift\"):\r\n      src = name[:-7]+\".thrift\"\r\n    else:\r\n      src = name+\".thrift\"\r\n  thrift_package(name=name, src=src, deps=deps)\r\n\r\n  if gen_java:\r\n    genthrift_java(\r\n        name = name+\"_java_src\",\r\n        src = src,\r\n        deps = deps,\r\n        visibility = [\"//visibility:private\"],\r\n    )\r\n    java_deps = [\r\n        \"//3rdparty/thrift:thrift-java\",\r\n        \"//3rdparty/logging:logging-java\",\r\n    ]\r\n    for dep in deps:\r\n      java_deps += [dep+\"_java\"]\r\n    native.java_library(\r\n        name  = name+\"_java\",\r\n        srcs = [name+\"_java_src\"],\r\n        deps = java_deps,\r\n        visibility = visibility,\r\n    )\r\n\r\nit depends on thrift executable invoking which depends on the host cpu\r\n\r\nicenses([\"notice\"])\r\n\r\npackage(default_visibility = [\"//visibility:public\"])\r\n\r\nfilegroup(\r\n    name = \"thrift\",\r\n    srcs = select({\r\n        \":darwin\": [\"thrift-osx-x86_64.exe\"],\r\n        \":k8\": [\"thrift-linux-x86_64.exe\"],\r\n    }),\r\n)\r\n\r\njava_import(\r\n    name = \"thrift-java\",\r\n    jars = [\"libthrift-0.5.0-1.jar\"],\r\n)\r\n\r\nconfig_setting(\r\n    name = \"darwin\",\r\n    values = {\"host_cpu\": \"darwin\"},\r\n)\r\n\r\nconfig_setting(\r\n    name = \"k8\",\r\n    values = {\"host_cpu\": \"k8\"},\r\n)\r\n"},"comment":{"url":"https://api.github.com/repos/bazelbuild/bazel/issues/comments/162775013","html_url":"https://github.com/bazelbuild/bazel/issues/694#issuecomment-162775013","issue_url":"https://api.github.com/repos/bazelbuild/bazel/issues/694","id":162775013,"user":{"login":"kamalmarhubi","id":50936,"avatar_url":"https://avatars.githubusercontent.com/u/50936?v=3","gravatar_id":"","url":"https://api.github.com/users/kamalmarhubi","html_url":"https://github.com/kamalmarhubi","followers_url":"https://api.github.com/users/kamalmarhubi/followers","following_url":"https://api.github.com/users/kamalmarhubi/following{/other_user}","gists_url":"https://api.github.com/users/kamalmarhubi/gists{/gist_id}","starred_url":"https://api.github.com/users/kamalmarhubi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kamalmarhubi/subscriptions","organizations_url":"https://api.github.com/users/kamalmarhubi/orgs","repos_url":"https://api.github.com/users/kamalmarhubi/repos","events_url":"https://api.github.com/users/kamalmarhubi/events{/privacy}","received_events_url":"https://api.github.com/users/kamalmarhubi/received_events","type":"User","site_admin":false},"created_at":"2015-12-08T05:47:44Z","updated_at":"2015-12-08T05:47:44Z","body":"To make this readable, could you surround your code with triple backticks?\r\n\r\n    ```\r\n    your code\r\n    ```\r\n\r\nOr better: add the contents of the files to a gist: https://gist.github.com/"}}