Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using [package.metadata] in each crate instead of maintaining a Crates.json file #503

Open
LongLiveCHIEF opened this issue Oct 4, 2021 · 6 comments
Assignees

Comments

@LongLiveCHIEF
Copy link

what do you guys think of using the [package.metadata.tier] format in the Cargo.toml so we can get rid of having to maintain a Crates.json file?

It would make things much simpler, especially as we move into auto-generating CHANGELOG and even auto-updating READMEwith list of tiered crates

likewise for [package.metadata.build_invocation]
each crate would add those two metadata fields, and specify their tier and build invocation, and then I can use that in the build matrix to modify the README accordingly as well as invoke any build instructions
https://doc.rust-lang.org/cargo/reference/manifest.html#the-metadata-table

This would also easily allow the build stage to check to ensure any new crates have the appropriate information required in the Cargo file, enabling us to dynamically add crates (especially BSP's) very easily.

@LongLiveCHIEF
Copy link
Author

LongLiveCHIEF commented Oct 4, 2021

maybe just a single [package.metadata.atsamd_metadata]:

[package.metadata.atsamd_metadata]
#crate_type = BSP | PAC | HAL
crate_type = BSP
tier = 2 # only applicable for 
build_invocation = "cargo build --examples --features=unproven,usb"

@jbeaurivage
Copy link
Contributor

This makes perfect sense to me!

@LongLiveCHIEF
Copy link
Author

related #481

@LongLiveCHIEF
Copy link
Author

LongLiveCHIEF commented Oct 4, 2021

Proposal spec:


Adding a new BSP/PAC

The build and release workflows will automatically recognize any new crate added to the repo,
but you will need to add some metadata to the crates's Cargo.toml.

# example of metadata for a BSP
[package.metadata.atsamd]
# also_build (optional): indicate if any additional crates (HAL | PAC | BSP's) should be built
# to properly test this crate
# also_build = ["boards/some_bsp", "pac/some_pac"]
# room for other generic high-level hooks for pipeline/build customization

[package.metadata.atsamd.bsp]

# tier (required)
# see: https://github.com/atsamd-rs/atsamd#how-to-use-a-bsp-ie-getting-started-writing-your-own-code
# for determining what tier your BSP is
tier = 2

# build_command (required)
# used to invoke the appropriate build command for the bsp
build_command = "cargo build --examples --features=unproven"

[package.metadata.atsamd.pac]
# target (required): the build target, used to configure the runner properly
target = "thumbv6m-none-eabi"
# features to build the pac with
features = ["samd21g", "unproven", "usb"]

@sajattack
Copy link
Member

Please update the wiki pages related to adding new boards/pacs.

@LongLiveCHIEF
Copy link
Author

This is also in a new CONTRIBUTING.md in the branch I'm working on: https://github.com/LongLiveCHIEF/atsamd/blob/use-package-metadata/CONTRIBUTING.md, which makes it pop up during merge requests and other github integrations. (I've also updated the merge request template)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants