pod trunk push - error: Unexpected duplicate tasks - swift

I'm trying to create a new cocoapod which I built.
I've tried everything I know, playing with the build settings, playing with build phases and even starting a fresh new empty project - nothing helped, and I keep getting the following errors:
error: Unexpected duplicate tasks:
1) Target 'IdFramework' (project 'Pods') has copy command from '/var/folders/j7/zvtf1r056n37blpr07lwpg_80000gr/T/CocoaPods-Lint-20210520-91577-hknniq-IdFramework/Pods/IdFramework/IdFramework/Info.plist' to '/Users/{username}/Library/Developer/Xcode/DerivedData/App-bmefgfaejhpjtdfjtbeehlmhmllt/Build/Products/Release-iphonesimulator/IdFramework/IdFramework.framework/Info.plist'
2) Target 'IdFramework' (project 'Pods') has copy command from '/var/folders/j7/zvtf1r056n37blpr07lwpg_80000gr/T/CocoaPods-Lint-20210520-91577-hknniq-IdFramework/Pods/IdFramework/IdFramework/Info.plist' to '/Users/{username}/Library/Developer/Xcode/DerivedData/App-bmefgfaejhpjtdfjtbeehlmhmllt/Build/Products/Release-iphonesimulator/IdFramework/IdFramework.framework/Info.plist'
warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')
warning: duplicate output file '/Users/{username}/Library/Developer/Xcode/DerivedData/App-bmefgfaejhpjtdfjtbeehlmhmllt/Build/Products/Release-iphonesimulator/IdFramework/IdFramework.framework/Info.plist' on task: ProcessInfoPlistFile /Users/{username}/Library/Developer/Xcode/DerivedData/App-bmefgfaejhpjtdfjtbeehlmhmllt/Build/Products/Release-iphonesimulator/IdFramework/IdFramework.framework/Info.plist /var/folders/j7/zvtf1r056n37blpr07lwpg_80000gr/T/CocoaPods-Lint-20210520-91577-hknniq-IdFramework/Pods/Target Support Files/IdFramework/IdFramework-Info.plist (in target 'IdFramework' from project 'Pods')
** BUILD FAILED **
I checked again and again, and there's nothing under Copy Bundle Resources - In fact the project gets compiled fine in XCode. I also tried to use the Legacy Build System - without success.
I'm using the latest version of cocoapods, with XCode 12.1.
What can possibly be the issue?

Related

"Build input file cannot be found:" - when running: xcodebuild

error:
Build input file cannot be found: *(this contains the folder and
project info) *.../build/Debug-iphoneos/StaffIS.app/StaffIS'. Did you
forget to declare this file as an output of a script phase or custom
build rule which produces it? (in target 'StaffIS' from project
'StaffIS')
Then it complains that:
The following build commands failed: ExtractAppIntentsMetadata (in
target 'StaffIS' from project 'StaffIS') CopySwiftLibs *(this
contains the folder and project info) *
/build/Debug-iphoneos/StaffIS.app (in target 'StaffIS' from project
'StaffIS') (2 failures)
It compiles just fine in Xcode, never an issue. I don't see any StaffIS files in the project, it is the project name however.
I simply want to run a command-line build without failure.

How to combine .metal and .swift in the same package

I created a MacOS command line app that defines and successfully calls a Metal kernel. I'm now trying to move this app's .metal and .swift logic into its own package so that it can used in other projects. I expected I would be able to create a Swift package, add my .metal and .swift logic and build/test it with no issues but this has not been the case.
In Xcode I created a new package (File->New->Package). After the package was created I tried to add a Metal file (right-click on sources -> New File). I opened the macOS tab in the window and tried to find a .metal template file but there was no result. I then just tried copy/pasting my .metal file into the sources and that worked but when I went to build I got an error
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler (in target '...' from project '...')
...
swiftc -incremental -module-name ...
...
Command CompileSwiftSources failed with a nonzero exit code
How can I add and build .metal files as part of my Xcode Swift package? I can't seem to find what I'm missing. I've found examples of packages on GitHub that have a combination of Metal and Swift in them and I managed to get this one (Metal in sources/other) to compile on my computer in Xcode.
Have you updated your Swift package file?
.metallib file (Bundle.module) is only available once you have specified your resources in the package manifest.
Package.swift:
.target(
name: "TargetName",
dependencies: [],
resources: [.process("ThePathToYour/Shader.metal")]
)

