Skip to content

Commit

Permalink
obfuscate_project tool using simulator SDK when using SDK >= 8 or Xco…
Browse files Browse the repository at this point in the history
…de >= 6; pull request comments related modification;
  • Loading branch information
Tomasz Grynfelder committed Feb 2, 2015
1 parent 9a2274b commit 96a29a0
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions contrib/obfuscate_project
Expand Up @@ -13,6 +13,9 @@ SDK=7.1
XCODEBUILD_OPTS=""
CLASS_GUARD_OPTS="-i IgnoredSymbol -F !ExcludedClass"

# In case of using Xcode >= 6 and SDK >= 8
CLASS_GUARD_OPTS_SDK="--sdk-root /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator$SDK.sdk"

####################################################
# BUILD SCRIPT STARTS HERE
####################################################
Expand Down Expand Up @@ -49,7 +52,15 @@ rm -rf build/
[[ -n "$PROJECT" ]] && XCODEBUILD_OPTS="$XCODEBUILD_OPTS -project $PROJECT"
[[ -n "$SCHEME" ]] && XCODEBUILD_OPTS="$XCODEBUILD_OPTS -scheme $SCHEME"
[[ -n "$CONFIGURATION" ]] && XCODEBUILD_OPTS="$XCODEBUILD_OPTS -configuration $CONFIGURATION"
[[ -n "$SDK" ]] && XCODEBUILD_OPTS="$XCODEBUILD_OPTS -sdk iphoneos$SDK"

xcodeversion=`xcodebuild -version | grep -oE '^Xcode\s+\d+' | grep -oE '\d+'`
if ((xcodeversion > 5)) || ((SDK >= 8.0))
then
[[ -n "$SDK" ]] && XCODEBUILD_OPTS="$XCODEBUILD_OPTS -sdk iphonesimulator$SDK"
else
[[ -n "$SDK" ]] && XCODEBUILD_OPTS="$XCODEBUILD_OPTS -sdk iphoneos$SDK"
[[ -n "$SDK" ]] && CLASS_GUARD_OPTS_SDK="--sdk-ios $SDK"
fi

echo_and_run xcodebuild $XCODEBUILD_OPTS \
clean build \
Expand All @@ -73,14 +84,14 @@ do
echo "You cannot use this tool when there is more than one .app file in products. Otherwise, only the first one will be used for obfuscation."
echo ""
echo ""
exit
exit 1
fi
((appsNumber+=1))

TARGET=$(basename "$app" .app)
echo "Obfuscating $TARGET in $app..."
echo_and_run ios-class-guard \
--sdk-ios "$SDK" \
$CLASS_GUARD_OPTS_SDK \
$CLASS_GUARD_OPTS \
-O "$SYMBOLS_FILE" \
"$app/$TARGET"
Expand Down

1 comment on commit 96a29a0

@jiang-yi-siphty
Copy link

Choose a reason for hiding this comment

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

This bash doesn't work since iOS 9 XCode 7.0 release......
HELP!!! PLEASE!!!!

Please sign in to comment.