cgrindel / rules_swift_package_manager

Collection of utilities and Bazel rules to aid in the development and maintenance of Swift repositories using Bazel.
Apache License 2.0
68 stars 22 forks source link

Recent Unreleased Revisions of rules_swift cause transitive compilation errors in rules_swift_package_manager dependencies #1091

Open ed-irl opened 1 month ago

ed-irl commented 1 month ago

See https://github.com/bazelbuild/rules_swift/issues/1210.

I have a repro of the issue here: https://github.com/ed-irl/rules_s_p_m_rules_swift_cnio_compile_error_repro.

This is the output of running bazel build //:main in the above repo:

Computing main repo mapping: 
Loading: 
Loading: 0 packages loaded
Analyzing: target //:main (0 packages loaded, 0 targets configured)
Analyzing: target //:main (0 packages loaded, 0 targets configured)
[0 / 1] [Prepa] BazelWorkspaceStatusAction stable-status.txt
INFO: Analyzed target //:main (0 packages loaded, 0 targets configured).
ERROR: /private/var/tmp/_bazel_ekohlwey/b401baf76224645435743afc2f7969c5/external/rules_swift_package_manager~~swift_deps~swiftpkg_swift_nio/BUILD.bazel:205:14: Compiling Swift module @@rules_swift_package_manager~~swift_deps~swiftpkg_swift_nio//:NIOConcurrencyHelpers.rspm failed: (Exit 1): worker failed: error executing SwiftCompile command (from target @@rules_swift_package_manager~~swift_deps~swiftpkg_swift_nio//:NIOConcurrencyHelpers.rspm) bazel-out/darwin_arm64-opt-exec-ST-13d3ddad9198/bin/external/rules_swift~/tools/worker/worker swiftc ... (remaining 1 argument skipped)
error: emit-module command failed with exit code 1 (use -v to see invocation)
external/rules_swift_package_manager~~swift_deps~swiftpkg_swift_nio/Sources/NIOConcurrencyHelpers/NIOAtomic.swift:15:8: error: no such module 'CNIOAtomics'
import CNIOAtomics
       ^
external/rules_swift_package_manager~~swift_deps~swiftpkg_swift_nio/Sources/NIOConcurrencyHelpers/NIOAtomic.swift:15:8: error: no such module 'CNIOAtomics'
import CNIOAtomics
       ^
error: fatalError
Target //:main failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.656s, Critical Path: 0.57s
INFO: 5 processes: 5 internal.
ERROR: Build did NOT complete successfully

Confusingly, the dependency itself is able to build correctly, eg. bazel build '@swiftpkg_swift_nio//:NIOConcurrencyHelpers' builds successfully.