Swift Package Manager failed extracting

I'm getting this Package Manager error, when switching to a different branch or cloning the project. Build fails and "Clean Build Folder" doesn't help.
Error:
failed extracting
'https://releases.amplify.aws/aws-sdk-ios/AWSConnect-2.26.6.zip'
which is required by binary target 'AWSConnect':
.../Library/Developer/Xcode/DerivedData/MyApp-cbgtlihuudupsqdzyjdbyvcwkilh/SourcePackages/artifacts/extract/AWSConnect
is not a directory
The following steps resolve the issue forcing all packages to download.
Product > Clean Build Folder
Delete DerivedData content (Preferences > Locations > Derived Data little arrow)
File > Packages > Reset Package Cache
Build
The Reset Package Cache step is the most important here. It forces all packages to download as if they where just added.
Another issue that can happen is if you have added a build configuration, make sure that you have replicated this build configuration name throughout all your in house libraries, frameworks and sub projects. If the project that uses your Library has no build configuration for the scheme you are building then it will not link and you will receive errors like:
failed extracting 'https://github.com/*.xcframework.zip' which is required by binary target 'BlahBlah': fchmod (file attributes) error: Operation not permitted

Getting 'Multiple commands produce' error with duplicate output file warning in Xcode 13.0

I am getting below multiple commands produce error while running the application in Xcode 13.0.
Multiple commands produce '/Users/XYZ/Library/Developer/Xcode/DerivedData/AppName-dsntzothkrspqbfirwzgyvntjirn/Build/Products/Debug-iphoneos/XCFrameworkIntermediates/GoogleAppMeasurement/AdIdSupport/GoogleAppMeasurement.framework':
1) That command depends on command in Target 'GoogleAppMeasurement' (project 'Pods'): script phase “[CP] Copy XCFrameworks”
2) That command depends on command in Target 'GoogleAppMeasurement-AdIdSupport' (project 'Pods'): script phase “[CP] Copy XCFrameworks”
And also getting duplicate output file warning as mentioned below: -
duplicate output file '/Users/XYZ/Library/Developer/Xcode/DerivedData/AppName-dsntzothkrspqbfirwzgyvntjirn/Build/Products/Debug-iphoneos/XCFrameworkIntermediates/GoogleAppMeasurement/AdIdSupport/GoogleAppMeasurement.framework' on task: PhaseScriptExecution [CP] Copy XCFrameworks /Users/asif.raza/Library/Developer/Xcode/DerivedData/AppName-dsntzothkrspqbfirwzgyvntjirn/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/GoogleAppMeasurement-AdIdSupport.build/Script-CAAD1E7A7F15E98CC87B30D71A33FD1C.sh
Could someone please help me out to resolve this issue?
Thanks in advance.
Solution found: After removing below ‘Pods_AppName.framework’ from ‘Link Binary With Libraries’ in Build Phases as showing disabled. Removed all derived data then Clean Build folder and and run.

xcodebuild command crashed from extension assets

When I run a build using fastlane or xcodebuild, I get an error:
"The following build commands failed:
Compile As set Catalog /Users/admin/Library/Developer/Xcode/DerivedData/.../Intermediate Build Files Path/UninstalledProducts/iphoneos/LotteriesWidget.appex .../ LotteriesWidget/Resources/Assets.xcassets"
Assets.xcassets Location set in "Relative to Group", changing this setting produces no results.
This error exists if Assets.xcassets are Copy Bundle Resources for my Today Extension. If you move them to the application target, the build and archiving succeeds, but the resources are not displayed.
How can I fix this ?