Skip to content

Commit

Permalink
Unify hal_(doc|build)_properties
Browse files Browse the repository at this point in the history
  • Loading branch information
glaeqen committed Mar 7, 2023
1 parent 53c4f71 commit c4682c3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 89 deletions.
2 changes: 1 addition & 1 deletion .github/actions/list-HAL-variants/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ runs:
- id: compute-matrix
shell: bash
run: |
matrix_json=$(cat crates.json | jq -Mr -c '{ "pac": (.hal_build_variants | keys ), "toolchain": ["stable", "nightly"] }')
matrix_json=$(cat crates.json | jq -Mr -c '{ "pac": (.hal_variants | keys ), "toolchain": ["stable", "nightly"] }')
echo "matrix=${matrix_json}" >> $GITHUB_OUTPUT
10 changes: 5 additions & 5 deletions .github/workflows/build-hal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: |
rustup set profile minimal
rustup override set ${{ matrix.toolchain }}
target=$(cat ./crates.json | jq -Mr --arg pac "${{matrix.pac}}" -c '.hal_build_variants["${{matrix.pac}}"].target')
target=$(cat ./crates.json | jq -Mr --arg pac "${{matrix.pac}}" -c '.hal_variants["${{matrix.pac}}"].target')
rustup target add ${target}
rustup component add clippy
Expand All @@ -36,14 +36,14 @@ jobs:
- name: Build HAL for ${{ matrix.pac }}
run: |
set -ex
features=$(cat ./crates.json | jq -Mr --arg pac "${{matrix.pac}}" -c '.hal_build_variants["${{matrix.pac}}"].features | join(",")')
target=$(cat ./crates.json | jq -Mr --arg pac "${{matrix.pac}}" -c '.hal_build_variants["${{matrix.pac}}"].target')
features=$(cat ./crates.json | jq -Mr --arg pac "${{matrix.pac}}" -c '.hal_variants["${{matrix.pac}}"].features | join(",")')
target=$(cat ./crates.json | jq -Mr --arg pac "${{matrix.pac}}" -c '.hal_variants["${{matrix.pac}}"].target')
cargo build --features=${features} --target=${target} --manifest-path=./hal/Cargo.toml
- name: Clippy HAL for ${{ matrix.pac }}
if: ${{ matrix.toolchain == 'nightly' }}
run: |
set -ex
features=$(cat ./crates.json | jq -Mr --arg pac "${{matrix.pac}}" -c '.hal_build_variants["${{matrix.pac}}"].features | join(",")')
target=$(cat ./crates.json | jq -Mr --arg pac "${{matrix.pac}}" -c '.hal_build_variants["${{matrix.pac}}"].target')
features=$(cat ./crates.json | jq -Mr --arg pac "${{matrix.pac}}" -c '.hal_variants["${{matrix.pac}}"].features | join(",")')
target=$(cat ./crates.json | jq -Mr --arg pac "${{matrix.pac}}" -c '.hal_variants["${{matrix.pac}}"].target')
cargo clippy --features=${features} --target=${target} --manifest-path=./hal/Cargo.toml
12 changes: 6 additions & 6 deletions .github/workflows/generate-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ jobs:
mkdir -pv "${docs_path}"
(cd "$docs_path" && git init && git checkout -b main)
for variant in $(cat crates.json | jq -Mr -c '.hal_doc_variants | keys[]');
for variant in $(cat crates.json | jq -Mr -c '.hal_variants | keys[]');
do
(
feature_str=$(cat crates.json | jq -Mr --arg variant "${variant}" -c '.hal_doc_variants[$variant].features | join(",")')
target=$(cat crates.json | jq -Mr --arg variant "${variant}" -c '.hal_doc_variants[$variant].target')
feature_str=$(cat crates.json | jq -Mr --arg variant "${variant}" -c '.hal_variants[$variant].features | join(",")')
target=$(cat crates.json | jq -Mr --arg variant "${variant}" -c '.hal_variants[$variant].target')
mkdir -pv "${docs_path}/${variant}"
cd hal
Expand Down Expand Up @@ -69,10 +69,10 @@ jobs:
echo ' </thead>' >> "${docs_path}/index.html"
echo ' <tbody>' >> "${docs_path}/index.html"
for variant in $(cat crates.json | jq -Mr -c '.hal_doc_variants | keys[]');
for variant in $(cat crates.json | jq -Mr -c '.hal_variants | keys[]');
do
target=$(cat crates.json | jq -Mr --arg variant "${variant}" -c '.hal_doc_variants[$variant].target')
features_html=$(cat crates.json | jq -Mr --arg variant "${variant}" -c '.hal_doc_variants[$variant].features | map("<span class=\"label label-default\">", . , "</span>") | join(" ")')
target=$(cat crates.json | jq -Mr --arg variant "${variant}" -c '.hal_variants[$variant].target')
features_html=$(cat crates.json | jq -Mr --arg variant "${variant}" -c '.hal_variants[$variant].features | map("<span class=\"label label-default\">", . , "</span>") | join(" ")')
echo ' <tr>' >> "${docs_path}/index.html"
echo " <td><a href='${variant}/${target}/doc/atsamd_hal/index.html'>${variant}</a></td>" >> "${docs_path}/index.html"
Expand Down
78 changes: 1 addition & 77 deletions crates.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,83 +166,7 @@
"target": "thumbv6m-none-eabi"
}
},
"hal_doc_variants": {
"samd11c": {
"features": [
"samd11c",
"unproven",
"dma"
],
"target": "thumbv6m-none-eabi"
},
"samd11d": {
"features": [
"samd11d",
"unproven",
"dma"
],
"target": "thumbv6m-none-eabi"
},
"samd21g": {
"features": [
"samd21g",
"unproven",
"usb",
"dma"
],
"target": "thumbv6m-none-eabi"
},
"samd21j": {
"features": [
"samd21j",
"unproven",
"usb",
"dma"
],
"target": "thumbv6m-none-eabi"
},
"samd51g": {
"features": [
"samd51g",
"unproven",
"usb",
"sdmmc",
"dma"
],
"target": "thumbv7em-none-eabihf"
},
"samd51j": {
"features": [
"samd51j",
"unproven",
"usb",
"sdmmc",
"dma"
],
"target": "thumbv7em-none-eabihf"
},
"samd51n": {
"features": [
"samd51n",
"unproven",
"usb",
"sdmmc",
"dma"
],
"target": "thumbv7em-none-eabihf"
},
"samd51p": {
"features": [
"samd51p",
"unproven",
"usb",
"sdmmc",
"dma"
],
"target": "thumbv7em-none-eabihf"
}
},
"hal_build_variants": {
"hal_variants": {
"samd11c": {
"features": [ "samd11c", "unproven", "dma", "rtic" ],
"target": "thumbv6m-none-eabi"
Expand Down

0 comments on commit c4682c3

Please sign in to comment.