Эх сурвалжийг харах

feat(cli): Build the CLI for Windows ARM64, closes #7015 (#7098) (#7106)

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
closes #7015 (#7098)
Fabian-Lars 2 жил өмнө
parent
commit
3480047ec1

+ 6 - 0
.changes/cli-windows-arm64.md

@@ -0,0 +1,6 @@
+---
+'tauri-cli': minor
+'@tauri-apps/cli': minor
+---
+
+Provide prebuilt CLIs for Windows ARM64 targets.

+ 4 - 4
.github/workflows/publish-cli-js.yml

@@ -40,6 +40,10 @@ jobs:
             build: yarn build:release --target i686-pc-windows-msvc
             target: i686-pc-windows-msvc
             architecture: x64
+          - host: windows-latest
+            architecture: x64
+            target: aarch64-pc-windows-msvc
+            build: yarn build:release --target aarch64-pc-windows-msvc --features native-tls-vendored --cargo-flags="--no-default-features"
           - host: ubuntu-20.04
             target: x86_64-unknown-linux-gnu
             docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
@@ -84,10 +88,6 @@ jobs:
               rustup target add aarch64-unknown-linux-musl
               yarn build:release --target aarch64-unknown-linux-musl
               /aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node
-          #- host: windows-latest
-          #  architecture: x64
-          #  target: aarch64-pc-windows-msvc
-          #  build: yarn build:release --target aarch64-pc-windows-msvc
     name: stable - ${{ matrix.settings.target }} - node@16
     runs-on: ${{ matrix.settings.host }}
     steps:

+ 9 - 1
.github/workflows/publish-cli-rs.yml

@@ -21,15 +21,23 @@ jobs:
           - os: ubuntu-20.04
             rust_target: x86_64-unknown-linux-gnu
             ext: ''
+            args: ''
           - os: macos-latest
             rust_target: x86_64-apple-darwin
             ext: ''
+            args: ''
           - os: macos-latest
             rust_target: aarch64-apple-darwin
             ext: ''
+            args: ''
           - os: windows-latest
             rust_target: x86_64-pc-windows-msvc
             ext: '.exe'
+            args: ''
+          - os: windows-latest
+            rust_target: aarch64-pc-windows-msvc
+            ext: '.exe'
+            args: '--no-default-features --features native-tls-vendored'
 
     steps:
       - uses: actions/checkout@v3
@@ -53,7 +61,7 @@ jobs:
         uses: actions-rs/cargo@v1
         with:
           command: build
-          args: --manifest-path ./tooling/cli/Cargo.toml --release
+          args: --manifest-path ./tooling/cli/Cargo.toml --release ${{ matrix.config.args }}
 
       - name: Upload CLI
         uses: actions/upload-artifact@v3

+ 24 - 8
.github/workflows/test-cli-rs.yml

@@ -24,24 +24,40 @@ concurrency:
 
 jobs:
   test:
-    runs-on: ${{ matrix.platform }}
+    runs-on: ${{ matrix.platform.os }}
 
     strategy:
       fail-fast: false
       matrix:
-        platform: [ubuntu-latest, macos-latest, windows-latest]
+        platform:
+          - {
+              target: x86_64-pc-windows-msvc,
+              os: windows-latest
+            }
+          - {
+              target: aarch64-pc-windows-msvc,
+              os: windows-latest,
+              args: --no-default-features --features native-tls-vendored
+            }
+          - {
+              target: x86_64-unknown-linux-gnu,
+              os: ubuntu-latest
+            }
+          - {
+              target: x86_64-apple-darwin,
+              os: macos-latest
+            }
 
     steps:
       - uses: actions/checkout@v2
 
-      - name: install stable
-        uses: actions-rs/toolchain@v1
+      - name: 'Setup Rust'
+        uses: dtolnay/rust-toolchain@stable
         with:
-          toolchain: stable
-          override: true
+          targets: ${{ matrix.platform.target }}
 
       - name: install Linux dependencies
-        if: matrix.platform == 'ubuntu-latest'
+        if: matrix.platform.os == 'ubuntu-latest'
         run: |
           sudo apt-get update
           sudo apt-get install -y libgtk-3-dev
@@ -54,4 +70,4 @@ jobs:
         uses: actions-rs/cargo@v1
         with:
           command: build
