Skip to content

Commit 11228ff

Browse files
committed
Merge remote-tracking branch 'upstream/main' into feat/build-optimize
2 parents 67c2ef0 + 3c5f230 commit 11228ff

10 files changed

Lines changed: 32 additions & 22 deletions

File tree

.github/workflows/binaries.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
5757
- name: Build
5858
run: |
59-
cargo build --package ${{ matrix.crate.name }} --features opt,additional-libs --release --target ${{ matrix.sys.target }}
59+
cargo build --package ${{ matrix.crate.name }} --release --target ${{ matrix.sys.target }}
6060
- name: Build provenance for binary attestation (release only)
6161
if: github.event_name == 'release'
6262
uses: actions/attest-build-provenance@v2

.github/workflows/rust.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,10 @@ jobs:
148148
# [2]: https://github.com/brson/wasm-opt-rs/issues/116
149149
- os: windows-latest-8-cores
150150
target: x86_64-pc-windows-msvc
151-
cargo-hack-feature-options: ''
151+
cargo-hack-feature-options: --no-default-features
152152
- os: windows-latest-8-cores
153153
target: x86_64-pc-windows-msvc
154-
cargo-hack-feature-options: --features opt --ignore-unknown-features
154+
cargo-hack-feature-options: --features additional-libs --ignore-unknown-features
155155

156156
uses: stellar/actions/.github/workflows/rust-publish-dry-run-v2.yml@main
157157
with:

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ exclude = [
2121

2222
[workspace.package]
2323
version = "22.8.1"
24-
rust-version = "1.84.0"
24+
rust-version = "1.85.0"
2525

2626
# Dependencies located in this repo:
2727
[workspace.dependencies.soroban-cli]

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@ brew install stellar-cli
3434

3535
Install the latest version from source:
3636
```
37-
cargo install --locked stellar-cli --features opt
37+
cargo install --locked stellar-cli
38+
```
39+
40+
Install without features that depend on additional libraries:
41+
```
42+
cargo install --locked stellar-cli --no-default-features
3843
```
3944

4045
Install or run the unreleased main branch with nix:

cmd/soroban-cli/Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,11 @@ path = "src/lib.rs"
3434
doctest = false
3535

3636
[features]
37-
default = []
37+
default = ["additional-libs"]
38+
additional-libs = ["dep:wasm-opt", "dep:keyring", "dep:stellar-ledger"]
3839
version_lt_23 = []
3940
version_gte_23 = []
40-
opt = ["dep:wasm-opt"]
4141
emulator-tests = ["stellar-ledger/emulator-tests"]
42-
additional-libs = ["dep:keyring", "dep:stellar-ledger"]
4342

4443
[dependencies]
4544
stellar-xdr = { workspace = true, features = ["cli"] }

cmd/soroban-cli/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ Docs: https://developers.stellar.org
1010
cargo install --locked stellar-cli
1111
```
1212

13-
To install with the `opt` feature, which includes a WASM optimization feature and wasm-opt built in:
13+
To install without features that depend on additional libraries:
1414

1515
```
16-
cargo install --locked stellar-cli --features opt
16+
cargo install --locked stellar-cli --no-default-features
1717
```
1818

1919
## Usage

cmd/soroban-cli/src/commands/contract/optimize.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use clap::{arg, command, Parser};
22
use std::fmt::Debug;
3+
#[cfg(feature = "additional-libs")]
4+
use wasm_opt::{Feature, OptimizationError, OptimizationOptions};
35

46
use crate::wasm;
57

@@ -17,18 +19,21 @@ pub struct Cmd {
1719
pub enum Error {
1820
#[error(transparent)]
1921
Wasm(#[from] wasm::Error),
20-
#[cfg(not(feature = "opt"))]
21-
#[error("Must install with \"opt\" feature, e.g. `cargo install --locked soroban-cli --features opt")]
22+
#[cfg(feature = "additional-libs")]
23+
#[error("optimization error: {0}")]
24+
OptimizationError(OptimizationError),
25+
#[cfg(not(feature = "additional-libs"))]
26+
#[error("must install with \"additional-libs\" feature.")]
2227
Install,
2328
}
2429

2530
impl Cmd {
26-
#[cfg(not(feature = "opt"))]
31+
#[cfg(not(feature = "additional-libs"))]
2732
pub fn run(&self) -> Result<(), Error> {
2833
Err(Error::Install)
2934
}
3035

31-
#[cfg(feature = "opt")]
36+
#[cfg(feature = "additional-libs")]
3237
pub fn run(&self) -> Result<(), Error> {
3338
let wasm_size = self.wasm.len()?;
3439

cmd/soroban-cli/src/signer/ledger.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::xdr::{self, DecoratedSignature, Transaction};
1+
use crate::xdr;
22

33
pub use ledger_impl::*;
44

@@ -20,8 +20,8 @@ pub enum Error {
2020

2121
#[cfg(feature = "additional-libs")]
2222
mod ledger_impl {
23-
use super::*;
24-
use crate::xdr::{Hash, Signature, SignatureHint};
23+
use super::Error;
24+
use crate::xdr::{DecoratedSignature, Hash, Signature, SignatureHint, Transaction};
2525
use sha2::{Digest, Sha256};
2626
use stellar_ledger::{Blob as _, Exchange, LedgerSigner};
2727

@@ -36,6 +36,7 @@ mod ledger_impl {
3636
}
3737

3838
#[cfg(not(feature = "emulator-tests"))]
39+
#[allow(clippy::unused_async)]
3940
pub async fn new(hd_path: u32) -> Result<Ledger<stellar_ledger::TransportNativeHID>, Error> {
4041
let signer = stellar_ledger::native()?;
4142
Ok(Ledger {

cmd/stellar-cli/Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ pkg-url = "{ repo }/releases/download/v{ version }/{ name }-{ version }-{ target
2121
bin-dir = "{ bin }{ binary-ext }"
2222

2323
[features]
24-
default = []
25-
opt = ["soroban-cli/opt"]
26-
emulator-tests = ["soroban-cli/emulator-tests"]
24+
default = ["additional-libs"]
2725
additional-libs = ["soroban-cli/additional-libs"]
26+
emulator-tests = ["soroban-cli/emulator-tests"]
2827

2928
[dependencies]
3029
soroban-cli = { workspace = true }

cmd/stellar-cli/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ Install with Homebrew (macOS, Linux):
1212
brew install stellar-cli
1313
```
1414

15-
Install the latest version from source:
15+
To install without features that depend on additional libraries:
16+
1617
```
17-
cargo install --locked stellar-cli --features opt
18+
cargo install --locked stellar-cli --no-default-features
1819
```
1920

2021
## Usage

0 commit comments

Comments
 (0)