feat: Implement Canister Build Adapter Framework and Script Adapter#10
feat: Implement Canister Build Adapter Framework and Script Adapter#10
Conversation
adamspofford-dfinity
left a comment
There was a problem hiding this comment.
If this PR is meant to fully implement the adapter, it should contain the build cache directory logic, and a test for a script canister that invokes cargo build.
…cluded by default
Hi @adamspofford-dfinity, as discussed in the team meeting, it doesn't seem like we've reached a consensus on how those things would work yet. I think it'd be valid to proceed with reviewing this code regardless since the things you've brought up would be additions to this code, rather than replace it. What is here works and is needed, so I don't see a need to wait for the design discussions to conclude. |
ghost
left a comment
There was a problem hiding this comment.
Let's start with a test or tests, since it looks like this is at the point where it's possible to add them and verify some functionality.
@ericswanson-dfinity Tests have been added. |
…le and multiple commands cases
4b2e483 to
2d66a9b
Compare
Summary:
This PR introduces canister build adapters within the
icp-adaptercrate. It defines a commonAdaptertrait and provides an initial, fully functional implementation for aScriptAdapter. This adapter allows canister builds to be performed by executing arbitrary shell commands. Placeholders forMotokoAdapterandRustAdapterare also included for future development.Detailed Changes:
Build Adapter Framework (
lib/icp-adapter/src/lib.rs):async Adaptertrait with acompilemethod, serving as the core abstraction for different build mechanisms.script,motoko, andrustadapters.AdapterCompileErrorenum usingsnafufor consistent error handling across adapters.Script Adapter (
lib/icp-adapter/src/script.rs):ScriptAdapterallows defining canister build processes via one or more shell commands.shellwords, enabling complex commands with quoted arguments.ScriptAdapterconfiguration (e.g., the command(s) to run) is designed to be deserializable from a configuration file (likecanister.yaml). For example:Placeholder Adapters:
lib/icp-adapter/src/motoko.rs): Includes a basicMotokoAdapterstruct and a stubbedcompilemethod.lib/icp-adapter/src/rust.rs): Includes a basicRustAdapterstruct and a stubbedcompilemethod.Future Work:
MotokoAdapter.RustAdapter.This PR description was generated by Roo.