|
1 | | -from create_database_utils import * |
2 | | - |
3 | | -import pathlib |
4 | 1 | import shutil |
| 2 | +import runs_on |
| 3 | +import commands |
5 | 4 |
|
6 | | -this_dir = pathlib.Path(__file__).resolve().parent |
7 | | -cwd = pathlib.Path.cwd() |
8 | | -builddir = cwd / 'build' |
9 | | - |
10 | | -builddir.mkdir(exist_ok=True) |
11 | | - |
12 | | -try: |
13 | | - runSuccessfully( |
14 | | - [f'{get_semmle_code_path()}/tools/bazel', f'--output_user_root={builddir}', '--max_idle_secs=1', 'build', |
15 | | - '//java/ql/integration-tests/linux-only/kotlin/custom_plugin/plugin', '--spawn_strategy=local', |
16 | | - '--nouse_action_cache', '--noremote_accept_cached', '--noremote_upload_local_results', |
17 | | - f'--symlink_prefix={cwd / "bazel-"}'], cwd=this_dir) |
18 | | -finally: |
19 | | - # rules_python creates a read-only directory in bazel's output, this allows cleanup to succeed |
20 | | - runSuccessfully(['chmod', '-R', '+w', builddir]) |
21 | | - |
22 | | -shutil.copy( |
23 | | - 'bazel-bin/java/ql/integration-tests/linux-only/kotlin/custom_plugin/plugin/plugin.jar', 'plugin.jar') |
24 | 5 |
|
25 | | -run_codeql_database_create( |
26 | | - ["kotlinc -J-Xmx2G -language-version 1.9 -Xplugin=plugin.jar a.kt b.kt c.kt d.kt e.kt"], lang="java") |
| 6 | +@runs_on.linux |
| 7 | +def test(codeql, java_full, cwd, semmle_code_dir, test_dir): |
| 8 | + build_dir = cwd / "build" |
| 9 | + build_dir.mkdir(exist_ok=True) |
| 10 | + commands.run( |
| 11 | + [ |
| 12 | + f"{semmle_code_dir}/tools/bazel", |
| 13 | + f"--output_user_root={build_dir}", |
| 14 | + "--max_idle_secs=1", |
| 15 | + "build", |
| 16 | + "//java/ql/integration-tests/linux-only/kotlin/custom_plugin/plugin", |
| 17 | + "--spawn_strategy=local", |
| 18 | + "--nouse_action_cache", |
| 19 | + "--noremote_accept_cached", |
| 20 | + "--noremote_upload_local_results", |
| 21 | + f'--symlink_prefix={cwd / "bazel-"}', |
| 22 | + ], |
| 23 | + _cwd=test_dir, |
| 24 | + ) |
| 25 | + shutil.copy( |
| 26 | + "bazel-bin/java/ql/integration-tests/linux-only/kotlin/custom_plugin/plugin/plugin.jar", |
| 27 | + "plugin.jar", |
| 28 | + ) |
| 29 | + codeql.database.create( |
| 30 | + command=[ |
| 31 | + "kotlinc -J-Xmx2G -language-version 1.9 -Xplugin=plugin.jar a.kt b.kt c.kt d.kt e.kt" |
| 32 | + ] |
| 33 | + ) |
0 commit comments