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