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

The csharp_repositories functions reference to dotnet/nunit.BUILD doesn't work #6

Closed
zaphar opened this issue Apr 4, 2016 · 8 comments
Labels

Comments

@zaphar
Copy link
Collaborator

zaphar commented Apr 4, 2016

It works if you use it inside this repositories workspace but if you include this repository in a different workspace it can't find the build file. It looks for it in the current workspace instead.

/private/var/tmp/_bazel_jwall/a4f05aced329c5d1ca55a18062777a02/external/io_bazel_rules_dotnet/bazel-bazel_rules_dotnet/examples/example_test/BUILD:3:1: every rule of type csharp_nunit_test implicitly depends upon the target '@nunit//:nunit_exe_libs', but this target could not be found because of: no such package '@nunit//': In new_http_archive rule //external:nunit the 'build_file' attribute does not specify an existing file (/Users/jwall/Downloads/csharp_tests/dotnet/nunit.BUILD does not exist).

@kchodorow
Copy link
Contributor

This is a known issue which has a fix at head (see bazelbuild/bazel#855). The csharp rules should be updated to refer to nunit.BUILD by label, btu if you're using an older version of Bazel, you'll need to just copy the nunit.BUILD file to your current repository.

@davidzchen davidzchen added the bug label Apr 4, 2016
@zaphar
Copy link
Collaborator Author

zaphar commented Apr 4, 2016

Okay so I just tried using a fully qualified label with head bazel and I still get an error:

/private/var/tmp/_bazel_jwall/a4f05aced329c5d1ca55a18062777a02/external/io_bazel_rules_dotnet/examples/example_test/BUILD:3:1: every rule of type csharp_nunit_test implicitly depends upon the target '@nunit//:nunit_framework', but this target could not be found because of: no such package '@nunit//': Unable to load package for @io_bazel_rules_dotnet//dotnet/nunit.BUILD: not found.

Am I just doing this wrong or is the fix not in github yet?

@zaphar
Copy link
Collaborator Author

zaphar commented Apr 4, 2016

never mind. found the error.

@zaphar
Copy link
Collaborator Author

zaphar commented Apr 4, 2016

@davidzchen Looks like it has to be a fully qualified name to work. so //dotnet:nunit.BUILD won't always work but @io_bazel_rules_dotnet//dotnet:nunit.BUILD will.

@davidzchen
Copy link
Member

The problem with fully-qualifying the label that way is that it would only work if there is an external repository called io_bazel_rules_dotnet, in which chase running the examples from within the rules_dotnet repository would not work.

IIUC, this recent change by @kchodorow should fix this issue so that referring to //dotnet:nunit.BUILD from csharp.bzl in rules_dotnet will resolve to the //dotnet:nunit.BUILD within rules_dotnet.

@zaphar, which version of Bazel are you running? Can you try running Bazel at HEAD and see if this works for you?

@zaphar
Copy link
Collaborator Author

zaphar commented Apr 5, 2016

To verify I just git pulled and rebuilt bazel from head and then tested again. I still get this error:

/private/var/tmp/_bazel_jwall/a4f05aced329c5d1ca55a18062777a02/external/io_bazel_rules_dotnet/examples/example_test/BUILD:3:1: every rule of type csharp_nunit_test implicitly depends upon the target '@nunit//:nunit_framework', but this target could not be found because of: no such package '@nunit//': Unable to load package for //dotnet:nunit.BUILD: not found.

I can get this consistently by copying the examples directory from the rules_dotnet repo to a different directory and importing the rules_dotnet workspace as a local repo then trying to run the //examples/example_test:MyTest test from there.

@zaphar
Copy link
Collaborator Author

zaphar commented Apr 5, 2016

My bazel is on revision: e25642a2bcb68d553fe56b0c3d6262544b15a870

@zaphar
Copy link
Collaborator Author

zaphar commented Apr 15, 2016

Hrmmm So after looking at the advice given to the Closure rules I think the fix is to do str(Label("//dotnet:nunit.BUILD")) instead of just "//dotnet:nunit.BUILD" Which is a little janky but works.

@zaphar zaphar closed this as completed in bdec1a6 Apr 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants