OLD | NEW |
| (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 # Setup | |
8 # - Install and build dartino. | |
9 # - Install Cocoapods. | |
10 # - Run immic (output in generated/packages/immi). | |
11 # - Run servicec (output in generated/packages/service). | |
12 # - Generate libdartino.a for your choice of platforms and add it to xcode. | |
13 # - Generate snapshot of your Dart program and add it to xcode. | |
14 # - Write Podfile that links to {Dartino,Service,Immi}.podspec. | |
15 # - Run pod install. | |
16 | |
17 # Build (implemented by the present script). | |
18 # - Run immic. | |
19 # - Run servicec. | |
20 # - Generate libdartino. | |
21 # - Generate snapshot of your Dart program. | |
22 | |
23 # After this, hit the 'run' button in xcode. | |
24 | |
25 set -ue | |
26 DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
27 PROJ=github | |
28 | |
29 DARTINO_DIR="$(cd "$DIR/../../.." && pwd)" | |
30 DARTINO_PKG_DIR="$DARTINO_DIR/package" | |
31 | |
32 TARGET_DIR="$(cd "$DIR/.." && pwd)" | |
33 TARGET_GEN_DIR="$TARGET_DIR/generated" | |
34 TARGET_PKG_FILE="$TARGET_DIR/.packages" | |
35 | |
36 IMMI_GEN_DIR="$TARGET_GEN_DIR/immi" | |
37 SERVICE_GEN_DIR="$TARGET_GEN_DIR/service" | |
38 | |
39 DART="$DARTINO_DIR/out/ReleaseIA32/dart" | |
40 IMMIC="$DART $DARTINO_DIR/tools/immic/bin/immic.dart" | |
41 DARTINO="$DARTINO_DIR/out/ReleaseIA32/dartino" | |
42 SERVICEC="$DARTINO x-servicec" | |
43 | |
44 MOCK_SERVER_SNAPSHOT="$TARGET_DIR/github_mock_service.snapshot" | |
45 | |
46 set -x | |
47 | |
48 cd $DARTINO_DIR | |
49 | |
50 ninja -C out/ReleaseIA32 | |
51 | |
52 ./tools/persistent_process_info.sh -k | |
53 | |
54 # Generate dart service file and other immi files with the compiler. | |
55 if [[ $# -eq 0 ]] || [[ "$1" == "immi" ]]; then | |
56 rm -rf "$IMMI_GEN_DIR" | |
57 mkdir -p "$IMMI_GEN_DIR" | |
58 $IMMIC --packages "$TARGET_PKG_FILE" --out "$IMMI_GEN_DIR" "$TARGET_DIR/lib/
$PROJ.immi" | |
59 | |
60 rm -rf "$SERVICE_GEN_DIR" | |
61 mkdir -p "$SERVICE_GEN_DIR" | |
62 $SERVICEC file "$IMMI_GEN_DIR/idl/immi_service.idl" out "$SERVICE_GEN_DIR" | |
63 | |
64 # Regenerate the mock service after deleting the service-gen directory. | |
65 $DIR/../compile_mock_service.sh service | |
66 fi | |
67 | |
68 if [[ $# -eq 0 ]] || [[ "$1" == "dartino" ]]; then | |
69 ninja -C out/ReleaseIA32IOS libdartino.a | |
70 ninja -C out/ReleaseXARM libdartino.a | |
71 lipo -create -output "$DIR/libdartinovm.a" \ | |
72 out/ReleaseIA32IOS/libdartino.a \ | |
73 out/ReleaseXARM/libdartino.a | |
74 fi | |
75 | |
76 if [[ $# -eq 0 ]] || [[ "$1" == "snapshot" ]]; then | |
77 $DART -c --packages=.packages \ | |
78 -Dsnapshot="$DIR/$PROJ.snapshot" \ | |
79 -Dpackages="$TARGET_PKG_FILE" \ | |
80 tests/dartino_compiler/run.dart "$TARGET_DIR/bin/$PROJ.dart" | |
81 fi | |
82 | |
83 # Ensure that we have a mock server. | |
84 if [[ $# -eq 0 ]] && [[ ! -f "$MOCK_SERVER_SNAPSHOT" ]]; then | |
85 $DIR/../compile_mock_service.sh | |
86 fi | |
87 | |
88 set +x | |
89 | |
90 if [[ $# -eq 1 ]]; then | |
91 echo | |
92 echo "Only ran task $1." | |
93 echo "Possible tasks: immi, dartino, and snapshot" | |
94 echo "If Dartino or any IMMI files changed re-run compile.sh without argumen
ts." | |
95 fi | |
OLD | NEW |