-          args: --manifest-path ./tooling/cli/Cargo.toml
+          args: --manifest-path ./tooling/cli/Cargo.toml ${{ matrix.platform.args }}

+ 9 - 2
tooling/bundler/Cargo.toml

@@ -32,12 +32,13 @@ tempfile = "3.5.0"
 log = { version = "0.4.17", features = [ "kv_unstable" ] }
 dirs-next = "2.0"
 os_pipe = "1"
-ureq = "2.5"
+ureq = { version = "2.5", default-features = false }
+native-tls = { version = "0.2", optional = true }
 hex = "0.4"
 semver = "1"
 sha1 = "0.10"
 sha2 = "0.10"
-zip = "0.6"
+zip = { version = "0.6", default-features = false }
 dunce = "1"
 
 [target."cfg(target_os = \"windows\")".dependencies]
@@ -62,3 +63,9 @@ md5 = "0.7.0"
 [lib]
 name = "tauri_bundler"
 path = "src/lib.rs"
+
+[features]
+default = ["rustls"]
+native-tls = [ "ureq/native-tls" ]
+native-tls-vendored = [ "native-tls", "native-tls/vendored" ]
+rustls = [ "ureq/tls" ]

+ 74 - 113
tooling/cli/Cargo.lock

@@ -261,12 +261,6 @@ version = "0.21.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d"
 
-[[package]]
-name = "base64ct"
-version = "1.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b"
-
 [[package]]
 name = "beef"
 version = "0.5.2"
@@ -385,35 +379,11 @@ version = "1.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be"
 
-[[package]]
-name = "bzip2"
-version = "0.4.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8"
-dependencies = [
- "bzip2-sys",
- "libc",
-]
-
-[[package]]
-name = "bzip2-sys"
-version = "0.1.11+1.0.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc"
-dependencies = [
- "cc",
- "libc",
- "pkg-config",
-]
-
 [[package]]
 name = "cc"
 version = "1.0.79"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
-dependencies = [
- "jobserver",
-]
 
 [[package]]
 name = "cfb"
