You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2014/04/24 22:38:44 UTC

mac commit: CB-2926 Add a ./cordova/log project-level script for OSX

Repository: cordova-osx
Updated Branches:
  refs/heads/master 04c6c0c97 -> 33f8a87a3


CB-2926 Add a ./cordova/log project-level script for OSX

- added log output to build script if it starts the app after building
- added flag to support launching in foreground

Signed-off-by: Shazron Abdullah <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cordova-osx/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-osx/commit/33f8a87a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-osx/tree/33f8a87a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-osx/diff/33f8a87a

Branch: refs/heads/master
Commit: 33f8a87a3f99ffc029dab5b62b6c4684147f5d34
Parents: 04c6c0c
Author: Tobias Bocanegra <tr...@adobe.com>
Authored: Tue Apr 22 18:35:37 2014 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Thu Apr 24 13:38:36 2014 -0700

----------------------------------------------------------------------
 templates/scripts/cordova/build | 26 ++++++++++++++++++++------
 templates/scripts/cordova/run   |  3 +--
 2 files changed, 21 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/33f8a87a/templates/scripts/cordova/build
----------------------------------------------------------------------
diff --git a/templates/scripts/cordova/build b/templates/scripts/cordova/build
index 542dc88..a6dd96e 100755
--- a/templates/scripts/cordova/build
+++ b/templates/scripts/cordova/build
@@ -22,6 +22,14 @@
 #
 # compile and launch a Cordova/iOS project to the simulator
 #
+function usage() {
+    echo "Usage: $0"
+    echo "      --clean    : clean before building"
+    echo "      --debug    : use debug configuration (default)."
+    echo "      --release  : use release configuration."
+    echo "      --run      : run application after building"
+    echo "      --fg       : run application in foreground after building"
+}
 
 CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P)
 PROJECT_PATH="$(dirname "$CORDOVA_PATH")"
@@ -33,15 +41,17 @@ cd "$PROJECT_PATH"
 
 CONFIGURATION=Debug
 CLEAN=
-OPEN=0
+RUN=
 while [[ $# -gt 0 ]]; do
     case "$1" in
         --debug) ;;
         --release) CONFIGURATION=Release;;
-        --device) OPEN=1 ;; # ignored for osx
-        --emulator) OPEN=1 ;; # ignored for osx
+        --device) RUN=run ;; # ignored for osx
+        --emulator) RUN=run ;; # ignored for osx
+        --run) RUN=run ;; # ignored for osx
+        --fg) RUN=fg;;
         --clean) CLEAN=clean;;
-        *) echo "Unrecognized flag: $1"; exit 2;;
+        *) echo "Unrecognized flag: $1"; usage; exit 2;;
     esac
     shift
 done
@@ -53,7 +63,11 @@ xcodebuild \
     -configuration "$CONFIGURATION" \
     $CLEAN build
 
-if (($OPEN)); then
+if [ "$RUN" == "run" ]; then
     echo "Starting $PROJECT_NAME.app ..."
-    open "$PROJECT_PATH/build/$PROJECT_NAME.app"
+    exec "$PROJECT_PATH/build/$PROJECT_NAME.app/Contents/MacOS/$PROJECT_NAME" \
+          > "$CORDOVA_PATH/console.log" 2>&1 &
+elif [ "$RUN" == "fg" ]; then
+    echo "Starting $PROJECT_NAME.app ..."
+    exec "$PROJECT_PATH/build/$PROJECT_NAME.app/Contents/MacOS/$PROJECT_NAME"
 fi
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/33f8a87a/templates/scripts/cordova/run
----------------------------------------------------------------------
diff --git a/templates/scripts/cordova/run b/templates/scripts/cordova/run
index 611d98c..51a0395 100755
--- a/templates/scripts/cordova/run
+++ b/templates/scripts/cordova/run
@@ -19,5 +19,4 @@
 # under the License.
 #
 CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P)
-"$CORDOVA_PATH/build" --device || exit $?
-
+"$CORDOVA_PATH/build" --run $* || exit $?
\ No newline at end of file