Skip to content

Commit 44048cc

Browse files
redsun82Copilot
andcommitted
Publish patched rules_dotnet as 0.21.5-codeql.2
`tfm_filegroup` binds a TFM to a RID without gating on it when the TFM maps to a single RID, so a package shipping only e.g. `netstandard1.6_unix` is published for every RID. Its PascalCase DLL then collides with the lowercase one from the matching `.Runtime.Win` package on case-insensitive filesystems, breaking `unzip` of the Windows CLI zip. The same function also omits `//conditions:default` for TFMs that only have RIDs, which fails analysis on every other platform. No-op for this repo: all 7 RID-bound TFM groups here have a `default` sibling and already take the gated multi-RID path. Landing it in the shared registry so consumers of that registry pick it up. `codeql.1` stays until those consumers bump their pin. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent c364999 commit 44048cc

6 files changed

Lines changed: 141 additions & 2 deletions

File tree

‎MODULE.bazel‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ bazel_dep(name = "nlohmann_json", version = "3.12.0.bcr.1", repo_name = "json")
2828
bazel_dep(name = "fmt", version = "12.1.0-codeql.1")
2929
bazel_dep(name = "rules_kotlin", version = "2.2.2-codeql.1")
3030
bazel_dep(name = "gazelle", version = "0.50.0")
31-
bazel_dep(name = "rules_dotnet", version = "0.21.5-codeql.1")
31+
bazel_dep(name = "rules_dotnet", version = "0.21.5-codeql.2")
3232
bazel_dep(name = "googletest", version = "1.17.0.bcr.2")
3333
bazel_dep(name = "rules_rust", version = "0.69.0")
3434
bazel_dep(name = "rules_swift", version = "4.0.0-rc5-codeql.2")
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
"rules_dotnet"
2+
3+
module(
4+
name = "rules_dotnet",
5+
version = "0.21.5-codeql.2",
6+
bazel_compatibility = [">=8.0.0"],
7+
compatibility_level = 0,
8+
)
9+
10+
dotnet = use_extension("@rules_dotnet//dotnet:extensions.bzl", "dotnet")
11+
dotnet.toolchain(dotnet_version = "10.0.100")
12+
dotnet.toolchain(
13+
name = "dotnet_apphost",
14+
dotnet_version = "10.0.100",
15+
)
16+
use_repo(dotnet, "dotnet_toolchains")
17+
18+
# These toolchains are used to build the apphost shimmer
19+
use_repo(dotnet, "dotnet_apphost_x86_64-unknown-linux-gnu")
20+
use_repo(dotnet, "dotnet_apphost_arm64-unknown-linux-gnu")
21+
use_repo(dotnet, "dotnet_apphost_aarch64-apple-darwin")
22+
use_repo(dotnet, "dotnet_apphost_x86_64-apple-darwin")
23+
use_repo(dotnet, "dotnet_apphost_x86_64-pc-windows-msvc")
24+
use_repo(dotnet, "dotnet_apphost_arm64-pc-windows-msvc")
25+
26+
register_toolchains("@dotnet_toolchains//:all")
27+
28+
paket2bazel_dependencies_extension = use_extension("@rules_dotnet//dotnet:paket.paket2bazel_dependencies_extension.bzl", "paket2bazel_dependencies_extension")
29+
use_repo(paket2bazel_dependencies_extension, "paket.paket2bazel_dependencies")
30+
31+
rules_dotnet_nuget_packages_extension = use_extension("@rules_dotnet//dotnet:paket.rules_dotnet_nuget_packages_extension.bzl", "rules_dotnet_nuget_packages_extension")
32+
use_repo(rules_dotnet_nuget_packages_extension, "paket.rules_dotnet_nuget_packages")
33+
34+
targeting_packs_extension = use_extension("@rules_dotnet//dotnet/private/sdk/targeting_packs:dotnet.targeting_packs_extension.bzl", "targeting_packs_extension")
35+
use_repo(targeting_packs_extension, "dotnet.targeting_packs")
36+
37+
runtime_packs_extension = use_extension("@rules_dotnet//dotnet/private/sdk/runtime_packs:dotnet.runtime_packs_extension.bzl", "runtime_packs_extension")
38+
use_repo(runtime_packs_extension, "dotnet.runtime_packs")
39+
40+
apphost_packs_extension = use_extension("@rules_dotnet//dotnet/private/sdk/apphost_packs:dotnet.apphost_packs_extension.bzl", "apphost_packs_extension")
41+
use_repo(apphost_packs_extension, "dotnet.apphost_packs")
42+
43+
bazel_dep(name = "bazel_skylib", version = "1.7.1")
44+
bazel_dep(name = "platforms", version = "1.0.0")
45+
bazel_dep(name = "bazel_lib", version = "3.0.0")
46+
bazel_dep(name = "rules_shell", version = "0.6.1")
47+
48+
# Dev dependencies
49+
bazel_dep(name = "rules_pkg", version = "1.1.0", dev_dependency = True)
50+
bazel_dep(name = "gazelle", version = "0.44.0", dev_dependency = True, repo_name = "bazel_gazelle")
51+
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.7.1", dev_dependency = True)
52+
bazel_dep(name = "rules_cc", version = "0.1.2", dev_dependency = True)
53+
bazel_dep(name = "rules_testing", version = "0.8.0", dev_dependency = True)
54+
bazel_dep(name = "bazel_ci_rules", version = "1.0.0", dev_dependency = True)
55+
bazel_dep(name = "dotnet_test_resources_other_repo", version = "", dev_dependency = True)
56+
local_path_override(
57+
module_name = "dotnet_test_resources_other_repo",
58+
path = "dotnet/private/tests/resources/other_repo",
59+
)
60+
61+
rules_dotnet_dev_nuget_packages_extension = use_extension("@rules_dotnet//dotnet:paket.rules_dotnet_dev_nuget_packages_extension.bzl", "rules_dotnet_dev_nuget_packages_extension", dev_dependency = True)
62+
use_repo(rules_dotnet_dev_nuget_packages_extension, "paket.rules_dotnet_dev_nuget_packages")
63+
64+
rules_dotnet_nuget_resource_assemblies_tests_extension = use_extension("@rules_dotnet//dotnet:paket.rules_dotnet_nuget_resource_assemblies_tests_extension.bzl", "rules_dotnet_nuget_resource_assemblies_tests_extension", dev_dependency = True)
65+
use_repo(rules_dotnet_nuget_resource_assemblies_tests_extension, "paket.rules_dotnet_nuget_resource_assemblies_tests")
66+
67+
internal_dev_deps = use_extension("@rules_dotnet//dotnet:internal_dev_deps.bzl", "internal_dev_deps", dev_dependency = True)
68+
use_repo(internal_dev_deps, "buildkite_config")
69+
70+
rules_dotnet_nuget_tool_tests_extension = use_extension("@rules_dotnet//dotnet:paket.rules_dotnet_nuget_tool_tests_extension.bzl", "rules_dotnet_nuget_tool_tests_extension", dev_dependency = True)
71+
use_repo(rules_dotnet_nuget_tool_tests_extension, "paket.rules_dotnet_nuget_tool_tests")
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
`tfm_filegroup` binds a TFM to a RID without gating on it in two cases:
2+
3+
* when a TFM maps to a single RID the alias points straight at that RID's files, so
4+
e.g. `Microsoft.Management.Infrastructure.Runtime.Unix` is published for every RID.
5+
Its `Microsoft.Management.Infrastructure.dll` then collides with the lowercase
6+
`microsoft.management.infrastructure.dll` from `...Runtime.Win` on case-insensitive
7+
filesystems. Route these through the same `select` as the multi-RID case.
8+
* when a TFM only has RIDs and no compatible sibling the `select` has no
9+
`//conditions:default`, which fails analysis on every other platform.
10+
`rid_filegroup` already resolves to an empty list in that situation; do the same here.
11+
12+
--- a/dotnet/private/rules/nuget/nuget_archive.bzl
13+
+++ b/dotnet/private/rules/nuget/nuget_archive.bzl
14+
@@ -621,15 +621,10 @@
15+
# that are incompatible with the current configuration
16+
tfm_target_mapping = {}
17+
for (tfm, rids) in tfm_rids.items():
18+
- if len(rids) == 1:
19+
- actual = None
20+
- if rids[0] == "default":
21+
- actual = "%s_%s_files" % (name, tfm)
22+
- else:
23+
- actual = "%s_%s_%s_files" % (name, tfm, rids[0])
24+
+ if len(rids) == 1 and rids[0] == "default":
25+
native.alias(
26+
name = "%s_%s_alias" % (name, tfm),
27+
- actual = actual,
28+
+ actual = "%s_%s_files" % (name, tfm),
29+
visibility = ["//visibility:public"],
30+
)
31+
tfm_target_mapping[tfm] = ":%s_%s_alias" % (name, tfm)
32+
@@ -642,6 +637,14 @@
33+
next_tfm = get_highest_compatible_target_framework(tfm, [t for t in tfm_rids.keys() if t != tfm])
34+
if next_tfm:
35+
map["//conditions:default"] = ":%s_%s_alias" % (name, next_tfm)
36+
+ else:
37+
+ empty = "%s_%s_empty" % (name, tfm)
38+
+ native.filegroup(
39+
+ name = empty,
40+
+ srcs = [],
41+
+ visibility = ["//visibility:public"],
42+
+ )
43+
+ map["//conditions:default"] = ":%s" % empty
44+
native.alias(
45+
name = "%s_%s_alias" % (name, tfm),
46+
actual = select(map),
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- a/dotnet/private/rules/nuget/nuget_archive.bzl 2025-09-04 16:14:49.402400198 +0200
2+
+++ b/dotnet/private/rules/nuget/nuget_archive.bzl 2025-09-04 16:12:16.577010334 +0200
3+
@@ -123,7 +123,7 @@
4+
return
5+
6+
# If the folder is empty we do nothing
7+
- if file.endswith(tfm) or file.endswith(tfm + "/"):
8+
+ if file.find("/", tfm_end + 1) != -1:
9+
return
10+
11+
group = groups[group_name]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"integrity": "sha256-fgvSYSFAtQh+MuDzTji3iWR642WwefGCSzCLLUtZyFE=",
3+
"strip_prefix": "rules_dotnet-0.21.5",
4+
"url": "https://github.com/bazel-contrib/rules_dotnet/releases/download/v0.21.5/rules_dotnet-v0.21.5.tar.gz",
5+
"patches": {
6+
"gate_rid_specific_tfm_groups.patch": "sha256-rEDTV56GnexS1ijgYhxcrWRM0TIMuoS9IESqGUEyR0Q=",
7+
"revert_additional_files_in_nuget_archive.patch": "sha256-FzMKXeHVhIBXQRCNFB0EANDszgJc/BBaPgWCzkbW9Ck="
8+
},
9+
"patch_strip": 1
10+
}

‎misc/bazel/registry/modules/rules_dotnet/metadata.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"github:bazel-contrib/rules_dotnet"
1414
],
1515
"versions": [
16-
"0.21.5-codeql.1"
16+
"0.21.5-codeql.1",
17+
"0.21.5-codeql.2"
1718
],
1819
"yanked_versions": {}
1920
}

0 commit comments

Comments
 (0)