@@ -514,7 +484,7 @@ checksum = "0c49e86fc36d5704151f5996b7b3795385f50ce09e3be0f47a0cfde869681cf8"
 dependencies = [
  "bitflags 1.3.2",
  "block",
- "core-foundation",
+ "core-foundation 0.7.0",
  "core-graphics",
  "foreign-types",
  "libc",
@@ -584,12 +554,6 @@ dependencies = [
  "windows-sys 0.45.0",
 ]
 
-[[package]]
-name = "constant_time_eq"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
-
 [[package]]
 name = "convert_case"
 version = "0.4.0"
@@ -615,6 +579,16 @@ dependencies = [
  "libc",
 ]
 
+[[package]]
+name = "core-foundation"
+version = "0.9.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146"
+dependencies = [
+ "core-foundation-sys 0.8.4",
+ "libc",
+]
+
 [[package]]
 name = "core-foundation-sys"
 version = "0.7.0"
@@ -634,7 +608,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "b3889374e6ea6ab25dba90bb5d96202f61108058361f6dc72e8b03e6f8bbe923"
 dependencies = [
  "bitflags 1.3.2",
- "core-foundation",
+ "core-foundation 0.7.0",
  "foreign-types",
  "libc",
 ]
@@ -1817,15 +1791,6 @@ dependencies = [
  "regex",
 ]
 
-[[package]]
-name = "jobserver"
-version = "0.1.26"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2"
-dependencies = [
- "libc",
-]
-
 [[package]]
 name = "jpeg-decoder"
 version = "0.3.0"
@@ -2323,6 +2288,24 @@ dependencies = [
  "libloading",
 ]
 
+[[package]]
+name = "native-tls"
+version = "0.2.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e"
+dependencies = [
+ "lazy_static",
+ "libc",
+ "log",
+ "openssl",
+ "openssl-probe",
+ "openssl-sys",
+ "schannel",
+ "security-framework",
+ "security-framework-sys",
+ "tempfile",
+]
+
 [[package]]
 name = "neli"
 version = "0.5.3"
@@ -2553,6 +2536,12 @@ dependencies = [
  "syn 2.0.17",
 ]
 
+[[package]]
+name = "openssl-probe"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
+
 [[package]]
 name = "openssl-src"
 version = "111.25.3+1.1.1t"
@@ -2628,17 +2617,6 @@ dependencies = [
  "windows-sys 0.45.0",
 ]
 
-[[package]]
-name = "password-hash"
-version = "0.4.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700"
-dependencies = [
- "base64ct",
- "rand_core 0.6.4",
- "subtle",
-]
-
 [[package]]
 name = "path_abs"
 version = "0.5.1"
@@ -2651,18 +2629,6 @@ dependencies = [
  "stfu8",
 ]
 
-[[package]]
-name = "pbkdf2"
-version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917"
-dependencies = [
- "digest 0.10.7",
- "hmac",
- "password-hash",
- "sha2",
-]
-
 [[package]]
 name = "pbkdf2"
 version = "0.12.1"
@@ -3254,6 +3220,15 @@ dependencies = [
  "winapi-util",
 ]
 
+[[package]]
+name = "schannel"
+version = "0.1.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3"
+dependencies = [
+ "windows-sys 0.42.0",
+]
+
 [[package]]
 name = "schemars"
 version = "0.8.12"
@@ -3291,7 +3266,7 @@ version = "0.11.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "0516a385866c09368f0b5bcd1caff3366aace790fcd46e2bb032697bb172fd1f"
 dependencies = [
- "pbkdf2 0.12.1",
+ "pbkdf2",
  "salsa20",
  "sha2",
 ]
@@ -3306,6 +3281,29 @@ dependencies = [
  "untrusted",
 ]
 
+[[package]]
+name = "security-framework"
+version = "2.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8"
+dependencies = [
+ "bitflags 1.3.2",
+ "core-foundation 0.9.3",
+ "core-foundation-sys 0.8.4",
+ "libc",
+ "security-framework-sys",
+]
+
+[[package]]
+name = "security-framework-sys"
+version = "2.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7"
+dependencies = [
+ "core-foundation-sys 0.8.4",
+ "libc",
+]
+
 [[package]]
 name = "selectors"
 version = "0.22.0"
@@ -3767,6 +3765,7 @@ dependencies = [
  "libflate",
  "log",
  "md5",
+ "native-tls",
  "os_pipe",
  "plist",
  "regex",
@@ -3876,13 +3875,13 @@ dependencies = [
 
 [[package]]
 name = "tauri-mobile"
-version = "0.5.0"
+version = "0.5.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "596fa2cd0538f040eeb1485f74eb40052625dafd55cef4b3139e200763f6a988"
+checksum = "b89f813f457a0f902f4ec37a70d0dd008b1e33473ac39b6df031b7c13880cdd4"
 dependencies = [
  "cocoa",
  "colored 1.9.3",
- "core-foundation",
+ "core-foundation 0.7.0",
  "deunicode",
  "duct",
  "dunce",
@@ -4394,6 +4393,7 @@ dependencies = [
  "base64 0.13.1",
  "flate2",
  "log",
+ "native-tls",
  "once_cell",
  "rustls",
  "url",
@@ -4942,48 +4942,9 @@ version = "0.6.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261"
 dependencies = [
- "aes",
  "byteorder",
- "bzip2",
- "constant_time_eq",
  "crc32fast",
  "crossbeam-utils",
- "flate2",
- "hmac",
- "pbkdf2 0.11.0",
- "sha1",
- "time",
- "zstd",
-]
-
-[[package]]
-name = "zstd"
-version = "0.11.2+zstd.1.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4"
-dependencies = [
- "zstd-safe",
-]
-
-[[package]]
-name = "zstd-safe"
-version = "5.0.2+zstd.1.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db"
-dependencies = [
- "libc",
- "zstd-sys",
-]
-
-[[package]]
-name = "zstd-sys"
-version = "2.0.8+zstd.1.5.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5556e6ee25d32df2586c098bbfa278803692a20d0ab9565e049480d52707ec8c"
-dependencies = [
- "cc",
- "libc",
- "pkg-config",
 ]
 
 [[package]]

+ 7 - 4
tooling/cli/Cargo.toml

@@ -39,7 +39,7 @@ name = "cargo-tauri"
 path = "src/main.rs"
 
 [dependencies]
-tauri-mobile = { version = "0.5", default-features = false }
+tauri-mobile = { version = "0.5.1", default-features = false }
 textwrap = { version = "0.11.0", features = [ "term_size" ] }
 jsonrpsee = { version = "0.16", features = [ "server" ] }
 jsonrpsee-core = "0.16"
@@ -50,7 +50,7 @@ sublime_fuzzy = "0.7"
 clap_complete = "4"
 clap = { version = "4.0", features = [ "derive" ] }
 anyhow = "1.0"
-tauri-bundler = { version = "2.0.0-alpha.5", path = "../bundler" }
+tauri-bundler = { version = "2.0.0-alpha.5", default-features = false, path = "../bundler" }
 colored = "2.0"
 once_cell = "1"
 serde = { version = "1.0", features = [ "derive" ] }
@@ -69,7 +69,7 @@ handlebars = "4.3"
 include_dir = "0.7"
 minisign = "0.7"
 base64 = "0.21.0"
-ureq = "2.5"
+ureq = { version = "2.5", default-features = false, features = ["gzip"] }
 os_info = "3"
 semver = "1.0"
 regex = "1.6.0"
@@ -106,4 +106,7 @@ libc = "0.2"
 lto = true
 
 [features]
-openssl-vendored = [ "tauri-mobile/openssl-vendored" ]
+default = [ "rustls" ]
+native-tls = [ "tauri-bundler/native-tls", "tauri-mobile/native-tls", "ureq/native-tls" ]
+native-tls-vendored = [ "native-tls", "tauri-bundler/native-tls-vendored", "tauri-mobile/openssl-vendored" ]
+rustls = [ "tauri-bundler/rustls", "tauri-mobile/rustls", "ureq/tls" ]

+ 3 - 2
tooling/cli/node/Cargo.toml

@@ -10,11 +10,12 @@ crate-type = ["cdylib"]
 # Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
 napi = { version = "2.12", default-features = false, features = ["napi4"] }
 napi-derive = "2.12"
-tauri-cli = { path = ".." }
+tauri-cli = { path = "..", default-features = false }
 log = "0.4.17"
 
 [build-dependencies]
 napi-build = "2.0"
 
 [features]
-openssl-vendored = ["tauri-cli/openssl-vendored"]
+default = ["tauri-cli/default"]
+native-tls-vendored = ["tauri-cli/native-tls-vendored"]

+ 3 - 0
tooling/cli/node/npm/win32-arm64-msvc/README.md

@@ -0,0 +1,3 @@
+# `@tauri-apps/cli-win32-arm64-msvc`
+
+This is the **aarch64-pc-windows-msvc** binary for `@tauri-apps/cli`

+ 21 - 0
tooling/cli/node/npm/win32-arm64-msvc/package.json

@@ -0,0 +1,21 @@
+{
+  "name": "@tauri-apps/cli-win32-arm64-msvc",
+  "version": "0.0.0",
+  "publishConfig": {
+    "access": "public"
+  },
+  "os": [
+    "win32"
+  ],
+  "cpu": [
+    "arm64"
+  ],
+  "main": "cli.win32-arm64-msvc.node",
+  "files": [
+    "cli.win32-arm64-msvc.node"
+  ],
+  "license": "MIT",
+  "engines": {
+    "node": ">= 10"
+  }
+}

+ 1 - 1
tooling/cli/node/package.json

@@ -56,7 +56,7 @@
   },
   "scripts": {
     "artifacts": "napi artifacts",
-    "build:release": "cross-env TARGET=node napi build --platform --release --features openssl-vendored",
+    "build:release": "cross-env TARGET=node napi build --platform --release",
     "build": "cross-env TARGET=node napi build --platform",
     "prepublishOnly": "napi prepublish -t npm --gh-release-id $RELEASE_ID",
     "prepack": "cp ../schema.json .",

+ 0 - 1
tooling/cli/src/mobile/ios/open.rs

@@ -5,7 +5,6 @@
 use super::{ensure_init, env, get_app, get_config, MobileTarget};
 use crate::{helpers::config::get as get_tauri_config, Result};
 
-use anyhow::Context;
 use tauri_mobile::os;
 
 pub fn command() -> Result<()> {

+ 0 - 1
tooling/cli/src/mobile/ios/xcode_script.rs

@@ -9,7 +9,6 @@ use crate::{
   Result,
 };
 
-use anyhow::Context;
 use clap::Parser;
 use tauri_mobile::{apple::target::Target, opts::Profile};