Skip to content

Commit

Permalink
Merge pull request #82 from BoltsFramework/nlutsenko.ios_framework
Browse files Browse the repository at this point in the history
Convert static library target to iOS Static Framework.
  • Loading branch information
nlutsenko committed Feb 27, 2015
2 parents 65e7c44 + 1174514 commit 491fbce
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 98 deletions.
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# OS X
.DS_Store

# Xcode
build
DerivedData
xcuserdata
*.pbxuser
*.xcuserdatad
.DS_Store
*.xccheckout
*.swp
21 changes: 14 additions & 7 deletions Bolts.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
8103FA7819900A84000BAE3F /* BFAppLinkTarget.m in Sources */ = {isa = PBXBuildFile; fileRef = 8103FA6319900A84000BAE3F /* BFAppLinkTarget.m */; };
8103FA7A19900A84000BAE3F /* BFURL.m in Sources */ = {isa = PBXBuildFile; fileRef = 8103FA6519900A84000BAE3F /* BFURL.m */; };
8103FA7C19900A84000BAE3F /* BFWebViewAppLinkResolver.m in Sources */ = {isa = PBXBuildFile; fileRef = 8103FA6719900A84000BAE3F /* BFWebViewAppLinkResolver.m */; };
8122B2871AA0C6890025C5AF /* Bolts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8EDDA63517E17DDD00655F8A /* Bolts.framework */; };
81D0EE7D19AFA8260000AE75 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 81D0EE7C19AFA8260000AE75 /* UIKit.framework */; };
81D0EE8019AFA9E20000AE75 /* BoltsVersion.h in Headers */ = {isa = PBXBuildFile; fileRef = 8103FA5619900A84000BAE3F /* BoltsVersion.h */; settings = {ATTRIBUTES = (Public, ); }; };
81D0EE8219AFAA060000AE75 /* BoltsVersion.h in Headers */ = {isa = PBXBuildFile; fileRef = 8103FA5619900A84000BAE3F /* BoltsVersion.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand All @@ -55,7 +56,6 @@
8E8C8EEA17F23D1D00E3F1C7 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8E8C8ED217F23C3B00E3F1C7 /* XCTest.framework */; };
8E8C8EEB17F23D1D00E3F1C7 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8E9C3CEC17DE9DE000427E62 /* Foundation.framework */; };
8E8C8EFB17F23E5F00E3F1C7 /* TaskTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E9C3D1C17DE9F6500427E62 /* TaskTests.m */; };
8E8C8EFC17F23E6E00E3F1C7 /* libBolts.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8E9C3CE917DE9DE000427E62 /* libBolts.a */; };
8E8C8F1A17F241DA00E3F1C7 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8E8C8ED217F23C3B00E3F1C7 /* XCTest.framework */; };
8E8C8F2917F241FF00E3F1C7 /* TaskTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E9C3D1C17DE9F6500427E62 /* TaskTests.m */; };
8E8C8F2A17F2420400E3F1C7 /* Bolts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8EDDA63517E17DDD00655F8A /* Bolts.framework */; };
Expand Down Expand Up @@ -126,6 +126,7 @@
8103FA6519900A84000BAE3F /* BFURL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BFURL.m; sourceTree = "<group>"; };
8103FA6619900A84000BAE3F /* BFWebViewAppLinkResolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BFWebViewAppLinkResolver.h; sourceTree = "<group>"; };
8103FA6719900A84000BAE3F /* BFWebViewAppLinkResolver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BFWebViewAppLinkResolver.m; sourceTree = "<group>"; };
8122B2881AA0E8220025C5AF /* iOS-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "iOS-Info.plist"; path = "Resources/iOS-Info.plist"; sourceTree = "<group>"; };
81D0EE7C19AFA8260000AE75 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
81F0E88D19E5CB5A00812A88 /* Mac-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "Mac-Info.plist"; path = "Resources/Mac-Info.plist"; sourceTree = "<group>"; };
8550FD2E18EE1B7A00976B4B /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
Expand Down Expand Up @@ -165,7 +166,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
8E8C8EFC17F23E6E00E3F1C7 /* libBolts.a in Frameworks */,
8122B2871AA0C6890025C5AF /* Bolts.framework in Frameworks */,
8E8C8EEA17F23D1D00E3F1C7 /* XCTest.framework in Frameworks */,
8E8C8EEB17F23D1D00E3F1C7 /* Foundation.framework in Frameworks */,
);
Expand Down Expand Up @@ -339,6 +340,7 @@
8E9C3CEF17DE9DE000427E62 /* Supporting Files */ = {
isa = PBXGroup;
children = (
8122B2881AA0E8220025C5AF /* iOS-Info.plist */,
81F0E88D19E5CB5A00812A88 /* Mac-Info.plist */,
8E9C3CF017DE9DE000427E62 /* Bolts-Prefix.pch */,
);
Expand Down Expand Up @@ -452,8 +454,8 @@
);
name = Bolts;
productName = Bolts;
productReference = 8E9C3CE917DE9DE000427E62 /* libBolts.a */;
productType = "com.apple.product-type.library.static";
productReference = 8EDDA63517E17DDD00655F8A /* Bolts.framework */;
productType = "com.apple.product-type.framework";
};
8EDDA62817E17DDC00655F8A /* MacBolts */ = {
isa = PBXNativeTarget;
Expand All @@ -478,7 +480,7 @@
8E9C3CE117DE9DE000427E62 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0600;
LastUpgradeCheck = 0630;
ORGANIZATIONNAME = "Parse Inc.";
TargetAttributes = {
8E8C8EE817F23D1D00E3F1C7 = {
Expand Down Expand Up @@ -840,6 +842,7 @@
CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGNING_REQUIRED = NO;
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
Expand Down Expand Up @@ -877,6 +880,7 @@
CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGNING_REQUIRED = NO;
COPY_PHASE_STRIP = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
Expand All @@ -899,14 +903,16 @@
"$(ARCHS_STANDARD)",
armv7s,
);
DEFINES_MODULE = YES;
DSTROOT = /tmp/Bolts.dst;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Bolts/Bolts-Prefix.pch";
INFOPLIST_FILE = "Bolts/Resources/iOS-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
"IPHONEOS_DEPLOYMENT_TARGET[arch=arm64]" = 6.0;
MACH_O_TYPE = staticlib;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
PUBLIC_HEADERS_FOLDER_PATH = "./$(PROJECT_NAME)";
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
};
Expand All @@ -922,11 +928,12 @@
DSTROOT = /tmp/Bolts.dst;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Bolts/Bolts-Prefix.pch";
INFOPLIST_FILE = "Bolts/Resources/iOS-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
"IPHONEOS_DEPLOYMENT_TARGET[arch=arm64]" = 6.0;
MACH_O_TYPE = staticlib;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
PUBLIC_HEADERS_FOLDER_PATH = "./$(PROJECT_NAME)";
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
};
Expand Down
41 changes: 0 additions & 41 deletions Bolts.xcodeproj/project.xcworkspace/xcshareddata/Bolts.xccheckout

