yonaskolb / XcodeGen

A Swift command line tool for generating your Xcode project
MIT License
7.04k stars 819 forks source link

Xcode 14 watchOS 9 watchOS app #1257

Closed MartinP7r closed 2 years ago

MartinP7r commented 2 years ago

Hello everyone and thanks so much for this awesome tool.

I found that the newly introduce single-target watchOS app does not work when I try to implement it with xcodegen.

I'm getting the following error:

Prepare build
note: Building targets in dependency order
error: Multiple commands produce '/Users/martin/Library/Developer/Xcode/DerivedData/WatchTestGen-eqtccuxbzqoyuncgwdiwyamlfkpb/Build/Products/Debug-watchsimulator/WatchTestWatch Watch App.app/WatchTestWatch Watch App'
    note: Target 'WatchTestWatch Watch App' (project 'WatchTestGen'): CopyAndPreserveArchs /Users/martin/Library/Developer/Xcode/DerivedData/WatchTestGen-eqtccuxbzqoyuncgwdiwyamlfkpb/Build/Products/Debug-watchsimulator/WatchTestWatch Watch App.app/WatchTestWatch Watch App
    note: Target 'WatchTestWatch Watch App' (project 'WatchTestGen') has a command with output '/Users/martin/Library/Developer/Xcode/DerivedData/WatchTestGen-eqtccuxbzqoyuncgwdiwyamlfkpb/Build/Products/Debug-watchsimulator/WatchTestWatch Watch App.app/WatchTestWatch Watch App'

Multiple commands produce '/Users/martin/Library/Developer/Xcode/DerivedData/WatchTestGen-eqtccuxbzqoyuncgwdiwyamlfkpb/Build/Products/Debug-watchsimulator/WatchTestWatch Watch App.app/WatchTestWatch Watch App'

Build failed    2022-08-30 16:41    1.2 seconds

I created a sample project here: https://github.com/MartinP7r/xcodegen-watch-sample

WatchTest.xcodeproj works fine while the generated WatchTestGen.xcodeproj does not.

This requires Xcode 14

dungi commented 2 years ago

I have the same issue; my first thought was, to wait for Xcode 14 final release and not running 2 instances of Xcode on 1 Mac (Beta and Release). Cause we also have this error-message on Xcode 13 (when Xcode 14 Beta is installed)

We will see when Xcode 14 GM will be released later this week (or next week).

dungi commented 2 years ago

I just downloaded Xcode 14 RC and removed all Beta Apps: Still get the error message with "multiple commands". Seems like to be an xcodegen bug, cause without xcodegen it works.

baveku commented 2 years ago

@MartinP7r v2.32.0 cannot use, I downgrade to 2.25.0, It's work fine

dungi commented 2 years ago

Thanks for the tip @baveku - I will try this out too.

dungi commented 2 years ago

I downgraded to 2.25.0 and generated a new project, but that doesn't help. Do you have an example app? @baveku

I also downloaded @MartinP7r example app and run xcodegen 2.25.0 - with same error message

baveku commented 2 years ago

I download v2.25.0 and unzip it

I run with command: /Users/admin/Downloads/xcodegen generate

dungi commented 2 years ago

It seems like xcodegen doesn't generate "Build rules" for the watchOS-Target.

image

That's the differences between a normal generated project and an xcodegen generated project.

dungi commented 2 years ago

I download v2.25.0 and unzip it

I run with command: /Users/admin/Downloads/xcodegen generate

I just run: mint install yonaskolb/XcodeGen@2.25.0

But I will give it a try.

dungi commented 2 years ago

Still, can't fixed the problem. watchOS App can't be compiled. Xcode 14.1 doesn't fix the problem either.

MartinP7r commented 2 years ago

@yonaskolb sorry I'm sure you're very busy 🙏🏼, but do you have any suggestions what to look for or who else could help with this?

MartinP7r commented 2 years ago

