Closed luispadron closed 2 weeks ago
Using the following lock for swift-system
:
{
"identity" : "swift-system",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-system.git",
"state" : {
"revision" : "f9266c85189c2751589a50ea5aec72799797e471",
"version" : "1.3.0"
}
},
Did you happen to capture the declaration in the BUILD.bazel
file that it does not like?
Hey @cgrindel ! I had the exact same problem. Here is the part of the BUILD.bazel
it didn't like:
swift_library(
name = "SystemPackage.rspm",
always_include_developer_search_paths = True,
copts = [
"-DSWIFT_PACKAGE",
"-DSYSTEM_PACKAGE",
] + select({
"@rules_swift_package_manager//config_settings/spm/configuration:debug": ["-DENABLE_MOCKING"], # <- here
"@rules_swift_package_manager//config_settings/spm/platform:ios": ["-DSYSTEM_PACKAGE_DARWIN"],
"@rules_swift_package_manager//config_settings/spm/platform:macos": ["-DSYSTEM_PACKAGE_DARWIN"],
"@rules_swift_package_manager//config_settings/spm/platform:tvos": ["-DSYSTEM_PACKAGE_DARWIN"],
"@rules_swift_package_manager//config_settings/spm/platform:visionos": ["-DSYSTEM_PACKAGE_DARWIN"],
"@rules_swift_package_manager//config_settings/spm/platform:watchos": ["-DSYSTEM_PACKAGE_DARWIN"],
"//conditions:default": [],
}),
# ...
For me the problem was that it would both match the debug configuration and macos platform, which seems like something that should be allowed. I've changed the implementation so it generates something like this:
swift_library(
name = "SystemPackage.rspm",
always_include_developer_search_paths = True,
copts = [
"-DSWIFT_PACKAGE",
"-DSYSTEM_PACKAGE",
] + select({
"@rules_swift_package_manager//config_settings/spm/configuration:debug": ["-DENABLE_MOCKING"],
"//conditions:default": [],
}) + select({
"@rules_swift_package_manager//config_settings/spm/platform:ios": ["-DSYSTEM_PACKAGE_DARWIN"],
"//conditions:default": [],
}) + select({
"@rules_swift_package_manager//config_settings/spm/platform:macos": ["-DSYSTEM_PACKAGE_DARWIN"],
"//conditions:default": [],
}) + select({
"@rules_swift_package_manager//config_settings/spm/platform:tvos": ["-DSYSTEM_PACKAGE_DARWIN"],
"//conditions:default": [],
}) + select({
"@rules_swift_package_manager//config_settings/spm/platform:visionos": ["-DSYSTEM_PACKAGE_DARWIN"],
"//conditions:default": [],
}) + select({
"@rules_swift_package_manager//config_settings/spm/platform:watchos": ["-DSYSTEM_PACKAGE_DARWIN"],
"//conditions:default": [],
}),
# ...
I just stated out with bazel so maybe there is a slicker way to do this 🧐
I was updating my dependencies and ran into a build failure in release mode (e.g.
--compilation_mode=opt
)