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

Centralize arg handling, writing to stderr and process exit in libcnb_runtime #369

Merged
merged 2 commits into from
Mar 7, 2022
Merged

Centralize arg handling, writing to stderr and process exit in libcnb_runtime #369

merged 2 commits into from
Mar 7, 2022

Conversation

nokome
Copy link
Contributor

@nokome nokome commented Mar 2, 2022

This change takes a "Functional Core - Imperative Shell" type of approach by centralizing argument handling, writing of error messages to stderr and calls to process::exit in the main libcnb_runtime function.

This allows for other functions such as libcnb_runtime_detect and libcnb_runtime_build to be re-used in other runtimes.

Note: This commit has been extracted out from https://github.com/Malax/libcnb.rs/pull/313 (which will be superseded by this an other PRs).

…b_runtime`

This change takes a "Functional Core - Imperitive Shell" type of approach by centralizing
argument handling, writing of error messages to stderr and calls to `process::exit` in
the main `libcnb_runtime` function.

This allows for other functions such as `libcnb_runtime_detect` and `libcnb_runtime_build`
to be re-used in other runtimes.

Note: This commit has been extracted out from https://github.com/Malax/libcnb.rs/pull/313 (which will be superseded by this an other PRs).
Copy link
Member

@Malax Malax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR and the split-up! 👍🏻 I took the liberty and replaced the &str error type with an enum so the runtime output is concentrated in one place.

@Malax Malax merged commit c83fefb into heroku:main Mar 7, 2022
Malax referenced this pull request Mar 7, 2022
Note: This commit is made on top of https://github.com/Malax/libcnb.rs/pull/369

Note: This commit has been extracted out from https://github.com/Malax/libcnb.rs/pull/313 (which will be superseded by this and other PRs).
Malax referenced this pull request Mar 7, 2022
* Make `libcnb_runtime_build` etc public

Note: This commit is made on top of https://github.com/Malax/libcnb.rs/pull/369

Note: This commit has been extracted out from https://github.com/Malax/libcnb.rs/pull/313 (which will be superseded by this and other PRs).

* Hide newly exposed runtime types from docs

They're only exposed for advanced use-cases and should not be used by buildpack authors directly.

* Update CHANGELOG

* Expose all public runtime types

Co-authored-by: Nokome Bentley <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants