Files
codeql/swift/BUILD.bazel
Paolo Tranquilli 400176f677 Swift: fix cmake generation
The bazel -> cmake generator is currently not capable of handling
separate included generated cmake files making use of common C/C++
dependencies.

To work around this limitation, a single generated cmake is now in
place. Long-term, we should either:
* make the cmake generator handle common dependencies gracefully, or
* make the cmake generation aspect travel up `pkg_` rules `srcs`
  attributes
so to avoid having to list the targets to be generated in the top-level
`BUILD` file.

Other things fixed:
* removed some warning spam about redefined `BAZEL_CURRENT_REPOSITORY`
* fixed the final link step, that was failing because `libswiftCore.so`
  was not being linked.
2023-06-05 11:12:11 +02:00

122 lines
2.8 KiB
Python

load("@rules_pkg//:mappings.bzl", "pkg_attributes", "pkg_filegroup", "pkg_files", "strip_prefix")
load("@rules_pkg//:install.bzl", "pkg_install")
load("//:defs.bzl", "codeql_platform")
load("//misc/bazel:pkg_runfiles.bzl", "pkg_runfiles")
load("//misc/bazel/cmake:cmake.bzl", "generate_cmake")
filegroup(
name = "schema",
srcs = ["schema.py"],
visibility = ["//swift:__subpackages__"],
)
filegroup(
name = "schema_includes",
srcs = glob(["*.dbscheme"]),
visibility = ["//swift:__subpackages__"],
)
filegroup(
name = "codegen_conf",
srcs = ["codegen.conf"],
visibility = ["//swift:__subpackages__"],
)
pkg_files(
name = "dbscheme_files",
srcs = [
"ql/lib/swift.dbscheme.stats",
"//swift/extractor/trap:generated_dbscheme",
],
)
pkg_files(
name = "manifest",
srcs = ["codeql-extractor.yml"],
)
pkg_filegroup(
name = "extractor-pack-generic",
srcs = [
":dbscheme_files",
":manifest",
"//swift/downgrades",
"//swift/tools",
],
visibility = ["//visibility:public"],
)
pkg_filegroup(
name = "extractor",
srcs = ["//swift/extractor:pkg"],
prefix = "tools/" + codeql_platform,
)
pkg_runfiles(
name = "xcode-autobuilder",
srcs = ["//swift/xcode-autobuilder"],
prefix = "tools/" + codeql_platform,
)
pkg_runfiles(
name = "incompatible-os",
srcs = ["//swift/tools/autobuilder-diagnostics:incompatible-os"],
prefix = "tools/" + codeql_platform,
)
pkg_files(
name = "swift-test-sdk-arch",
srcs = ["//swift/third_party/swift-llvm-support:swift-test-sdk"],
prefix = "qltest/" + codeql_platform,
strip_prefix = strip_prefix.from_pkg(),
)
pkg_filegroup(
name = "extractor-pack-arch",
srcs = [
":extractor",
":swift-test-sdk-arch",
] + select({
"@platforms//os:linux": [
":incompatible-os",
],
"@platforms//os:macos": [
":xcode-autobuilder",
],
}),
visibility = ["//visibility:public"],
)
pkg_filegroup(
name = "extractor-pack",
srcs = [
":extractor-pack-arch",
":extractor-pack-generic",
],
visibility = ["//visibility:public"],
)
pkg_install(
name = "_create_extractor_pack",
srcs = ["//swift:extractor-pack"],
)
py_binary(
name = "create-extractor-pack",
srcs = ["create_extractor_pack.py"],
main = "create_extractor_pack.py",
deps = [":_create_extractor_pack"],
)
generate_cmake(
name = "cmake",
targets = [
"//swift/extractor:extractor.real",
"//swift/logging/tests/assertion-diagnostics:assert-false",
] + select({
"@platforms//os:linux": ["//swift/tools/autobuilder-diagnostics:incompatible-os"],
"@platforms//os:macos": ["//swift/xcode-autobuilder"],
}),
visibility = ["//visibility:public"],
)