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

BuildConfig: Want to get values that I set #825

Open
schneems opened this issue May 17, 2024 · 0 comments
Open

BuildConfig: Want to get values that I set #825

schneems opened this issue May 17, 2024 · 0 comments
Labels
enhancement New feature or request libcnb-test

Comments

@schneems
Copy link
Contributor

Currently the values on BuildConfig are pub(crate) so I cannot access values that I've set:

pub struct BuildConfig {
    pub(crate) app_dir: PathBuf,
    pub(crate) cargo_profile: CargoProfile,
    pub(crate) target_triple: String,
    pub(crate) builder_name: String,
    pub(crate) buildpacks: Vec<BuildpackReference>,
    pub(crate) env: HashMap<String, String>,
    pub(crate) app_dir_preprocessor: Option<Rc<dyn Fn(PathBuf)>>,
    pub(crate) expected_pack_result: PackResult,
}

I'm wanting to inspect the builder_name to write logic like https://github.com/heroku/buildpacks-python/blob/de378063c83e1eec6302e79f93f189162b5bbbbf/tests/mod.rs#L31-L38. I would prefer to pass in a BuildConfig to a specific function and return a BuildConfig (or mutate a passed in build config, either way). Currently I cannot do this, because that value is not readable.

Options

  • Make the fields pub
  • Add get_* associated functions to retrieve set values
  • Do nothing, any values desired must be passed into a single function like the Python example above

Additional thoughts

While I'm looking at BuildConfig I think we should also make it Debug in addition to Clone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request libcnb-test
Projects
None yet
Development

No branches or pull requests

2 participants