Skip to content

Move applications into separate crates #423

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

Closed
wants to merge 6 commits into from
Closed

Move applications into separate crates #423

wants to merge 6 commits into from

Conversation

jvff
Copy link
Contributor

@jvff jvff commented Feb 3, 2023

Motivation

Some example applications have been written and placed in linera-sdk/examples. However, having the applications interact among themselves and writing test code outside linera-sdk that interacts with the applications is hard because none of the necessary types are exported through a crate.

Solution

Create a separate crate per application in a linera-examples sub-directory.

jvff added 6 commits February 3, 2023 19:33
Change the service and contract to be binaries instead of example
targets. Requires marking them as not having `main` functions.
Now that the Counter application has been moved, the path where its
binaries are placed in has changed, so the tests must be updated.
Change the service and contract to be binaries instead of example
targets. Requires marking them as not having `main` functions. Also
change how the modules are organized, with `interface` becoming a
library target, and the `types` module only being accessed through the
library.
Update the Crowd-Funding application to use the Fungible Token
application crate directly.
Change the service and contract to be binaries instead of example
targets. Requires marking them as not having `main` functions.
Update the crates necessary to build for running tests.
@jvff jvff added the refactor label Feb 3, 2023
@jvff jvff added this to the Local testnet milestone Feb 3, 2023
@jvff jvff requested a review from ma2bd February 3, 2023 21:25
@jvff jvff self-assigned this Feb 3, 2023
Copy link
Contributor

@ma2bd ma2bd left a comment

Choose a reason for hiding this comment

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

Fantastic! Make sure to get all green in CI (see comment) and otherwise ship it!

@@ -2,15 +2,13 @@
// SPDX-License-Identifier: Apache-2.0

#![cfg(target_arch = "wasm32")]
Copy link
Contributor

Choose a reason for hiding this comment

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

Apparently, in order to fix all the clippy errors in CI, one has to remove all the lines #![cfg(target_arch = "wasm32")] in contract.rs and service.rs files.

Copy link
Contributor

@ma2bd ma2bd Feb 6, 2023

Choose a reason for hiding this comment

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

Actually this is more tricky than that. Ideally, the workspace would handle different targets but this is not supported yet: rust-lang/cargo#5220

@ma2bd
Copy link
Contributor

ma2bd commented Feb 6, 2023

Rebased and landed in #427
Thanks @jvff for the epic work!

@ma2bd ma2bd closed this Feb 6, 2023
@jvff jvff deleted the move-applications-to-separate-crates branch February 6, 2023 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants