johnno1962 / InjectionIII

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

Multiple frameworks/targets issue #481

Closed tlacan closed 8 months ago

tlacan commented 8 months ago

Hello, Thank you for the amazing work. On most of my projects it works spotless,

Unfortunately, on the one I am working one currently, it does not work.

The project is composed of multiple targets and frameworks. On each target the SPM "inject" has been added. There are no optimisation in debug for every target. On every target there are the flags -Xlinker and -interposable.

The SwiftUI files where I make the changes are in the ****SwiftUI target

Screenshot 2024-01-27 at 11 35 41

There no optimisation in debug for every targets On every targets there is the flags -Xlinker and -interposable

In the console I have the following info

💉 InjectionIII connected .xcworkspace 💉 Watching files under the directory /ios

💉 ⚠️ Could not locate compile command for “” in /Library/Developer/Xcode/DerivedData/***/Logs/Build/. 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: /Library/Developer/CoreSimulator/Devices//tmp/command.sh".

When I make changes on the main target, there is not the "Could not locate compile command" message

I have tried to delete derived data and rebuilt it changed nothing. Is there a limitation and Injection does not manage changes in other frameworks ? Or should I try something ?

johnno1962 commented 8 months ago

Hi, have a look at your build logs. If the file you're trying to inject isn't in the log, Injection doesn't know how to build it.

tlacan commented 8 months ago

Seems to be a known limitation

' The Xcode activity log xcactivitylog does not automatically track changes in Frameworks. xcactivitylog is primarily designed to log build and debugging events for the "primary" target of a build - essentially, the main app that is being developed. '

would need to try with XCode16

johnno1962 commented 8 months ago

That's news to me !