瀏覽代碼

perf: remove lto setting from CLI (#6861)

Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
Jonas Kruckenberg 2 年之前
父節點
當前提交
02eb08bbd7
共有 3 個文件被更改,包括 12 次插入7 次删除
  1. 2 2
      .github/workflows/publish-cli-rs.yml
  2. 7 3
      tooling/cli/Cargo.toml
  3. 3 2
      tooling/cli/node/package.json

+ 2 - 2
.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:

+ 7 - 3
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"

+ 3 - 2
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": {}
 }