Update BUILD configuration (#312)
This has 2 important fixes from Lyft's internal config: 1. The `cc_library` is now tagged with `swift_module` which is a special tag that tells rules_swift to generate a module map for the library. This is likely why sandboxing had to be disabled. 2. This adds `-fPIC` to the `cc_library` compilation. This is required for C libraries that Swift depends on, but there's an outstanding bug in bazel where this isn't handled correctly when you use the target through the host transition. This also formats this file using buildifier
This commit is contained in:
parent
3ed41e1acf
commit
2ceeb28a28
3
.bazelrc
3
.bazelrc
|
@ -1,4 +1 @@
|
|||
# Force the tests to not run in sandboxed mode, since it can introduce
|
||||
# errors and flakes.
|
||||
test --spawn_strategy=local
|
||||
build --macos_minimum_os=10.9
|
||||
|
|
33
BUILD
33
BUILD
|
@ -1,31 +1,26 @@
|
|||
load(
|
||||
"@rules_cc//cc:defs.bzl",
|
||||
"cc_library"
|
||||
)
|
||||
load(
|
||||
"@build_bazel_rules_swift//swift:swift.bzl",
|
||||
"swift_library"
|
||||
)
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
|
||||
|
||||
cc_library(
|
||||
name = "CYaml",
|
||||
srcs = glob(["Sources/CYaml/src/*.c", "Sources/CYaml/src/*.h"]),
|
||||
srcs = glob([
|
||||
"Sources/CYaml/src/*.c",
|
||||
"Sources/CYaml/src/*.h",
|
||||
]),
|
||||
hdrs = ["Sources/CYaml/include/yaml.h"],
|
||||
# Requires because of https://github.com/bazelbuild/bazel/pull/10143 otherwise host transition builds fail
|
||||
copts = ["-fPIC"],
|
||||
includes = ["Sources/CYaml/include"],
|
||||
visibility = [
|
||||
"//Tests:__subpackages__",
|
||||
],
|
||||
linkstatic = True,
|
||||
tags = ["swift_module"],
|
||||
visibility = ["//Tests:__subpackages__"],
|
||||
)
|
||||
|
||||
swift_library(
|
||||
name = "Yams",
|
||||
module_name = "Yams",
|
||||
srcs = glob(["Sources/Yams/*.swift"]),
|
||||
copts = [
|
||||
"-DSWIFT_PACKAGE",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public"
|
||||
],
|
||||
copts = ["-DSWIFT_PACKAGE"],
|
||||
module_name = "Yams",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["//:CYaml"],
|
||||
)
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
|
||||
* Update Bazel config to allow targets to be directly consumed.
|
||||
[Maxwell Elliott](https://github.com/maxwellE)
|
||||
* Fix some Bazel integration issues
|
||||
[Keith Smiley](https://github.com/keith)
|
||||
|
||||
##### Bug Fixes
|
||||
|
||||
|
|
Loading…
Reference in New Issue