bazelbuild / rules_swift

Bazel rules to build Swift on Apple and Linux platforms
Apache License 2.0
311 stars 136 forks source link

Rules Swift Package Manager transitive deps no longer compile correctly #1210

Open ed-irl opened 4 months ago

ed-irl commented 4 months ago

Hello, While trying out the fix for #1204 I noticed that my rules_swift_package_manager dependencies no longer compile on recent unreleased revisions of rules_swift. I had previously been compiling with 1.18.0.

I have a repro 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.

I will file a bug on rules_swift_package_manager and cross link here as well.