Skip to content

platforms: enable preferring softeners and defaulting to built-in if softener not available#216

Draft
artiepoole wants to merge 9 commits into
artie/rename-platformfrom
artie/defaulting-preference
Draft

platforms: enable preferring softeners and defaulting to built-in if softener not available#216
artiepoole wants to merge 9 commits into
artie/rename-platformfrom
artie/defaulting-preference

Conversation

@artiepoole

Copy link
Copy Markdown
Collaborator

When the user does not specifically select a softener or platform compat string, the softener key being present in the registered platform compat string means that it will be preferred. To avoid constructing a platform which will always fail (e.g. if not installed) the "available" function is also part of the registration part of the platform and returns true for all built-in platforms and does a check for all softeners platforms.

For dfx-mgr platform, the finding the client binary code, that is already used before trying to running dfx-mgr-client, is re-used to check if the platform is available.

If the user tries to use the softener when it is not available (by using dfx-mgr or softener parts of the platform string) then the return is still a FpgadError type due to the softener not being available and there being no other platforms matching.

If the built-in is specified, e.g.using platform or xlnx-sys, then the softener will not be used.

While I was there, I also changed the registration process to store the registered platform string for re-use in the getter for Platform trait. This stops the user from having to define the compat string in two places like it used to be.

… platforms

Signed-off-by: Artie Poole <stuart.poole@canonical.com>
this is possible by returning the macro-generated platform object's compat
 string in platform_compat_string method

Signed-off-by: Artie Poole <stuart.poole@canonical.com>
…irst

Signed-off-by: Artie Poole <stuart.poole@canonical.com>
Signed-off-by: Artie Poole <stuart.poole@canonical.com>
…forms

Signed-off-by: Artie Poole <stuart.poole@canonical.com>
- docstrings in platform.rs to describe the algorithm
- readme updates for adding a softener

Signed-off-by: Artie Poole <stuart.poole@canonical.com>
due to needing available to return true for dfx-mgr softener

Signed-off-by: Artie Poole <stuart.poole@canonical.com>
…ilar

Signed-off-by: Artie Poole <stuart.poole@canonical.com>
changes:
- platform selection now prefers softeners and allows choice over
preference behaviour

Signed-off-by: Artie Poole <stuart.poole@canonical.com>
@artiepoole artiepoole force-pushed the artie/defaulting-preference branch from 5f12d11 to 6486d2d Compare June 16, 2026 15:10
@artiepoole artiepoole requested a review from talhaHavadar June 16, 2026 15:15
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

Successfully merging this pull request may close these issues.

1 participant