This file was deleted.

10 changes: 5 additions & 5 deletions Bolts.xcodeproj/xcshareddata/xcschemes/Bolts.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0600"
LastUpgradeVersion = "0630"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8E9C3CE817DE9DE000427E62"
BuildableName = "libBolts.a"
BuildableName = "Bolts.framework"
BlueprintName = "Bolts"
ReferencedContainer = "container:Bolts.xcodeproj">
</BuildableReference>
Expand Down Expand Up @@ -43,7 +43,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8E9C3CE817DE9DE000427E62"
BuildableName = "libBolts.a"
BuildableName = "Bolts.framework"
BlueprintName = "Bolts"
ReferencedContainer = "container:Bolts.xcodeproj">
</BuildableReference>
Expand All @@ -62,7 +62,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8E9C3CE817DE9DE000427E62"
BuildableName = "libBolts.a"
BuildableName = "Bolts.framework"
BlueprintName = "Bolts"
ReferencedContainer = "container:Bolts.xcodeproj">
</BuildableReference>
Expand All @@ -80,7 +80,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8E9C3CE817DE9DE000427E62"
BuildableName = "libBolts.a"
BuildableName = "Bolts.framework"
BlueprintName = "Bolts"
ReferencedContainer = "container:Bolts.xcodeproj">
</BuildableReference>
Expand Down
2 changes: 1 addition & 1 deletion Bolts.xcodeproj/xcshareddata/xcschemes/MacBolts.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0600"
LastUpgradeVersion = "0630"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
29 changes: 29 additions & 0 deletions Bolts/Resources/iOS-Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?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>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>Bolts</string>
<key>CFBundleIdentifier</key>
<string>com.bolts.bolts-ios</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneSimulator</string>
<string>iPhoneOS</string>
</array>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>5.0</string>
</dict>
</plist>
57 changes: 14 additions & 43 deletions scripts/build_framework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ done
test -x "$XCODEBUILD" || die 'Could not find xcodebuild in $PATH'
test -x "$LIPO" || die 'Could not find lipo in $PATH'

