After #1528 and #1532, we now have actual slides which showcase the
crates in action. So we can reclaim a few minutes by removing the slide
which mentions Mockall and GoogleTest slide.
The slide mentioned [proptest](https://docs.rs/proptest) and
[rstest](https://docs.rs/rstest) as well. While I'm sure the libraries
are useful, we don't have them imported into AOSP and I've never
personally used them. We should therefore not advertise them yet at this
point since they won't be useful to Android engineers.
Of course we can mention things that are not in AOSP (or in Chromium),
but I think we should do it in the speaker notes at most.
This is the result of running `dprint fmt` after removing `src/` from
the list of excluded directories.
This also reformats the Rust code: we might want to tweak this a bit in
the future since some of the changes removes the hand-formatting. Of
course, this formatting can be seen as a mis-feature, so maybe this is
good overall.
Thanks to mdbook-i18n-helpers 0.2, the POT file is nearly unchanged
after this, meaning that all existing translations remain valid! A few
messages were changed because of stray whitespace characters:
msgid ""
"Slices always borrow from another object. In this example, `a` has to remain "
-"'alive' (in scope) for at least as long as our slice. "
+"'alive' (in scope) for at least as long as our slice."
msgstr ""
The formatting is enforced in CI and we will have to see how annoying
this is in practice for the many contributors. If it becomes annoying,
we should look into fixing dprint/check#11 so that `dprint` can annotate
the lines that need fixing directly, then I think we can consider more
strict formatting checks.
I added more customization to `rustfmt.toml`. This is to better emulate
the dense style used in the course:
- `max_width = 85` allows lines to take up the full width available in
our code blocks (when taking margins and the line numbers into account).
- `wrap_comments = true` ensures that we don't show very long comments
in the code examples. I edited some comments to shorten them and avoid
unnecessary line breaks — please trim other unnecessarily long comments
when you see them! Remember we're writing code for slides 😄
- `use_small_heuristics = "Max"` allows for things like struct literals
and if-statements to take up the full line width configured above.
The formatting settings apply to all our Rust code right now — I think
we could improve this with https://github.com/dprint/dprint/issues/711
which lets us add per-directory `dprint` configuration files. However,
the `inherit: true` setting is not yet implemented (as far as I can
tell), so a nested configuration file will have to copy most or all of
the top-level file.
```
$ adb shell /data/local/tmp/hello_rust_with_dep
CANNOT LINK EXECUTABLE "/data/local/tmp/hello_rust_with_dep": library "libtextwrap.dylib.so" not found: needed by main executable
```
```
error: unsafe block missing a safety comment
--> interoperability/bindgen/main.rs:11:5
|
11 | unsafe {
| ^^^^^^^^
|
= help: consider adding a safety comment on the preceding line
= help: for further information visit https://rust-lang.github.io/rust-clippy
/master/index.html#undocumented_unsafe_blocks
= note: requested on the command line with `-D clippy::undocumented-unsafe-bl
ocks`
```
```
$ lunch aosp_cf_x86_64_phone-userdebug
Invalid lunch combo: aosp_cf_x86_64_phone-userdebug
Valid combos must be of the form <product>-<release>-<variant>
```
Add a number of slides that cover most of CXX's functionality and
demonstrate how it can be used.
Fixes#823.
---------
Co-authored-by: Martin Geisler <mgeisler@google.com>
While we don’t have slides showing how to use the crate (#823), we can
at least explain at a high level what the instructor should focus on
when walking through the tutorial.
* 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
* remove $ from code blocks in translations
* remove $ from code blocks in the other markdown files as well
* Revert "remove $ from code blocks in the other markdown files as well"
This reverts commit eda922dab93dd2d2967581650a5c983432ec3a80.
* remove $ from code blocks in setup.md
* re-added the previous changes
* revert logging.md
* Update build_all.sh
The path, $ANDROID_BUILD_TOP and/or $ANDROID_PRODUCT_OUT, can contain spaces, which results in error. As long as shell var is not number, it is safe to enclose it with ""
* Enclose full shell word in quotes
This is just a stylistic choice: I find it easier to parse a command line if the full shell word is in quotes.
---------
Co-authored-by: Martin Geisler <martin@geisler.net>