Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

bazel: build the //lib folder #46929

Merged
merged 17 commits into from
Jan 27, 2023
Merged

bazel: build the //lib folder #46929

merged 17 commits into from
Jan 27, 2023

Conversation

jhchabran
Copy link
Contributor

This PR adds a bunch of fixes to be able to build //lib/....

@jbedard if you stumble across this PR, and to follow up with our conversation from yesterday, I'm adding things in separate jobs here only as a temporary measure, so I can track that I'm not breaking things as I progress through the migration. This is obviously not the final approach, which is to simply build //...

The notable fix that this PR includes is to add some build directives to the sourcegraph/scip go_repository rule, in order to deal with the fact that we're using a replace directive in our root go.mod to work around the circular depedency (sourcegraph/scip depends on sourcegraph/sourcegraph/lib which then also depends on sourcegraph/scip).

@bobheadxi I had to update internal/cmd/resources-report along the way. There are no unit tests, so apart for building it, so I couldn't really QA it further.

Fixes #46832

Test plan

I ran a main-dry-run over https://buildkite.com/sourcegraph/sourcegraph/builds/195371 to ensure merging this does not break anything.

@@ -26,3 +26,5 @@ client/plugin-backstage/node_modules

cmd/symbols/squirrel/test_repos/starlark
docker-images/syntax-highlighter/crates/sg-syntax/src/snapshots/

lib/codeintel/precise/diff/testdata/
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can get picked up by gazelle and will incorectly generate buildfiles.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you use a glob? Likely this isn't the only place we have go code that lives under testdata dir. Go compiler always ignores it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@keegancsmith we cannot sadly, see bazelbuild/bazel#7093

@sourcegraph-bot
Copy link
Contributor

sourcegraph-bot commented Jan 25, 2023

Not notifying subscribers because the number of notifying subscribers (15) has exceeded the threshold (10).

@sourcegraph-bot
Copy link
Contributor

sourcegraph-bot commented Jan 25, 2023

Codenotify: Notifying subscribers in OWNERS files for diff 728ea45...525711f.

Notify File(s)
@mrnugget dev/sg/root/BUILD.bazel
@sourcegraph/dev-experience dev/sg/root/BUILD.bazel
enterprise/dev/ci/internal/ci/BUILD.bazel
enterprise/dev/ci/internal/ci/bazel_operations.go

Comment on lines +6563 to +6568
build_directives = [
"gazelle:resolve go github.com/sourcegraph/sourcegraph/lib/errors @//lib/errors",
"gazelle:resolve go github.com/sourcegraph/sourcegraph/lib/codeintel/lsif/protocol @//lib/codeintel/lsif/protocol",
"gazelle:resolve go github.com/sourcegraph/sourcegraph/lib/codeintel/lsif/protocol/reader @//lib/codeintel/lsif/protocol/reader",
"gazelle:resolve go github.com/sourcegraph/sourcegraph/lib/codeintel/lsif/protocol/writer @//lib/codeintel/lsif/protocol/writer",
],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This effectively does the same thing as having the replace directive.

@sourcegraph-bot
Copy link
Contributor

Not notifying subscribers because the number of notifying subscribers (15) has exceeded the threshold (10).

@sourcegraph-bot
Copy link
Contributor

Not notifying subscribers because the number of notifying subscribers (15) has exceeded the threshold (10).

@sourcegraph-bot
Copy link
Contributor

Not notifying subscribers because the number of notifying subscribers (15) has exceeded the threshold (10).

@jhchabran jhchabran merged commit 5bea6c7 into main Jan 27, 2023
@jhchabran jhchabran deleted the bzl/go/lib branch January 27, 2023 14:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build lib/* with Bazel
5 participants