Compare commits

...

1 Commits

Author SHA1 Message Date
Paolo Tranquilli
fa81fcf562 Bazel/C#: avoid zipmerge 2024-05-21 11:20:43 +01:00
8 changed files with 82 additions and 12 deletions

View File

@@ -15,7 +15,7 @@ local_path_override(
bazel_dep(name = "platforms", version = "0.0.9")
bazel_dep(name = "rules_go", version = "0.47.0")
bazel_dep(name = "rules_pkg", version = "0.10.1")
bazel_dep(name = "rules_pkg", version = "0.10.1-codeql.1")
bazel_dep(name = "rules_nodejs", version = "6.0.3")
bazel_dep(name = "rules_python", version = "0.31.0")
bazel_dep(name = "bazel_skylib", version = "1.5.0")

View File

@@ -1,5 +1,4 @@
load("@rules_pkg//pkg:mappings.bzl", "pkg_filegroup", "pkg_files")
load("@semmle_code//:common.bzl", "zipmerge")
load("@semmle_code//:dist.bzl", "dist")
package(default_visibility = ["//visibility:public"])
@@ -50,15 +49,13 @@ pkg_files(
],
)
# See `csharp.bzl` for an explanation of why we need zipmerge here
zipmerge(
dist(
name = "extractor-arch",
srcs = [
"//csharp/autobuilder/Semmle.Autobuild.CSharp:Semmle.Autobuild.CSharp.zip",
"//csharp/extractor/Semmle.Extraction.CSharp.Driver:Semmle.Extraction.CSharp.Driver.zip",
"//csharp/extractor/Semmle.Extraction.CSharp.Standalone:Semmle.Extraction.CSharp.Standalone.zip",
"//csharp/autobuilder/Semmle.Autobuild.CSharp",
"//csharp/extractor/Semmle.Extraction.CSharp.Driver",
"//csharp/extractor/Semmle.Extraction.CSharp.Standalone",
],
out = "extractor-arch.zip",
)
dist(

View File

@@ -60,14 +60,10 @@ def codeql_csharp_binary(name, **kwargs):
),
)
# we need to declare individual zip targets for each binary, as `self_contained=True` means that every binary target
# contributes the same runtime files. Bazel (rightfully) complains about this, so we work around this by creating individual zip files,
# and using zipmerge to produce the final extractor-arch file. For overlapping files, zipmerge chooses just one.
pack_zip(
name = name,
srcs = [publish_binary_target],
prefix = "csharp/tools/" + codeql_platform,
strip_prefix = strip_prefix.files_only(),
compression_level = 0,
visibility = visibility,
)

View File

@@ -0,0 +1,25 @@
module(
name = "rules_pkg",
version = "0.10.1-codeql.1", # Must sync with version.bzl.
compatibility_level = 1,
repo_name = "rules_pkg",
)
# Do not update to newer versions until you need a specific new feature.
bazel_dep(name = "rules_license", version = "0.0.4")
bazel_dep(name = "rules_python", version = "0.24.0")
bazel_dep(name = "bazel_skylib", version = "1.2.0")
# Only for development
bazel_dep(name = "platforms", version = "0.0.5", dev_dependency = True)
bazel_dep(name = "stardoc", version = "0.5.3", dev_dependency = True)
bazel_dep(name = "rules_cc", version = "0.0.9", dev_dependency = True)
# Find the system rpmbuild if one is available.
find_rpm = use_extension("//toolchains/rpm:rpmbuild_configure.bzl", "find_system_rpmbuild_bzlmod", dev_dependency = True)
use_repo(find_rpm, "rules_pkg_rpmbuild")
register_toolchains(
"@rules_pkg_rpmbuild//:all",
dev_dependency = True,
)

View File

@@ -0,0 +1,16 @@
diff --git a/pkg/private/pkg_files.bzl b/pkg/private/pkg_files.bzl
index 6fc0971..f800719 100644
--- a/pkg/private/pkg_files.bzl
+++ b/pkg/private/pkg_files.bzl
@@ -147,10 +147,7 @@ def _check_dest(content_map, dest, src, origin, allow_duplicates_with_different_
content_map[dest].origin,
src,
)
- if allow_duplicates_with_different_content:
- # buildifier: disable=print
- print("WARNING:", msg)
- else:
+ if not allow_duplicates_with_different_content:
# When we default to this behaviour, we should consider telling
# users the attribute to set to deal with this.
# For now though, let's not, since they've explicitly opted in.

View File

@@ -0,0 +1,22 @@
diff --git a/MODULE.bazel b/MODULE.bazel
index 16d9549..9e0f714 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -1,6 +1,6 @@
module(
name = "rules_pkg",
- version = "0.10.1", # Must sync with version.bzl.
+ version = "0.10.1-codeql.1", # Must sync with version.bzl.
compatibility_level = 1,
repo_name = "rules_pkg",
)
diff --git a/version.bzl b/version.bzl
index 7e93127..97ad831 100644
--- a/version.bzl
+++ b/version.bzl
@@ -13,4 +13,4 @@
# limitations under the License.
"""The version of rules_pkg."""
-version = "0.10.1"
+version = "0.10.1-codeql.1"

View File

@@ -0,0 +1,9 @@
{
"url": "https://github.com/bazelbuild/rules_pkg/releases/download/0.10.1/rules_pkg-0.10.1.tar.gz",
"integrity": "sha256-0lCSSi7MUXaAj8TCXVz16eeeY0bXnVqxxJPiieci0dA=",
"patches": {
"version.patch": "sha256-xrShfRSZJ2senH6f9o8usMc7OgShieRporlINOd3tv8=",
"suppress-duplicate-warning.patch": "sha256-3wMZ+48gj7eNqT4+q5/k/mYeJWB5HchKwFlCFqkZ4P8="
},
"patch_strip": 1
}

View File

@@ -0,0 +1,5 @@
{
"versions": [
"0.10.1-codeql.1"
]
}