[ios] Streamlined resource bundling

Added a target that produces Mapbox.bundle.

Replaced $BUNDLE_RESOURCES and $PLACE_RESOURCE_BUNDLES_OUTSIDE_FRAMEWORK with a single variable, $SELF_CONTAINED, that determines whether the output static framework is self-contained – that is, whether it contains Mapbox.bundle, Settings.bundle, and LICENSE.md. Eliminated the ability to produce a static framework that has the same layout as a dynamic framework. Now, resources are always in Mapbox.bundle; self-containment only determines where that bundle resides.

Added a separate source Info.plist to be placed in both the static framework and its resource bundle, but only after we give the build system a chance to expand variables within it. Now nearly all the Info.plist keys are filled in by the build system rather than using plutil in package.sh.
This commit is contained in:
Minh Nguyễn
2016-04-24 13:51:44 -07:00
committed by Minh Nguyễn
parent 95613bd7dd
commit f85f4f4105
7 changed files with 201 additions and 58 deletions

View File

@@ -109,17 +109,14 @@ test-ios: ios
ipackage: $(IOS_PROJ_PATH)
BITCODE=$(BITCODE) FORMAT=$(FORMAT) BUILD_DEVICE=$(BUILD_DEVICE) SYMBOLS=$(SYMBOLS) \
BUNDLE_RESOURCES=YES PLACE_RESOURCE_BUNDLES_OUTSIDE_FRAMEWORK=YES \
./platform/ios/scripts/package.sh
ipackage-strip: $(IOS_PROJ_PATH)
BITCODE=$(BITCODE) FORMAT=$(FORMAT) BUILD_DEVICE=$(BUILD_DEVICE) SYMBOLS=NO \
BUNDLE_RESOURCES=YES PLACE_RESOURCE_BUNDLES_OUTSIDE_FRAMEWORK=YES \
./platform/ios/scripts/package.sh
ipackage-sim: $(IOS_PROJ_PATH)
BUILDTYPE=Debug BITCODE=$(BITCODE) FORMAT=dynamic BUILD_DEVICE=false SYMBOLS=$(SYMBOLS) \
BUNDLE_RESOURCES=YES PLACE_RESOURCE_BUNDLES_OUTSIDE_FRAMEWORK=YES \
./platform/ios/scripts/package.sh
iframework: $(IOS_PROJ_PATH)
@@ -127,7 +124,7 @@ iframework: $(IOS_PROJ_PATH)
./platform/ios/scripts/package.sh
ifabric: $(IOS_PROJ_PATH)
BITCODE=$(BITCODE) FORMAT=static BUILD_DEVICE=$(BUILD_DEVICE) SYMBOLS=NO BUNDLE_RESOURCES=YES \
BITCODE=$(BITCODE) FORMAT=static BUILD_DEVICE=$(BUILD_DEVICE) SYMBOLS=NO SELF_CONTAINED=YES \
./platform/ios/scripts/package.sh
idocument:

View File

