Repository navigation
feat(stellar-scaffold-cli): build clients without a Cargo workspace - #652
Open
sharmis-tp wants to merge 1 commit into
Open
sharmis-tp wants to merge 1 commit into
sharmis-tp wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #584
A project that only uses contracts deployed elsewhere, such as the Registry UI, can now run
stellar scaffold buildwith noCargo.toml, nocontracts/and no Rust toolchain. As discussed in the issue,buildfollows the contract'stype. Onlyworkspacecontracts need cargo, so if the selected network lists none, nothing is compiled andbuildgoes straight to generating clients fromscaffold.yml. Non-local sources (from-network, registry) are left for the follow-up.Changes
buildwithout cargo (commands/build/mod.rs)cargo metadatafails (noCargo.toml, or no cargo at all) and the project root has a version 2scaffold.yml,buildresolves the selected network's plan without crate checks.type: workspace, it printsNo Cargo workspace found; nothing to compile, starts the local container if the network uses one, and runs the client pipeline.type: workspace, it fails with an error that names them and includes cargo's error:contract `hello` is `type: workspace`, so building it needs a Cargo workspace and a Rust toolchain, but cargo failed: …--list,--compile-onlyandenvironments.tomlprojects still return cargo's original error, since for them there's nothing to do without crates.--manifest-pathdirectory or the current directory. This now uses one helper,config::root_without_cargo, shared withWorkspace::discover(used byconfig checkanddoctor).ClientsArgsand resolving the v2 plan are now helpers (clients_args,v2_plan,start_network_if_local), so both paths share them.Client pipeline (
commands/build/clients.rs)handle_listed_contracts. It used to return early when no crates were compiled, so referenced contracts got no client. This also affects a Cargo workspace with nocdylibcrates.accountsno longer fails with "you need to provide at least one account" when nothing on it istype: workspace. Bindings for a deployed contract sign nothing.config checkalready requires accounts for any contract that deploys.Environment::workspace_contracts()inenv_toml.rs, used for both checks.Docs
configuration.md: new "Projects without Rust contracts" section with a minimalscaffold.yml.cli.md: a note underbuild.Testing
cargo fmt --all -- --checkjust clippyandjust clippy-testequivalents:cargo clippy --all [--tests --all-features] -- -Dclippy::pedantic …are cleancargo test -p stellar-scaffold-cli: 243 unit tests andtests/unit.rspass. New tests:clients::tests::referenced_contracts_need_no_accountandworkspace_contracts_need_an_accountunit.rs::builds_without_cargo_when_no_contract_is_a_workspace_crate: a temp dir with onlyscaffold.ymlunit.rs::workspace_contracts_need_cargounit.rs::without_cargo_other_builds_report_cargos_error: noscaffold.yml, and--compile-only--features integration-tests), against a localstellar/quickstart(protocol 29) and stellar-cli 28.1.0:build_clients::scaffold_v2::client_for_a_deployed_contract_builds_without_cargodeployshellofrom the boilerplate. It then builds a sibling directory that has only ascaffold.ymlpointing at that ID (type: contract) and checks the generated client andindex.ts.build_clients::scaffold_v2andbuild_clients::accountsstill pass (6/6).examples::,features::, the otherbuild_clients::modules) was not run locally.scaffold.ymlthat references the testnet XLM SAC (CDLZ…CYSC) builds and generatesapp-lib/clients/xlmandindex.ts. This also works withcargoremoved fromPATH.docs/site:prettier -candlint:admonitionspass on the changed pages.