forked from omnigroup/OmniGroup
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuild
More file actions
executable file
·145 lines (126 loc) · 4.67 KB
/
Copy pathBuild
File metadata and controls
executable file
·145 lines (126 loc) · 4.67 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/bin/zsh
#
# Copyright 2000-2010 Omni Development, Inc. All rights reserved.
#
# This software may only be used and reproduced according to the
# terms in the file OmniSourceLicense.html, which should be
# distributed with this project and can also be found at
# <http://www.omnigroup.com/developer/sourcecode/sourcelicense/>.
#
# $Id$
# Backwards compatibility -- if we are in the OmniGroup directory, cd up one directory
if [ "$PWD:t" = "OmniGroup" ]; then
cd ..
echo "Now in: $PWD"
else
# github requires lowercase for project names. Alert the user that we require 'OmniGroup' for now.
echo "This script should be run from the main source directory, which must be named 'OmniGroup'"
exit 1
fi
PUBLIC=/Users/Shared
ProjectName="$1"
shift
if [ ! -f /usr/bin/xcodebuild ]; then
echo "*******************************"
echo "Xcode is not installed, exiting"
echo "*******************************"
exit 1
fi
if [ -z "$OMNI_PRODUCT_DIRECTORY" ]; then
# Read the product and build directories from Xcode's defaults
productDirectory=$(defaults read com.apple.Xcode PBXProductDirectory | sed 's/\$(USER)/'$USER'/g')
if [ -z "$productDirectory" ]; then
productDirectory="$PUBLIC/$USER/Products"
echo "Warning: PBXProductDirectory not defined in Xcode, using $productDirectory"
fi
buildDirectory=$(defaults read com.apple.Xcode PBXIntermediatesDirectory | sed 's/\$(USER)/'$USER'/g')
if [ -z "$buildDirectory" ]; then
buildDirectory="$productDirectory/Builds"
echo "Warning: PBXIntermediatesDirectory not defined in Xcode, using $buildDirectory"
fi
else
# The user has explicitly set an OMNI_PRODUCT_DIRECTORY environment variable for us to use
productDirectory="$OMNI_PRODUCT_DIRECTORY"
buildDirectory="$productDirectory/Builds"
fi
mkdir -p "$productDirectory"
# This is what we'll pass to xcodebuild
BUILD_ACTION=$*
echo BUILD_ACTION=$BUILD_ACTION
if [ "$BUILD_ACTION" = "install" ]; then
BUILD_CONFIGURATION=Release
if [ -z "$OMNI_INSTALLED_PRODUCTS" ]; then
OMNI_INSTALLED_PRODUCTS=`dirname $productDirectory`/InstalledProducts
fi
echo "Making installed product files writable"
chmod -R u+w "$OMNI_INSTALLED_PRODUCTS"
OMNI_FRAMEWORK_TARGET_PATH="@executable_path/../Frameworks"
elif [ "$BUILD_ACTION" = "coverage" ]; then
if [ -z "$BUILD_CONFIGURATION" ]; then
BUILD_CONFIGURATION=Coverage
fi
OMNI_INSTALLED_PRODUCTS=""
OMNI_FRAMEWORK_TARGET_PATH="$productDirectory/$BUILD_CONFIGURATION"
# xcodebuild doesn't allow 'coverage' as an argument
BUILD_ACTION=
elif [ "$BUILD_ACTION" = "" ] || [ "$BUILD_ACTION" = "clean" ]; then
if [ -z "$BUILD_CONFIGURATION" ]; then
BUILD_CONFIGURATION=Debug
fi
OMNI_INSTALLED_PRODUCTS=""
OMNI_FRAMEWORK_TARGET_PATH="$productDirectory/$BUILD_CONFIGURATION"
else
echo "Error handling arguments: " $BUILD_ACTION
echo "Don't know which build style to use"
exit 1
fi
echo "#"
echo "#" `date`
echo "#" Starting build of $ProjectName
echo "#" BUILD_CONFIGURATION=$BUILD_CONFIGURATION
echo "#"
./OmniGroup/Scripts/projectList $ProjectName | sed 's/^\.\///' | while read project tag
do
directory="${project%\(*\)}"
if [ "$directory" != "$project" ]; then
spec=`echo "${(M)project%\(*\)}" | sed 's/(\(.*\))/\1/'`
target=$(echo $spec | cut -f1 -d: | perl -pe 's/\s+//mg')
style=$(echo $spec | cut -sf2 -d: | perl -pe 's/\s+//mg')
else
target=''
style=''
fi
if [ "$target" = "nobuild" ]; then
echo "Skipping $project..."
else
(
if [ -z "$style" ]; then
pbxopts=( '-configuration' "$BUILD_CONFIGURATION" )
else
pbxopts=( '-configuration' "$BUILD_CONFIGURATION-$style" )
fi
if [ -n "$target" ]; then
pbxopts=($pbxopts '-target' "$target")
fi
cd $directory
projectName="`echo *.xcodeproj(N)`"
pbxopts=($pbxopts '-project' "$projectName" )
if [ "$projectName" = "" ]; then
echo "*******************************"
echo "$directory has no Xcode project"
echo "*******************************"
exit 1
else
echo "Building ${projectName%.xcodeproj} (${project})"
(
set -x
xcodebuild DSTROOT="/" SYMROOT="$productDirectory" OBJROOT="$buildDirectory" OMNI_INSTALLED_PRODUCTS="$OMNI_INSTALLED_PRODUCTS" OMNI_FRAMEWORK_TARGET_PATH="$OMNI_FRAMEWORK_TARGET_PATH" $pbxopts $BUILD_ACTION
)
fi
) || (
echo "Build failed in ${projectName%.xcodeproj} (${project})"
exit 1
) || exit 1
fi
echo
done