Skip to content

Move shared C# assembly-info scripts to misc/bazel/csharp - #22564

Draft
redsun82 wants to merge 3 commits into
mainfrom
redsun82-move-shared-csharp-bazel-scripts
Draft

redsun82 wants to merge 3 commits into
mainfrom
redsun82-move-shared-csharp-bazel-scripts

Conversation

@redsun82

@redsun82 redsun82 commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Targets used by misc/bazel/csharp.bzl should live in misc/bazel/, not be reached sideways out of //csharp/scripts:. That holds on its own; PowerShell picking up csharp.bzl in microsoft#398 is just what surfaced it.

Three renames plus their three label references in misc/bazel/csharp.bzl. The .py files are 100% renames; BUILD.bazel is 70% because of two deliberate changes:

  • gen-assembly-info and git-assembly-info-src go from //csharp:__subpackages__ to //visibility:public, matching the rest of misc/bazel/. Without it the first non-C# caller of codeql_csharp_binary gets a bare visibility error. gen-git-assembly-info stays private (only the in-package genrule uses it), hence per-target declarations rather than a package default.
  • Both generators declared a @rules_python//python/runfiles dep that neither imports; they are plain argparse. Dropped.

create-extractor-pack.sh and stubs/ stay put: C#-specific, not Bazel, and they follow the ruby/scripts/, ql/scripts/ convention.

Stubbing git_info

.bazelrc already overrides semmle_code with misc/bazel/semmle_code_stub, but that stub had no root package, so @semmle_code//:git_info could not resolve and anything reaching git-assembly-info-src failed to analyse here. Adding the missing root BUILD.bazel fixes that, taking bazel build --nobuild //csharp/... from 28 to 52 of 62 targets analysable without the internal repository.

The remaining 10 are all @semmle_code//extractor-asp, a prebuilt internal jar that a stub genrule cannot stand in for, so the C# pack itself still needs the internal repository.

The stub emits only the three logs gen-git-assembly-info actually reads, and yields AssemblyInformationalVersion("unknown (unknown)"). It does not shadow the real target: built against the internal repository, the live version string is still produced.

redsun82 and others added 3 commits September 15, 2026 08:43
`misc/bazel/csharp.bzl` is language-shared infra and should not reach into `csharp/`.
Widen the moved targets to public, matching `misc/bazel`, so non-C# languages can use them.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Neither script imports runfiles; they are plain `argparse`.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
`.bazelrc` already overrides `semmle_code` with the in-repo stub, but the stub had no
root package, so `@semmle_code//:git_info` could not resolve. Emit the three logs
`gen-git-assembly-info` reads.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@redsun82

redsun82 commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author
Rerun has been triggered: 1 restarted 🚀

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.

1 participant