Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bazel 0.4.2 loading local rules does not work in new_git_repository #2293

Closed
andrewmed opened this issue Dec 23, 2016 · 4 comments
Closed

bazel 0.4.2 loading local rules does not work in new_git_repository #2293

andrewmed opened this issue Dec 23, 2016 · 4 comments
Assignees

Comments

@andrewmed
Copy link

andrewmed commented Dec 23, 2016

With this in WORKSPACE:

new_git_repository(
    name = "hiccup",
    commit = "53057de9799b27d5d0ddfe865fdac6e7a141d896",
    build_file_content = """
load("//build_tools/clojure:clojure.bzl", "clojure")
clojure(
    name = "src",
    namespace = "src.hiccup.core",
)""",
    remote = "https://github.com/weavejester/hiccup.git",
)

as it says, bzl rule should be loaded from a local repository //build_tools/clojure:clojure.bzl

However, when called, the rule is looked upon in remote new_git_repository repository:

andy@laptop:~/repo/build_tools/clojure/tests$ bazel run :two
ERROR: /home/andy/repo/build_tools/clojure/tests/BUILD:9:1: error loading package '@hiccup//': Extension file not found. Unable to load package for '@hiccup//build_tools/clojure:clojure.bzl': BUILD file not found on package path and referenced by '//build_tools/clojure/tests:two'.
ERROR: Analysis of target '//build_tools/clojure/tests:two' failed; build aborted.
INFO: Elapsed time: 0.157s
ERROR: Build failed. Not running target.

here is //build_tools/clojure/tests

load("//build_tools/clojure:clojure.bzl", "clojure")

clojure(
    name = "one",
)
clojure(
    name = "two",
    deps = [
        "@hiccup//:src",
        ":one_library",
    ],
)

Environment info

@damienmg
Copy link
Contributor

This is a workaround until this get fixed but you actually access the main repository from a remote repository so you should use @//build_tools/clojure:clojure.bzl. Without the @ prefix it resolve to a repository local label, from the @hiccup repository so it is like @hiccup//build_tools/clouure:clojure.bzl.

So your new workspace file should looks like:

new_git_repository(
    name = "hiccup",
    commit = "53057de9799b27d5d0ddfe865fdac6e7a141d896",
    build_file_content = """
load("@//build_tools/clojure:clojure.bzl", "clojure")
clojure(
    name = "src",
    namespace = "src.hiccup.core",
)""",
    remote = "https://github.com/weavejester/hiccup.git",
)

@damienmg
Copy link
Contributor

damienmg commented Jan 9, 2017

This does seems resolved, closing, please ping if you still have issues

@damienmg damienmg closed this as completed Jan 9, 2017
@andrewmed
Copy link
Author

Hello Damien
Yes with 'at' sign it works perfect

@damienmg
Copy link
Contributor

Glad to hear :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants