As a guard against this kind of bug in the future, an IsDefault trait was
created and a derive macro created to derive the is_default method
semi-automatically. All existing is_default methods have been changed to
use the trait instead.
Both recipes and packages have the install.environment property, so
refactor runtime_environment() out of the Package trait into its own
trait, then require both Recipe and Package implement it.
This change was prompted in order to make the code in the new test possible.
Refactor various is_default() methods into IsDefault trait
Fixes #1081. The bug causing #1081 was in
InstallSpec::is_default
as the logic was not updated when theenvironment
field was added to the struct way back at https://github.com/spkenv/spk/blob/f4899ce1e4ac0634ee95608e322a86a358096d4d/src/api/install_spec.rs#L31As a guard against this kind of bug in the future, an
IsDefault
trait was created and a derive macro created to derive theis_default
method semi-automatically. All existingis_default
methods have been changed to use the trait instead.And...
Refactor Package::runtime_environment
Both recipes and packages have the
install.environment
property, so refactorruntime_environment()
out of thePackage
trait into its own trait, then require bothRecipe
andPackage
implement it.This change was prompted in order to make the code in the new test possible.