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

Allow bazel test //... to run out-of-the-box #4150

Merged
merged 4 commits into from
Oct 21, 2024

Conversation

eljobe
Copy link
Contributor

@eljobe eljobe commented Oct 21, 2024

  • Update to gazelle 0.39.1
  • Wrap generate_imported_dylib.sh in genrules

What type of PR is this?

Bug fix

What does this PR do? Why is it needed?

This PR fixes 3 issues which caused an invocation of
bazel test //... in a clean checkout of the repository to fail
depending on potential contributor's development environment.

  1. Contributors needed to know to run generate_imported_dylib.sh
  2. Contributors needed to have $JAVA_HOME set
  3. Contributors needed NOT to have go env GOTOOLCHAIN set

For 1, this PR wraps the generate_imported_dylib.sh in genrules so
that the build will just automatically create the dynamic libraries
appropriate for the platform.

For 2, the PR adds a --java_runtime_version=remotejdk_21 argument to
the one test in lcov_coverage_test.go that needs to be able to build
a Java rule.

For 3, the PR upgrades gazellle to version 0.39.1 and updates the
excludes lists in the popular_repos.py file to handle the latest
versions of those popular repos. This upgrade addresses the problem
because bazel-contrib/bazel-gazelle#1858 is
fixed in that version of gazelle.

BONUS: Also, there were a few TODOs left in the WORKSPACE and
.bazelrc files which were addressed by upgrading to the latest
gazelle version. So, this PR cleans those up at the same time.

Which issues(s) does this PR fix?

Fixes #4149

Other notes for review

I have tested this on the following two machines:

macos (M3 arm64)
linux (amd64)

In both cases, I can clone the repository into an fresh directory hop
onto the build-fixes branch and run:

❯ bazel test -j 8 //...

And, it actually has all 452 tests passing within 30 minutes or so.

On both machines, go env GOTOOLCHAIN is go1.23.2 and $JAVA_HOME
is not set on either machine.

This fixes a few of the TODOs in the WORKSPACE file and changes a lot
about the popular_repos tests.

This commit also provides a default value of
`--java_runtime_version=remotejdk_21` just for the bazel_test in
lcov_coverage_test.go so that contributors who don't
have a JAVA_HOME on the host system can still get the
lcov_coverage_test.go to pass by default.

Oh, and it also fixes a TODO in the repository's `.bazelrc` file.
As a contributor to the project, I expect to be able to clone the
repository, go to the master branch and run `bazel test //...` and
have it work.

But, before this change, just like the CI system, contributors were
also expected to run `./tests/core/cgo/generate_imported_dylib.sh`
manually. Well ... no more!
That script should no longer be run.
The Ubuntu build is breaking because jdk21 is not supported on that
OS, and the Windows build is failing because some of the tools pprof
and diffp are not available on Windows.
Copy link
Member

@fmeum fmeum left a comment

Choose a reason for hiding this comment

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

Thank you for the thorough cleanup!

@fmeum fmeum merged commit 922ace0 into bazel-contrib:master Oct 21, 2024
1 check passed
@eljobe eljobe deleted the build-fixes branch October 21, 2024 07:19
@sluongng
Copy link
Contributor

Amazing PR. Thanks so much 🙏

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

Successfully merging this pull request may close these issues.

Missing instructions to build and test master branch
3 participants