From 200650925b54b3200aadd4ed98ce94458811fe92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20G=C3=B3rski?= Date: Tue, 7 Mar 2023 15:46:50 +0100 Subject: [PATCH] Unify `hal_(doc|build)_variants` properties --- .github/actions/list-HAL-variants/action.yml | 2 +- .github/workflows/build-hal.yml | 6 +- .github/workflows/generate-docs.yml | 12 +-- crates.json | 92 ++------------------ 4 files changed, 18 insertions(+), 94 deletions(-) diff --git a/.github/actions/list-HAL-variants/action.yml b/.github/actions/list-HAL-variants/action.yml index 2c53c6b49ee2..355618d2ad1c 100644 --- a/.github/actions/list-HAL-variants/action.yml +++ b/.github/actions/list-HAL-variants/action.yml @@ -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 diff --git a/.github/workflows/build-hal.yml b/.github/workflows/build-hal.yml index be1e1291f7bc..27a457026ed3 100644 --- a/.github/workflows/build-hal.yml +++ b/.github/workflows/build-hal.yml @@ -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 @@ -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 diff --git a/.github/workflows/generate-docs.yml b/.github/workflows/generate-docs.yml index 8d1841e7a186..5a6c8cf0f998 100644 --- a/.github/workflows/generate-docs.yml +++ b/.github/workflows/generate-docs.yml @@ -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 @@ -69,10 +69,10 @@ jobs: echo ' ' >> "${docs_path}/index.html" echo ' ' >> "${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("", . , "") | 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("", . , "") | join(" ")') echo ' ' >> "${docs_path}/index.html" echo " ${variant}" >> "${docs_path}/index.html" diff --git a/crates.json b/crates.json index 6a3872969ff1..0f9e4c13e1a3 100644 --- a/crates.json +++ b/crates.json @@ -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" },