Skip to content

Commit 6440242

Browse files
committed
Swift+Bazel: apply review comments
1 parent f2f9961 commit 6440242

File tree

12 files changed

+39
-94
lines changed

12 files changed

+39
-94
lines changed

WORKSPACE.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
workspace(name = "ql")
55

6-
load("@ql//misc/bazel:workspace.bzl", "ql_workspace")
6+
load("//misc/bazel:workspace.bzl", "ql_workspace")
77

88
ql_workspace()
99

10-
load("@ql//misc/bazel:workspace_deps.bzl", "ql_workspace_deps")
10+
load("//misc/bazel:workspace_deps.bzl", "ql_workspace_deps")
1111

1212
ql_workspace_deps()

cpp/BUILD.bazel

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ load("@rules_pkg//:mappings.bzl", "pkg_filegroup")
44

55
alias(
66
name = "dbscheme",
7-
actual = "@ql//cpp/ql/lib:dbscheme",
7+
actual = "//cpp/ql/lib:dbscheme",
88
)
99

1010
pkg_filegroup(
1111
name = "db-files",
1212
srcs = [
1313
":dbscheme",
14-
"@ql//cpp/downgrades",
15-
"@ql//cpp/ql/lib:dbscheme-stats",
14+
"//cpp/downgrades",
15+
"//cpp/ql/lib:dbscheme-stats",
1616
],
1717
)

misc/bazel/BUILD.toolchain.tpl

Lines changed: 0 additions & 12 deletions
This file was deleted.

misc/bazel/source_dir.bzl.tpl

Lines changed: 0 additions & 11 deletions
This file was deleted.

misc/bazel/test.bzl

Lines changed: 0 additions & 38 deletions
This file was deleted.

misc/bazel/test.template.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

misc/bazel/workspace.bzl

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,7 @@
11
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
22
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
33

4-
def _ql_utils_impl(repository_ctx):
5-
root = repository_ctx.path(Label("//:WORKSPACE.bazel")).realpath.dirname
6-
repository_ctx.file("BUILD.bazel")
7-
repository_ctx.template(
8-
"source_dir.bzl",
9-
Label("@ql//misc/bazel:source_dir.bzl.tpl"),
10-
substitutions = {"{root}": str(root)},
11-
)
12-
13-
_ql_utils = repository_rule(
14-
implementation = _ql_utils_impl,
15-
)
16-
174
def ql_workspace():
18-
_ql_utils(name = "ql_utils")
19-
205
maybe(
216
repo_rule = http_archive,
227
name = "rules_pkg",

swift/BUILD.bazel

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
load("@rules_pkg//:mappings.bzl", "pkg_attributes", "pkg_filegroup", "pkg_files")
22
load("@rules_pkg//:install.bzl", "pkg_install")
3-
load("@ql//:defs.bzl", "codeql_platform")
4-
load("@ql_utils//:source_dir.bzl", "current_source_dir")
3+
load("//:defs.bzl", "codeql_platform")
54

65
pkg_files(
76
name = "dbscheme",
@@ -56,10 +55,13 @@ pkg_filegroup(
5655
)
5756

5857
pkg_install(
59-
name = "create-extractor-pack",
58+
name = "_create_extractor_pack",
6059
srcs = ["//swift:extractor-pack"],
61-
args = [
62-
"--destdir",
63-
current_source_dir() + "/extractor-pack",
64-
],
60+
)
61+
62+
py_binary(
63+
name = "create-extractor-pack",
64+
srcs = ["tools/create_extractor_pack.py"],
65+
main = "tools/create_extractor_pack.py",
66+
deps = [":_create_extractor_pack"],
6567
)

swift/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ The Swift codeql package is an experimental and unsupported work in progress.
66

77
Run `bazel run //swift:create-extractor-pack`, which will install `swift/extractor-pack`.
88
Using `--search-path=swift/extractor-pack` will then pick up the Swift extractor. You can also use
9-
`--search-path=swift`, as the extractor pack is mentioned in `swift/.codeqlmanifest`.
9+
`--search-path=swift`, as the extractor pack is mentioned in `swift/.codeqlmanifest.json`.

swift/extractor/BUILD.bazel

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
cc_binary(
22
name = "extractor",
33
srcs = ["main.cpp"],
4+
target_compatible_with = select({
5+
"@platforms//os:linux": [],
6+
"@platforms//os:macos": [],
7+
"//conditions:default": ["@platforms//:incompatible"],
8+
}),
49
visibility = ["//swift:__pkg__"],
510
)

0 commit comments

Comments
 (0)