Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xcframework debug symbols xcode12 example #10137

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -13,7 +13,6 @@ Pod::Spec.new do |spec|
spec.watchos.deployment_target = '3.0'
spec.tvos.deployment_target = '13.0'

spec.default_subspecs = 'DynamicFramework'

spec.vendored_frameworks = 'build/BananaLib.xcframework'
spec.preserve_paths = 'build/BananaLib.dSYMs/iOS-Simulator.dSYM', 'build/BananaLib.dSYMs/iOS.dSYM', 'build/BananaLib.dSYMs/iOS-Catalyst.dSYM', 'build/BananaLib.dSYMs/macOS.dSYM', 'build/BananaLib.dSYMs/tvOS-Simulator.dSYM', 'build/BananaLib.dSYMs/tvOS.dSYM', 'build/BananaLib.dSYMs/watchOS-Simulator.dSYM', 'build/BananaLib.dSYMs/watchOS.dSYM'
end
57 changes: 57 additions & 0 deletions examples/Vendored-XCFramework12-Example/BananaLib/build.sh
@@ -0,0 +1,57 @@
#!/usr/bin/env sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any way this could be shared between this example and the existing one here? https://github.com/CocoaPods/CocoaPods/blob/master/examples/Vendored%20XCFramework%20Example/CoconutLib/build.sh? Not a blocker for this PR, but would be nice to not have to maintain both

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amorde The scripts are similar, but there are a few differences between each and I worried a little about overcomplicating the setup by trying too hard to avoid the duplication.

The new Banana script that's compiling the Xcode 11 format xcframework is the closest to the existing script: both collect the dSYMs at the root and manually stuff the BCSymbolMaps down inside the .frameworks. The current differences are:

  • Location of xcarchives (new in build/DerivedData/, old in build/)
  • The new script does not have a need for static linking or library-style output. (I'm not as familiar with the setup for static linking, so I'm a little hesitant to refactor in a way that affects that portion of the existing script)

The new Coconut script is the Xcode 12 style compilation that removes the manual manipulation of debug symbols and instead uses the new xcodebuild -create-xcframework -debug-symbols option.

So, I think if we were to consolidate we'd need to consider:

  • Where does the master copy of the script live where it can be called for both example projects?
  • Fully generalize the script so it can be argument-controlled to pass in:
    • Source project/directory to compile
    • Output directory
    • Static/Dynamic Library/Framework output
    • Xcode 11 vs Xcode 12 debug symbol collection
  • Maybe setup new wrapper build scripts that call into the master script so that there's less of a chance of passing in the wrong arguments when re-running.

You're definitely right that there's a good bit of similarity between parts of the script, I just fear that to properly setup a consolidated script that replicates what these do, we'd end up losing some of the more straightforward traceability that the current ones have. Let me know what you think!

#
# This will build and export `BananaLib.xcframework` to `build/BananaLib.xcframework` including all supported slices.
#
# Note: You may need to open the project and add a development team for code signing.
#

set -eou pipefail

