StanfordBDHG / ResearchKit

ResearchKit with Swift Package Manager (SPM), SwiftUI, C++ Interoperability, and visionOS support
https://swiftpackageindex.com/StanfordBDHG/ResearchKit/documentation/researchkitswiftui
Other
7 stars 3 forks source link

Info.plist Does Not Include `CFBundleVersion` #5

Closed PSchmiedmayer closed 11 months ago

PSchmiedmayer commented 1 year ago

Description

The automatically generated Info.plist does not include a proper CFBundleVersion value.

Reproduction

Create an XCFramework using Xcode 14.3:

$ xcodebuild archive \                                                                                    
            -workspace RKWorkspace.xcworkspace \                                                                  
            -scheme ResearchKit \                                                                                        
            -configuration Release \       
            -sdk iphonesimulator \
            -archivePath './.build/ResearchKit-iphonesimulator.xcarchive' \
            SKIP_INSTALL=NO \
            BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
            ONLY_ACTIVE_ARCH=NO
$ xcodebuild archive \                                                                                    
            -workspace RKWorkspace.xcworkspace \                                                                  
            -scheme ResearchKit \                                                                                        
            -configuration Release \       
            -sdk iphoneos \
            -archivePath './.build/ResearchKit-iphoneos.xcarchive' \
            SKIP_INSTALL=NO \
            BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
            ONLY_ACTIVE_ARCH=NO
$ xcodebuild -create-xcframework \                                                                        
            -framework ./.build/ResearchKit-iphoneos.xcarchive/Products/Library/Frameworks/ResearchKit.framework \
            -framework ./.build/ResearchKit-iphonesimulator.xcarchive/Products/Library/Frameworks/ResearchKit.framework \
            -output ResearchKit.xcframework

And then inspect the binary Info.plist files using

$ plutil -convert xml1 ResearchKit.xcframework/ios-arm64/ResearchKit.framework/Info.plist
$ plutil -convert xml1 ResearchKit.xcframework/ios-arm64_x86_64-simulator/ResearchKit.framework/Info.plist

Expected behavior

The Info.plist files should include a version bundle key as defined in the Xcode settings:

    <key>CFBundleVersion</key>
    <string>2.2.10</string>

Additional context

The issue is resolved in Xcode 15. Once Xcode 15 is released we can rely on Xcode to generate the correct keys. Until then we have to manually convert the Info.plist files with:

$ plutil -convert xml1 ResearchKit.xcframework/ios-arm64/ResearchKit.framework/Info.plist
$ plutil -convert xml1 ResearchKit.xcframework/ios-arm64_x86_64-simulator/ResearchKit.framework/Info.plist

Modify them to include

    <key>CFBundleVersion</key>
    <string>2.2.10</string>

and convert them back to the binary format using

$ plutil -convert binary1 ResearchKit.xcframework/ios-arm64/ResearchKit.framework/Info.plist
$ plutil -convert binary1 ResearchKit.xcframework/ios-arm64_x86_64-simulator/ResearchKit.framework/Info.plist

and commit these files as done in e.g.: https://github.com/StanfordBDHG/ResearchKit/commit/f677e4adc38d8ce2bdc718cd420c60d7be45a648

Code of Conduct

PSchmiedmayer commented 1 year ago

@supereg This is related to the issue we are having in https://github.com/StanfordBDHG/NAMS/actions/runs/5358248972/jobs/9732017815. Should be addressed once I have manually tagged a new release.

Supereg commented 1 year ago

As noted here https://github.com/StanfordBDHG/NAMS/pull/14#issuecomment-1609280691, it seems like the referenced PR (version 2.2.9) completely breaks projects depending on this ResearchKit fork.