swiftlang / swift-package-manager

The Package Manager for the Swift Programming Language
Apache License 2.0
9.71k stars 1.33k forks source link

TestTarget unable to use build tool plugin to generate files #7597

Closed rauhul closed 2 months ago

rauhul commented 3 months ago

Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?

Description

swift-mmio fails to build with SwiftPM from main with the following error: "error: cannot find 'Banana' in scope" which is a type that should be generated by the SVD2SwiftPlugin.

Expected behavior

Build succeeds (as is the case with 5.9 and 5.10)

Actual behavior

Build fails with:

/code/Tests/SVD2SwiftPluginTests/SVD2SwiftTests.swift:17:5: error: cannot find 'Banana' in scope
15 |   // swift-format-ignore: AlwaysUseLowerCamelCase
16 |   func _do_not_run() {
17 |     Banana.timer1.cr.modify { _, _ in }
   |     `- error: cannot find 'Banana' in scope
18 |   }

Steps to reproduce

swift test with swift-mmio @ 822f5e231dacb686030437ef18654d586a1575c6

Swift Package Manager version/commit hash

main

Swift & OS version (output of swift --version ; uname -a)

Swift version 6.0-dev (LLVM cef183591317ec7, Swift 66e311074bff491)
Target: aarch64-unknown-linux-gnu
Linux b1edcdcd4c95 6.1.68 #1 SMP Thu May  2 02:50:09 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux
xedin commented 3 months ago

@rauhul I think this should be fixed by https://github.com/apple/swift-package-manager/pull/7593, would you might trying with that PR?

xedin commented 3 months ago

I triggered toolchain build with the changes @ https://ci.swift.org/job/swift-PR-toolchain-macos/1267/

rauhul commented 3 months ago

I'll try that toolchain when available!

xedin commented 3 months ago

Thank you!