rm -rf build/*

settings="SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES"

echo "Building xcframework slices"

DSYM_FOLDER=build/BananaLib.dSYMs

xcodebuild clean archive -project BananaLib.xcodeproj -scheme "BananaLib" -sdk iphoneos -archivePath "build/iOS" $settings
xcodebuild clean archive -project BananaLib.xcodeproj -scheme "BananaLib" -sdk iphonesimulator -archivePath "build/iOS-Simulator" $settings
xcodebuild clean archive -project BananaLib.xcodeproj -scheme "BananaLib" -destination 'platform=macOS,arch=x86_64,variant=Mac Catalyst' -archivePath "build/iOS-Catalyst" $settings
xcodebuild clean archive -project BananaLib.xcodeproj -scheme "BananaLib" -sdk watchos -archivePath "build/watchOS" $settings
xcodebuild clean archive -project BananaLib.xcodeproj -scheme "BananaLib" -sdk watchsimulator -archivePath "build/watchOS-Simulator" $settings
xcodebuild clean archive -project BananaLib.xcodeproj -scheme "BananaLib" -sdk appletvos -archivePath "build/tvOS" $settings
xcodebuild clean archive -project BananaLib.xcodeproj -scheme "BananaLib" -sdk appletvsimulator -archivePath "build/tvOS-Simulator" $settings
xcodebuild clean archive -project BananaLib.xcodeproj -scheme "BananaLib" -sdk macosx -archivePath "build/macOS" $settings

archives=(iOS iOS-Simulator iOS-Catalyst watchOS watchOS-Simulator tvOS tvOS-Simulator macOS)

args=""
for archive in "${archives[@]}"; do
args="$args -framework build/${archive}.xcarchive/Products/Library/Frameworks/BananaLib.framework"
done

echo "Copying bitcode symbol maps..."
for archive in "${archives[@]}"; do
symbolmap_src="build/${archive}.xcarchive/BCSymbolMaps"
if [[ -d "$symbolmap_src" ]]; then
rsync -av "${symbolmap_src}/" "build/${archive}.xcarchive/Products/Library/Frameworks/BananaLib.framework/BCSymbolMaps"
else
echo "No bitcode symbol maps in archive ${archive}"
fi
done


echo "xcodebuild -create-xcframework $args -output build/BananaLib.xcframework"
xcodebuild -create-xcframework $args -output build/BananaLib.xcframework

echo "Gathering dSYMs to $DSYM_FOLDER..."
mkdir $DSYM_FOLDER
for archive in "${archives[@]}"; do
dsym_src="build/${archive}.xcarchive/dSYMs/BananaLib.framework.dSYM"
if [[ -d "$dsym_src" ]]; then
rsync -av "${dsym_src}/" "${DSYM_FOLDER}/${archive}.dSYM"
else
echo "No dSYMs in archive ${archive}"
fi
done
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.org.cocoapods.BananaLib</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
Binary file not shown.
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.org.cocoapods.BananaLib</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
Binary file not shown.
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.org.cocoapods.BananaLib</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
Binary file not shown.
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.org.cocoapods.BananaLib</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
Binary file not shown.
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.org.cocoapods.BananaLib</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
Binary file not shown.
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.org.cocoapods.BananaLib</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
Binary file not shown.
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.org.cocoapods.BananaLib</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
Binary file not shown.
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.org.cocoapods.BananaLib</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
Binary file not shown.
@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AvailableLibraries</key>
<array>
<dict>
<key>LibraryIdentifier</key>
<string>tvos-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>BananaLib.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>tvos</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>macos-x86_64</string>
<key>LibraryPath</key>
<string>BananaLib.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>macos</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>tvos-arm64</string>
<key>LibraryPath</key>
<string>BananaLib.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>tvos</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>watchos-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>BananaLib.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>watchos</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>BananaLib.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>watchos-arm64_32_armv7k</string>
<key>LibraryPath</key>
<string>BananaLib.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64_32</string>
<string>armv7k</string>
</array>
<key>SupportedPlatform</key>
<string>watchos</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-x86_64-maccatalyst</string>
<key>LibraryPath</key>
<string>BananaLib.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>maccatalyst</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>BananaLib.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>
<key>XCFrameworkFormatVersion</key>
<string>1.0</string>
</dict>
</plist>
@@ -0,0 +1,12 @@
BCSymbolMap Version: 2.0
Apple clang version 12.0.0 (clang-1200.0.32.2)
/Applications/Xcode-12.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk
iPhoneOS14.0.sdk
/Users/jtm/Library/Developer/Xcode/DerivedData/BananaLib-goieoziljschjhfxqahxldwqessj/Build/Intermediates.noindex/ArchiveIntermediates/BananaLib/IntermediateBuildFilesPath/BananaLib.build/Release-iphoneos/BananaLib.build/DerivedSources/BananaLib_vers.c
/Users/jtm/development/CocoaPodsOrg/CocoaPods/examples/Vendored-XCFramework12-Example/BananaLib
-[Banana peel]
__OBJC_METACLASS_RO_$_Banana
__OBJC_$_INSTANCE_METHODS_Banana
__OBJC_CLASS_RO_$_Banana
/Users/jtm/development/CocoaPodsOrg/CocoaPods/examples/Vendored-XCFramework12-Example/BananaLib/BananaLib/Banana.m
BananaLib/Banana.m
Binary file not shown.
@@ -0,0 +1,11 @@
#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface Banana : NSObject

- (void)peel;

@end

NS_ASSUME_NONNULL_END
@@ -0,0 +1,11 @@
#import <Foundation/Foundation.h>

//! Project version number for BananaLib.
FOUNDATION_EXPORT double BananaLibVersionNumber;

//! Project version string for BananaLib.
FOUNDATION_EXPORT const unsigned char BananaLibVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <BananaLib/PublicHeader.h>

#import "Banana.h"
Binary file not shown.