File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree 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")
22load ("@bazel_tools//tools/build_defs/repo:utils.bzl" , "maybe" )
33
44def 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+
516 maybe (
617 repo_rule = http_archive ,
718 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+
19cc_binary (
210 name = "extractor" ,
311 srcs = ["main.cpp" ],
@@ -7,4 +15,5 @@ cc_binary(
715 "//conditions:default" : ["@platforms//:incompatible" ],
816 }),
917 visibility = ["//swift:__pkg__" ],
18+ deps = [":swift-llvm-support" ],
1019)
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 22#include < iomanip>
33#include < stdlib.h>
44
5- int main () {
5+ #include < swift/Basic/LLVMInitialize.h>
6+
7+ int main (int argc, char ** argv) {
8+ PROGRAM_START (argc, argv);
69 if (auto trapDir = getenv (" CODEQL_EXTRACTOR_SWIFT_TRAP_DIR" )) {
710 std::string file = trapDir;
811 file += " /my_first.trap" ;
You can’t perform that action at this time.
0 commit comments