Skip to content
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.

Add jspahrsummers/objc-build-scripts #63

Merged
merged 2 commits into from
May 6, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions script/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
**Copyright (c) 2013 Justin Spahr-Summers**

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 changes: 20 additions & 0 deletions script/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
These scripts are primarily meant to support the use of
[Janky](https://github.com/github/janky). To use them, read the contents of this
repository into a `script` folder:

```
$ git remote add objc-build-scripts https://github.com/jspahrsummers/objc-build-scripts.git
$ git fetch objc-build-scripts
$ git read-tree --prefix=script/ -u objc-build-scripts/master
```

Then commit the changes to incorporate the scripts into your own repository's
history. You can also freely tweak the scripts for your specific project's
needs.

To bring in upstream changes later:

```
$ git fetch -p objc-build-scripts
$ git merge -Xsubtree=script objc-build-scripts/master
```
11 changes: 11 additions & 0 deletions script/bootstrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

SCRIPT_DIR=$(dirname "$0")
cd "$SCRIPT_DIR/.."

set -o errexit

echo "*** Updating submodules..."
git submodule sync --quiet
git submodule update --init
git submodule foreach --recursive --quiet "git submodule sync --quiet && git submodule update --init"
44 changes: 44 additions & 0 deletions script/cibuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

SCRIPT_DIR=$(dirname "$0")
cd "$SCRIPT_DIR/.."

##
## Configuration Variables
##

# The build configuration to use.
if [ -z "$XCCONFIGURATION" ]
then
XCCONFIGURATION="Release"
fi

# A bootstrap script to run before building.
#
# If this file does not exist, it is not considered an error.
BOOTSTRAP="$SCRIPT_DIR/bootstrap"

# Extra build settings to pass to xcodebuild.
XCODEBUILD_SETTINGS=

##
## Build Process
##

if [ -f "$BOOTSTRAP" ]
then
echo "*** Bootstrapping..."
bash "$BOOTSTRAP" || exit $?
fi

echo "*** Building framework..."
xcodebuild -workspace ReactiveCocoaLayout.xcworkspace -configuration "$XCCONFIGURATION" -scheme "ReactiveCocoaLayout Mac" clean test OBJROOT="$PWD/build" SYMROOT="$PWD/build" $XCODEBUILD_SETTINGS || exit $?
xcodebuild -workspace ReactiveCocoaLayout.xcworkspace -configuration "$XCCONFIGURATION" -scheme "ReactiveCocoaLayout iOS" clean build OBJROOT="$PWD/build" SYMROOT="$PWD/build" $XCODEBUILD_SETTINGS || exit $?

echo "*** Building demos..."

cd Demos/DeviceRotation
xcodebuild -configuration "$XCCONFIGURATION" -scheme "DeviceRotation" -sdk iphonesimulator build OBJROOT="$PWD/build" SYMROOT="$PWD/build" $XCODEBUILD_SETTINGS || exit $?

cd ../ResizingWindow
xcodebuild -configuration "$XCCONFIGURATION" -scheme "ResizingWindow" build OBJROOT="$PWD/build" SYMROOT="$PWD/build" $XCODEBUILD_SETTINGS || exit $?
12 changes: 12 additions & 0 deletions script/targets.awk
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
BEGIN {
FS = "\n";
}

/Targets:/ {
while (getline && $0 != "") {
if ($0 ~ /Tests/) continue;

sub(/^ +/, "");
print "'" $0 "'";
}
}
35 changes: 35 additions & 0 deletions script/xcodebuild.awk
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Exit statuses:
#
# 0 - No errors found.
# 1 - Build or test failure. Errors will be logged automatically.
# 2 - Untestable target. Retry with the "build" action.

BEGIN {
status = 0;
}

{
print;
fflush(stdout);
}

/is not valid for Testing/ {
exit 2;
}

/[0-9]+: (error|warning):/ {
errors = errors $0 "\n";
}

/(TEST|BUILD) FAILED/ {
status = 1;
}

END {
if (length(errors) > 0) {
print "\n*** All errors:\n" errors;
}

fflush(stdout);
exit status;
}