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

Migrate to Bzlmod for managing external dependencies #1469

Closed
meteorcloudy opened this issue Oct 6, 2023 · 4 comments · Fixed by #1507
Closed

Migrate to Bzlmod for managing external dependencies #1469

meteorcloudy opened this issue Oct 6, 2023 · 4 comments · Fixed by #1507
Assignees
Milestone

Comments

@meteorcloudy
Copy link
Member

With future Bazel LTS versions, Bzlmod will become the default system for external dependencies management.

Please consider migrating all your external dependencies in WORKSPACE to MODULE.bazel

For more information, please check bazelbuild/bazel#18958

@meteorcloudy
Copy link
Member Author

meteorcloudy added a commit that referenced this issue Oct 6, 2023
This will help make sure Bazel Downstream Pipeline is green after enabling Bzlmod at Bazel@HEAD

See bazelbuild/bazel#18958 (comment)

#1469
@rickeylev
Copy link
Collaborator

posterity: From a cursory look, I get the impression the cause is some tests aren't going through the runfiles apis, so end up not being aware of repo-remapping.

@aignas aignas added this to the Bzlmod GA milestone Oct 9, 2023
github-merge-queue bot pushed a commit that referenced this issue Oct 10, 2023
rickeylev added a commit to rickeylev/rules_python that referenced this issue Oct 10, 2023
A few tests weren't compatible with bzlmod, so would fail when it was
enabled. The various causes and fixes are:

* Under bzlmod, `runfiles.CurrentRepository()` returns the empty string
  for the main repository. To fix, an environment variable is used to
  tell the test whether bzlmod is enabled or not.

* Accessing data files through `TEST_SRCDIR` directly is error-prone
  under bzlmod because the directory name within runfiles changes from
  the workspace name to `_main`. To fix, use the runfiles libraries,
  which know how to map apparent repo names to the actual directory
  name. In the integration tests, the runfiles library isn't available,
  so just check for the `_main` directory instead.

Work towards bazelbuild#1469
rickeylev added a commit to rickeylev/rules_python that referenced this issue Oct 10, 2023
A few tests weren't compatible with bzlmod, so would fail when it was
enabled. The various causes and fixes are:

* Under bzlmod, `runfiles.CurrentRepository()` returns the empty string
  for the main repository. To fix, an environment variable is used to
  tell the test whether bzlmod is enabled or not.

* Accessing data files through `TEST_SRCDIR` directly is error-prone
  under bzlmod because the directory name within runfiles changes from
  the workspace name to `_main`. To fix, use the runfiles libraries,
  which know how to map apparent repo names to the actual directory
  name. In the integration tests, the runfiles library isn't available,
  so just check for the `_main` directory instead.

Work towards bazelbuild#1469
rickeylev added a commit to rickeylev/rules_python that referenced this issue Oct 10, 2023
A few tests weren't compatible with bzlmod, so would fail when it was
enabled. The various causes and fixes are:

* Under bzlmod, `runfiles.CurrentRepository()` returns the empty string
  for the main repository. To fix, an environment variable is used to
  tell the test whether bzlmod is enabled or not.

* Accessing data files through `TEST_SRCDIR` directly is error-prone
  under bzlmod because the directory name within runfiles changes from
  the workspace name to `_main`. To fix, use the runfiles libraries,
  which know how to map apparent repo names to the actual directory
  name. In the integration tests, the runfiles library isn't available,
  so just check for the `_main` directory instead.

Work towards bazelbuild#1469
@rickeylev rickeylev self-assigned this Oct 10, 2023
@rickeylev
Copy link
Collaborator

PR #1482 out to fix this. It's as I thought -- the runfiles directory changing to _main broke various assumptions.

rickeylev added a commit to rickeylev/rules_python that referenced this issue Oct 11, 2023
A few tests weren't compatible with bzlmod, so would fail when it was
enabled. The various causes and fixes are:

* Under bzlmod, `runfiles.CurrentRepository()` returns the empty string
  for the main repository. To fix, an environment variable is used to
  tell the test whether bzlmod is enabled or not.

* Accessing data files through `TEST_SRCDIR` directly is error-prone
  under bzlmod because the directory name within runfiles changes from
  the workspace name to `_main`. To fix, use the runfiles libraries,
  which know how to map apparent repo names to the actual directory
  name. In the integration tests, the runfiles library isn't available,
  so just check for the `_main` directory instead.

Work towards bazelbuild#1469
github-merge-queue bot pushed a commit that referenced this issue Oct 11, 2023
A few tests weren't compatible with bzlmod, so would fail when it was
enabled. The various causes and fixes are:

* Under bzlmod, `runfiles.CurrentRepository()` returns the empty string
for the main repository. To fix, an environment variable is used to tell
the test whether bzlmod is enabled or not.

* Accessing data files through `TEST_SRCDIR` directly is error-prone
under bzlmod because the directory name within runfiles changes from the
workspace name to `_main`. To fix, use the runfiles libraries, which
know how to map apparent repo names to the actual directory name. In the
integration tests, the runfiles library isn't available, so just check
for the `_main` directory instead.

Work towards #1469
@rickeylev
Copy link
Collaborator

1482 is merged, so this should be fixed now

@aignas aignas reopened this Oct 18, 2023
aignas added a commit to aignas/rules_python that referenced this issue Oct 18, 2023
This makes the necessary changes to the toolchains acceptance tests
and also moves the tests to the `//tests` directory as this is the
current convention.

Fixes bazelbuild#1469.
github-merge-queue bot pushed a commit that referenced this issue Oct 18, 2023
This makes the necessary changes to the toolchains acceptance tests
and also moves the tests to the `//tests` directory as this is the
current convention.

Fixes #1469.
Fixes #1496.
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 a pull request may close this issue.

3 participants