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

Separate testing module and bzlmod tests for toolchains/posix #323

Merged
merged 10 commits into from
Feb 15, 2023

Conversation

aherrmann
Copy link
Member

Depends on #320

Creates a new module in testing/posix and moves the tests from toolchains/posix into this module following the motivation from tweag/rules_sh#41.

Makes the POSIX toolchain registration optional, as the corresponding native.register_toolchains cannot be called in a repository macro under bzlmod.

Refactors the .bazelrc configuration to avoid duplication. See the corresponding commit message for details.

The previous test case was too lenient and would also succeed if the
resolved toolchain was not provided by rules_nixpkgs but instead the
default toolchain generated within a Nix shell.
Before common `.bazelrc` configuration was shared by making `.bazelrc` a
symlink to a common configuration file. However, this approach had a few
short-comings:
1) Any required modification meant that the symlink no longer worked and
   instead the file had to be replicated and adapted. Leading to
   duplicated code.
2) `%workspace%` relative paths had to be valid relative to all
   workspaces using the file.

In this new setup common parts are factored out into `.bazelrc.common`,
`.bazelrc.cc`, and `.bazelrc.java` in the top-level and can be imported
into the workspace specific `.bazelrc` files as needed.
@aherrmann aherrmann changed the base branch from master to bzlmod-java February 10, 2023 14:44
@aherrmann aherrmann marked this pull request as ready for review February 10, 2023 14:46
Base automatically changed from bzlmod-java to master February 13, 2023 16:56
@dpulls
Copy link

dpulls bot commented Feb 13, 2023

🎉 All dependencies have been resolved !

Copy link
Contributor

@benradf benradf left a comment

Choose a reason for hiding this comment

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

Looks good 👍

Comment on lines +1 to +3
import %workspace%/.bazelrc.common
import %workspace%/.bazelrc.cc
import %workspace%/.bazelrc.java
Copy link
Contributor

@benradf benradf Feb 15, 2023

Choose a reason for hiding this comment

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

This is much cleaner.

Comment on lines +6 to +11
def _non_module_deps_impl(ctx):
nixpkgs_repositories(bzlmod = True)

non_module_deps = module_extension(
implementation = _non_module_deps_impl,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is implied by your TODO comment in testing/posix/MODULE.bazel, but is the idea to later remove this non_module_deps extension and directly call the various *_configure macros that nixpkgs_repositories currently invokes once they've been modularised?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, exactly, that's the plan once #183 is implemented (or as part of it).

@aherrmann aherrmann added the merge-queue merge on green CI label Feb 15, 2023
@mergify mergify bot merged commit 77172f1 into master Feb 15, 2023
@mergify mergify bot deleted the bzlmod-posix branch February 15, 2023 10:24
@mergify mergify bot removed the merge-queue merge on green CI label Feb 15, 2023
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.

2 participants