File tree Expand file tree Collapse file tree 4 files changed +47
-1
lines changed Expand file tree Collapse file tree 4 files changed +47
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,17 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
2
2
load ("@bazel_tools//tools/build_defs/repo:utils.bzl" , "maybe" )
3
3
4
4
def codeql_workspace ():
5
+ for arch , repo_arch , sha256 in (
6
+ ("linux" , "linux" , "48e39228e49aa560f0c1e504c4f9d488e28278b31fedc8271ce4cf807d9f7791" ),
7
+ ("darwin_x86_64" , "macos-x86_64" , "8f1e8e9cfb4391b3fbc0b90da548a7e660f302b1a8551e6640e8a944eb377028" ),
8
+ ):
9
+ http_archive (
10
+ name = "swift_prebuilt_%s" % arch ,
11
+ url = "https://github.com/dsp-testing/codeql-swift-artifacts/releases/download/swift-5.6-RELEASE.42271.49/swift-prebuilt-%s.zip" % repo_arch ,
12
+ build_file = "@ql//swift/extractor:BUILD.swift-prebuilt.bazel" ,
13
+ sha256 = sha256 ,
14
+ )
15
+
5
16
maybe (
6
17
repo_rule = http_archive ,
7
18
name = "rules_pkg" ,
Original file line number Diff line number Diff line change
1
+ alias (
2
+ name = "swift-llvm-support" ,
3
+ actual = select ({
4
+ "@bazel_tools//src/conditions:%s" % arch : "@swift_prebuilt_%s//:swift-llvm-support" % arch
5
+ for arch in ("linux" , "darwin_x86_64" , "darwin_arm64" )
6
+ }),
7
+ )
8
+
1
9
cc_binary (
2
10
name = "extractor" ,
3
11
srcs = ["main.cpp" ],
@@ -7,4 +15,5 @@ cc_binary(
7
15
"//conditions:default" : ["@platforms//:incompatible" ],
8
16
}),
9
17
visibility = ["//swift:__pkg__" ],
18
+ deps = [":swift-llvm-support" ],
10
19
)
Original file line number Diff line number Diff line change
1
+ cc_library(
2
+ name = "swift-llvm-support",
3
+ srcs = glob([
4
+ "libswiftAndLlvmSupportReal.a",
5
+ "libswiftAndLlvmSupportReal.so",
6
+ ]),
7
+ hdrs = glob(["include/**/*"]),
8
+ linkopts = [
9
+ "-lm",
10
+ "-lz",
11
+ ] + select({
12
+ "@platforms//os:macos": ["-lcurses"],
13
+ "@platforms//os:linux": [
14
+ "-luuid",
15
+ "-lrt",
16
+ "-lpthread",
17
+ "-ltinfo",
18
+ "-ldl",
19
+ ],
20
+ }),
21
+ strip_include_prefix = "include",
22
+ visibility = ["//visibility:public"],
23
+ )
Original file line number Diff line number Diff line change 2
2
#include < iomanip>
3
3
#include < stdlib.h>
4
4
5
- int main () {
5
+ #include < swift/Basic/LLVMInitialize.h>
6
+
7
+ int main (int argc, char ** argv) {
8
+ PROGRAM_START (argc, argv);
6
9
if (auto trapDir = getenv (" CODEQL_EXTRACTOR_SWIFT_TRAP_DIR" )) {
7
10
std::string file = trapDir;
8
11
file += " /my_first.trap" ;
You can’t perform that action at this time.
0 commit comments