XcodeGen icon indicating copy to clipboard operation
XcodeGen copied to clipboard

Xcode 14 watchOS 9 watchOS app

Open MartinP7r opened this issue 3 years ago • 9 comments

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

MartinP7r avatar Aug 30 '22 07:08 MartinP7r

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 avatar Sep 05 '22 13:09 dungi

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.

dungi avatar Sep 08 '22 06:09 dungi

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

baveku avatar Sep 12 '22 10:09 baveku

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

dungi avatar Sep 12 '22 10:09 dungi

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

dungi avatar Sep 13 '22 12:09 dungi

I download v2.25.0 and unzip it

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

baveku avatar Sep 13 '22 12:09 baveku

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 avatar Sep 13 '22 12:09 dungi

I download v2.25.0 and unzip it

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

I just run: mint install yonaskolb/[email protected]

But I will give it a try.

dungi avatar Sep 13 '22 12:09 dungi

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

dungi avatar Sep 20 '22 08:09 dungi

@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 avatar Sep 29 '22 23:09 MartinP7r

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

MartinP7r avatar Sep 29 '22 23:09 MartinP7r

@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.

MartinP7r avatar Sep 30 '22 01:09 MartinP7r

Thanks for the info. I will give it a try

dungi avatar Sep 30 '22 08:09 dungi

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

MartinP7r avatar Oct 02 '22 06:10 MartinP7r

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 avatar Oct 02 '22 14:10 ccworld1000

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

ccworld1000 avatar Oct 02 '22 14:10 ccworld1000

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 avatar Oct 02 '22 14:10 ccworld1000

CC # xcodegen --version Version: 2.32.0 CC #

ccworld1000 avatar Oct 02 '22 14:10 ccworld1000

@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.

MartinP7r avatar Oct 03 '22 00:10 MartinP7r

` 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: - FilamentApp settings: base: OTHER_LDFLAGS: ["-lfilameshio", "-lmeshoptimizer", "-limage", "-lktxreader"] preBuildScripts: - path: build-resources.sh name: Build Resources CC # CC # cat app-template.yml | grep -v '#' targetTemplates: FilamentApp: type: application platform: iOS deploymentTarget: "12.1" sources: - path: ${target_name} - path: Materials buildPhase: none optional: true settings: base: OTHER_LDFLAGS: ["-lfilament", "-lbackend", "-lfilaflat", "-lktxreader", "-lfilabridge", "-lutils", "-lsmol-v", "-lgeometry", "-libl"] ENABLE_BITCODE: NO CLANG_CXX_LANGUAGE_STANDARD: gnu++17 SAMPLE_CODE_DISAMBIGUATOR: ${DEVELOPMENT_TEAM}

            GCC_PREPROCESSOR_DEFINITIONS: ["FILAMENT_APP_USE_METAL=1", "$(inherited)"]

            HEADER_SEARCH_PATHS: ["/Users/cc/Desktop/CC.2022/CC.Meta.Create/CCFilament/filament/include"]
            LIBRARY_SEARCH_PATHS:
                - "/Users/cc/Desktop/CC.2022/CC.Meta.Create/CCFilament/filament/lib/universal"

CC # `

ccworld1000 avatar Oct 03 '22 09:10 ccworld1000

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

ccworld1000 avatar Oct 03 '22 09:10 ccworld1000

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

MartinP7r avatar Oct 03 '22 11:10 MartinP7r