@@ -0,0 +1,26 @@
<?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>en</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundleShortVersionString</key>
<string>$(CURRENT_SHORT_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>MGLCommitHash</key>
<string>$(CURRENT_COMMIT_HASH)</string>
<key>MGLSemanticVersionString</key>
<string>$(CURRENT_SEMANTIC_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@@ -15,11 +15,15 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>$(CURRENT_SHORT_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>MGLCommitHash</key>
<string>$(CURRENT_COMMIT_HASH)</string>
<key>MGLSemanticVersionString</key>
<string>$(CURRENT_SEMANTIC_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>

View File

@@ -137,6 +137,22 @@
DA8933A31CCC95B000E68420 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = DA89339F1CCC951200E68420 /* Localizable.strings */; };
DA8933BC1CCD2CA100E68420 /* Foundation.strings in Resources */ = {isa = PBXBuildFile; fileRef = DA8933BA1CCD2CA100E68420 /* Foundation.strings */; };
DA8933BF1CCD2CAD00E68420 /* Foundation.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = DA8933BD1CCD2CAD00E68420 /* Foundation.stringsdict */; };
DA8933DB1CCD31D400E68420 /* Foundation.strings in Resources */ = {isa = PBXBuildFile; fileRef = DA8933BA1CCD2CA100E68420 /* Foundation.strings */; };
DA8933DC1CCD31D400E68420 /* Foundation.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = DA8933BD1CCD2CAD00E68420 /* Foundation.stringsdict */; };
DA8933DD1CCD31D400E68420 /* api_mapbox_com-digicert.der in Resources */ = {isa = PBXBuildFile; fileRef = DA8848771CBAFD5C00AB86E3 /* api_mapbox_com-digicert.der */; };
DA8933DE1CCD31D400E68420 /* api_mapbox_com-geotrust.der in Resources */ = {isa = PBXBuildFile; fileRef = DA8848781CBAFD5C00AB86E3 /* api_mapbox_com-geotrust.der */; };
DA8933DF1CCD31D400E68420 /* star_tilestream_net.der in Resources */ = {isa = PBXBuildFile; fileRef = DA8848791CBAFD5C00AB86E3 /* star_tilestream_net.der */; };
DA8933E01CCD31DF00E68420 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = DA89339F1CCC951200E68420 /* Localizable.strings */; };
DA8933E11CCD31DF00E68420 /* Compass.png in Resources */ = {isa = PBXBuildFile; fileRef = DA8848631CBAFCC100AB86E3 /* Compass.png */; };
DA8933E21CCD31DF00E68420 /* Compass@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DA8848641CBAFCC100AB86E3 /* Compass@2x.png */; };
DA8933E31CCD31DF00E68420 /* Compass@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = DA8848651CBAFCC100AB86E3 /* Compass@3x.png */; };
DA8933E41CCD31DF00E68420 /* default_marker.png in Resources */ = {isa = PBXBuildFile; fileRef = DA8848661CBAFCC100AB86E3 /* default_marker.png */; };
DA8933E51CCD31DF00E68420 /* default_marker@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DA8848671CBAFCC100AB86E3 /* default_marker@2x.png */; };
DA8933E61CCD31DF00E68420 /* default_marker@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = DA8848681CBAFCC100AB86E3 /* default_marker@3x.png */; };
DA8933E71CCD31DF00E68420 /* mapbox.png in Resources */ = {isa = PBXBuildFile; fileRef = DA8848691CBAFCC100AB86E3 /* mapbox.png */; };
DA8933E81CCD31DF00E68420 /* mapbox@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DA88486A1CBAFCC100AB86E3 /* mapbox@2x.png */; };
DA8933E91CCD31DF00E68420 /* mapbox@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = DA88486B1CBAFCC100AB86E3 /* mapbox@3x.png */; };
DA8933F01CCD387900E68420 /* strip-frameworks.sh in Resources */ = {isa = PBXBuildFile; fileRef = DA8933EF1CCD387900E68420 /* strip-frameworks.sh */; };
DA8963371CC549A100684375 /* glyphs in Resources */ = {isa = PBXBuildFile; fileRef = DA8963331CC549A100684375 /* glyphs */; };
DA8963381CC549A100684375 /* sprites in Resources */ = {isa = PBXBuildFile; fileRef = DA8963341CC549A100684375 /* sprites */; };
DA8963391CC549A100684375 /* styles in Resources */ = {isa = PBXBuildFile; fileRef = DA8963351CC549A100684375 /* styles */; };
@@ -393,6 +409,9 @@
DA8933A01CCC951200E68420 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Localizable.strings; sourceTree = "<group>"; };
DA8933BB1CCD2CA100E68420 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Foundation.strings; sourceTree = "<group>"; };
DA8933BE1CCD2CAD00E68420 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = en; path = en.lproj/Foundation.stringsdict; sourceTree = "<group>"; };
DA8933D51CCD306400E68420 /* Mapbox.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Mapbox.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
DA8933EF1CCD387900E68420 /* strip-frameworks.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = "strip-frameworks.sh"; path = "framework/strip-frameworks.sh"; sourceTree = SOURCE_ROOT; };
DA8933F11CCD3FD700E68420 /* Info-static.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-static.plist"; sourceTree = "<group>"; };
DA8963331CC549A100684375 /* glyphs */ = {isa = PBXFileReference; lastKnownFileType = folder; path = glyphs; sourceTree = "<group>"; };
DA8963341CC549A100684375 /* sprites */ = {isa = PBXFileReference; lastKnownFileType = folder; path = sprites; sourceTree = "<group>"; };
DA8963351CC549A100684375 /* styles */ = {isa = PBXFileReference; lastKnownFileType = folder; path = styles; sourceTree = "<group>"; };
@@ -485,6 +504,7 @@
DA8847D21CBAF91600AB86E3 /* Mapbox.framework */,
DAA4E4131CBB71D400178DFB /* libMapbox.a */,
DA2E88511CC036F400F24E7B /* test.xctest */,
DA8933D51CCD306400E68420 /* Mapbox.bundle */,
);
name = Products;
sourceTree = "<group>";
@@ -563,6 +583,7 @@
DA8848331CBAFB2A00AB86E3 /* Kit */,
DA8848621CBAFCC100AB86E3 /* Kit Resources */,
DA8847D61CBAF91600AB86E3 /* Info.plist */,
DA8933F11CCD3FD700E68420 /* Info-static.plist */,
);
name = SDK;
path = framework;
@@ -663,6 +684,9 @@
isa = PBXGroup;
children = (
DA89339F1CCC951200E68420 /* Localizable.strings */,
DA8848771CBAFD5C00AB86E3 /* api_mapbox_com-digicert.der */,
DA8848781CBAFD5C00AB86E3 /* api_mapbox_com-geotrust.der */,
DA8848791CBAFD5C00AB86E3 /* star_tilestream_net.der */,
DA8848631CBAFCC100AB86E3 /* Compass.png */,
DA8848641CBAFCC100AB86E3 /* Compass@2x.png */,
DA8848651CBAFCC100AB86E3 /* Compass@3x.png */,
@@ -672,6 +696,7 @@
DA8848691CBAFCC100AB86E3 /* mapbox.png */,
DA88486A1CBAFCC100AB86E3 /* mapbox@2x.png */,
DA88486B1CBAFCC100AB86E3 /* mapbox@3x.png */,
DA8933EF1CCD387900E68420 /* strip-frameworks.sh */,
);
name = "Kit Resources";
path = resources;
@@ -714,9 +739,6 @@
children = (
DA8933BA1CCD2CA100E68420 /* Foundation.strings */,
DA8933BD1CCD2CAD00E68420 /* Foundation.stringsdict */,
DA8848771CBAFD5C00AB86E3 /* api_mapbox_com-digicert.der */,
DA8848781CBAFD5C00AB86E3 /* api_mapbox_com-geotrust.der */,
DA8848791CBAFD5C00AB86E3 /* star_tilestream_net.der */,
);
name = "Foundation Resources";
path = ../../darwin/resources;
@@ -924,6 +946,21 @@
productReference = DA8847D21CBAF91600AB86E3 /* Mapbox.framework */;
productType = "com.apple.product-type.framework";
};
DA8933D41CCD306400E68420 /* bundle */ = {
isa = PBXNativeTarget;
buildConfigurationList = DA8933D81CCD306400E68420 /* Build configuration list for PBXNativeTarget "bundle" */;
buildPhases = (
DA8933D31CCD306400E68420 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = bundle;
productName = bundle;
productReference = DA8933D51CCD306400E68420 /* Mapbox.bundle */;
productType = "com.apple.product-type.bundle";
};
DAA4E4121CBB71D400178DFB /* static */ = {
isa = PBXNativeTarget;
buildConfigurationList = DAA4E4191CBB71D500178DFB /* Build configuration list for PBXNativeTarget "static" */;
@@ -980,6 +1017,9 @@
DA8847D11CBAF91600AB86E3 = {
CreatedOnToolsVersion = 7.3;
};
DA8933D41CCD306400E68420 = {
CreatedOnToolsVersion = 7.3;
};
DAA4E4121CBB71D400178DFB = {
CreatedOnToolsVersion = 7.3;
};
@@ -1005,6 +1045,7 @@
DABCABA71CB80692000A7C39 /* bench */,
DA8847D11CBAF91600AB86E3 /* dynamic */,
DAA4E4121CBB71D400178DFB /* static */,
DA8933D41CCD306400E68420 /* bundle */,
DA2E88501CC036F400F24E7B /* test */,
);
};
@@ -1049,12 +1090,35 @@
DA88486E1CBAFCC100AB86E3 /* Compass@2x.png in Resources */,
DA8848701CBAFCC100AB86E3 /* default_marker.png in Resources */,
DA8848711CBAFCC100AB86E3 /* default_marker@2x.png in Resources */,
DA8933F01CCD387900E68420 /* strip-frameworks.sh in Resources */,
DA8848751CBAFCC100AB86E3 /* mapbox@3x.png in Resources */,
DA88487B1CBAFD5C00AB86E3 /* api_mapbox_com-geotrust.der in Resources */,
DA8933BF1CCD2CAD00E68420 /* Foundation.stringsdict in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
DA8933D31CCD306400E68420 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
DA8933E01CCD31DF00E68420 /* Localizable.strings in Resources */,
DA8933E11CCD31DF00E68420 /* Compass.png in Resources */,
DA8933E21CCD31DF00E68420 /* Compass@2x.png in Resources */,
DA8933E31CCD31DF00E68420 /* Compass@3x.png in Resources */,
DA8933E41CCD31DF00E68420 /* default_marker.png in Resources */,
DA8933E51CCD31DF00E68420 /* default_marker@2x.png in Resources */,
DA8933E61CCD31DF00E68420 /* default_marker@3x.png in Resources */,
DA8933E71CCD31DF00E68420 /* mapbox.png in Resources */,
DA8933E81CCD31DF00E68420 /* mapbox@2x.png in Resources */,
DA8933E91CCD31DF00E68420 /* mapbox@3x.png in Resources */,
DA8933DB1CCD31D400E68420 /* Foundation.strings in Resources */,
DA8933DC1CCD31D400E68420 /* Foundation.stringsdict in Resources */,
DA8933DD1CCD31D400E68420 /* api_mapbox_com-digicert.der in Resources */,
DA8933DE1CCD31D400E68420 /* api_mapbox_com-geotrust.der in Resources */,
DA8933DF1CCD31D400E68420 /* star_tilestream_net.der in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
DABCABA61CB80692000A7C39 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
@@ -1259,6 +1323,9 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_COMMIT_HASH = deadbeef;
CURRENT_SEMANTIC_VERSION = 1.0.0;
CURRENT_SHORT_VERSION = 1.0;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@@ -1305,6 +1372,9 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_COMMIT_HASH = deadbeef;
CURRENT_SEMANTIC_VERSION = 1.0.0;
CURRENT_SHORT_VERSION = 1.0;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -1455,6 +1525,28 @@
};
name = Release;
};
DA8933D91CCD306400E68420 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
INFOPLIST_FILE = "framework/Info-static.plist";
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.sdk.ios;
PRODUCT_NAME = Mapbox;
SKIP_INSTALL = YES;
WRAPPER_EXTENSION = bundle;
};
name = Debug;
};
DA8933DA1CCD306400E68420 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
INFOPLIST_FILE = "framework/Info-static.plist";
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.sdk.ios;
PRODUCT_NAME = Mapbox;
SKIP_INSTALL = YES;
WRAPPER_EXTENSION = bundle;
};
name = Release;
};
DAA4E41A1CBB71D500178DFB /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = DAC07C961CBB2CD6000CB309 /* mbgl.xcconfig */;
@@ -1578,6 +1670,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
DA8933D81CCD306400E68420 /* Build configuration list for PBXNativeTarget "bundle" */ = {
isa = XCConfigurationList;
buildConfigurations = (
DA8933D91CCD306400E68420 /* Debug */,
DA8933DA1CCD306400E68420 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
DAA4E4191CBB71D500178DFB /* Build configuration list for PBXNativeTarget "static" */ = {
isa = XCConfigurationList;
buildConfigurations = (

View File

@@ -34,6 +34,20 @@
ReferencedContainer = "container:ios.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DA8933D41CCD306400E68420"
BuildableName = "Mapbox.bundle"
BlueprintName = "bundle"
ReferencedContainer = "container:ios.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"

View File

@@ -20,6 +20,20 @@
ReferencedContainer = "container:ios.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DA8933D41CCD306400E68420"
BuildableName = "Mapbox.bundle"
BlueprintName = "bundle"
ReferencedContainer = "container:ios.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
@@ -29,6 +43,15 @@
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DAA4E4121CBB71D400178DFB"
BuildableName = "libMapbox.a"
BlueprintName = "static"
ReferencedContainer = "container:ios.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>

View File

@@ -21,25 +21,19 @@ elif [[ ${FORMAT} == "dynamic" ]]; then
BUILD_STATIC=false
fi
BUNDLE_RESOURCES=${BUNDLE_RESOURCES:-}
BUNDLE_PATH=
if [[ ${BUNDLE_RESOURCES} ]]; then
BUNDLE_PATH="/${NAME}.bundle"
SELF_CONTAINED=${SELF_CONTAINED:-}
STATIC_BUNDLE_DIR=
if [[ ${SELF_CONTAINED} ]]; then
STATIC_BUNDLE_DIR="${OUTPUT}/static/${NAME}.framework"
else
STATIC_BUNDLE_DIR="${OUTPUT}/static"
fi
PLACE_RESOURCE_BUNDLES_OUTSIDE_FRAMEWORK=${PLACE_RESOURCE_BUNDLES_OUTSIDE_FRAMEWORK:-}
STATIC_BUNDLE_PATH=
if [[ ${PLACE_RESOURCE_BUNDLES_OUTSIDE_FRAMEWORK} ]]; then
STATIC_BUNDLE_PATH="${OUTPUT}/static${BUNDLE_PATH}"
STATIC_SETTINGS_DIR=
if [[ ${SELF_CONTAINED} ]]; then
STATIC_SETTINGS_DIR="${OUTPUT}/static/${NAME}.framework"
else
STATIC_BUNDLE_PATH="${OUTPUT}/static/${NAME}.framework${BUNDLE_PATH}"
fi
STATIC_SETTINGS_DIRECTORY=
if [[ ${PLACE_RESOURCE_BUNDLES_OUTSIDE_FRAMEWORK} ]]; then
STATIC_SETTINGS_DIRECTORY="${OUTPUT}"
else
STATIC_SETTINGS_DIRECTORY="${OUTPUT}/static/${NAME}.framework"
STATIC_SETTINGS_DIR="${OUTPUT}"
fi
SDK=iphonesimulator
@@ -48,7 +42,7 @@ if [[ ${BUILD_FOR_DEVICE} == true ]]; then
fi
IOS_SDK_VERSION=`xcrun --sdk ${SDK} --show-sdk-version`
echo "Configuring ${FORMAT:-dynamic and static} ${BUILDTYPE} framework for ${SDK}; symbols: ${GCC_GENERATE_DEBUGGING_SYMBOLS}; Mapbox.bundle: ${BUNDLE_RESOURCES} bundle.outside: ${PLACE_RESOURCE_BUNDLES_OUTSIDE_FRAMEWORK}"
echo "Configuring ${FORMAT:-dynamic and static} ${BUILDTYPE} framework for ${SDK}; symbols: ${GCC_GENERATE_DEBUGGING_SYMBOLS}; self-contained static framework: ${SELF_CONTAINED:-NO}"
function step { >&2 echo -e "\033[1m\033[36m* $@\033[0m"; }
function finish { >&2 echo -en "\033[0m"; }
@@ -71,10 +65,11 @@ echo -n "mapbox-gl-native "
echo ${HASH}
echo ${HASH} >> ${VERSION}
PROJ_VERSION=$(git rev-list --count HEAD)
SEM_VERSION=$( git describe --tags --match=ios-v*.*.* --abbrev=0 | sed 's/^ios-v//' )
SHORT_VERSION=${SEM_VERSION%-*}
step "Building targets (build ${PROJ_VERSION})…"
step "Building targets (build ${PROJ_VERSION}, version ${SEM_VERSION})…"
SCHEME='dynamic'
if [[ ${BUILD_DYNAMIC} == true && ${BUILD_STATIC} == true ]]; then
@@ -86,6 +81,9 @@ fi
xcodebuild \
GCC_GENERATE_DEBUGGING_SYMBOLS=${GCC_GENERATE_DEBUGGING_SYMBOLS} \
CURRENT_PROJECT_VERSION=${PROJ_VERSION} \
CURRENT_SHORT_VERSION=${SHORT_VERSION} \
CURRENT_SEMANTIC_VERSION=${SEM_VERSION} \
CURRENT_COMMIT_HASH=${HASH} \
-derivedDataPath ${DERIVED_DATA} \
-workspace ./platform/ios/ios.xcworkspace \
-scheme ${SCHEME} \
@@ -97,6 +95,9 @@ if [[ ${BUILD_FOR_DEVICE} == true ]]; then
xcodebuild \
GCC_GENERATE_DEBUGGING_SYMBOLS=${GCC_GENERATE_DEBUGGING_SYMBOLS} \
CURRENT_PROJECT_VERSION=${PROJ_VERSION} \
CURRENT_SHORT_VERSION=${SHORT_VERSION} \
CURRENT_SEMANTIC_VERSION=${SEM_VERSION} \
CURRENT_COMMIT_HASH=${HASH} \
-derivedDataPath ${DERIVED_DATA} \
-workspace ./platform/ios/ios.xcworkspace \
-scheme ${SCHEME} \
@@ -117,6 +118,8 @@ if [[ "${BUILD_FOR_DEVICE}" == true ]]; then
-o ${OUTPUT}/static/${NAME}.framework/${NAME} \
${LIBS[@]/#/${PRODUCTS}/${BUILDTYPE}-iphoneos/libmbgl-} \
${LIBS[@]/#/${PRODUCTS}/${BUILDTYPE}-iphonesimulator/libmbgl-}
cp -rv ${PRODUCTS}/${BUILDTYPE}-iphoneos/${NAME}.bundle ${STATIC_BUNDLE_DIR}
fi
if [[ ${BUILD_DYNAMIC} == true ]]; then
@@ -143,6 +146,8 @@ else
`find mason_packages/ios-${IOS_SDK_VERSION} -type f -name libgeojsonvt.a` \
-o ${OUTPUT}/static/${NAME}.framework/${NAME} \
${LIBS[@]/#/${PRODUCTS}/${BUILDTYPE}-iphonesimulator/libmbgl-}
cp -rv ${PRODUCTS}/${BUILDTYPE}-iphonesimulator/${NAME}.bundle ${STATIC_BUNDLE_DIR}
fi
if [[ ${BUILD_DYNAMIC} == true ]]; then
@@ -182,41 +187,14 @@ if [[ ${BUILD_STATIC} == true ]]; then
fi
step "Copying library resources…"
SEM_VERSION=$( git describe --tags --match=ios-v*.*.* --abbrev=0 | sed 's/^ios-v//' )
SHORT_VERSION=${SEM_VERSION%-*}
if [[ ${BUNDLE_RESOURCES} ]]; then
cp -pv LICENSE.md ${STATIC_SETTINGS_DIRECTORY}
cp -rv platform/ios/framework/Settings.bundle ${STATIC_SETTINGS_DIRECTORY}
else
cp -pv LICENSE.md "${OUTPUT}"
cp -rv platform/ios/framework/Settings.bundle "${OUTPUT}"
fi
cp -pv LICENSE.md ${STATIC_SETTINGS_DIR}
cp -rv platform/ios/framework/Settings.bundle ${STATIC_SETTINGS_DIR}
if [[ ${BUILD_STATIC} == true ]]; then
mkdir -p ${STATIC_BUNDLE_PATH}
cp -pv platform/{default,ios}/resources/* ${STATIC_BUNDLE_PATH}
INFO_PLIST_PATH="${OUTPUT}/static/${NAME}.framework/Info.plist"
cp -pv platform/ios/framework/Info.plist "${INFO_PLIST_PATH}"
plutil -remove CFBundleExecutable "${INFO_PLIST_PATH}"
plutil -remove CFBundlePackageType "${INFO_PLIST_PATH}"
plutil -replace CFBundleIdentifier -string com.mapbox.sdk.ios "${INFO_PLIST_PATH}"
plutil -replace CFBundleName -string ${NAME} "${INFO_PLIST_PATH}"
plutil -replace CFBundleShortVersionString -string "${SHORT_VERSION}" "${INFO_PLIST_PATH}"
plutil -replace CFBundleVersion -string ${PROJ_VERSION} "${INFO_PLIST_PATH}"
plutil -replace MGLSemanticVersionString -string "${SEM_VERSION}" "${INFO_PLIST_PATH}"
plutil -replace MGLCommitHash -string "${HASH}" "${INFO_PLIST_PATH}"
if [[ ${BUNDLE_RESOURCES} ]]; then
cp -pv "${INFO_PLIST_PATH}" "${STATIC_BUNDLE_PATH}/Info.plist"
fi
cp -pv "${STATIC_BUNDLE_DIR}/${NAME}.bundle/Info.plist" "${OUTPUT}/static/${NAME}.framework/Info.plist"
plutil -replace CFBundlePackageType -string FMWK "${OUTPUT}/static/${NAME}.framework/Info.plist"
mkdir "${OUTPUT}/static/${NAME}.framework/Modules"
cp -pv platform/ios/framework/modulemap "${OUTPUT}/static/${NAME}.framework/Modules/module.modulemap"
fi
if [[ ${BUILD_DYNAMIC} == true ]]; then
plutil -replace CFBundleShortVersionString -string "${SHORT_VERSION}" "${OUTPUT}/dynamic/${NAME}.framework/Info.plist"
plutil -replace CFBundleVersion -string "${PROJ_VERSION}" "${OUTPUT}/dynamic/${NAME}.framework/Info.plist"
plutil -replace MGLSemanticVersionString -string "${SEM_VERSION}" "${OUTPUT}/dynamic/${NAME}.framework/Info.plist"
plutil -replace MGLCommitHash -string "${HASH}" "${OUTPUT}/dynamic/${NAME}.framework/Info.plist"
cp -pv platform/ios/framework/strip-frameworks.sh "${OUTPUT}/dynamic/${NAME}.framework/strip-frameworks.sh"
fi
sed -n -e '/^## /,$p' platform/ios/CHANGELOG.md > "${OUTPUT}/CHANGELOG.md"
rm -rf /tmp/mbgl