It looks like tuist already has it working: https://github.com/tuist/tuist/commit/948c435c75891458ef28f4055659a0d11ab623b3

MartinP7r commented 2 years ago

@dungi

It seems like xcodegen doesn't generate "Build rules" for the watchOS-Target.

while looking at the tuist fix above, I realized that the watch app application target now can simply use application as a type, the build rules will appear.

targets:
  # ...
  WatchTest Watch App:
    platform: watchOS
    type: application

The initial error still seems to persist, though.

edit: I just realized, I forgot WKRunsIndependentlyOfCompanionApp info.plist entry, which might solve my problem. Let me update my sample.

dungi commented 2 years ago

Thanks for the info. I will give it a try

MartinP7r commented 2 years ago

I'm going to close this issue, because it is working for me with the mentioned setup.

ccworld1000 commented 2 years ago

Is it the same problem as my problem? @MartinP7r

note: Planning note: Build preparation complete note: Building targets in dependency order error: Multiple commands produce '/Users/cc/Library/Developer/Xcode/DerivedData/CCMetaSuzanneiOS-dsdgrvwgflimacfnvzczoulbmaax/Build/Products/Debug-iphonesimulator/.app' note: Target 'CCMetaSuzanneiOS' (project 'CCMetaSuzanneiOS') has a command with output '/Users/cc/Library/Developer/Xcode/DerivedData/CCMetaSuzanneiOS-dsdgrvwgflimacfnvzczoulbmaax/Build/Products/Debug-iphonesimulator/.app' note: Target 'CCMetaSuzanneiOS' (project 'CCMetaSuzanneiOS') has create directory command with output '/Users/cc/Library/Developer/Xcode/DerivedData/CCMetaSuzanneiOS-dsdgrvwgflimacfnvzczoulbmaax/Build/Products/Debug-iphonesimulator/.app'

ccworld1000 commented 2 years ago

Showing All Messages Multiple commands produce '/Users/cc/Library/Developer/Xcode/DerivedData/CCMetaSuzanneiOS-dsdgrvwgflimacfnvzczoulbmaax/Build/Products/Debug-iphonesimulator/.app'

ccworld1000 commented 2 years ago

Is it the same problem as my problem? @MartinP7r

note: Planning note: Build preparation complete note: Building targets in dependency order error: Multiple commands produce '/Users/cc/Library/Developer/Xcode/DerivedData/CCMetaSuzanneiOS-dsdgrvwgflimacfnvzczoulbmaax/Build/Products/Debug-iphonesimulator/.app' note: Target 'CCMetaSuzanneiOS' (project 'CCMetaSuzanneiOS') has a command with output '/Users/cc/Library/Developer/Xcode/DerivedData/CCMetaSuzanneiOS-dsdgrvwgflimacfnvzczoulbmaax/Build/Products/Debug-iphonesimulator/.app' note: Target 'CCMetaSuzanneiOS' (project 'CCMetaSuzanneiOS') has create directory command with output '/Users/cc/Library/Developer/Xcode/DerivedData/CCMetaSuzanneiOS-dsdgrvwgflimacfnvzczoulbmaax/Build/Products/Debug-iphonesimulator/.app'

ccworld1000 commented 2 years ago

CC # xcodegen --version Version: 2.32.0 CC #

MartinP7r commented 2 years ago

@ccworld1000 I can't see for sure without more information (your project.yml for example).

But it seems different than my issue. The overlapping commands are different. Yours is referring to create directory command. Also your product's .app seems to have no name? Maybe there's some issue with your configuration.

ccworld1000 commented 2 years ago

` CC # ls *.yml app-template.yml project.yml CC # CC # cat project.yml name: CCMetaSuzanneiOS options: bundleIdPrefix: com.cc include: app-template.yml targets: CCMetaSuzanneiOS: templates:

ccworld1000 commented 2 years ago

I can't continue to use it because of this problem

MartinP7r commented 2 years ago

From what I can see, your project does not contain a watchOS app, so it's most likely not related to this issue.