Open ileitch opened 2 months ago
I am a little surprised that is being picked up. rules_swift_package_manager
deletes existing Bazel build files for Swift packages. The delete logic is here. 🤔
I just attempted to reproduce the issue. I am seeing a build error:
ERROR: /private/var/tmp/_bazel_chuck/1d745b1f8c4c04cbd181f13871d2aaa3/external/rules_go~/BUILD.bazel:42:7: GoStdlib external/rules_go~/stdlib_/pkg [for tool] failed: (Exit 1): builder failed: error executing GoStdlib command (from target @@rules_go~//:stdlib)
(cd /private/var/tmp/_bazel_chuck/1d745b1f8c4c04cbd181f13871d2aaa3/sandbox/darwin-sandbox/2/execroot/_main && \
exec env - \
CC=external/bazel_tools~cc_configure_extension~local_config_cc/cc_wrapper.sh \
CGO_CFLAGS='-U_FORTIFY_SOURCE -fstack-protector -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -O2 -D_FORTIFY_SOURCE=1 -DNDEBUG -ffunction-sections -fdata-sections -mmacosx-version-min=14.4 -no-canonical-prefixes -Wno-builtin-macro-redefined -D__DATE__="redacted" -D__TIMESTAMP__="redacted" -D__TIME__="redacted"' \
CGO_ENABLED=1 \
CGO_LDFLAGS='-mmacosx-version-min=14.4 -no-canonical-prefixes -fobjc-link-runtime -headerpad_max_install_names -Wl,-dead_strip -lm' \
GOARCH=amd64 \
GOEXPERIMENT=nocoverageredesign \
GOOS=darwin \
GOPATH='' \
GOROOT=external/rules_go~~go_sdk~go_default_sdk \
GOROOT_FINAL=GOROOT \
GOTOOLCHAIN=local \
PATH=/Applications/Xcode-15.3.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:external/bazel_tools~cc_configure_extension~local_config_cc:/bin:/usr/bin \
ZERO_AR_DATE=1 \
bazel-out/darwin_x86_64-opt-exec-ST-d57f47055a04/bin/external/rules_go~~go_sdk~go_default_sdk/builder_reset/builder stdlib -sdk external/rules_go~~go_sdk~go_default_sdk -installsuffix darwin_amd64 -out bazel-out/darwin_x86_64-opt-exec-ST-d57f47055a04/bin/external/rules_go~/stdlib_ -package std -package runtime/cgo -gcflags '')
# Configuration: 472ee93f664283993c12a8846b7e08c17338e9e8797c5cf86698c875fac858f8
# Execution platform: @@platforms//host:host
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
# runtime/cgo
_cgo_export.c:3:10: fatal error: 'stdlib.h' file not found
stdlib: error running subcommand external/rules_go~~go_sdk~go_default_sdk/bin/go: exit status 1
Target //:update_build_files failed to build
I will install Xcode 15.4 and try again.
Interesting! Let me know if I can help by making any changes to Yams. What's interesting is that I've been using rspm with Yams for a year without issue.
Maybe what's happening here is that the .build
directory is being recreated outside of this Bazel rule. This can happen for many reasons like resolving the package or having an editor for Swift/SPM which resolves these files.
We have also been using Yams and other repositories via rules_swift_package_manager which also have BUILD files in their repository without issue but that's potentially because we add the .build
to our .bazelignore
file so that its never part of the build.
Steps to reproduce:
git clone git@github.com:peripheryapp/periphery.git
cd periphery
git checkout bazel-swiftpm
swift package resolve
bazel run //:update_build_files
It looks like this select in the Yams project isn't being evaluated correctly. Is there somewhere I need to configure
rules_swift_package_manager
to only build for macos, or is this an incompatibility with Yams? Alternatively, is it possible to exclude the Yams test targets from the analysis?Environment: