mirror of
https://github.com/github/codeql.git
synced 2026-04-25 16:55:19 +02:00
Merge branch 'main' into redsun82/kotlin
This commit is contained in:
69
misc/bazel/csharp.bzl
Normal file
69
misc/bazel/csharp.bzl
Normal file
@@ -0,0 +1,69 @@
|
||||
load("@rules_dotnet//dotnet:defs.bzl", "csharp_binary", "csharp_library", "csharp_test", "publish_binary")
|
||||
load("@rules_pkg//pkg:mappings.bzl", "strip_prefix")
|
||||
load("@semmle_code//:dist.bzl", "pack_zip")
|
||||
load("//:defs.bzl", "codeql_platform")
|
||||
|
||||
TARGET_FRAMEWORK = "net8.0"
|
||||
|
||||
def codeql_csharp_library(name, **kwargs):
|
||||
kwargs.setdefault("nullable", "enable")
|
||||
kwargs.setdefault("target_frameworks", [TARGET_FRAMEWORK])
|
||||
csharp_library(name = name, **kwargs)
|
||||
|
||||
def codeql_xunit_test(name, **kwargs):
|
||||
kwargs.setdefault("nullable", "enable")
|
||||
kwargs.setdefault("target_frameworks", [TARGET_FRAMEWORK])
|
||||
|
||||
srcs = kwargs.pop("srcs", []) + [
|
||||
"//csharp/extractor/Testrunner:Testrunner.cs",
|
||||
]
|
||||
|
||||
deps = kwargs.pop("deps", []) + [
|
||||
"@paket.main//xunit",
|
||||
"@paket.main//xunit.runner.utility",
|
||||
]
|
||||
|
||||
tags = kwargs.pop("tags", []) + ["csharp"]
|
||||
|
||||
csharp_test(
|
||||
name = name,
|
||||
deps = deps,
|
||||
srcs = srcs,
|
||||
tags = tags,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
def codeql_csharp_binary(name, language_prefix = "csharp", **kwargs):
|
||||
kwargs.setdefault("nullable", "enable")
|
||||
kwargs.setdefault("target_frameworks", [TARGET_FRAMEWORK])
|
||||
|
||||
visibility = kwargs.pop("visibility", ["//visibility:public"])
|
||||
resources = kwargs.pop("resources", [])
|
||||
srcs = kwargs.pop("srcs", [])
|
||||
|
||||
# always add the assembly info file that sets the AssemblyInformationalVersion attribute to the extractor version
|
||||
srcs.append("//csharp/scripts:assembly-info-src")
|
||||
|
||||
csharp_binary_target = "bin/" + name
|
||||
publish_binary_target = "publish/" + name
|
||||
csharp_binary(name = csharp_binary_target, srcs = srcs, resources = resources, visibility = visibility, **kwargs)
|
||||
publish_binary(
|
||||
name = publish_binary_target,
|
||||
binary = csharp_binary_target,
|
||||
self_contained = True,
|
||||
target_framework = TARGET_FRAMEWORK,
|
||||
runtime_identifier = select(
|
||||
{
|
||||
"@platforms//os:macos": "osx-x64", # always force intel on macos for now, until we build universal binaries
|
||||
"//conditions:default": "",
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
pack_zip(
|
||||
name = name,
|
||||
srcs = [publish_binary_target],
|
||||
prefix = language_prefix + "/tools/" + codeql_platform,
|
||||
strip_prefix = strip_prefix.files_only(),
|
||||
visibility = visibility,
|
||||
)
|
||||
37
misc/bazel/pkg.bzl
Normal file
37
misc/bazel/pkg.bzl
Normal file
@@ -0,0 +1,37 @@
|
||||
load("@rules_pkg//pkg:providers.bzl", "PackageFilegroupInfo", "PackageFilesInfo")
|
||||
|
||||
def _pkg_overlay_impl(ctx):
|
||||
destinations = {}
|
||||
files = []
|
||||
depsets = []
|
||||
|
||||
for src in reversed(ctx.attr.srcs):
|
||||
pfi = src[PackageFilesInfo]
|
||||
dest_src_map = {k: v for k, v in pfi.dest_src_map.items() if k not in destinations}
|
||||
destinations.update({k: True for k in dest_src_map})
|
||||
if dest_src_map:
|
||||
new_pfi = PackageFilesInfo(
|
||||
dest_src_map = dest_src_map,
|
||||
attributes = pfi.attributes,
|
||||
)
|
||||
files.append((new_pfi, src.label))
|
||||
depsets.append(depset(dest_src_map.values()))
|
||||
return [
|
||||
PackageFilegroupInfo(
|
||||
pkg_files = reversed(files),
|
||||
pkg_dirs = [],
|
||||
pkg_symlinks = [],
|
||||
),
|
||||
DefaultInfo(
|
||||
files = depset(transitive = reversed(depsets)),
|
||||
),
|
||||
]
|
||||
|
||||
codeql_pkg_files_overlay = rule(
|
||||
implementation = _pkg_overlay_impl,
|
||||
doc = "Combine `pkg_files` targets so that later targets overwrite earlier ones without warnings",
|
||||
attrs = {
|
||||
# this could be updated to handle PackageFilegroupInfo as well if we ever need it
|
||||
"srcs": attr.label_list(providers = [PackageFilesInfo, DefaultInfo]),
|
||||
},
|
||||
)
|
||||
4
misc/suite-helpers/change-notes/2024-05-23-Version1.md
Normal file
4
misc/suite-helpers/change-notes/2024-05-23-Version1.md
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
category: breaking
|
||||
---
|
||||
* CodeQL package management is now generally available, and all GitHub-produced CodeQL packages have had their version numbers increased to 1.0.0.
|
||||
@@ -1,4 +1,4 @@
|
||||
name: codeql/suite-helpers
|
||||
version: 0.7.17-dev
|
||||
version: 1.0.0-dev
|
||||
groups: shared
|
||||
warnOnImplicitThis: true
|
||||
|
||||
Reference in New Issue
Block a user