Closed dpursehouse closed 6 years ago
I don't know what the root cause is, but switching to using the skylark git_repository rule in bazlets.bzl fixes the problem. Since we are deprecating the native git rules, I'm not going to keep investigating at the moment. If this is blocking you right now and you can't switch, please reopen the bug.
Thanks, that works. Is there also a replacement for native.local_repository
?
There isn't (and there aren't currently plans to replace it). Are you seeing failures with local_repository as well?
And thanks for migrating the git rules so quickly! :)
Are you seeing failures with local_repository as well?
Yes, but I'm not sure what is causing it. If I switch to use native.local_repository
pointing to my local clone of bazlets, i.e. with a diff like this:
admin-console $ git diff
diff --git a/WORKSPACE b/WORKSPACE
index 4e30c88..1269528 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -4,7 +4,7 @@ load("//:bazlets.bzl", "load_bazlets")
load_bazlets(
commit = "0cdf281f110834b71ae134afe0a7e3fe346f0078",
- # local_path = "/home/<user>/projects/bazlets",
+ local_path = "/Users/dpursehouse/git/bazlets",
)
#Snapshot Plugin API
where the local repo contains the same sha1 as I was using with the remote repo (i.e. it is exactly the same contents), then the build starts failing with java compilation errors that look like being caused by the wrong Gerrit API:
admin-console $ bazel build admin-console
Starting local Bazel server and connecting to it...
INFO: Analysed target //:admin-console (18 packages loaded).
INFO: Found 1 target...
ERROR: /Users/dpursehouse/git/gerrit-plugins/admin-console/BUILD:3:1: Building libadmin-console__plugin-class.jar (6 source files) failed (Exit 1)
src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowAccountCommand.java:25: error: cannot find symbol
import com.google.gerrit.reviewdb.client.AccountExternalId;
^
symbol: class AccountExternalId
location: package com.google.gerrit.reviewdb.client
src/main/java/com/googlesource/gerrit/plugins/adminconsole/ListUsersCommand.java:51: error: cannot find symbol
ResultSet<Account> accounts = db.accounts().all();
^
symbol: method accounts()
location: variable db of type ReviewDb
src/main/java/com/googlesource/gerrit/plugins/adminconsole/ListUsersCommand.java:82: error: method find in class AccountResolver cannot be applied to given types;
Account accountFromResolver = accountResolver.find(db, id);
^
required: String
found: ReviewDb,String
reason: actual and formal argument lists differ in length
src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowAccountCommand.java:96: error: method findAll in class AccountResolver cannot be applied to given types;
Set<Id> idList = accountResolver.findAll(db, name);
^
required: String
found: ReviewDb,String
reason: actual and formal argument lists differ in length
src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowAccountCommand.java:116: error: method find in class AccountResolver cannot be applied to given types;
account = accountResolver.find(db, id.toString());
^
required: String
found: ReviewDb,String
reason: actual and formal argument lists differ in length
src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowAccountCommand.java:131: error: cannot find symbol
db.accountExternalIds().byAccount(account.getId())) {
^
symbol: method accountExternalIds()
location: variable db of type ReviewDb
src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowAccountCommand.java:130: error: cannot find symbol
for (AccountExternalId accountExternalId :
^
symbol: class AccountExternalId
location: class ShowAccountCommand
src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowRepoAccountAccessCommand.java:108: error: method findAll in class AccountResolver cannot be applied to given types;
Set<Id> idList = accountResolver.findAll(db, name);
^
required: String
found: ReviewDb,String
reason: actual and formal argument lists differ in length
src/main/java/com/googlesource/gerrit/plugins/adminconsole/ShowRepoAccountAccessCommand.java:129: error: method find in class AccountResolver cannot be applied to given types;
account = accountResolver.find(db, id.toString());
^
required: String
found: ReviewDb,String
reason: actual and formal argument lists differ in length
Target //:admin-console failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 9.428s, Critical Path: 3.21s
INFO: 2 processes: 2 darwin-sandbox.
FAILED: Build did NOT complete successfully
@davido can you confirm if you also see this?
And thanks for migrating the git rules so quickly! :)
Well, it was for my own benefit, so... :)
I hope you didn't get spammed with notifications from all those commits. I didn't realise it would add comments here.
@dpursehouse As I see, the local repository variant of load_bazlets does not use the passed checksum. So you are using whatever local version you pointed to. Seems it is not the version you expected:)
@irengrig thanks, I hadn't thought of that. But it's strange that I never saw this problem before. It seemed to only start after edited the bzl
file to use the git_repository
skylark rule, although I don't understand how that could be. I'll try it again later.
I guess when I used it before I always had the same revision checked out locally in the bazlets
repo. Sorry for the noise.
Description of the problem / feature request:
When invoking
bazel build
from within agit submodule foreach
command, it fails witherror loading package ''
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
What operating system are you running Bazel on?
OSX 10.14
What's the output of
bazel info release
?release 0.17.2
If
bazel info release
returns "development version" or "(@non-git)", tell us how you built Bazel.N/A
What's the output of
git remote get-url origin ; git rev-parse master ; git rev-parse HEAD
?N/A
Have you found anything relevant by searching the web?
Could not find anything related to this.
Any other information, logs, or outputs that you want to share?