Skip to content

Commit

Permalink
Unify hal_(doc|build)_variants properties
Browse files Browse the repository at this point in the history
  • Loading branch information
glaeqen committed Oct 27, 2024
1 parent ef7a1b2 commit 2006509
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 94 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
6 changes: 3 additions & 3 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,6 +36,6 @@ 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 clippy --features=${features} --target=${target} --manifest-path=./hal/Cargo.toml -- -D warnings
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
92 changes: 8 additions & 84 deletions crates.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,112 +171,36 @@
"target": "thumbv6m-none-eabi"
}
},
"hal_doc_variants": {
"hal_variants": {
"samd11c": {
"features": [
"samd11c",
"dma",
"defmt"
],
"target": "thumbv6m-none-eabi"
},
"samd11d": {
"features": [
"samd11d",
"dma",
"defmt"
],
"target": "thumbv6m-none-eabi"
},
"samd21g": {
"features": [
"samd21g",
"usb",
"dma",
"defmt"
],
"target": "thumbv6m-none-eabi"
},
"samd21j": {
"features": [
"samd21j",
"usb",
"dma",
"defmt"
],
"target": "thumbv6m-none-eabi"
},
"samd51g": {
"features": [
"samd51g",
"usb",
"sdmmc",
"dma",
"defmt"
],
"target": "thumbv7em-none-eabihf"
},
"samd51j": {
"features": [
"samd51j",
"usb",
"sdmmc",
"dma",
"defmt"
],
"target": "thumbv7em-none-eabihf"
},
"samd51n": {
"features": [
"samd51n",
"usb",
"sdmmc",
"dma",
"defmt"
],
"target": "thumbv7em-none-eabihf"
},
"samd51p": {
"features": [
"samd51p",
"usb",
"sdmmc",
"dma",
"defmt"
],
"target": "thumbv7em-none-eabihf"
}
},
"hal_build_variants": {
"samd11c": {
"features": [ "samd11c", "dma", "rtic", "defmt" ],
"target": "thumbv6m-none-eabi"
},
"samd11d": {
"samd11d": {
"features": [ "samd11d", "dma", "rtic", "defmt" ],
"target": "thumbv6m-none-eabi"
},
"samd21e": {
"samd21e": {
"features": [ "samd21e", "usb", "dma", "rtic", "defmt" ],
"target": "thumbv6m-none-eabi"
},
"samd21el": {
"samd21el": {
"features": [ "samd21el", "dma", "rtic", "defmt" ],
"target": "thumbv6m-none-eabi"
},
"samd21g": {
"samd21g": {
"features": [ "samd21g", "usb", "dma", "rtic", "defmt" ],
"target": "thumbv6m-none-eabi"
},
"samd21gl": {
"samd21gl": {
"features": [ "samd21gl", "dma", "rtic", "defmt" ],
"target": "thumbv6m-none-eabi"
},
"samd21j": {
"samd21j": {
"features": [ "samd21j", "usb", "dma", "rtic", "defmt" ],
"target": "thumbv6m-none-eabi"
},
"samd51g": {
"samd51g": {
"features": [ "samd51g", "usb", "dma", "sdmmc", "rtic", "defmt" ],
"target": "thumbv7em-none-eabihf"
},
Expand Down

0 comments on commit 2006509

Please sign in to comment.