BOLTS_UNIVERSAL_BINARY=$BOLTS_BUILD/${BUILDCONFIGURATION}-universal/Bolts
BOLTS_IOS_BINARY=$BOLTS_BUILD/${BUILDCONFIGURATION}-universal/Bolts.framework/Bolts
BOLTS_OSX_BINARY=$BOLTS_BUILD/${BUILDCONFIGURATION}/Bolts.framework

# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -100,53 +100,24 @@ xcode_build_target "macosx" "${BUILDCONFIGURATION}" "Mac"
#
progress_message "Building Bolts univeral library using lipo."

mkdir -p $(dirname $BOLTS_UNIVERSAL_BINARY)
mkdir -p $(dirname $BOLTS_IOS_BINARY)

# Copy/Paste iOS Framework to get structure/resources/etc
cp -av \
"$BOLTS_BUILD/${BUILDCONFIGURATION}-iphoneos/Bolts.framework" \
"$BOLTS_BUILD/${BUILDCONFIGURATION}-universal"
rm "$BOLTS_BUILD/${BUILDCONFIGURATION}-universal/Bolts.framework/Bolts"

# Combine iOS/Simulator binaries into a single universal binary.
$LIPO \
-create \
$BOLTS_BUILD/${BUILDCONFIGURATION}-iphonesimulator/libBolts.a \
$BOLTS_BUILD/${BUILDCONFIGURATION}-iphoneos/libBolts.a \
-output $BOLTS_UNIVERSAL_BINARY \
$BOLTS_BUILD/${BUILDCONFIGURATION}-iphonesimulator/Bolts.framework/Bolts \
$BOLTS_BUILD/${BUILDCONFIGURATION}-iphoneos/Bolts.framework/Bolts \
-output $BOLTS_IOS_BINARY \
|| die "lipo failed - could not create universal static library"

# -----------------------------------------------------------------------------
# Build .framework out of binaries
#
function build_framework() {
FRAMEWORK=$1
BINARY=$2

FRAMEWORK_NAME=`basename $FRAMEWORK`
progress_message "Building $FRAMEWORK_NAME."

\rm -rf $FRAMEWORK
mkdir $FRAMEWORK \
|| die "Could not create directory $FRAMEWORK"
mkdir $FRAMEWORK/Versions
mkdir $FRAMEWORK/Versions/A
mkdir $FRAMEWORK/Versions/A/Headers
mkdir $FRAMEWORK/Versions/A/DeprecatedHeaders

\cp \
$BOLTS_BUILD/${BUILDCONFIGURATION}-iphoneos/Bolts/*.h \
$FRAMEWORK/Versions/A/Headers \
|| die "Error building framework while copying SDK headers"

\cp \
$BINARY \
$FRAMEWORK/Versions/A/Bolts \
|| die "Error building framework while copying Bolts"

# Current directory matters to ln.
cd $FRAMEWORK
ln -s ./Versions/A/Headers ./Headers
ln -s ./Versions/A/Bolts ./Bolts
cd $FRAMEWORK/Versions
ln -s ./A ./Current
}

# Build iOS framework from all architectures together
build_framework "$BOLTS_IOS_FRAMEWORK" "$BOLTS_UNIVERSAL_BINARY"
# Copy/Paste created iOS Framework to final location
cp -av "$(dirname $BOLTS_IOS_BINARY)" "$BOLTS_IOS_FRAMEWORK"

# Copy/Paste OSX framework, as this is already built for us
cp -av "$BOLTS_OSX_BINARY" "$BOLTS_OSX_FRAMEWORK"
Expand Down

0 comments on commit 491fbce

Please sign in to comment.