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

feat: structure as cargo workspace #344

Closed
wants to merge 2 commits into from

Conversation

chadoh
Copy link
Contributor

@chadoh chadoh commented Nov 27, 2024

Fixes #328

Undoes #232

Forked from #330

What

Add top-level Cargo.toml, with all project folders as part of this
workspace.

Why

We now encourage everyone to use Cargo workspaces when building Soroban
projects. Let's make it easy to copy-paste these examples into their
projects, rather than requiring special tooling
(like the old stellar contract init behavior) to update the contract's
Cargo.toml.

Known Limitations

Currently, there is a compilation error when attempting to run tests:

error[E0433]: failed to resolve: use of undeclared crate or module
`__get_allowance`
 --> token/src/contract.rs:67:12
  | 67 |     pub fn get_allowance(e: Env, from: Address, spender: Address)
-> Option<AllowanceValue> {
  |            ^^^^^^^^^^^^^ use of undeclared crate or module
`__get_allowance`
  | help: there is a crate or module with a similar name
  | 67 |     pub fn __allowance(e: Env, from: Address, spender: Address) ->
Option<AllowanceValue> {
  |            ~~~~~~~~~~~

Most of the updates involve using constructors and the new test API. I've also addressed a couple small issues in some examples.
@chadoh chadoh marked this pull request as draft November 27, 2024 15:08
Fixes stellar#328

Undoes stellar#232

Forked from stellar#330

Add top-level `Cargo.toml`, with all project folders as part of this
workspace.

We now encourage everyone to use Cargo workspaces when
building Soroban projects. Let's make it easy to copy-paste these
examples into their projects, rather than requiring special tooling
(like the old `stellar contract init` behavior) to update the contract's
Cargo.toml.

Currently, there are two compilation errors when attempting to run
tests:

```
error[E0433]: failed to resolve: use of undeclared crate or module `__get_allowance`
  --> token/src/contract.rs:67:12
   |
67 |     pub fn get_allowance(e: Env, from: Address, spender: Address) -> Option<AllowanceValue> {
   |            ^^^^^^^^^^^^^ use of undeclared crate or module `__get_allowance`
   |
help: there is a crate or module with a similar name
   |
67 |     pub fn __allowance(e: Env, from: Address, spender: Address) -> Option<AllowanceValue> {
   |            ~~~~~~~~~~~
```
@chadoh chadoh force-pushed the feat/cargo-workspace branch from 6735a95 to 5c6a2b9 Compare November 27, 2024 15:15
@chadoh chadoh mentioned this pull request Dec 3, 2024
@chadoh
Copy link
Contributor Author

chadoh commented Dec 3, 2024

As discussed in #328, we have decided not to implement this change.

@chadoh chadoh closed this Dec 3, 2024
@chadoh chadoh deleted the feat/cargo-workspace branch December 3, 2024 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Structure as workspace
2 participants