Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Side by Side Diff: samples/simple_todo/compile.sh

Issue 2035023003: Remove service-compiler related code. (Closed) Base URL: git@github.com:dartino/sdk.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « samples/samples.status ('k') | samples/simple_todo/java/SimpleTodo.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/bin/bash
2
3 # Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file
4 # for details. All rights reserved. Use of this source code is governed by a
5 # BSD-style license that can be found in the LICENSE.md file.
6
7 set -eu
8
9 THIS_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
10 ROOT_DIR=$(cd "$THIS_DIR/../.." && pwd)
11
12 TEST_PY="$ROOT_DIR/tools/test.py"
13
14 ARCH="ia32"
15 MODE="release"
16 TARGET=""
17 OUT=""
18
19 function print_help() {
20 echo
21 echo "This script can be run as:"
22 echo " compile.sh [<options>] <target>"
23 echo
24 echo " where <options> are:"
25 echo " -a <arch> (eg, ia32, x64)"
26 echo " -m <mode> (eg, debug, release)"
27 echo
28 echo " and <target> is one of:"
29 echo " cc (run the C-based CLI)"
30 echo " java (run the Java-based CLI)"
31 }
32
33 function print_error() {
34 echo "Error: $1"
35 print_help
36 exit 1
37 }
38
39 function build() {
40 SUFFIX=service_tests/simple_todo_$1
41 OUT="$ROOT_DIR/out/${MODE_CC}${ARCH_UC}/temporary_test_output/$SUFFIX"
42 $TEST_PY -a $ARCH -m $MODE dartino_tests/$SUFFIX
43 echo
44 echo "Compilation and testing succeeded"
45 echo "Compiled output in"
46 echo " $OUT"
47 }
48
49 while [[ $# > 1 ]]; do
50 case "$1" in
51 -a|--arch) ARCH="$2"; shift 2;;
52 -m|--mode) MODE="$2"; shift 2;;
53 *) echo "Unknown option $1"; exit 1;;
54 esac
55 done
56
57 if [[ $# == 1 ]]; then
58 TARGET="$1"
59 shift
60 else
61 print_error "unsupplied target"
62 fi
63
64 # lowercase and uppercase arch
65 ARCH=$(echo -n "$ARCH" | tr "[:upper:]" "[:lower:]")
66 ARCH_UC=$(echo -n "$ARCH" | tr "[:lower:]" "[:upper:]")
67
68 # lowercase and capitalized mode
69 MODE=$(echo -n "$MODE" | tr "[:upper:]" "[:lower:]")
70 MODE_CC=$(echo -n "${MODE:0:1}" | tr "[:lower:]" "[:upper:]"; echo "${MODE:1}")
71
72 case "$TARGET" in
73 cc)
74 build cc
75 $OUT/simple_todo_sample $OUT/simple_todo.snapshot
76 ;;
77 java)
78 if [[ "$ARCH" != "x64" ]]; then
79 print_error "Target java requires using 64 bit by setting: -a x64"
80 fi
81 build java
82 LD_LIBRARY_PATH=$OUT \
83 java -d64 -ea -cp $OUT/simple_todo.jar -Djava.library.path=$OUT \
84 SimpleTodo $OUT/simple_todo.snapshot
85 ;;
86 *)
87 print_error "unknown target '$TARGET'"
88 ;;
89 esac
OLDNEW
« no previous file with comments | « samples/samples.status ('k') | samples/simple_todo/java/SimpleTodo.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698