-
Notifications
You must be signed in to change notification settings - Fork 8
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
Make libcnb_runtime_build
and libcnb_runtime_detect
public
#313
Conversation
This exposes `libcnb_runtime_build` and `libcnb_runtime_detect` (and associated types) so that they can be used by other crates.
Hey @nokome 👋🏻 Thanks for your PR! In general, I can see us exposing Before we continue with this, I'd love to hear more about your use-case. Which benefits do you get by having multiple buildpacks in an existing binary and how are you packaging it? I never thought of doing that and maybe there is even more we can do to support your use-case if it's applicable to a broader audience? |
Thanks for your interest @Malax. I'm putting together a PR for our project, https://github.com/stencila/stencila, that will introduce |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR and the links to your project - it's very exciting to see other usages of libcnb! I'm curious, will your project interact with Pack CLI, or is it effectively an alternative implementation of the CNB lifecycle?
Re this PR, at first glance these changes seem great, I just wonder if it might be best to split them into a few PRs, since there are a few distinct changes here:
- Moving args handling + the
process::exit
s up a level (tolibcnb_runtime
) - Making
libcnb_runtime_build
,libcnb_runtime_detect
,DetectArgs
andBuildArgs
public - Improving support for non-Unix platforms in
LayerEnv
andlibcnb_runtime
Previously, there were several places in the code where `cfg` attributes where causing compile errors on Windows (when bypassing `libcnb_runtime` and using `libcnb_runtime_detect` and `libcnb_runtime_build` directly). This fixes those compile errors (checked using cross-compile on Linux).
Hi @edmorley. Sorry for taking so long to reply: I've had my head down with my other PR and somehow missed the notification.
Both. Our users are data scientists and researchers (who often don't have software dev experience) and we want to provide a transparent and seamless-as-possible journey from a local project to a Docker image. So the use case is perhaps a little different to the usual use case for CNB's. We're using > stencila buildpacks plan fixtures/projects/polyglot/small
Buildpack 'stencila/apt'
- apt_packages Install apt packages for Ubuntu 'impish' (Aptfile)
Buildpack 'stencila/node'
- node Install Node.js lts
- node_modules Install Node.js packages into node_modules (package-lock.json)
Buildpack 'stencila/python'
- python Install Python ^3.10 (pyproject.toml)
- poetry Install Poetry (pyproject.toml)
- venv Install Python packages into virtual environment using Poetry (pyproject.toml)
Buildpack 'stencila/r'
- r Install R 4.1.2 (renv.lock)
- renv Install R packages into renv by restoring from lockfile (renv.lock)
Buildpack 'stencila/stencila'
- stencila Install Stencila >=1.1.0
I feel that 1 & 2 are closely connected so to avoid unnecessary extra work would prefer to combine those. Would it be OK to submit two PRs for each of my two commits: |
…b_runtime` (#369) * Centralize arg handling, writing to stderr and process exit in `libcnb_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). * Add DetectArgsParseError, BuildArgsParseError Co-authored-by: Manuel Fuchs <[email protected]>
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).
* 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]>
This exposes
libcnb_runtime_build
andlibcnb_runtime_detect
(and associated types) so that they can be used by other crates.For my use case, instead of building separate executable for each buildpack, I would like to combine several buildpacks into an existing CLI executable and delegate to their
detect
andbuild
methods. This change allows me to do that without rewriting alot of the code contained in these two functions e.g.