Skip to content

Commit 7adb1e2

Browse files
authored
Merge branch 'google:main' into async-chapter
2 parents 29be28b + 8c56c94 commit 7adb1e2

File tree

117 files changed

+10573
-5996
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+10573
-5996
lines changed

.github/workflows/build.yml

+46
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ jobs:
2525
- name: Test code snippets
2626
run: mdbook test
2727

28+
format:
29+
name: Format
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v3
34+
35+
- name: Format Rust code
36+
run: cargo fmt --all -- --check
37+
2838
cargo:
2939
runs-on: ubuntu-latest
3040
steps:
@@ -40,6 +50,42 @@ jobs:
4050
- name: Test Rust code
4151
run: cargo test
4252

53+
bare-metal:
54+
name: Build bare-metal Rust examples
55+
runs-on: ubuntu-latest
56+
strategy:
57+
matrix:
58+
include:
59+
- directory: src/bare-metal/alloc-example
60+
target: aarch64-unknown-none
61+
- directory: src/bare-metal/aps/examples
62+
target: aarch64-unknown-none
63+
- directory: src/bare-metal/microcontrollers/examples
64+
target: thumbv7em-none-eabihf
65+
- directory: src/exercises/bare-metal/compass
66+
target: thumbv7em-none-eabihf
67+
- directory: src/exercises/bare-metal/rtc
68+
target: aarch64-unknown-none
69+
steps:
70+
- name: Checkout
71+
uses: actions/checkout@v3
72+
73+
- name: Setup Rust cache
74+
uses: ./.github/workflows/setup-rust-cache
75+
76+
- name: Install dependencies
77+
run: sudo apt update && sudo apt install gcc-aarch64-linux-gnu
78+
79+
- name: Install toolchain
80+
uses: actions-rs/toolchain@v1
81+
with:
82+
toolchain: stable
83+
target: ${{ matrix.target }}
84+
85+
- name: Build Rust code
86+
working-directory: ${{ matrix.directory }}
87+
run: cargo build
88+
4389
i18n-helpers:
4490
runs-on: ubuntu-latest
4591
steps:

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ target/
33
po/messages.pot
44
po/*.mo
55
.DS_Store
6-
6+
*.bin

Cargo.lock

+57-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
members = [
33
"i18n-helpers",
44
"src/exercises",
5+
"src/bare-metal/useful-crates/allocator-example",
6+
"src/bare-metal/useful-crates/zerocopy-example",
57
]

i18n-helpers/src/bin/mdbook-gettext.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
//! is found under `po` directory based on the `book.language`.
2222
//! For example, `book.langauge` is set to `ko`, then `po/ko.po` is used.
2323
//! You can set `preprocessor.gettext.po-dir` to specify where to find PO
24-
//! files. If the PO file is not found, you'll get the untranslated book.
24+
//! files. If the PO file is not found, you'll get the untranslated book.
2525
//!
2626
//! See `TRANSLATIONS.md` in the repository root for more information.
2727
@@ -33,8 +33,7 @@ use mdbook::BookItem;
3333
use polib::catalog::Catalog;
3434
use polib::po_file;
3535
use semver::{Version, VersionReq};
36-
use std::io;
37-
use std::process;
36+
use std::{io, process};
3837
use toml::Value;
3938

4039
fn translate(text: &str, catalog: &Catalog) -> String {

i18n-helpers/src/bin/mdbook-xgettext.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ use mdbook::renderer::RenderContext;
2626
use mdbook::BookItem;
2727
use polib::catalog::Catalog;
2828
use polib::message::Message;
29-
use std::fs;
30-
use std::io;
29+
use std::{fs, io};
3130

3231
fn add_message(catalog: &mut Catalog, msgid: &str, source: &str) {
3332
let sources = match catalog.find_message(msgid) {
@@ -91,8 +90,7 @@ fn create_catalog(ctx: &RenderContext) -> anyhow::Result<Catalog> {
9190
Some(path) => ctx.config.book.src.join(path),
9291
None => continue,
9392
};
94-
for msg in i18n_helpers::extract_msgs(&chapter.content)
95-
{
93+
for msg in i18n_helpers::extract_msgs(&chapter.content) {
9694
let source = format!("{}:{}", path.display(), msg.line_number());
9795
add_message(&mut catalog, msg.text(&chapter.content), &source);
9896
}

0 commit comments

Comments
 (0)