-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathAppDNA.sh
51 lines (39 loc) · 1.91 KB
/
AppDNA.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
# AppDNA Script
# Copyright 2006 Chuck Houpt <chuck@habilis.net>. No rights reserved.
set -eux
# Only bundle the source for Release/Deployment builds.
if [ "$CONFIGURATION" != 'Release' -a "$CONFIGURATION" != 'Deployment' ] ; then exit ; fi
INSIDE_SOURCE="$TARGET_BUILD_DIR"/"$CONTENTS_FOLDER_PATH"/Source
PROJECT_NAME=`basename "$PROJECT_FILE_PATH"`
rm -rf "$INSIDE_SOURCE"
mkdir -p "$INSIDE_SOURCE"
# Copy the source tree, minus resources, into Content/Source.
rsync -a --cvs-exclude --extended-attributes --exclude 'NoRedist' --exclude 'Updates' \
--exclude 'build' --exclude '*.pbxuser' --exclude '*.mode1' --exclude '.git' \
--exclude '*.scriptSuite' --exclude '*.a' --exclude '*.o' --exclude '*.d' \
--exclude '*.iconset' --exclude 'xcuserdata' --exclude '*.mode1v3' --exclude '*.perspectivev3' \
$@ \
"$SRCROOT"/ "$INSIDE_SOURCE"
# Check if the project has already been modified for embedding.
if ! grep 'path = ../Resources;' "$PROJECT_FILE_PATH"/project.pbxproj
then
# No, so modify the project to find resources in the Package's Resources directory.
# Change the location of Info.plist, since it isn't like other resources. Add _Mod to
# Current Project Version to identify derivitive apps.
sed \
-e '/name = Resources;/a\
path = ../Resources;\
' \
-e 's/path = Info.plist; sourceTree = "<group>";/path = Info.plist; sourceTree = SOURCE_ROOT;/' \
-e 's/CURRENT_PROJECT_VERSION = \(.*\);/CURRENT_PROJECT_VERSION = \1_Mutant;/g' \
"$PROJECT_FILE_PATH"/project.pbxproj > "$INSIDE_SOURCE"/"$PROJECT_NAME"/project.pbxproj
# Check if the project is embedded.
elif [ -d "$SRCROOT"/../../../"$WRAPPER_NAME" ]
then
# Project embedded, so syncrhonize the build result to the enclosing application.
rsync -a --extended-attributes --exclude 'Source' "$TARGET_BUILD_DIR"/"$WRAPPER_NAME"/ "$SRCROOT"/../../../"$WRAPPER_NAME"
fi
cd "$TARGET_BUILD_DIR"/"$CONTENTS_FOLDER_PATH"
zip -r Source.zip Source
rm -rf "$INSIDE_SOURCE"