From 02eb08bbd71063ccd5e85a547412399a7c425908 Mon Sep 17 00:00:00 2001 From: Jonas Kruckenberg <118265418+CrabNejonas@users.noreply.github.com> Date: Mon, 14 Aug 2023 12:28:11 +0200 Subject: [PATCH] perf: remove lto setting from CLI (#6861) Co-authored-by: Lucas Nogueira --- .github/workflows/publish-cli-rs.yml | 4 ++-- tooling/cli/Cargo.toml | 10 +++++++--- tooling/cli/node/package.json | 5 +++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish-cli-rs.yml b/.github/workflows/publish-cli-rs.yml index 26e445175d57..7608aebfb90a 100644 --- a/.github/workflows/publish-cli-rs.yml +++ b/.github/workflows/publish-cli-rs.yml @@ -61,13 +61,13 @@ jobs: uses: actions-rs/cargo@v1 with: command: build - args: --manifest-path ./tooling/cli/Cargo.toml --release ${{ matrix.config.args }} + args: --manifest-path ./tooling/cli/Cargo.toml --profile release-size-optimized ${{ matrix.config.args }} - name: Upload CLI uses: actions/upload-artifact@v3 with: name: cargo-tauri-${{ matrix.config.rust_target }}${{ matrix.config.ext }} - path: tooling/cli/target/release/cargo-tauri${{ matrix.config.ext }} + path: tooling/cli/target/release-size-optimized/cargo-tauri${{ matrix.config.ext }} if-no-files-found: error upload: diff --git a/tooling/cli/Cargo.toml b/tooling/cli/Cargo.toml index 400dbb530622..37dfc11796b3 100644 --- a/tooling/cli/Cargo.toml +++ b/tooling/cli/Cargo.toml @@ -102,9 +102,6 @@ cc = "1" [target."cfg(unix)".dependencies] libc = "0.2" -[profile.release] -lto = true - [features] default = [ "rustls" ] native-tls = [ @@ -118,3 +115,10 @@ native-tls-vendored = [ "tauri-mobile/openssl-vendored" ] rustls = [ "tauri-bundler/rustls", "tauri-mobile/rustls", "ureq/tls" ] + +[profile.release-size-optimized] +inherits = "release" +codegen-units = 1 +lto = true +incremental = false +opt-level = "s" diff --git a/tooling/cli/node/package.json b/tooling/cli/node/package.json index 9d80a8f3b2ea..f2f6c8dbd5ba 100644 --- a/tooling/cli/node/package.json +++ b/tooling/cli/node/package.json @@ -58,7 +58,7 @@ }, "scripts": { "artifacts": "napi artifacts", - "build:release": "cross-env TARGET=node napi build --platform --release", + "build:release": "cross-env TARGET=node napi build --platform --profile release-size-optimized", "build": "cross-env TARGET=node napi build --platform", "prepublishOnly": "napi prepublish -t npm --gh-release-id $RELEASE_ID", "prepack": "cp ../schema.json .", @@ -67,5 +67,6 @@ "tauri": "node ./tauri.js", "format": "prettier --write ./package.json ./tauri.js", "format:check": "prettier --check ./package.json ./tauri.js" - } + }, + "dependencies": {} }