muter icon indicating copy to clipboard operation
muter copied to clipboard

If we launch muter using Xcode on a custom working directory, muter is failing. It throws UIKit not found

Open Kogilapriadarsini opened this issue 6 months ago • 11 comments

[4/6] Compiling Core Core.swift /Users/kogilapriadarsininathan/Documents/Projects/Core_mutated/Sources/Core/Core.swift:9:8: error: no such module 'UIKit' 7 | // https://docs.swift.org/swift-book 8 | // write a function to compare two strings 9 | import UIKit | `- error: no such module 'UIKit' 10 | import AVFoundation 11 | error: fatalError

Kogilapriadarsini avatar May 26 '25 11:05 Kogilapriadarsini

Any chance you're trying to build a UIKit project for macOS instead of iOS? Are you able to provide a sample project that reproduces the error?

ZevEisenberg avatar May 26 '25 21:05 ZevEisenberg

@ZevEisenberg WFCore.zip Attached the sample project which is SPM , supports only for iOS.

Image - This is how I selected the path of my spm project and ran muter.

Please let me know if muter.conf.yml needs any change.

Kogilapriadarsini avatar May 27 '25 04:05 Kogilapriadarsini

Here's the contexts of your file for convenience:

arguments:
- test
executable: /usr/bin/swift
exclude: []
excludeCalls: []
coverageThreshold: 0e+0

If you run /usr/bin/swift test in your terminal, does it build and test successfully? Or do you need to specify a target platform of an iOS simulator?

ZevEisenberg avatar May 27 '25 11:05 ZevEisenberg

hi @Kogilapriadarsini, I wasn't able to build the example project from Xcode. Could you check if its working on your end?

Image

rakaramos avatar May 27 '25 12:05 rakaramos

Here's the contexts of your file for convenience:

arguments:

  • test executable: /usr/bin/swift exclude: [] excludeCalls: [] coverageThreshold: 0e+0 If you run /usr/bin/swift test in your terminal, does it build and test successfully? Or do you need to specify a target platform of an iOS simulator?

its throwing same error.

Image

But if I run using Xcode, it's working fine. In package.swift, I mentioned supported platform as "iOS" only.

Image

Kogilapriadarsini avatar May 27 '25 12:05 Kogilapriadarsini

hi @Kogilapriadarsini, I wasn't able to build the example project from Xcode. Could you check if its working on your end?

Image

its building fine for me . have to select target as iPhone simulator.

Image Image

Kogilapriadarsini avatar May 27 '25 12:05 Kogilapriadarsini

Muter uses the command line invocation described in the config file to build. When building for iOS in the command line, you have to specify an iOS destination, even if the package doesn't support macOS, I guess. I believe you'll have to use xcodebuild instead of swift, and specify the destination. I like using this cheat sheet.

ZevEisenberg avatar May 27 '25 13:05 ZevEisenberg

Could you please share working muter.cnf.yml for this use case. I tried using xcodebuild , but I got different errors. Once I got unknown argument “destination”, then I got deriveddata folder not found, then I got .xctestrun not found in TestContent folder. If you can share working muter config file for this project, it will be really helpful.

Kogilapriadarsini avatar May 27 '25 17:05 Kogilapriadarsini

This crashes xcodebuild for me with Xcode 16.3 (😆/😭), but runs tests on Xcode 16.4:

xcodebuild test -scheme WFCore -destination "platform=iOS Simulator,name=iPhone SE (3rd generation),OS=18.4"

(Substitute the name of a simulator you have installed.)

ZevEisenberg avatar May 27 '25 18:05 ZevEisenberg

After updating the config file, it threw the below error

Image. Let me know if you are aware about this.

Kogilapriadarsini avatar May 28 '25 09:05 Kogilapriadarsini

can you please post your updated config file, or even better, the full project that reproduces the above error?

ZevEisenberg avatar May 28 '25 15:05 ZevEisenberg