1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-01-31 11:01:46 +02:00

remove $ from code-blocks in build_all.sh (#955)

* removed $ from code-blocks in build_all.sh

* separate the code from the output

* added shell indicator for the code block

* added shell indicator for the code block

* update logging.md

* separate the code from the output in other files as well

* update the output code-blocks to text
This commit is contained in:
Sharun 2023-07-12 10:31:16 -04:00 committed by GitHub
parent 4f84a7e505
commit c564ca625f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 47 additions and 29 deletions

View File

@ -20,5 +20,8 @@ Build, push, and run the client on your device:
```shell
{{#include ../build_all.sh:birthday_client}}
```
```text
Happy Birthday Charlie, congratulations with the 60 years!
```

View File

@ -10,13 +10,19 @@ In another terminal, check that the service runs:
```shell
{{#include ../build_all.sh:service_check_birthday_server}}
```
```text
Service birthdayservice: found
```
You can also call the service with `service call`:
```shell
$ {{#include ../build_all.sh:service_call_birthday_server}}
{{#include ../build_all.sh:service_call_birthday_server}}
```
```text
Result: Parcel(
0x00000000: 00000000 00000036 00610048 00700070 '....6...H.a.p.p.'
0x00000010: 00200079 00690042 00740072 00640068 'y. .B.i.r.t.h.d.'

View File

@ -19,5 +19,8 @@ You can now build, push, and run the binary:
```shell
{{#include ../build_all.sh:hello_rust}}
```
```text
Hello from Rust!
```

View File

@ -32,6 +32,9 @@ You build, push, and run the binary like before:
```shell
{{#include ../build_all.sh:hello_rust_with_dep}}
```
```text
Hello Bob, it is very
nice to meet you!
```

View File

@ -34,26 +34,26 @@ adb shell rm -rf '/data/local/tmp/*'
run_example <<EOF
# ANCHOR: hello_rust
$ m hello_rust
$ adb push "$ANDROID_PRODUCT_OUT/system/bin/hello_rust /data/local/tmp"
$ adb shell /data/local/tmp/hello_rust
m hello_rust
adb push "$ANDROID_PRODUCT_OUT/system/bin/hello_rust /data/local/tmp"
adb shell /data/local/tmp/hello_rust
# ANCHOR_END: hello_rust
EOF
run_example <<EOF
# ANCHOR: hello_rust_with_dep
$ m hello_rust_with_dep
$ adb push "$ANDROID_PRODUCT_OUT/system/bin/hello_rust_with_dep /data/local/tmp"
$ adb shell /data/local/tmp/hello_rust_with_dep
m hello_rust_with_dep
adb push "$ANDROID_PRODUCT_OUT/system/bin/hello_rust_with_dep /data/local/tmp"
adb shell /data/local/tmp/hello_rust_with_dep
# ANCHOR_END: hello_rust_with_dep
EOF
function birthday_server() {
run_example <<EOF
# ANCHOR: birthday_server
$ m birthday_server
$ adb push "$ANDROID_PRODUCT_OUT/system/bin/birthday_server /data/local/tmp"
$ adb shell /data/local/tmp/birthday_server
m birthday_server
adb push "$ANDROID_PRODUCT_OUT/system/bin/birthday_server /data/local/tmp"
adb shell /data/local/tmp/birthday_server
# ANCHOR_END: birthday_server
EOF
}
@ -70,21 +70,21 @@ echo "Found birthdayservice..."
run_example <<EOF
# ANCHOR: service_check_birthday_server
$ adb shell service check birthdayservice
adb shell service check birthdayservice
# ANCHOR_END: service_check_birthday_server
EOF
run_example <<EOF
# ANCHOR: service_call_birthday_server
$ adb shell service call birthdayservice 1 s16 Bob i32 24
adb shell service call birthdayservice 1 s16 Bob i32 24
# ANCHOR_END: service_call_birthday_server
EOF
run_example <<EOF
# ANCHOR: birthday_client
$ m birthday_client
$ adb push "$ANDROID_PRODUCT_OUT/system/bin/birthday_client /data/local/tmp"
$ adb shell /data/local/tmp/birthday_client Charlie 60
m birthday_client
adb push "$ANDROID_PRODUCT_OUT/system/bin/birthday_client /data/local/tmp"
adb shell /data/local/tmp/birthday_client Charlie 60
# ANCHOR_END: birthday_client
EOF
@ -93,38 +93,38 @@ pkill -f birthday_server
run_example <<EOF
# ANCHOR: hello_rust_logs
$ m hello_rust_logs
$ adb push "$ANDROID_PRODUCT_OUT/system/bin/hello_rust_logs /data/local/tmp"
$ adb shell /data/local/tmp/hello_rust_logs
m hello_rust_logs
adb push "$ANDROID_PRODUCT_OUT/system/bin/hello_rust_logs /data/local/tmp"
adb shell /data/local/tmp/hello_rust_logs
# ANCHOR_END: hello_rust_logs
EOF
run_example <<EOF
# ANCHOR: print_birthday_card
$ m print_birthday_card
$ adb push "$ANDROID_PRODUCT_OUT/system/bin/print_birthday_card /data/local/tmp"
$ adb shell /data/local/tmp/print_birthday_card
m print_birthday_card
adb push "$ANDROID_PRODUCT_OUT/system/bin/print_birthday_card /data/local/tmp"
adb shell /data/local/tmp/print_birthday_card
# ANCHOR_END: print_birthday_card
EOF
run_example <<EOF
# ANCHOR: libbirthday_bindgen_test
$ atest libbirthday_bindgen_test
atest libbirthday_bindgen_test
# ANCHOR_END: libbirthday_bindgen_test
EOF
run_example <<EOF
# ANCHOR: analyze_numbers
$ m analyze_numbers
$ adb push "$ANDROID_PRODUCT_OUT/system/bin/analyze_numbers /data/local/tmp"
$ adb shell /data/local/tmp/analyze_numbers
m analyze_numbers
adb push "$ANDROID_PRODUCT_OUT/system/bin/analyze_numbers /data/local/tmp"
adb shell /data/local/tmp/analyze_numbers
# ANCHOR_END: analyze_numbers
EOF
run_example <<EOF
# ANCHOR: helloworld_jni
$ m helloworld_jni
$ adb sync # requires adb root && adb remount
$ adb shell /system/bin/helloworld_jni
m helloworld_jni
adb sync # requires adb root && adb remount
adb shell /system/bin/helloworld_jni
# ANCHOR_END: helloworld_jni
EOF

View File

@ -24,7 +24,10 @@ Build, push, and run the binary on your device:
The logs show up in `adb logcat`:
```shell
$ adb logcat -s rust
adb logcat -s rust
```
```text
09-08 08:38:32.454 2420 2420 D rust: hello_rust_logs: Starting program.
09-08 08:38:32.454 2420 2420 I rust: hello_rust_logs: Things are going fine.
09-08 08:38:32.454 2420 2420 E rust: hello_rust_logs: Something went wrong!