From 77cab9d0689e5036929de6fe67b0a5d3c103f678 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Mon, 14 Jul 2025 13:50:48 +0200 Subject: [PATCH 1/2] Kotlin: tweak plugin test Put less emphasis on plugin build isolation, to get a better DevEx out of it. The crux of the test is the database extraction part, not the plugin build. --- .../kotlin/linux/custom_plugin/plugin/BUILD.bazel | 5 ++++- .../kotlin/linux/custom_plugin/test.py | 12 +++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/java/ql/integration-tests/kotlin/linux/custom_plugin/plugin/BUILD.bazel b/java/ql/integration-tests/kotlin/linux/custom_plugin/plugin/BUILD.bazel index 3e5195df88c2..2ee3d63e3ecf 100644 --- a/java/ql/integration-tests/kotlin/linux/custom_plugin/plugin/BUILD.bazel +++ b/java/ql/integration-tests/kotlin/linux/custom_plugin/plugin/BUILD.bazel @@ -17,7 +17,10 @@ kt_jvm_library( srcs = ["Plugin.kt"], kotlinc_opts = ":kotlinc-options", module_name = "test", - resource_strip_prefix = "%s/resources" % package_name(), + resource_strip_prefix = "../%s/%s/resources" % ( + repo_name(), + package_name(), + ), resources = glob(["resources/**"]), deps = [ "@kotlin-compiler-%s" % _version, diff --git a/java/ql/integration-tests/kotlin/linux/custom_plugin/test.py b/java/ql/integration-tests/kotlin/linux/custom_plugin/test.py index 71b6514059fa..f62a3aadb3cf 100644 --- a/java/ql/integration-tests/kotlin/linux/custom_plugin/test.py +++ b/java/ql/integration-tests/kotlin/linux/custom_plugin/test.py @@ -10,20 +10,14 @@ def test(codeql, java_full, cwd, semmle_code_dir, test_dir): commands.run( [ f"{semmle_code_dir}/tools/bazel", - f"--output_user_root={build_dir}", "--max_idle_secs=1", "build", - "//java/ql/integration-tests/kotlin/linux/custom_plugin/plugin", - "--spawn_strategy=local", - "--nouse_action_cache", - "--noremote_accept_cached", - "--noremote_upload_local_results", - f'--symlink_prefix={cwd / "bazel-"}', + "@codeql//java/ql/integration-tests/kotlin/linux/custom_plugin/plugin", ], - _cwd=test_dir, + _cwd=semmle_code_dir, ) shutil.copy( - "bazel-bin/java/ql/integration-tests/kotlin/linux/custom_plugin/plugin/plugin.jar", + f"{semmle_code_dir}/bazel-bin/external/ql+/java/ql/integration-tests/kotlin/linux/custom_plugin/plugin/plugin.jar", "plugin.jar", ) codeql.database.create( From 31d0897f743c4aefaab020f7544f95d055da05e8 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Mon, 14 Jul 2025 15:30:11 +0200 Subject: [PATCH 2/2] Kotlin: disable bazel cache in plugin test --- java/ql/integration-tests/kotlin/linux/custom_plugin/test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/java/ql/integration-tests/kotlin/linux/custom_plugin/test.py b/java/ql/integration-tests/kotlin/linux/custom_plugin/test.py index f62a3aadb3cf..f9da92683868 100644 --- a/java/ql/integration-tests/kotlin/linux/custom_plugin/test.py +++ b/java/ql/integration-tests/kotlin/linux/custom_plugin/test.py @@ -15,6 +15,7 @@ def test(codeql, java_full, cwd, semmle_code_dir, test_dir): "@codeql//java/ql/integration-tests/kotlin/linux/custom_plugin/plugin", ], _cwd=semmle_code_dir, + _env={"CODEQL_BAZEL_REMOTE_CACHE": "false"}, ) shutil.copy( f"{semmle_code_dir}/bazel-bin/external/ql+/java/ql/integration-tests/kotlin/linux/custom_plugin/plugin/plugin.jar",