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

Support local buildpacks and meta-buildpacks in libcnb-test (outdated) #590

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,36 @@ separate changelogs for each crate were used. If you need to refer to these old

## [Unreleased]

The main feature added here is support in `libcnb-test` for expanded testing on local buildpacks. Previously it
was possible to test a single (local) buildpack with `BuildpackReference::Crate` for development testing as well as
external (remote) buildpacks with `BuildpackReference::Other(String)`. This support has been expanded to allow
testing of any local buildpack (including meta-buildpacks) with `BuildpackReference::Local(PathBuf)`. This should make
developing and testing changes across multiple buildpacks easier on the buildpack author.

### Added

- `libcnb-package`
- Added `find_cargo_workspace` which provides a convenient starting point for locating buildpacks for packaging and testing purposes. ([#590](https://github.com/heroku/libcnb.rs/pull/590))
- Added the `BuildpackOutputDirectoryLocator` which contains information on how compiled buildpack directories are structured and provides a `.get(buildpack_id)` method which produces the output path for a buildpack. ([#590](https://github.com/heroku/libcnb.rs/pull/590))
- Added `output::assemble_single_buildpack_directory` and `output::assemble_meta_buildpack_directory` which construct buildpack output directories with all their required files during packaging. ([#590](https://github.com/heroku/libcnb.rs/pull/590))

### Changed

- `libcnb-package`
Copy link
Contributor

Choose a reason for hiding this comment

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

[Question for maintainers, no action] More of a question for Manuel and Ed. This package is mostly exposed for re-use in our tooling. I would assume that we don't expect others to use these interfaces directly or do we?

Are we treating libcnb-package as a "true" cargo project with version guarantees, or is it more like this internal serde crate https://crates.io/crates/serde_derive_internals?

Copy link
Member

@edmorley edmorley Aug 7, 2023

Choose a reason for hiding this comment

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

Are we treating libcnb-package as a "true" cargo project with version guarantees, or is it more like this internal serde crate

Good question. I'd thought the former, but I'm open to either really, as long as we're clear with potential external consumers of the create. Also at the moment with libcnb being pre-v1, we're bumping the major version most releases, so this mostly won't be an issue - and later once we go v1 I suspect libcnb-package will have settled down enough that we don't expect too much breakage.

One thing to watch out for though - if we were to switch to being more relaxed about the major version for libcnb-package - we'd really have to switch to using hard version pins instead of ranges for intra-crate dependencies. ie: libcnb-cargo would need to depend on libcnb-package version ==1.2.3 not ^1.2.3. (We should perhaps make that switch regardless given our unified release versions approach.)

Copy link
Member

Choose a reason for hiding this comment

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

@schneems Just to follow up here - we've now (a) switched to hard version pins in #644, (b) marked libcnb-package (and the new libcnb-common) as internal in their READMEs in #662.

- Changed the `ReadBuildpackDataError` and `ReadBuildpackageDataError` enums from struct to tuple format to be consistent with other error enums in the package. ([#590](https://github.com/heroku/libcnb.rs/pull/590))
- Changed `build::build_buildpack_binaries` to drop the `cargo_metadata` argument since it can read that directly from the given `project_path`. ([#590](https://github.com/heroku/libcnb.rs/pull/590))
- Changed `build::BuildBinariesError` to include the error variant `ReadCargoMetadata(PathBuf, cargo_metadata::Error)`. ([#590](https://github.com/heroku/libcnb.rs/pull/590))
- Changed `buildpack_dependency::rewrite_buildpackage_local_dependencies` to accept a `&BuildpackOutputDirectoryLocator` instead of `&HashMap<&BuildpackId, PathBuf>`. ([#590](https://github.com/heroku/libcnb.rs/pull/590))
- Moved `default_buildpack_directory_name` to `output::default_buildpack_directory_name`. ([#590](https://github.com/heroku/libcnb.rs/pull/590))
- `libcnb-test`
- Change `BuildpackReference` to include the `Local(PathBuf)` variant for referencing buildpacks on the local file-system. ([#590](https://github.com/heroku/libcnb.rs/pull/590))

### Removed

- `libcnb-package`
- `get_buildpack_target_dir` has been removed in favor of `BuildpackOutputDirectoryLocator` for building output paths to compiled buildpacks. ([#590](https://github.com/heroku/libcnb.rs/pull/590))
- `assemble_buildpack_directory` has been removed in favor of `output::assemble_single_buildpack_directory` and `output::assemble_meta_buildpack_directory`. ([#590](https://github.com/heroku/libcnb.rs/pull/590))

### Added

- `libcnb-package`: Add cross-compilation assistance for Linux `aarch64-unknown-linux-musl`. ([#577](https://github.com/heroku/libcnb.rs/pull/577))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ id = "multiple-buildpacks/one"
version = "0.0.0"

[[stacks]]
id = "some-stack"
id = "*"
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ id = "multiple-buildpacks/two"
version = "0.0.0"

[[stacks]]
id = "some-stack"
id = "*"
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
api = "0.8"

[buildpack]
id = "multiple-buildpacks/meta-two"
name = "Meta-buildpack Test"
version = "0.0.0"
homepage = "https://example.com"
description = "Official test example"
keywords = ["test"]

[[buildpack.licenses]]
type = "BSD-3-Clause"

[[order]]

[[order.group]]
id = "multiple-buildpacks/one"
version = "0.0.0"

[[order.group]]
id = "multiple-buildpacks/two"
version = "0.0.0"

[[order.group]]
id = "heroku/procfile"
version = "2.0.0"
optional = true

[metadata]
[metadata.extra]
some_key = "some_value"
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[buildpack]
uri = "."

[[dependencies]]
uri = "libcnb:multiple-buildpacks/one"

[[dependencies]]
uri = "libcnb:multiple-buildpacks/two"

[[dependencies]]
uri = "docker://docker.io/heroku/procfile-cnb:2.0.0"
2 changes: 1 addition & 1 deletion libcnb-cargo/fixtures/single_buildpack/buildpack.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ id = "single-buildpack"
version = "0.0.0"

[[stacks]]
id = "some-stack"
id = "*"
Loading