{"action":"created","issue":{"url":"https://api.github.com/repos/bazelbuild/bazel/issues/1704","repository_url":"https://api.github.com/repos/bazelbuild/bazel","labels_url":"https://api.github.com/repos/bazelbuild/bazel/issues/1704/labels{/name}","comments_url":"https://api.github.com/repos/bazelbuild/bazel/issues/1704/comments","events_url":"https://api.github.com/repos/bazelbuild/bazel/issues/1704/events","html_url":"https://github.com/bazelbuild/bazel/issues/1704","id":174041498,"number":1704,"title":"repository_ctx is unable to get another repository_rule's attributes","user":{"login":"jin","id":347918,"avatar_url":"https://avatars.githubusercontent.com/u/347918?v=3","gravatar_id":"","url":"https://api.github.com/users/jin","html_url":"https://github.com/jin","followers_url":"https://api.github.com/users/jin/followers","following_url":"https://api.github.com/users/jin/following{/other_user}","gists_url":"https://api.github.com/users/jin/gists{/gist_id}","starred_url":"https://api.github.com/users/jin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jin/subscriptions","organizations_url":"https://api.github.com/users/jin/orgs","repos_url":"https://api.github.com/users/jin/repos","events_url":"https://api.github.com/users/jin/events{/privacy}","received_events_url":"https://api.github.com/users/jin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/bazelbuild/bazel/labels/category:%20extensibility%20%3E%20skylark%20remote%20repositories","name":"category: extensibility > skylark remote repositories","color":"d4c5f9"},{"url":"https://api.github.com/repos/bazelbuild/bazel/labels/P2","name":"P2","color":"e99695"},{"url":"https://api.github.com/repos/bazelbuild/bazel/labels/type:%20documentation","name":"type: documentation","color":"0052cc"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-08-30T14:53:32Z","updated_at":"2016-08-30T17:10:10Z","closed_at":null,"body":"I'm currently trying to implement a couple of `repository_rule` rules in Skylark. \r\n\r\nMy `maven_rules.bzl` file looks like this:\r\n\r\n```bzl\r\ndef maven_jar_impl(repo_ctx):\r\n   ...\r\n\r\nmaven_jar_attrs = { \r\n  server: attr.label(), # refers to a maven_server target\r\n  ... \r\n}\r\n\r\nmaven_jar = repository_rule(\r\n  maven_jar_impl, \r\n  attrs=maven_jar_attrs, \r\n  ...\r\n)\r\n\r\ndef maven_server_impl(repo_ctx):\r\n  ...\r\n  \r\nmaven_server_attr = { \r\n  url=attr.string(),\r\n  ...\r\n}\r\n\r\nmaven_server = repository_rule(\r\n  maven_server_impl,\r\n  attrs=maven_server_attr,\r\n  ...\r\n)\r\n```\r\n\r\nHow do you retrieve the `url` attribute of the referenced `maven_server` target within `maven_jar_impl`, hopefully via `repo_ctx`? I've looked around and found `native.existing_rules()` and `native.existing_rule(name)`, but they do not work in the analysis phase."},"comment":{"url":"https://api.github.com/repos/bazelbuild/bazel/issues/comments/243510185","html_url":"https://github.com/bazelbuild/bazel/issues/1704#issuecomment-243510185","issue_url":"https://api.github.com/repos/bazelbuild/bazel/issues/1704","id":243510185,"user":{"login":"kchodorow","id":17042,"avatar_url":"https://avatars.githubusercontent.com/u/17042?v=3","gravatar_id":"","url":"https://api.github.com/users/kchodorow","html_url":"https://github.com/kchodorow","followers_url":"https://api.github.com/users/kchodorow/followers","following_url":"https://api.github.com/users/kchodorow/following{/other_user}","gists_url":"https://api.github.com/users/kchodorow/gists{/gist_id}","starred_url":"https://api.github.com/users/kchodorow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kchodorow/subscriptions","organizations_url":"https://api.github.com/users/kchodorow/orgs","repos_url":"https://api.github.com/users/kchodorow/repos","events_url":"https://api.github.com/users/kchodorow/events{/privacy}","received_events_url":"https://api.github.com/users/kchodorow/received_events","type":"User","site_admin":false},"created_at":"2016-08-30T17:10:10Z","updated_at":"2016-08-30T17:10:10Z","body":"> you can wrap maven_jar as a macro that calls the real maven_jar passing along the url to the actual maven_jar\r\n\r\nWhat?"}}
{"actor":{"display_login":"kchodorow"}}