-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
bzlmod #387
Merged
bzlmod #387
Changes from 2 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
c5fc51e
WIP
purkhusid 42329a7
WIP
purkhusid 5ebc666
WIP
purkhusid af050f1
WIP
purkhusid ea08fd7
WIP
purkhusid 37f9654
WIP
purkhusid c069547
WIP
purkhusid 2408a7a
Merge branch 'master' into bzlmod
purkhusid 03327ae
WIP
purkhusid d543bde
WIP
purkhusid 360438e
WIP
purkhusid 8734bb3
WIP
purkhusid 5bf92e2
WIP
purkhusid 4b3d4f3
WIP
purkhusid b86d78a
WIP
purkhusid 5418448
WIP
purkhusid bedda9d
WIP
purkhusid 276de13
WIP
purkhusid 0c4287e
WIP
purkhusid 453e369
WIP
purkhusid dcddeed
WIP
purkhusid 5f15477
WIP
purkhusid 014145c
WIP
purkhusid 54a22de
WIP
purkhusid 985dc59
WIP
purkhusid e4541d5
WIP
purkhusid 75a4776
WIP
purkhusid 1cea698
WIP
purkhusid 184ec66
WIP
purkhusid d5c9873
WIP
purkhusid 5c05f81
WIP
purkhusid File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"rules_dotnet" | ||
|
||
module( | ||
name = "rules_dotnet", | ||
version = "0.0.0", | ||
compatibility_level = 1, | ||
) | ||
|
||
dotnet = use_extension("@rules_dotnet//dotnet:extensions.bzl", "dotnet") | ||
dotnet.toolchain(dotnet_version = "7.0.101") | ||
use_repo(dotnet, "dotnet_toolchains") | ||
register_toolchains("@dotnet_toolchains//:all") | ||
|
||
rules_dotnet_nuget_packages = use_extension("//dotnet/rules_dotnet_nuget_packages.bzl", "rules_dotnet_nuget_packages") | ||
use_repo(rules_dotnet_nuget_packages, "rules_dotnet_nuget_packages") | ||
|
||
paket2bazel_dependencies = use_extension("//dotnet/paket2bazel_dependencies.bzl", "paket2bazel_dependencies") | ||
use_repo(paket2bazel_dependencies, "paket2bazel_dependencies") | ||
|
||
rules_dotnet_dev_nuget_packages = use_extension("//dotnet/rules_dotnet_dev_nuget_packages.bzl", "rules_dotnet_dev_nuget_packages", dev_dependency = True) | ||
use_repo(rules_dotnet_dev_nuget_packages, "rules_dotnet_dev_nuget_packages") | ||
|
||
bazel_dep(name = "bazel_skylib", version = "1.4.2") | ||
bazel_dep(name = "aspect_bazel_lib", version = "1.34.5") | ||
bazel_dep(name = "platforms", version = "0.0.7") | ||
|
||
# Dev dependencies | ||
bazel_dep(name = "rules_pkg", version = "0.9.1", dev_dependency = True) | ||
bazel_dep(name = "gazelle", repo_name = "bazel_gazelle", version = "0.33.0", dev_dependency = True) | ||
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.4.2", dev_dependency = True) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
"extensions for bzlmod" | ||
|
||
load(":repositories.bzl", "dotnet_register_toolchains") | ||
|
||
_DEFAULT_NAME = "dotnet" | ||
|
||
def _toolchain_extension(module_ctx): | ||
registrations = {} | ||
for mod in module_ctx.modules: | ||
for toolchain in mod.tags.toolchain: | ||
if toolchain.name != _DEFAULT_NAME and not mod.is_root: | ||
fail("Only the root module may provide a name for the dotnet toolchain.") | ||
|
||
if toolchain.name in registrations.keys(): | ||
if toolchain.name == _DEFAULT_NAME: | ||
# Prioritize the root-most registration of the default dotnet toolchain version and | ||
# ignore any further registrations (modules are processed breadth-first) | ||
continue | ||
if toolchain.dotnet_version == registrations[toolchain.name]: | ||
# No problem to register a matching toolchain twice | ||
continue | ||
fail("Multiple conflicting toolchains declared for name {} ({} and {})".format( | ||
toolchain.name, | ||
toolchain.dotnet_version, | ||
registrations[toolchain.name], | ||
)) | ||
else: | ||
registrations[toolchain.name] = toolchain.dotnet_version | ||
for name, dotnet_version in registrations.items(): | ||
dotnet_register_toolchains( | ||
name = name, | ||
dotnet_version = dotnet_version, | ||
register = False, | ||
) | ||
|
||
dotnet = module_extension( | ||
implementation = _toolchain_extension, | ||
tag_classes = { | ||
"toolchain": tag_class(attrs = { | ||
"name": attr.string( | ||
doc = "Base name for generated repositories", | ||
default = _DEFAULT_NAME, | ||
), | ||
"dotnet_version": attr.string( | ||
doc = "Version of the .Net SDK", | ||
), | ||
}), | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and everywhere below, repo-relative labels in macros should be wrapped in
Label(...)
. Otherwise they will be interpreted relative to the BUILD file that is ultimately using them, which is likely not in@rules_dotnet
.