johnno1962 / InjectionIII

Re-write of Injection for Xcode in (mostly) Swift
MIT License
3.96k stars 312 forks source link

Could not locate compile command for {modified swift file} #450

Closed leonidmelnyk closed 1 year ago

leonidmelnyk commented 1 year ago

Hello @johnno1962,

At some point in time, the Hot Reloading stopped working failing to locate the compile command for the updated swift file.

💉 ⚠️ Could not locate compile command for /Users/leonid.melnyk/Developer/revolut-ios-reviews/SharedModules/RevolutUIKit/RevolutUIKitApp/Debug/Revolut10/Rev10ComponentsViewModel.swift.
This could be due to one of the following:
1. Injection does not work with Whole Module Optimization.
2. There are restrictions on characters allowed in paths.
3. File paths in the simulator are case sensitive.
4. The modified source file is not in the current project.
5. The source file is an XCTest that has not been run yet.
6. Xcode has removed the build logs. Edit a file and re-run.
Try a build clean then rebuild to make logs available or
consult: ...command.sh

Some digging discovered that the Perl script wasn't able to find the appropriate compile command in the build logs. I've sent you '.xcactivitylog' to email which I've found in some threads. I use xcode 14.1. Please let me know if you need additional info. 🙏

Thank you in advance!

Best regards, Leonid

johnno1962 commented 1 year ago

Hi, what configuration are you using? The InjectionIII.app? From the App Store or a GitHub release, if so which version? When you say it stopped working are you sure you were able inject that particular file in the past? Are you sure you're not using "Whole Module Optimisation" build setting? Seems like you are according to the log you sent through (thanks for that).

leonidmelnyk commented 1 year ago

Many thanks for the fast response!

I'm using InjectionIII.app from GitHub release. Previously I was using 4.3.1, today I tried the latest 4.7.0 and also tried to clone main branch and run it from xcode.

When you say it stopped working are you sure you were able inject that particular file in the past?

That particular file no, but in general, yes, this is for sure. Last year I was actively using it (also we had a thread) but haven't used it since then.

Are you sure you're not using "Whole Module Optimisation" build setting?

Ahh! Yes, Swift Compiler - Code Generation > Compilation Mode > is Whole module 🤦‍♂️

Sorry for the disturbance and thanks again for the majestic tool! 🙏

johnno1962 commented 1 year ago

👍