mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Merge branch 'main' into redsun82/swift-6
This commit is contained in:
@@ -179,15 +179,18 @@ def get_locations(objects):
|
||||
try:
|
||||
with urllib.request.urlopen(req, timeout=TIMEOUT) as resp:
|
||||
data = json.load(resp)
|
||||
assert len(data["objects"]) == len(
|
||||
indexes
|
||||
), f"received {len(data)} objects, expected {len(indexes)}"
|
||||
for i, resp in zip(indexes, data["objects"]):
|
||||
ret[i] = f'{resp["oid"]} {resp["actions"]["download"]["href"]}'
|
||||
return ret
|
||||
except urllib.error.URLError as e:
|
||||
warn(f"encountered {type(e).__name__} {e}, ignoring endpoint {endpoint.name}")
|
||||
continue
|
||||
assert len(data["objects"]) == len(
|
||||
indexes
|
||||
), f"received {len(data)} objects, expected {len(indexes)}"
|
||||
for i, resp in zip(indexes, data["objects"]):
|
||||
ret[i] = f'{resp["oid"]} {resp["actions"]["download"]["href"]}'
|
||||
return ret
|
||||
except KeyError:
|
||||
warn(f"encountered malformed response, ignoring endpoint {endpoint.name}:\n{json.dumps(data, indent=2)}")
|
||||
continue
|
||||
raise NoEndpointsFound
|
||||
|
||||
|
||||
@@ -210,5 +213,12 @@ try:
|
||||
for resp in get_locations(objects):
|
||||
print(resp)
|
||||
except NoEndpointsFound as e:
|
||||
print(f"ERROR: no valid endpoints found", file=sys.stderr)
|
||||
print("""\
|
||||
ERROR: no valid endpoints found, your git authentication method might be currently unsupported by this script.
|
||||
You can bypass this error by running from semmle-code (this might take a while):
|
||||
git config lfs.fetchexclude ""
|
||||
git -C ql config lfs.fetchinclude \\*
|
||||
git lfs fetch && git lfs checkout
|
||||
cd ql
|
||||
git lfs fetch && git lfs checkout""", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
@@ -75,7 +75,7 @@ std::string get_file(const char* name) {
|
||||
return ret;
|
||||
}();
|
||||
// this works from both `codeql` and the internal repository
|
||||
for (auto prefix : {"_main", "ql~"}) {
|
||||
for (auto prefix : {"_main", "ql+"}) {
|
||||
auto ret = runfiles->Rlocation(prefix + "/misc/bazel/internal/zipmerge/test-files/"s + name);
|
||||
if (fs::exists(ret)) {
|
||||
return ret;
|
||||
|
||||
@@ -64,8 +64,8 @@ def _download_lfs(repository_ctx):
|
||||
srcs = [f for f in dir.readdir() if not f.is_dir]
|
||||
lfs_smudge(repository_ctx, srcs, executable = repository_ctx.attr.executable)
|
||||
|
||||
# with bzlmod the name is qualified with `~` separators, and we want the base name here
|
||||
name = repository_ctx.name.split("~")[-1]
|
||||
# with bzlmod the name is qualified with `+` separators, and we want the base name here
|
||||
name = repository_ctx.name.split("+")[-1]
|
||||
basenames = [src.basename for src in srcs]
|
||||
build = "exports_files(%s)\n" % repr(basenames)
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"integrity": "sha256-dsD8wsI+33NjIK3tGs2d3guuQY5XMd8Skz2IbLqGt5U=",
|
||||
"url": "https://github.com/bazelbuild/rules_kotlin/releases/download/v1.9.4/rules_kotlin-v1.9.4.tar.gz",
|
||||
"patches": {
|
||||
"codeql_do_not_emit_jdeps.patch": "sha256-x/HsujFlR1FGrgmbAbRZag9V4vKZZinBcs73tgRS478=",
|
||||
"codeql_add_language_version_option.patch": "sha256-qFpP/hIvqGzjJi0h8LAQK0UuWqwlj/oCecZYGqlMVP8="
|
||||
},
|
||||
"patch_strip": 1
|
||||
}
|
||||
@@ -1,14 +1,16 @@
|
||||
module(
|
||||
name = "rules_kotlin",
|
||||
version = "1.9.4-codeql.1",
|
||||
version = "2.0.0-codeql.1",
|
||||
compatibility_level = 1,
|
||||
repo_name = "rules_kotlin",
|
||||
)
|
||||
|
||||
bazel_dep(name = "platforms", version = "0.0.6")
|
||||
bazel_dep(name = "bazel_skylib", version = "1.4.2")
|
||||
bazel_dep(name = "platforms", version = "0.0.10")
|
||||
bazel_dep(name = "bazel_skylib", version = "1.7.1")
|
||||
bazel_dep(name = "rules_java", version = "7.2.0")
|
||||
bazel_dep(name = "rules_python", version = "0.23.1")
|
||||
bazel_dep(name = "rules_cc", version = "0.0.8")
|
||||
bazel_dep(name = "rules_android", version = "0.1.1")
|
||||
|
||||
rules_kotlin_extensions = use_extension(
|
||||
"//src/main/starlark/core/repositories:bzlmod_setup.bzl",
|
||||
@@ -19,7 +21,9 @@ use_repo(
|
||||
"com_github_google_ksp",
|
||||
"com_github_jetbrains_kotlin",
|
||||
"com_github_pinterest_ktlint",
|
||||
"rules_android",
|
||||
"kotlinx_serialization_core_jvm",
|
||||
"kotlinx_serialization_json",
|
||||
"kotlinx_serialization_json_jvm",
|
||||
)
|
||||
|
||||
register_toolchains("//kotlin/internal:default_toolchain")
|
||||
@@ -1,13 +1,13 @@
|
||||
We need to build different extractor variants with different -language-version options, which is not allowed
|
||||
in current kotlin_rules
|
||||
diff --git a/src/main/starlark/core/options/opts.kotlinc.bzl b/src/main/starlark/core/options/opts.kotlinc.bzl
|
||||
index 9b15fb8..c0ac2cd 100644
|
||||
index 5e1461b..b93e6aa 100644
|
||||
--- a/src/main/starlark/core/options/opts.kotlinc.bzl
|
||||
+++ b/src/main/starlark/core/options/opts.kotlinc.bzl
|
||||
@@ -28,6 +28,11 @@ def _map_jvm_target_to_flag(version):
|
||||
@@ -33,6 +33,11 @@ def _map_jdk_release_to_flag(version):
|
||||
return None
|
||||
return ["-jvm-target=%s" % version]
|
||||
|
||||
return ["-Xjdk-release=%s" % version]
|
||||
|
||||
+def _map_language_version_to_flag(version):
|
||||
+ if not version:
|
||||
+ return None
|
||||
@@ -16,9 +16,9 @@ index 9b15fb8..c0ac2cd 100644
|
||||
_KOPTS_ALL = {
|
||||
"warn": struct(
|
||||
args = dict(
|
||||
@@ -349,6 +354,15 @@ _KOPTS_ALL = {
|
||||
@@ -417,6 +422,15 @@ _KOPTS_ALL = {
|
||||
value_to_flag = None,
|
||||
map_value_to_flag = _map_jvm_target_to_flag,
|
||||
map_value_to_flag = _map_jdk_release_to_flag,
|
||||
),
|
||||
+ "language_version": struct(
|
||||
+ args = dict(
|
||||
@@ -30,5 +30,5 @@ index 9b15fb8..c0ac2cd 100644
|
||||
+ map_value_to_flag = _map_language_version_to_flag,
|
||||
+ ),
|
||||
}
|
||||
|
||||
# Filters out options that are not available in current compiler release
|
||||
|
||||
# Filters out options that are not available in current compiler release
|
||||
@@ -1,9 +1,11 @@
|
||||
Emitting jdeps is broken for the 2.0.0 kotlin extractor, and we don't need those files.
|
||||
Patching it here rather than passing `--@rules_kotlin//kotlin/settings:jvm_emit_jdeps=false`
|
||||
allows us to not have to specify that option (and therefore pull in `rules_kotlin`) in `semmle-code`.
|
||||
--- a/kotlin/settings/BUILD.bazel 2000-01-01 01:00:00.000000000 +0100
|
||||
+++ b/kotlin/settings/BUILD.bazel 2024-04-10 14:51:16.060085986 +0200
|
||||
@@ -16,7 +16,7 @@
|
||||
diff --git a/kotlin/settings/BUILD.bazel b/kotlin/settings/BUILD.bazel
|
||||
index 2c93c11..f352b80 100644
|
||||
--- a/kotlin/settings/BUILD.bazel
|
||||
+++ b/kotlin/settings/BUILD.bazel
|
||||
@@ -25,7 +25,7 @@ release_archive(
|
||||
# Flag that controls the emission of jdeps files during kotlin jvm compilation.
|
||||
bool_flag(
|
||||
name = "jvm_emit_jdeps",
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"integrity": "sha256-2JcjzJ67t72y66yhr30jg+B0YVZDz5ejZrdYp2t9xEM=",
|
||||
"url": "https://github.com/bazelbuild/rules_kotlin/releases/download/v2.0.0/rules_kotlin-v2.0.0.tar.gz",
|
||||
"patches": {
|
||||
"codeql_do_not_emit_jdeps.patch": "sha256-1ir4Aio1SICxnj1wafQ0GefT/m7bwn2n+SQwq19V3A8=",
|
||||
"codeql_add_language_version_option.patch": "sha256-t8Fm0bYZ4Q4vTqcoXZjyK4WPEoAafjE4whJLNnrnRbg="
|
||||
},
|
||||
"patch_strip": 1
|
||||
}
|
||||
@@ -21,7 +21,7 @@
|
||||
"github:bazelbuild/rules_kotlin"
|
||||
],
|
||||
"versions": [
|
||||
"1.9.4-codeql.1"
|
||||
"2.0.0-codeql.1"
|
||||
],
|
||||
"yanked_versions": {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user