diff --git a/.changes/append_invoke_initialization_script.md b/.changes/append_invoke_initialization_script.md new file mode 100644 index 000000000000..b0fba2cca381 --- /dev/null +++ b/.changes/append_invoke_initialization_script.md @@ -0,0 +1,5 @@ +--- +"tauri": patch:enhance +--- + +Added `Builder::append_invoke_initialization_script`. diff --git a/.changes/avoid-rebuilds.md b/.changes/avoid-rebuilds.md new file mode 100644 index 000000000000..5963d54535a2 --- /dev/null +++ b/.changes/avoid-rebuilds.md @@ -0,0 +1,7 @@ +--- +"tauri": patch:bug +"tauri-build": patch:bug +"tauri-utils": patch:bug +--- + +Prevent build script from rerunning unnecessarily by only writing files when the content changes. diff --git a/.changes/bundler-object-custom-sign-command.md b/.changes/bundler-object-custom-sign-command.md new file mode 100644 index 000000000000..ee0110f78bcf --- /dev/null +++ b/.changes/bundler-object-custom-sign-command.md @@ -0,0 +1,8 @@ +--- +"tauri-bundler": patch:feat +"tauri-utils": patch:feat +"@tauri-apps/cli": patch:feat +"tauri-cli": patch:feat +--- + +Custom sign command with object notation for whitespaces in the command path and arguments. diff --git a/.changes/change-pr-10676.md b/.changes/change-pr-10676.md new file mode 100644 index 000000000000..2e531c8d338c --- /dev/null +++ b/.changes/change-pr-10676.md @@ -0,0 +1,6 @@ +--- +"@tauri-apps/cli": 'patch:bug' +"tauri-cli": 'patch:bug' +--- + +Change plugin template call to `register_ios_plugin` params to snake case diff --git a/.changes/config.json b/.changes/config.json index 79c302e311ef..0615c4428c3a 100644 --- a/.changes/config.json +++ b/.changes/config.json @@ -14,10 +14,13 @@ "pkgManagers": { "rust": { "version": true, - "getPublishedVersion": "node ../../.scripts/covector/package-latest-version.js cargo ${ pkgFile.pkg.package.name } ${ pkgFile.pkg.package.version }", + "getPublishedVersion": { + "use": "fetch:check", + "options": { + "url": "https://crates.io/api/v1/crates/${ pkg.pkgFile.pkg.package.name }/${ pkg.pkgFile.version }" + } + }, "prepublish": [ - "sudo apt-get update", - "sudo apt-get install -y webkit2gtk-4.1 libayatana-appindicator3-dev", "cargo install cargo-audit --features=fix", { "command": "cargo generate-lockfile", @@ -43,11 +46,6 @@ } ], "publish": [ - "sleep 15s", - { - "command": "cargo package --no-verify", - "dryRunCommand": true - }, { "command": "echo '
\n

Cargo Publish

\n\n```'", "dryRunCommand": true, @@ -64,21 +62,22 @@ "pipe": true } ], - "postpublish": [ - "git tag ${ pkg.pkg }-v${ pkgFile.versionMajor } -f", - "git tag ${ pkg.pkg }-v${ pkgFile.versionMajor }.${ pkgFile.versionMinor } -f", - "git push --tags -f" - ], - "assets": [ - { - "path": "./target/package/${ pkg.pkg }-${ pkgFile.version }.crate", - "name": "${ pkg.pkg }-${ pkgFile.version }.crate" - } - ] + "postpublish": { + "use": "fetch:check", + "options": { + "url": "https://crates.io/api/v1/crates/${ pkg.pkgFile.pkg.package.name }/${ pkg.pkgFile.version }" + }, + "retries": [5000, 5000, 5000] + } }, "javascript": { "version": true, - "getPublishedVersion": "node ../../.scripts/covector/package-latest-version.js npm ${ pkgFile.pkg.name } ${ pkgFile.pkg.version }", + "getPublishedVersion": { + "use": "fetch:check", + "options": { + "url": "https://registry.npmjs.com/${ pkg.pkgFile.pkg.name }/${ pkg.pkgFile.version }" + } + }, "prepublish": [ { "command": "pnpm i --frozen-lockfile", @@ -99,14 +98,9 @@ "command": "echo '```\n\n
\n'", "dryRunCommand": true, "pipe": true - }, - { - "command": "npm pack", - "dryRunCommand": true } ], "publish": [ - "sleep 15s", { "command": "echo '
\n

PNPM Publish

\n\n```'", "dryRunCommand": true, @@ -123,49 +117,19 @@ "pipe": true } ], - "postpublish": [ - "git tag ${ pkg.pkg }-v${ pkgFile.versionMajor } -f", - "git tag ${ pkg.pkg }-v${ pkgFile.versionMajor }.${ pkgFile.versionMinor } -f", - "git push --tags -f" - ] + "postpublish": { + "use": "fetch:check", + "options": { + "url": "https://registry.npmjs.com/${ pkg.pkgFile.pkg.name }/${ pkg.pkgFile.version }" + }, + "retries": [5000, 5000, 5000] + } } }, "packages": { "@tauri-apps/api": { "path": "./tooling/api", "manager": "javascript", - "assets": [ - { - "path": "./tooling/api/dist/tauri-apps-api-${ pkgFile.version }.tgz", - "name": "tauri-apps-api-${ pkgFile.version }.tgz" - } - ], - "prepublish": [ - { - "command": "pnpm i --frozen-lockfile", - "dryRunCommand": true - }, - { - "command": "echo '
\n

PNPM Audit

\n\n```'", - "dryRunCommand": true, - "pipe": true - }, - { - "command": "pnpm audit", - "dryRunCommand": true, - "runFromRoot": true, - "pipe": true - }, - { - "command": "echo '```\n\n
\n'", - "dryRunCommand": true, - "pipe": true - }, - { - "command": "pnpm npm-pack", - "dryRunCommand": true - } - ], "publish": [ { "command": "echo '
\n

PNPM Publish

\n\n```'", @@ -253,7 +217,6 @@ "@tauri-apps/cli": { "path": "./tooling/cli/node", "manager": "javascript", - "getPublishedVersion": "node ../../../.scripts/covector/package-latest-version.js npm ${ pkgFile.pkg.name } ${ pkgFile.pkg.version }", "dependencies": ["tauri-cli"], "postversion": [ "node ../../../.scripts/covector/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }", @@ -270,12 +233,6 @@ "postversion": [ "cargo check", "cargo build --manifest-path ../../core/tauri-config-schema/Cargo.toml" - ], - "assets": [ - { - "path": "${ pkg.path }/target/package/tauri-cli-${ pkgFile.version }.crate", - "name": "${ pkg.pkg }-${ pkgFile.version }.crate" - } ] }, "tauri-driver": { diff --git a/.changes/enhance-permission-error-message.md b/.changes/enhance-permission-error-message.md new file mode 100644 index 000000000000..207dbdd9ca23 --- /dev/null +++ b/.changes/enhance-permission-error-message.md @@ -0,0 +1,5 @@ +--- +"tauri": patch:enhance +--- + +Include more information in the IPC permission error message. diff --git a/.changes/fix-cli-add-plugin-version.md b/.changes/fix-cli-add-plugin-version.md new file mode 100644 index 000000000000..3c0db7e07223 --- /dev/null +++ b/.changes/fix-cli-add-plugin-version.md @@ -0,0 +1,6 @@ +--- +'tauri-cli': 'patch:bug' +'@tauri-apps/cli': 'patch:bug' +--- + +Changed the `add` command to use a version requirement that matches the CLI's stable and prerelease numbers. diff --git a/.changes/fix-export-default-permissions.md b/.changes/fix-export-default-permissions.md new file mode 100644 index 000000000000..245868efbbf2 --- /dev/null +++ b/.changes/fix-export-default-permissions.md @@ -0,0 +1,5 @@ +--- +"tauri-build": patch:bug +--- + +Correctly export `DefaultPermissionsRule` diff --git a/.changes/fix-ios-build-older-swift.md b/.changes/fix-ios-build-older-swift.md new file mode 100644 index 000000000000..c5e6d8990f65 --- /dev/null +++ b/.changes/fix-ios-build-older-swift.md @@ -0,0 +1,6 @@ +--- +'tauri-cli': 'patch:bug' +'@tauri-apps/cli': 'patch:bug' +--- + +Fix Swift plugin compilation on older versions. diff --git a/.changes/fix-tslib-path.md b/.changes/fix-tslib-path.md new file mode 100644 index 000000000000..e43ee138cc03 --- /dev/null +++ b/.changes/fix-tslib-path.md @@ -0,0 +1,5 @@ +--- +"@tauri-apps/api": patch:bug +--- + +Fix tslib path in dist. diff --git a/.changes/fix-xcodebuild-arch.md b/.changes/fix-xcodebuild-arch.md new file mode 100644 index 000000000000..59a54a96d2f3 --- /dev/null +++ b/.changes/fix-xcodebuild-arch.md @@ -0,0 +1,7 @@ +--- +'tauri-cli': 'patch:bug' +'@tauri-apps/cli': 'patch:bug' +--- + +Do not include the target arch when building and archiving the iOS application, +which makes Xcode project modifications more flexible. diff --git a/.changes/inject-mobile-resources.md b/.changes/inject-mobile-resources.md new file mode 100644 index 000000000000..6d83411c66ec --- /dev/null +++ b/.changes/inject-mobile-resources.md @@ -0,0 +1,6 @@ +--- +"tauri-cli": patch:feat +"@tauri-apps/cli": patch:feat +--- + +Inject configured resources on mobile apps. diff --git a/.changes/pre.json b/.changes/pre.json index 59db8e3481dd..cede81e694c3 100644 --- a/.changes/pre.json +++ b/.changes/pre.json @@ -6,12 +6,16 @@ ".changes/android-dev-open-adb-fix.md", ".changes/android-gradle-8-9.md", ".changes/android-port-forward-fixes.md", + ".changes/append_invoke_initialization_script.md", ".changes/asset-resolver-dev-fallback.md", + ".changes/avoid-rebuilds.md", ".changes/brotli-6.md", + ".changes/bundler-object-custom-sign-command.md", ".changes/change-default-export-option-debugging.md", ".changes/change-pr-10435.md", ".changes/change-pr-10498.md", ".changes/change-pr-10619.md", + ".changes/change-pr-10676.md", ".changes/check-android-lib-symbols.md", ".changes/cli-add-no-fmt.md", ".changes/cli-android-template-androidtv.md", @@ -21,22 +25,29 @@ ".changes/cli-signtool-path.md", ".changes/core-plugin-namespace.md", ".changes/dev-url-localhost-mobile.md", + ".changes/enhance-permission-error-message.md", ".changes/feat-remove-target-sdk.md", ".changes/fix-adb.md", + ".changes/fix-cli-add-plugin-version.md", ".changes/fix-cli-dev-server-android.md", ".changes/fix-cli-panic-bun.md", ".changes/fix-colon-in-file-path.md", ".changes/fix-conf-parsing-error-filepath.md", ".changes/fix-config-override.md", + ".changes/fix-export-default-permissions.md", + ".changes/fix-ios-build-older-swift.md", ".changes/fix-ios-bun-support.md", ".changes/fix-ipc-fallback.md", ".changes/fix-manifest-migration.md", ".changes/fix-missing-codesign-error-macos.md", + ".changes/fix-tslib-path.md", ".changes/fix-usage-without-compression.md", ".changes/fix-v1-frontend-migration.md", + ".changes/fix-xcodebuild-arch.md", ".changes/get-window-async.md", ".changes/improve-cli-init.md", ".changes/infer-signing-identity.md", + ".changes/inject-mobile-resources.md", ".changes/ios-custom-project-template.md", ".changes/ios-default-minversion.md", ".changes/ios-frameworks.md", @@ -54,6 +65,8 @@ ".changes/refactor-ipc-response.md", ".changes/remove-open-command.md", ".changes/remove-unsecure-configs.md", + ".changes/resource-dir-android.md", + ".changes/resource-dir-ios.md", ".changes/resources-map-becoming-dirs.md", ".changes/universal-bin-build-fails.md", ".changes/update-tao-wry.md", diff --git a/.changes/resource-dir-android.md b/.changes/resource-dir-android.md new file mode 100644 index 000000000000..05480021b2fc --- /dev/null +++ b/.changes/resource-dir-android.md @@ -0,0 +1,5 @@ +--- +"tauri-utils": patch:bug +--- + +Implemented `resource_dir` on Android, which returns a URI that needs to be resolved using [AssetManager::open](https://developer.android.com/reference/android/content/res/AssetManager#open(java.lang.String,%20int)). This will be handled by the file system plugin. diff --git a/.changes/resource-dir-ios.md b/.changes/resource-dir-ios.md new file mode 100644 index 000000000000..e4650a698b6b --- /dev/null +++ b/.changes/resource-dir-ios.md @@ -0,0 +1,5 @@ +--- +"tauri-utils": patch:bug +--- + +Fix `resource_dir` on iOS. diff --git a/.github/workflows/covector-version-or-publish.yml b/.github/workflows/covector-version-or-publish.yml index 18c105717c93..4108ff4a6019 100644 --- a/.github/workflows/covector-version-or-publish.yml +++ b/.github/workflows/covector-version-or-publish.yml @@ -87,6 +87,11 @@ jobs: git config --global user.name "${{ github.event.pusher.name }}" git config --global user.email "${{ github.event.pusher.email }}" + - name: install Linux dependencies + run: | + sudo apt-get update + sudo apt-get install -y webkit2gtk-4.1 libayatana-appindicator3-dev + - name: covector version or publish (publish when no change files present) uses: jbolda/covector/packages/action@covector-v0 id: covector diff --git a/.github/workflows/lint-js.yml b/.github/workflows/lint-js.yml index daa55855e2bf..581dba768b6a 100644 --- a/.github/workflows/lint-js.yml +++ b/.github/workflows/lint-js.yml @@ -23,7 +23,7 @@ jobs: - run: corepack enable - uses: actions/setup-node@v4 with: - node-version: '18' + node-version: 'lts/*' cache: 'pnpm' - run: pnpm i --frozen-lockfile - run: pnpm format:check @@ -35,7 +35,7 @@ jobs: - run: corepack enable - uses: actions/setup-node@v4 with: - node-version: '18' + node-version: 'lts/*' cache: 'pnpm' - run: pnpm i --frozen-lockfile - run: pnpm eslint:check @@ -47,7 +47,7 @@ jobs: - run: corepack enable - uses: actions/setup-node@v4 with: - node-version: '18' + node-version: 'lts/*' cache: 'pnpm' - run: pnpm i --frozen-lockfile - run: pnpm ts:check diff --git a/.github/workflows/publish-cli-js.yml b/.github/workflows/publish-cli-js.yml index 59a2b34b5fc3..166dc1e518e2 100644 --- a/.github/workflows/publish-cli-js.yml +++ b/.github/workflows/publish-cli-js.yml @@ -97,8 +97,7 @@ jobs: uses: actions/setup-node@v4 if: ${{ !matrix.settings.docker }} with: - node-version: 16 - check-latest: true + node-version: 18 cache: 'pnpm' architecture: ${{ matrix.settings.architecture }} - name: Install Rust @@ -116,7 +115,7 @@ jobs: if: ${{ matrix.settings.setup }} shell: bash - name: Install dependencies - run: pnpm i --frozen-lockfile --ignore-scripts --registry https://registry.npmjs.org --network-timeout 300000 + run: pnpm i --frozen-lockfile --ignore-scripts - name: Build in docker uses: addnab/docker-run-action@v3 @@ -175,7 +174,7 @@ jobs: # env # freebsd-version # cd ./tooling/cli/node/ - # pnpm i --frozen-lockfile --ignore-scripts --registry https://registry.npmjs.org --network-timeout 300000 + # pnpm i --frozen-lockfile --ignore-scripts # pnpm build:release # strip -x *.node # rm -rf node_modules @@ -199,7 +198,6 @@ jobs: - host: windows-latest target: x86_64-pc-windows-msvc node: - - '16' - '18' - '20' runs-on: ${{ matrix.settings.host }} @@ -210,10 +208,9 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - check-latest: true cache: 'pnpm' - name: Install dependencies - run: pnpm i --frozen-lockfile --ignore-scripts --registry https://registry.npmjs.org --network-timeout 300000 + run: pnpm i --frozen-lockfile --ignore-scripts - name: Download artifacts uses: actions/download-artifact@v3 with: @@ -232,7 +229,6 @@ jobs: fail-fast: false matrix: node: - - '16' - '18' - '20' runs-on: ubuntu-latest @@ -243,10 +239,9 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - check-latest: true cache: 'pnpm' - name: Install dependencies - run: pnpm i --frozen-lockfile --ignore-scripts --registry https://registry.npmjs.org --network-timeout 300000 + run: pnpm i --frozen-lockfile --ignore-scripts - name: Download artifacts uses: actions/download-artifact@v3 with: @@ -269,7 +264,6 @@ jobs: fail-fast: false matrix: node: - - '16' - '18' - '20' runs-on: ubuntu-latest @@ -282,10 +276,9 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - check-latest: true cache: 'pnpm' - name: Install dependencies - run: pnpm i --frozen-lockfile --ignore-scripts --registry https://registry.npmjs.org --network-timeout 300000 + run: pnpm i --frozen-lockfile --ignore-scripts - name: Download artifacts uses: actions/download-artifact@v3 with: @@ -312,7 +305,6 @@ jobs: fail-fast: false matrix: node: - - '16' - '18' - '20' image: @@ -326,8 +318,6 @@ jobs: - name: List packages run: ls -R . shell: bash - - name: Install dependencies - run: pnpm i --frozen-lockfile --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000 - name: Download aarch64-gnu artifacts uses: actions/download-artifact@v3 with: @@ -356,7 +346,7 @@ jobs: fnm install ${{ matrix.node }} fnm use ${{ matrix.node }} cd tooling/cli/node - pnpm tauri --help + node tauri.js --help ls -la publish: name: Publish @@ -367,6 +357,9 @@ jobs: - test-linux-x64-gnu-binding - test-linux-x64-musl-binding #- test-linux-arm-bindings + permissions: + contents: write # update release + id-token: write # npm provenance steps: - uses: actions/checkout@v4 - run: corepack enable @@ -374,10 +367,9 @@ jobs: uses: actions/setup-node@v4 with: node-version: 20 - check-latest: true cache: 'pnpm' - name: Install dependencies - run: pnpm i --frozen-lockfile --ignore-scripts --registry https://registry.npmjs.org --network-timeout 300000 + run: pnpm i --frozen-lockfile --ignore-scripts - name: Download all artifacts uses: actions/download-artifact@v3 with: diff --git a/.scripts/covector/package-latest-version.js b/.scripts/covector/package-latest-version.js deleted file mode 100644 index 954645348825..000000000000 --- a/.scripts/covector/package-latest-version.js +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env node - -// Copyright 2019-2024 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT - -/* -This script is solely intended to be run as part of the `covector publish` step to -check the latest version of a crate, considering the current minor version. -*/ - -const https = require('https') - -const kind = process.argv[2] -const packageName = process.argv[3] -const packageVersion = process.argv[4] -const target = packageVersion.substring(0, packageVersion.lastIndexOf('.')) - -let url = null -switch (kind) { - case 'cargo': - url = `https://crates.io/api/v1/crates/${packageName}` - break - case 'npm': - url = `https://registry.npmjs.org/${packageName}` - break - default: - throw new Error('unexpected kind ' + kind) -} - -const options = { - headers: { - 'Content-Type': 'application/json', - Accept: 'application/json', - 'User-Agent': 'tauri (https://github.com/tauri-apps/tauri)' - } -} - -https.get(url, options, (response) => { - let chunks = [] - response.on('data', function (chunk) { - chunks.push(chunk) - }) - - response.on('end', function () { - const data = JSON.parse(chunks.join('')) - if (kind === 'cargo') { - const versions = - data.versions?.filter((v) => v.num.startsWith(target)) ?? [] - console.log(versions.length ? versions[0].num : '0.0.0') - } else if (kind === 'npm') { - const versions = Object.keys(data.versions).filter((v) => - v.startsWith(target) - ) - console.log(versions[versions.length - 1] || '0.0.0') - } - }) -}) diff --git a/Cargo.lock b/Cargo.lock index aa6bfc847409..c91439cc5fe3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3791,7 +3791,7 @@ checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" [[package]] name = "tauri" -version = "2.0.0-rc.3" +version = "2.0.0-rc.5" dependencies = [ "anyhow", "bytes", @@ -3860,7 +3860,7 @@ dependencies = [ [[package]] name = "tauri-build" -version = "2.0.0-rc.3" +version = "2.0.0-rc.5" dependencies = [ "anyhow", "cargo_toml", @@ -3882,7 +3882,7 @@ dependencies = [ [[package]] name = "tauri-codegen" -version = "2.0.0-rc.3" +version = "2.0.0-rc.5" dependencies = [ "base64 0.22.1", "brotli", @@ -3919,7 +3919,7 @@ dependencies = [ [[package]] name = "tauri-macros" -version = "2.0.0-rc.3" +version = "2.0.0-rc.5" dependencies = [ "heck 0.5.0", "proc-macro2", @@ -3931,7 +3931,7 @@ dependencies = [ [[package]] name = "tauri-plugin" -version = "2.0.0-rc.3" +version = "2.0.0-rc.5" dependencies = [ "anyhow", "glob", @@ -3946,7 +3946,7 @@ dependencies = [ [[package]] name = "tauri-runtime" -version = "2.0.0-rc.3" +version = "2.0.0-rc.5" dependencies = [ "dpi", "gtk", @@ -3963,7 +3963,7 @@ dependencies = [ [[package]] name = "tauri-runtime-wry" -version = "2.0.0-rc.3" +version = "2.0.0-rc.5" dependencies = [ "cocoa 0.26.0", "gtk", @@ -3986,7 +3986,7 @@ dependencies = [ [[package]] name = "tauri-utils" -version = "2.0.0-rc.3" +version = "2.0.0-rc.5" dependencies = [ "aes-gcm", "brotli", diff --git a/core/tauri-acl-schema/build.rs b/core/tauri-acl-schema/build.rs index 8a2f3d1bb716..1c7302576110 100644 --- a/core/tauri-acl-schema/build.rs +++ b/core/tauri-acl-schema/build.rs @@ -6,8 +6,7 @@ use std::{error::Error, path::PathBuf}; use schemars::schema_for; use tauri_utils::{ - acl::capability::Capability, - acl::{Permission, Scopes}, + acl::{capability::Capability, Permission, Scopes}, write_if_changed, }; diff --git a/core/tauri-build/CHANGELOG.md b/core/tauri-build/CHANGELOG.md index 835a8ff1fc81..7e553743a1c9 100644 --- a/core/tauri-build/CHANGELOG.md +++ b/core/tauri-build/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## \[2.0.0-rc.5] + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-rc.5` +- Upgraded to `tauri-codegen@2.0.0-rc.5` + +## \[2.0.0-rc.4] + +### Bug Fixes + +- [`5c335ae9a`](https://www.github.com/tauri-apps/tauri/commit/5c335ae9ad88e46c2135a557390f6e808c9a6088) ([#10648](https://www.github.com/tauri-apps/tauri/pull/10648) by [@Flakebi](https://www.github.com/tauri-apps/tauri/../../Flakebi)) Prevent build script from rerunning unnecessarily by only writing files when the content changes. +- [`77844529f`](https://www.github.com/tauri-apps/tauri/commit/77844529f323434919ad6581d54cb2d97500cf4d) ([#10678](https://www.github.com/tauri-apps/tauri/pull/10678) by [@Norbiros](https://www.github.com/tauri-apps/tauri/../../Norbiros)) Correctly export `DefaultPermissionsRule` + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-rc.4` +- Upgraded to `tauri-codegen@2.0.0-rc.4` + ## \[2.0.0-rc.3] ### New Features diff --git a/core/tauri-build/Cargo.toml b/core/tauri-build/Cargo.toml index a1fb0f7845cc..d5062670f67b 100644 --- a/core/tauri-build/Cargo.toml +++ b/core/tauri-build/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-build" -version = "2.0.0-rc.3" +version = "2.0.0-rc.5" description = "build time code to pair with https://crates.io/crates/tauri" exclude = [ "CHANGELOG.md", "/target" ] readme = "README.md" @@ -28,8 +28,8 @@ rustdoc-args = [ "--cfg", "docsrs" ] [dependencies] anyhow = "1" quote = { version = "1", optional = true } -tauri-codegen = { version = "2.0.0-rc.3", path = "../tauri-codegen", optional = true } -tauri-utils = { version = "2.0.0-rc.3", path = "../tauri-utils", features = [ "build", "resources" ] } +tauri-codegen = { version = "2.0.0-rc.5", path = "../tauri-codegen", optional = true } +tauri-utils = { version = "2.0.0-rc.5", path = "../tauri-utils", features = [ "build", "resources" ] } cargo_toml = "0.17" serde = "1" serde_json = "1" diff --git a/core/tauri-build/src/acl.rs b/core/tauri-build/src/acl.rs index 2f916f1ae1ce..bbae74dd0185 100644 --- a/core/tauri-build/src/acl.rs +++ b/core/tauri-build/src/acl.rs @@ -24,6 +24,7 @@ use tauri_utils::{ APP_ACL_KEY, }, platform::Target, + write_if_changed, }; const CAPABILITIES_SCHEMA_FILE_NAME: &str = "schema.json"; @@ -384,7 +385,8 @@ permissions = [{default_permissions}] let default_permission_toml_path = plugin_out_dir.join("default.toml"); - write_if_changed(&default_permission_toml, &default_permission_toml_path); + write_if_changed(&default_permission_toml_path, default_permission_toml) + .unwrap_or_else(|_| panic!("unable to autogenerate {default_permission_toml_path:?}")); } tauri_utils::acl::build::define_permissions( @@ -428,12 +430,6 @@ permissions = [{default_permissions}] Ok(acl_manifests) } -fn write_if_changed(content: &str, path: &Path) { - if content != read_to_string(path).unwrap_or_default() { - std::fs::write(path, content).unwrap_or_else(|_| panic!("unable to autogenerate {path:?}")); - } -} - pub fn app_manifest_permissions( out_dir: &Path, manifest: AppManifest, diff --git a/core/tauri-build/src/lib.rs b/core/tauri-build/src/lib.rs index 1646a0f7e20f..57b63b0f3058 100644 --- a/core/tauri-build/src/lib.rs +++ b/core/tauri-build/src/lib.rs @@ -40,7 +40,7 @@ mod static_vcruntime; #[cfg_attr(docsrs, doc(cfg(feature = "codegen")))] pub use codegen::context::CodegenContext; -pub use acl::{AppManifest, InlinedPlugin}; +pub use acl::{AppManifest, DefaultPermissionRule, InlinedPlugin}; const ACL_MANIFESTS_FILE_NAME: &str = "acl-manifests.json"; const CAPABILITIES_FILE_NAME: &str = "capabilities.json"; diff --git a/core/tauri-build/src/mobile.rs b/core/tauri-build/src/mobile.rs index 3c8e7c1cb797..836b0d93564e 100644 --- a/core/tauri-build/src/mobile.rs +++ b/core/tauri-build/src/mobile.rs @@ -6,7 +6,7 @@ use std::{fs::write, path::PathBuf}; use anyhow::{Context, Result}; use semver::Version; -use tauri_utils::config::Config; +use tauri_utils::{config::Config, write_if_changed}; use crate::is_dev; @@ -80,20 +80,25 @@ dependencies {" } } - write(&gradle_settings_path, gradle_settings).context("failed to write tauri.settings.gradle")?; + // Overwrite only if changed to not trigger rebuilds + write_if_changed(&gradle_settings_path, gradle_settings) + .context("failed to write tauri.settings.gradle")?; - write(&app_build_gradle_path, app_build_gradle) + write_if_changed(&app_build_gradle_path, app_build_gradle) .context("failed to write tauri.build.gradle.kts")?; if !app_tauri_properties.is_empty() { - write( - &app_tauri_properties_path, - format!( - "// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.\n{}", - app_tauri_properties.join("\n") - ), - ) - .context("failed to write tauri.properties")?; + let app_tauri_properties_content = format!( + "// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.\n{}", + app_tauri_properties.join("\n") + ); + if std::fs::read_to_string(&app_tauri_properties_path) + .map(|o| o != app_tauri_properties_content) + .unwrap_or(true) + { + write(&app_tauri_properties_path, app_tauri_properties_content) + .context("failed to write tauri.properties")?; + } } println!("cargo:rerun-if-changed={}", gradle_settings_path.display()); diff --git a/core/tauri-codegen/CHANGELOG.md b/core/tauri-codegen/CHANGELOG.md index 606a1f964f41..d2898047032e 100644 --- a/core/tauri-codegen/CHANGELOG.md +++ b/core/tauri-codegen/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## \[2.0.0-rc.5] + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-rc.5` + +## \[2.0.0-rc.4] + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-rc.4` + ## \[2.0.0-rc.3] ### Dependencies diff --git a/core/tauri-codegen/Cargo.toml b/core/tauri-codegen/Cargo.toml index 367156afaa80..5142aabc09d9 100644 --- a/core/tauri-codegen/Cargo.toml +++ b/core/tauri-codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-codegen" -version = "2.0.0-rc.3" +version = "2.0.0-rc.5" description = "code generation meant to be consumed inside of `tauri` through `tauri-build` or `tauri-macros`" exclude = [ "CHANGELOG.md", "/target" ] readme = "README.md" @@ -20,7 +20,7 @@ quote = "1" syn = "2" serde = { version = "1", features = [ "derive" ] } serde_json = "1" -tauri-utils = { version = "2.0.0-rc.3", path = "../tauri-utils", features = [ "build" ] } +tauri-utils = { version = "2.0.0-rc.5", path = "../tauri-utils", features = [ "build" ] } thiserror = "1" walkdir = "2" brotli = { version = "6", optional = true, default-features = false, features = [ "std" ] } diff --git a/core/tauri-config-schema/schema.json b/core/tauri-config-schema/schema.json index 90c2831a36c0..dca49bf04be3 100644 --- a/core/tauri-config-schema/schema.json +++ b/core/tauri-config-schema/schema.json @@ -2033,10 +2033,14 @@ ] }, "signCommand": { - "description": "Specify a custom command to sign the binaries.\n This command needs to have a `%1` in it which is just a placeholder for the binary path,\n which we will detect and replace before calling the command.\n\n Example:\n ```text\n sign-cli --arg1 --arg2 %1\n ```\n\n By Default we use `signtool.exe` which can be found only on Windows so\n if you are on another platform and want to cross-compile and sign you will\n need to use another tool like `osslsigncode`.", - "type": [ - "string", - "null" + "description": "Specify a custom command to sign the binaries.\n This command needs to have a `%1` in args which is just a placeholder for the binary path,\n which we will detect and replace before calling the command.\n\n By Default we use `signtool.exe` which can be found only on Windows so\n if you are on another platform and want to cross-compile and sign you will\n need to use another tool like `osslsigncode`.", + "anyOf": [ + { + "$ref": "#/definitions/CustomSignCommandConfig" + }, + { + "type": "null" + } ] } }, @@ -2425,6 +2429,37 @@ } ] }, + "CustomSignCommandConfig": { + "description": "Custom Signing Command configuration.", + "anyOf": [ + { + "description": "A string notation of the script to execute.\n\n \"%1\" will be replaced with the path to the binary to be signed.\n\n This is a simpler notation for the command.\n Tauri will split the string with `' '` and use the first element as the command name and the rest as arguments.\n\n If you need to use whitespace in the command or arguments, use the object notation [`Self::ScriptWithOptions`].", + "type": "string" + }, + { + "description": "An object notation of the command.\n\n This is more complex notation for the command but\n this allows you to use whitespace in the command and arguments.", + "type": "object", + "required": [ + "args", + "cmd" + ], + "properties": { + "cmd": { + "description": "The command to run to sign the binary.", + "type": "string" + }, + "args": { + "description": "The arguments to pass to the command.\n\n \"%1\" will be replaced with the path to the binary to be signed.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + ] + }, "LinuxConfig": { "description": "Configuration for Linux bundles.\n\n See more: ", "type": "object", diff --git a/core/tauri-macros/CHANGELOG.md b/core/tauri-macros/CHANGELOG.md index 89d2ed7f5249..1afa25c4833e 100644 --- a/core/tauri-macros/CHANGELOG.md +++ b/core/tauri-macros/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## \[2.0.0-rc.5] + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-rc.5` +- Upgraded to `tauri-codegen@2.0.0-rc.5` + +## \[2.0.0-rc.4] + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-rc.4` +- Upgraded to `tauri-codegen@2.0.0-rc.4` + ## \[2.0.0-rc.3] ### Dependencies diff --git a/core/tauri-macros/Cargo.toml b/core/tauri-macros/Cargo.toml index 91de4b451bf3..a740f8ee10f0 100644 --- a/core/tauri-macros/Cargo.toml +++ b/core/tauri-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-macros" -version = "2.0.0-rc.3" +version = "2.0.0-rc.5" description = "Macros for the tauri crate." exclude = [ "CHANGELOG.md", "/target" ] readme = "README.md" @@ -20,8 +20,8 @@ proc-macro2 = { version = "1", features = [ "span-locations" ] } quote = "1" syn = { version = "2", features = [ "full" ] } heck = "0.5" -tauri-codegen = { version = "2.0.0-rc.3", default-features = false, path = "../tauri-codegen" } -tauri-utils = { version = "2.0.0-rc.3", path = "../tauri-utils" } +tauri-codegen = { version = "2.0.0-rc.5", default-features = false, path = "../tauri-codegen" } +tauri-utils = { version = "2.0.0-rc.5", path = "../tauri-utils" } [features] custom-protocol = [ ] diff --git a/core/tauri-plugin/CHANGELOG.md b/core/tauri-plugin/CHANGELOG.md index fc31bb0816c7..3170d6e92116 100644 --- a/core/tauri-plugin/CHANGELOG.md +++ b/core/tauri-plugin/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## \[2.0.0-rc.5] + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-rc.5` + +## \[2.0.0-rc.4] + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-rc.4` + ## \[2.0.0-rc.3] ### Dependencies diff --git a/core/tauri-plugin/Cargo.toml b/core/tauri-plugin/Cargo.toml index 89e5abd826da..ade251c0f3a0 100644 --- a/core/tauri-plugin/Cargo.toml +++ b/core/tauri-plugin/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin" -version = "2.0.0-rc.3" +version = "2.0.0-rc.5" description = "Build script and runtime Tauri plugin definitions" authors = { workspace = true } homepage = { workspace = true } @@ -30,7 +30,7 @@ runtime = [ ] [dependencies] anyhow = { version = "1", optional = true } serde = { version = "1", optional = true } -tauri-utils = { version = "2.0.0-rc.3", default-features = false, features = [ "build" ], path = "../tauri-utils" } +tauri-utils = { version = "2.0.0-rc.5", default-features = false, features = [ "build" ], path = "../tauri-utils" } serde_json = { version = "1", optional = true } glob = { version = "0.3", optional = true } toml = { version = "0.8", optional = true } diff --git a/core/tauri-runtime-wry/CHANGELOG.md b/core/tauri-runtime-wry/CHANGELOG.md index 29155e729bfe..7dab768233cc 100644 --- a/core/tauri-runtime-wry/CHANGELOG.md +++ b/core/tauri-runtime-wry/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## \[2.0.0-rc.5] + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-rc.5` +- Upgraded to `tauri-runtime@2.0.0-rc.5` + +## \[2.0.0-rc.4] + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-rc.4` +- Upgraded to `tauri-runtime@2.0.0-rc.4` + ## \[2.0.0-rc.3] ### Dependencies diff --git a/core/tauri-runtime-wry/Cargo.toml b/core/tauri-runtime-wry/Cargo.toml index d44c1ff7c8b5..335b02f4b431 100644 --- a/core/tauri-runtime-wry/Cargo.toml +++ b/core/tauri-runtime-wry/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-runtime-wry" -version = "2.0.0-rc.3" +version = "2.0.0-rc.5" description = "Wry bindings to the Tauri runtime" exclude = [ "CHANGELOG.md", "/target" ] readme = "README.md" @@ -19,8 +19,8 @@ rustdoc-args = [ "--cfg", "docsrs" ] [dependencies] wry = { version = "0.42", default-features = false, features = [ "drag-drop", "protocol", "os-webview" ] } tao = { version = "0.29", default-features = false, features = [ "rwh_06" ] } -tauri-runtime = { version = "2.0.0-rc.3", path = "../tauri-runtime" } -tauri-utils = { version = "2.0.0-rc.3", path = "../tauri-utils" } +tauri-runtime = { version = "2.0.0-rc.5", path = "../tauri-runtime" } +tauri-utils = { version = "2.0.0-rc.5", path = "../tauri-utils" } raw-window-handle = "0.6" http = "1.1" url = "2" diff --git a/core/tauri-runtime/CHANGELOG.md b/core/tauri-runtime/CHANGELOG.md index c6d2df6954c3..a764ebf97df7 100644 --- a/core/tauri-runtime/CHANGELOG.md +++ b/core/tauri-runtime/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## \[2.0.0-rc.5] + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-rc.5` + +## \[2.0.0-rc.4] + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-rc.4` + ## \[2.0.0-rc.3] ### Dependencies diff --git a/core/tauri-runtime/Cargo.toml b/core/tauri-runtime/Cargo.toml index 98a47392bce2..77c01840982c 100644 --- a/core/tauri-runtime/Cargo.toml +++ b/core/tauri-runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-runtime" -version = "2.0.0-rc.3" +version = "2.0.0-rc.5" description = "Runtime for Tauri applications" exclude = [ "CHANGELOG.md", "/target" ] readme = "README.md" @@ -29,7 +29,7 @@ targets = [ serde = { version = "1.0", features = [ "derive" ] } serde_json = "1.0" thiserror = "1.0" -tauri-utils = { version = "2.0.0-rc.3", path = "../tauri-utils" } +tauri-utils = { version = "2.0.0-rc.5", path = "../tauri-utils" } http = "1.1" raw-window-handle = "0.6" url = { version = "2" } diff --git a/core/tauri-utils/CHANGELOG.md b/core/tauri-utils/CHANGELOG.md index f1b68160b439..b1d16eee64db 100644 --- a/core/tauri-utils/CHANGELOG.md +++ b/core/tauri-utils/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## \[2.0.0-rc.5] + +### Bug Fixes + +- [`da381e07f`](https://www.github.com/tauri-apps/tauri/commit/da381e07f3770988fe6d0859a02331b87cc6723f) ([#10696](https://www.github.com/tauri-apps/tauri/pull/10696) by [@lucasfernog](https://www.github.com/tauri-apps/tauri/../../lucasfernog)) Implemented `resource_dir` on Android, which returns a URI that needs to be resolved using [AssetManager::open](https://developer.android.com/reference/android/content/res/AssetManager#open\(java.lang.String,%20int\)). This will be handled by the file system plugin. +- [`da381e07f`](https://www.github.com/tauri-apps/tauri/commit/da381e07f3770988fe6d0859a02331b87cc6723f) ([#10696](https://www.github.com/tauri-apps/tauri/pull/10696) by [@lucasfernog](https://www.github.com/tauri-apps/tauri/../../lucasfernog)) Fix `resource_dir` on iOS. + +## \[2.0.0-rc.4] + +### New Features + +- [`8d148a9e2`](https://www.github.com/tauri-apps/tauri/commit/8d148a9e2566edebfea2d75f32df7c9396d765a4) ([#10634](https://www.github.com/tauri-apps/tauri/pull/10634) by [@anatawa12](https://www.github.com/tauri-apps/tauri/../../anatawa12)) Custom sign command with object notation for whitespaces in the command path and arguments. + +### Bug Fixes + +- [`5c335ae9a`](https://www.github.com/tauri-apps/tauri/commit/5c335ae9ad88e46c2135a557390f6e808c9a6088) ([#10648](https://www.github.com/tauri-apps/tauri/pull/10648) by [@Flakebi](https://www.github.com/tauri-apps/tauri/../../Flakebi)) Prevent build script from rerunning unnecessarily by only writing files when the content changes. + ## \[2.0.0-rc.3] ### Enhancements diff --git a/core/tauri-utils/Cargo.toml b/core/tauri-utils/Cargo.toml index 32c8ce9c9563..bcfcf8a6742b 100644 --- a/core/tauri-utils/Cargo.toml +++ b/core/tauri-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-utils" -version = "2.0.0-rc.3" +version = "2.0.0-rc.5" description = "Utilities for Tauri" exclude = [ "CHANGELOG.md", "/target" ] readme = "README.md" diff --git a/core/tauri-utils/src/acl/build.rs b/core/tauri-utils/src/acl/build.rs index 7cadf044de0c..8c9956752dae 100644 --- a/core/tauri-utils/src/acl/build.rs +++ b/core/tauri-utils/src/acl/build.rs @@ -11,7 +11,7 @@ use std::{ path::{Path, PathBuf}, }; -use crate::acl::Error; +use crate::{acl::Error, write_if_changed}; use schemars::{ schema::{InstanceType, Metadata, RootSchema, Schema, SchemaObject, SubschemaValidation}, schema_for, @@ -450,7 +450,8 @@ commands.deny = ["{command}"] ); let out_path = path.join(format!("{command}.toml")); - write_if_changed(&toml, &out_path); + write_if_changed(&out_path, toml) + .unwrap_or_else(|_| panic!("unable to autogenerate {out_path:?}")); autogenerated .allowed @@ -462,9 +463,3 @@ commands.deny = ["{command}"] autogenerated } - -fn write_if_changed(content: &str, path: &Path) { - if content != read_to_string(path).unwrap_or_default() { - std::fs::write(path, content).unwrap_or_else(|_| panic!("unable to autogenerate {path:?}")); - } -} diff --git a/core/tauri-utils/src/config.rs b/core/tauri-utils/src/config.rs index 2089da339432..174990e5b8be 100644 --- a/core/tauri-utils/src/config.rs +++ b/core/tauri-utils/src/config.rs @@ -891,6 +891,34 @@ impl Default for WebviewInstallMode { } } +/// Custom Signing Command configuration. +#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] +#[cfg_attr(feature = "schema", derive(JsonSchema))] +#[serde(rename_all = "camelCase", deny_unknown_fields, untagged)] +pub enum CustomSignCommandConfig { + /// A string notation of the script to execute. + /// + /// "%1" will be replaced with the path to the binary to be signed. + /// + /// This is a simpler notation for the command. + /// Tauri will split the string with `' '` and use the first element as the command name and the rest as arguments. + /// + /// If you need to use whitespace in the command or arguments, use the object notation [`Self::ScriptWithOptions`]. + Command(String), + /// An object notation of the command. + /// + /// This is more complex notation for the command but + /// this allows you to use whitespace in the command and arguments. + CommandWithOptions { + /// The command to run to sign the binary. + cmd: String, + /// The arguments to pass to the command. + /// + /// "%1" will be replaced with the path to the binary to be signed. + args: Vec, + }, +} + /// Windows bundler configuration. /// /// See more: @@ -935,19 +963,14 @@ pub struct WindowsConfig { /// Configuration for the installer generated with NSIS. pub nsis: Option, /// Specify a custom command to sign the binaries. - /// This command needs to have a `%1` in it which is just a placeholder for the binary path, + /// This command needs to have a `%1` in args which is just a placeholder for the binary path, /// which we will detect and replace before calling the command. /// - /// Example: - /// ```text - /// sign-cli --arg1 --arg2 %1 - /// ``` - /// /// By Default we use `signtool.exe` which can be found only on Windows so /// if you are on another platform and want to cross-compile and sign you will /// need to use another tool like `osslsigncode`. #[serde(alias = "sign-command")] - pub sign_command: Option, + pub sign_command: Option, } impl Default for WindowsConfig { diff --git a/core/tauri-utils/src/platform.rs b/core/tauri-utils/src/platform.rs index 5b0040264b9d..81df60b9c129 100644 --- a/core/tauri-utils/src/platform.rs +++ b/core/tauri-utils/src/platform.rs @@ -15,6 +15,9 @@ use crate::{Env, PackageInfo}; mod starting_binary; +#[cfg(target_os = "android")] +pub const ANDROID_ASSET_PROTOCOL_URI_PREFIX: &str = "asset://localhost/"; + /// Platform target. #[derive(PartialEq, Eq, Copy, Debug, Clone, Serialize, Deserialize)] #[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] @@ -256,7 +259,13 @@ fn is_cargo_output_directory(path: &Path) -> bool { /// `${exe_dir}/../lib/${exe_name}`. /// /// On MacOS, it's `${exe_dir}../Resources` (inside .app). +/// +/// On iOS, it's `${exe_dir}/assets`. +/// +/// Android uses a special URI prefix that is resolved by the Tauri file system plugin `asset://localhost/` pub fn resource_dir(package_info: &PackageInfo, env: &Env) -> crate::Result { + #[cfg(target_os = "android")] + return Ok(PathBuf::from(ANDROID_ASSET_PROTOCOL_URI_PREFIX)); let exe = current_exe()?; resource_dir_from(exe, package_info, env) } @@ -320,6 +329,11 @@ fn resource_dir_from>( .map_err(Into::into); } + #[cfg(target_os = "ios")] + { + res = exe_dir.join("assets").canonicalize().map_err(Into::into); + } + res } diff --git a/core/tauri/CHANGELOG.md b/core/tauri/CHANGELOG.md index a39d94fef2ee..eed2f60ec4ef 100644 --- a/core/tauri/CHANGELOG.md +++ b/core/tauri/CHANGELOG.md @@ -1,5 +1,34 @@ # Changelog +## \[2.0.0-rc.5] + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-rc.5` +- Upgraded to `tauri-runtime@2.0.0-rc.5` +- Upgraded to `tauri-runtime-wry@2.0.0-rc.5` +- Upgraded to `tauri-macros@2.0.0-rc.5` +- Upgraded to `tauri-build@2.0.0-rc.5` + +## \[2.0.0-rc.4] + +### Enhancements + +- [`30c7685eb`](https://www.github.com/tauri-apps/tauri/commit/30c7685eb82c7a1a9af53abdca7d75b1a886cc6e) ([#10295](https://www.github.com/tauri-apps/tauri/pull/10295) by [@liesauer](https://www.github.com/tauri-apps/tauri/../../liesauer)) Added `Builder::append_invoke_initialization_script`. +- [`ed04cc3d3`](https://www.github.com/tauri-apps/tauri/commit/ed04cc3d36205b277517d052dfd997b6c3cb673d) ([#10664](https://www.github.com/tauri-apps/tauri/pull/10664) by [@lucasfernog](https://www.github.com/tauri-apps/tauri/../../lucasfernog)) Include more information in the IPC permission error message. + +### Bug Fixes + +- [`5c335ae9a`](https://www.github.com/tauri-apps/tauri/commit/5c335ae9ad88e46c2135a557390f6e808c9a6088) ([#10648](https://www.github.com/tauri-apps/tauri/pull/10648) by [@Flakebi](https://www.github.com/tauri-apps/tauri/../../Flakebi)) Prevent build script from rerunning unnecessarily by only writing files when the content changes. + +### Dependencies + +- Upgraded to `tauri-build@2.0.0-rc.4` +- Upgraded to `tauri-utils@2.0.0-rc.4` +- Upgraded to `tauri-runtime@2.0.0-rc.4` +- Upgraded to `tauri-runtime-wry@2.0.0-rc.4` +- Upgraded to `tauri-macros@2.0.0-rc.4` + ## \[2.0.0-rc.3] ### Bug Fixes diff --git a/core/tauri/Cargo.toml b/core/tauri/Cargo.toml index d85db74e1ee5..93537d8a54d1 100644 --- a/core/tauri/Cargo.toml +++ b/core/tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri" -version = "2.0.0-rc.3" +version = "2.0.0-rc.5" description = "Make tiny, secure apps for all desktop platforms with Tauri" exclude = [ "/test", "/.scripts", "CHANGELOG.md", "/target" ] readme = "README.md" @@ -51,10 +51,10 @@ uuid = { version = "1", features = [ "v4" ], optional = true } url = "2" anyhow = "1.0" thiserror = "1.0" -tauri-runtime = { version = "2.0.0-rc.3", path = "../tauri-runtime" } -tauri-macros = { version = "2.0.0-rc.3", path = "../tauri-macros" } -tauri-utils = { version = "2.0.0-rc.3", features = [ "resources" ], path = "../tauri-utils" } -tauri-runtime-wry = { version = "2.0.0-rc.3", path = "../tauri-runtime-wry", optional = true } +tauri-runtime = { version = "2.0.0-rc.5", path = "../tauri-runtime" } +tauri-macros = { version = "2.0.0-rc.5", path = "../tauri-macros" } +tauri-utils = { version = "2.0.0-rc.5", features = [ "resources" ], path = "../tauri-utils" } +tauri-runtime-wry = { version = "2.0.0-rc.5", path = "../tauri-runtime-wry", optional = true } getrandom = "0.2" serde_repr = "0.1" state = "0.6" @@ -110,8 +110,8 @@ swift-rs = "1.0.6" [build-dependencies] heck = "0.5" -tauri-build = { path = "../tauri-build/", default-features = false, version = "2.0.0-rc.3" } -tauri-utils = { path = "../tauri-utils/", version = "2.0.0-rc.3", features = [ "build" ] } +tauri-build = { path = "../tauri-build/", default-features = false, version = "2.0.0-rc.5" } +tauri-utils = { path = "../tauri-utils/", version = "2.0.0-rc.5", features = [ "build" ] } [dev-dependencies] proptest = "1.4.0" diff --git a/core/tauri/build.rs b/core/tauri/build.rs index 4c4230c1adfc..9c4c6d3f8d38 100644 --- a/core/tauri/build.rs +++ b/core/tauri/build.rs @@ -3,12 +3,12 @@ // SPDX-License-Identifier: MIT use heck::AsShoutySnakeCase; +use tauri_utils::write_if_changed; use std::env::var_os; use std::fs::create_dir_all; use std::fs::read_dir; use std::fs::read_to_string; -use std::fs::write; use std::{ env::var, path::{Path, PathBuf}, @@ -290,7 +290,9 @@ fn main() { .replace("{{library}}", &library); let out_path = kotlin_out_dir.join(file.file_name()); - write(&out_path, content).expect("Failed to write kotlin file"); + // Overwrite only if changed to not trigger rebuilds + write_if_changed(&out_path, &content).expect("Failed to write kotlin file"); + println!("cargo:rerun-if-changed={}", out_path.display()); } } diff --git a/core/tauri/mobile/android/src/main/java/app/tauri/PathPlugin.kt b/core/tauri/mobile/android/src/main/java/app/tauri/PathPlugin.kt index e33a9597e771..ec72d008ad0e 100644 --- a/core/tauri/mobile/android/src/main/java/app/tauri/PathPlugin.kt +++ b/core/tauri/mobile/android/src/main/java/app/tauri/PathPlugin.kt @@ -12,6 +12,8 @@ import app.tauri.plugin.Plugin import app.tauri.plugin.Invoke import app.tauri.plugin.JSObject +const val TAURI_ASSETS_DIRECTORY_URI = "asset://localhost/" + @TauriPlugin class PathPlugin(private val activity: Activity): Plugin(activity) { private fun resolvePath(invoke: Invoke, path: String?) { @@ -67,8 +69,7 @@ class PathPlugin(private val activity: Activity): Plugin(activity) { @Command fun getResourcesDir(invoke: Invoke) { - // TODO - resolvePath(invoke, activity.cacheDir.absolutePath) + resolvePath(invoke, TAURI_ASSETS_DIRECTORY_URI) } @Command diff --git a/core/tauri/src/app.rs b/core/tauri/src/app.rs index ba800cf5563c..a5900a05ff06 100644 --- a/core/tauri/src/app.rs +++ b/core/tauri/src/app.rs @@ -1328,6 +1328,53 @@ impl Builder { self } + /// Append a custom initialization script. + /// + /// Allow to append custom initialization script instend of replacing entire invoke system. + /// + /// # Examples + /// + /// ``` + /// let custom_script = r#" + /// // A custom call system bridge build on top of tauri invoke system. + /// async function invoke(cmd, args = {}) { + /// if (!args) args = {}; + /// + /// let prefix = ""; + /// + /// if (args?.__module) { + /// prefix = `plugin:hybridcall.${args.__module}|`; + /// } + /// + /// const command = `${prefix}tauri_${cmd}`; + /// + /// const invoke = window.__TAURI_INTERNALS__.invoke; + /// + /// return invoke(command, args).then(result => { + /// if (window.build.debug) { + /// console.log(`call: ${command}`); + /// console.log(`args: ${JSON.stringify(args)}`); + /// console.log(`return: ${JSON.stringify(result)}`); + /// } + /// + /// return result; + /// }); + /// } + /// "#; + /// + /// tauri::Builder::default() + /// .append_invoke_initialization_script(custom_script); + /// ``` + pub fn append_invoke_initialization_script( + mut self, + initialization_script: impl AsRef, + ) -> Self { + self + .invoke_initialization_script + .push_str(initialization_script.as_ref()); + self + } + /// Defines the setup hook. /// /// # Examples diff --git a/core/tauri/src/ipc/authority.rs b/core/tauri/src/ipc/authority.rs index ca528caf60e8..a15cfb017d9c 100644 --- a/core/tauri/src/ipc/authority.rs +++ b/core/tauri/src/ipc/authority.rs @@ -343,7 +343,7 @@ impl RuntimeAuthority { webview: &str, origin: &Origin, ) -> String { - fn print_references(resolved: Vec<&ResolvedCommand>) -> String { + fn print_references(resolved: &[ResolvedCommand]) -> String { resolved .iter() .map(|r| { @@ -356,6 +356,53 @@ impl RuntimeAuthority { .join(" || ") } + fn print_allowed_on(resolved: &[ResolvedCommand]) -> String { + if resolved.is_empty() { + "command not allowed on any window/webview/URL context".to_string() + } else { + let mut s = "allowed on: ".to_string(); + + let last_index = resolved.len() - 1; + for (index, cmd) in resolved.iter().enumerate() { + let windows = cmd + .windows + .iter() + .map(|w| format!("\"{}\"", w.as_str())) + .collect::>() + .join(", "); + let webviews = cmd + .webviews + .iter() + .map(|w| format!("\"{}\"", w.as_str())) + .collect::>() + .join(", "); + + s.push('['); + + if !windows.is_empty() { + s.push_str(&format!("windows: {windows}, ")); + } + + if !webviews.is_empty() { + s.push_str(&format!("webviews: {webviews}, ")); + } + + match &cmd.context { + ExecutionContext::Local => s.push_str("URL: local"), + ExecutionContext::Remote { url } => s.push_str(&format!("URL: {}", url.as_str())), + } + + s.push(']'); + + if index != last_index { + s.push_str(", "); + } + } + + s + } + } + fn has_permissions_allowing_command( manifest: &crate::utils::acl::manifest::Manifest, set: &crate::utils::acl::PermissionSet, @@ -393,35 +440,34 @@ impl RuntimeAuthority { format!("{key}.{command_name}") }; - if let Some(resolved) = self.denied_commands.get(&command).map(|r| { - r.iter() - .filter(|cmd| origin.matches(&cmd.context)) - .collect() - }) { + if let Some(resolved) = self.denied_commands.get(&command) { format!( - "{command_pretty_name} denied on origin {origin}, referenced by: {}", + "{command_pretty_name} explicitly denied on origin {origin}\n\nreferenced by: {}", print_references(resolved) ) } else { let command_matches = self.allowed_commands.get(&command); - if let Some(resolved) = self.allowed_commands.get(&command).map(|r| { - r.iter() + if let Some(resolved) = self.allowed_commands.get(&command) { + let resolved_matching_origin = resolved + .iter() .filter(|cmd| origin.matches(&cmd.context)) - .collect::>() - }) { - if resolved + .collect::>(); + if resolved_matching_origin .iter() .any(|cmd| cmd.webviews.iter().any(|w| w.matches(webview))) - || resolved + || resolved_matching_origin .iter() .any(|cmd| cmd.windows.iter().any(|w| w.matches(window))) { "allowed".to_string() } else { - format!("{command_pretty_name} not allowed on window {window}, webview {webview}, allowed windows: {}, allowed webviews: {}, referenced by {}", - resolved.iter().flat_map(|cmd| cmd.windows.iter().map(|w| w.as_str())).collect::>().join(", "), - resolved.iter().flat_map(|cmd| cmd.webviews.iter().map(|w| w.as_str())).collect::>().join(", "), + format!("{command_pretty_name} not allowed on window \"{window}\", webview \"{webview}\", URL: {}\n\n{}\n\nreferenced by: {}", + match origin { + Origin::Local => "local", + Origin::Remote { url } => url.as_str() + }, + print_allowed_on(resolved), print_references(resolved) ) } @@ -451,20 +497,25 @@ impl RuntimeAuthority { permissions_referencing_command.sort(); - format!( - "Permissions associated with this command: {}", - permissions_referencing_command - .iter() - .map(|p| if key == APP_ACL_KEY { + let associated_permissions = permissions_referencing_command + .iter() + .map(|p| { + if key == APP_ACL_KEY { p.to_string() } else { format!("{key}:{p}") - }) - .collect::>() - .join(", ") - ) + } + }) + .collect::>() + .join(", "); + + if associated_permissions.is_empty() { + "Command not found".to_string() + } else { + format!("Permissions associated with this command: {associated_permissions}") + } } else { - "Plugin did not define its manifest".to_string() + "Plugin not found".to_string() }; if let Some(resolved_cmds) = command_matches { @@ -985,4 +1036,153 @@ mod tests { .resolve_access(command, window, webview, &Origin::Local) .is_none()); } + + #[cfg(debug_assertions)] + #[test] + fn resolve_access_message() { + use tauri_utils::acl::manifest::Manifest; + + let plugin_name = "myplugin"; + let command_allowed_on_window = "my-command-window"; + let command_allowed_on_webview_window = "my-command-webview-window"; + let window = "main-*"; + let webview = "webview-*"; + let remote_url = "http://localhost:8080"; + + let referenced_by = tauri_utils::acl::resolved::ResolvedCommandReference { + capability: "maincap".to_string(), + permission: "allow-command".to_string(), + }; + + let resolved_window_cmd = ResolvedCommand { + windows: vec![Pattern::new(window).unwrap()], + referenced_by: referenced_by.clone(), + ..Default::default() + }; + let resolved_webview_window_cmd = ResolvedCommand { + windows: vec![Pattern::new(window).unwrap()], + webviews: vec![Pattern::new(webview).unwrap()], + referenced_by: referenced_by.clone(), + ..Default::default() + }; + let resolved_webview_window_remote_cmd = ResolvedCommand { + windows: vec![Pattern::new(window).unwrap()], + webviews: vec![Pattern::new(webview).unwrap()], + referenced_by: referenced_by.clone(), + context: ExecutionContext::Remote { + url: remote_url.parse().unwrap(), + }, + ..Default::default() + }; + + let allowed_commands = [ + ( + format!("plugin:{plugin_name}|{command_allowed_on_window}"), + vec![resolved_window_cmd], + ), + ( + format!("plugin:{plugin_name}|{command_allowed_on_webview_window}"), + vec![ + resolved_webview_window_cmd, + resolved_webview_window_remote_cmd, + ], + ), + ] + .into_iter() + .collect(); + + let authority = RuntimeAuthority::new( + [( + plugin_name.to_string(), + Manifest { + default_permission: None, + permissions: Default::default(), + permission_sets: Default::default(), + global_scope_schema: None, + }, + )] + .into_iter() + .collect(), + Resolved { + allowed_commands, + ..Default::default() + }, + ); + + // unknown plugin + assert_eq!( + authority.resolve_access_message( + "unknown-plugin", + command_allowed_on_window, + window, + webview, + &Origin::Local + ), + "unknown-plugin.my-command-window not allowed. Plugin not found" + ); + + // unknown command + assert_eq!( + authority.resolve_access_message( + plugin_name, + "unknown-command", + window, + webview, + &Origin::Local + ), + "myplugin.unknown-command not allowed. Command not found" + ); + + // window/webview do not match + assert_eq!( + authority.resolve_access_message( + plugin_name, + command_allowed_on_window, + "other-window", + "any-webview", + &Origin::Local + ), + "myplugin.my-command-window not allowed on window \"other-window\", webview \"any-webview\", URL: local\n\nallowed on: [windows: \"main-*\", URL: local]\n\nreferenced by: capability: maincap, permission: allow-command" + ); + + // window matches, but not origin + assert_eq!( + authority.resolve_access_message( + plugin_name, + command_allowed_on_window, + window, + "any-webview", + &Origin::Remote { + url: "http://localhst".parse().unwrap() + } + ), + "myplugin.my-command-window not allowed on window \"main-*\", webview \"any-webview\", URL: http://localhst/\n\nallowed on: [windows: \"main-*\", URL: local]\n\nreferenced by: capability: maincap, permission: allow-command" + ); + + // window/webview do not match + assert_eq!( + authority.resolve_access_message( + plugin_name, + command_allowed_on_webview_window, + "other-window", + "other-webview", + &Origin::Local + ), + "myplugin.my-command-webview-window not allowed on window \"other-window\", webview \"other-webview\", URL: local\n\nallowed on: [windows: \"main-*\", webviews: \"webview-*\", URL: local], [windows: \"main-*\", webviews: \"webview-*\", URL: http://localhost:8080]\n\nreferenced by: capability: maincap, permission: allow-command || capability: maincap, permission: allow-command" + ); + + // window/webview matches, but not origin + assert_eq!( + authority.resolve_access_message( + plugin_name, + command_allowed_on_webview_window, + window, + webview, + &Origin::Remote { + url: "http://localhost:123".parse().unwrap() + } + ), + "myplugin.my-command-webview-window not allowed on window \"main-*\", webview \"webview-*\", URL: http://localhost:123/\n\nallowed on: [windows: \"main-*\", webviews: \"webview-*\", URL: local], [windows: \"main-*\", webviews: \"webview-*\", URL: http://localhost:8080]\n\nreferenced by: capability: maincap, permission: allow-command || capability: maincap, permission: allow-command" + ); + } } diff --git a/examples/api/src-tauri/Cargo.lock b/examples/api/src-tauri/Cargo.lock index 8590b7440128..8273f8e9879f 100644 --- a/examples/api/src-tauri/Cargo.lock +++ b/examples/api/src-tauri/Cargo.lock @@ -3221,7 +3221,7 @@ checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" [[package]] name = "tauri" -version = "2.0.0-rc.3" +version = "2.0.0-rc.4" dependencies = [ "anyhow", "bytes", @@ -3271,7 +3271,7 @@ dependencies = [ [[package]] name = "tauri-build" -version = "2.0.0-rc.3" +version = "2.0.0-rc.4" dependencies = [ "anyhow", "cargo_toml", @@ -3293,7 +3293,7 @@ dependencies = [ [[package]] name = "tauri-codegen" -version = "2.0.0-rc.3" +version = "2.0.0-rc.4" dependencies = [ "base64 0.22.1", "brotli", @@ -3318,7 +3318,7 @@ dependencies = [ [[package]] name = "tauri-macros" -version = "2.0.0-rc.3" +version = "2.0.0-rc.4" dependencies = [ "heck 0.5.0", "proc-macro2", @@ -3330,7 +3330,7 @@ dependencies = [ [[package]] name = "tauri-plugin" -version = "2.0.0-rc.3" +version = "2.0.0-rc.4" dependencies = [ "anyhow", "glob", @@ -3356,7 +3356,7 @@ dependencies = [ [[package]] name = "tauri-runtime" -version = "2.0.0-rc.3" +version = "2.0.0-rc.4" dependencies = [ "dpi", "gtk", @@ -3373,7 +3373,7 @@ dependencies = [ [[package]] name = "tauri-runtime-wry" -version = "2.0.0-rc.3" +version = "2.0.0-rc.4" dependencies = [ "cocoa 0.26.0", "gtk", @@ -3395,7 +3395,7 @@ dependencies = [ [[package]] name = "tauri-utils" -version = "2.0.0-rc.3" +version = "2.0.0-rc.4" dependencies = [ "aes-gcm", "brotli", diff --git a/examples/api/src-tauri/tauri-plugin-sample/ios/Package.swift b/examples/api/src-tauri/tauri-plugin-sample/ios/Package.swift index d0aa2fbfab7d..db42f770c06e 100644 --- a/examples/api/src-tauri/tauri-plugin-sample/ios/Package.swift +++ b/examples/api/src-tauri/tauri-plugin-sample/ios/Package.swift @@ -8,6 +8,7 @@ import PackageDescription let package = Package( name: "tauri-plugin-sample", platforms: [ + .macOS(.v10_13), .iOS(.v13), ], products: [ diff --git a/tooling/api/CHANGELOG.md b/tooling/api/CHANGELOG.md index 6ede72954899..fd6522d94d19 100644 --- a/tooling/api/CHANGELOG.md +++ b/tooling/api/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## \[2.0.0-rc.2] + +### Bug Fixes + +- [`c689521a7`](https://www.github.com/tauri-apps/tauri/commit/c689521a7674b6562b5dfd4f5cacd12138d99d85) ([#10681](https://www.github.com/tauri-apps/tauri/pull/10681) by [@lucasfernog](https://www.github.com/tauri-apps/tauri/../../lucasfernog)) Fix tslib path in dist. + ## \[2.0.0-rc.1] ### Breaking Changes diff --git a/tooling/api/package.json b/tooling/api/package.json index d8ac87d656e5..baea3cc1fefa 100644 --- a/tooling/api/package.json +++ b/tooling/api/package.json @@ -1,6 +1,6 @@ { "name": "@tauri-apps/api", - "version": "2.0.0-rc.1", + "version": "2.0.0-rc.2", "description": "Tauri API definitions", "funding": { "type": "opencollective", diff --git a/tooling/api/rollup.config.ts b/tooling/api/rollup.config.ts index 4af733784beb..4463b924cdc7 100644 --- a/tooling/api/rollup.config.ts +++ b/tooling/api/rollup.config.ts @@ -6,7 +6,7 @@ import { defineConfig, Plugin, RollupLog } from 'rollup' import typescript from '@rollup/plugin-typescript' import terser from '@rollup/plugin-terser' import fg from 'fast-glob' -import { basename, join } from 'path' +import { basename, dirname, join } from 'path' import { copyFileSync, opendirSync, rmSync, Dir } from 'fs' import { fileURLToPath } from 'url' @@ -27,7 +27,7 @@ export default defineConfig([ preserveModulesRoot: 'src', entryFileNames: (chunkInfo) => { if (chunkInfo.name.includes('node_modules')) { - return chunkInfo.name.replace('node_modules', 'external') + '.js' + return externalLibPath(chunkInfo.name) + '.js' } return '[name].js' @@ -40,7 +40,7 @@ export default defineConfig([ preserveModulesRoot: 'src', entryFileNames: (chunkInfo) => { if (chunkInfo.name.includes('node_modules')) { - return chunkInfo.name.replace('node_modules', 'external') + '.cjs' + return externalLibPath(chunkInfo.name) + '.cjs' } return '[name].cjs' @@ -71,6 +71,10 @@ export default defineConfig([ } ]) +function externalLibPath(path: string) { + return `external/${basename(dirname(path))}/${basename(path)}` +} + function onwarn(warning: RollupLog) { // deny warnings by default throw Object.assign(new Error(), warning) diff --git a/tooling/bundler/CHANGELOG.md b/tooling/bundler/CHANGELOG.md index 73d43d953118..b428f962a1ef 100644 --- a/tooling/bundler/CHANGELOG.md +++ b/tooling/bundler/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## \[2.0.1-rc.4] + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-rc.5` + +## \[2.0.1-rc.3] + +### New Features + +- [`8d148a9e2`](https://www.github.com/tauri-apps/tauri/commit/8d148a9e2566edebfea2d75f32df7c9396d765a4) ([#10634](https://www.github.com/tauri-apps/tauri/pull/10634) by [@anatawa12](https://www.github.com/tauri-apps/tauri/../../anatawa12)) Custom sign command with object notation for whitespaces in the command path and arguments. + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-rc.4` + ## \[2.0.1-rc.2] ### New Features diff --git a/tooling/bundler/Cargo.toml b/tooling/bundler/Cargo.toml index 130e1201e727..e1a23d38f7ef 100644 --- a/tooling/bundler/Cargo.toml +++ b/tooling/bundler/Cargo.toml @@ -2,7 +2,7 @@ workspace = { } [package] name = "tauri-bundler" -version = "2.0.1-rc.2" +version = "2.0.1-rc.4" authors = [ "George Burton ", "Tauri Programme within The Commons Conservancy" @@ -17,7 +17,7 @@ rust-version = "1.70" exclude = [ "CHANGELOG.md", "/target", "rustfmt.toml" ] [dependencies] -tauri-utils = { version = "2.0.0-rc.3", path = "../../core/tauri-utils", features = [ "resources" ] } +tauri-utils = { version = "2.0.0-rc.5", path = "../../core/tauri-utils", features = [ "resources" ] } image = "0.25.0" flate2 = "1.0" anyhow = "1.0" diff --git a/tooling/bundler/src/bundle.rs b/tooling/bundler/src/bundle.rs index eb222295eac0..17100cb9cdfd 100644 --- a/tooling/bundler/src/bundle.rs +++ b/tooling/bundler/src/bundle.rs @@ -20,9 +20,9 @@ use tauri_utils::display_path; pub use self::{ category::AppCategory, settings::{ - AppImageSettings, BundleBinary, BundleSettings, DebianSettings, DmgSettings, MacOsSettings, - PackageSettings, PackageType, Position, RpmSettings, Settings, SettingsBuilder, Size, - UpdaterSettings, + AppImageSettings, BundleBinary, BundleSettings, CustomSignCommandSettings, DebianSettings, + DmgSettings, MacOsSettings, PackageSettings, PackageType, Position, RpmSettings, Settings, + SettingsBuilder, Size, UpdaterSettings, }, }; #[cfg(target_os = "macos")] diff --git a/tooling/bundler/src/bundle/settings.rs b/tooling/bundler/src/bundle/settings.rs index 0f910a1ea875..da7538b7eb27 100644 --- a/tooling/bundler/src/bundle/settings.rs +++ b/tooling/bundler/src/bundle/settings.rs @@ -459,6 +459,17 @@ pub struct NsisSettings { pub installer_hooks: Option, } +/// The Custom Signing Command Settings for Windows exe +#[derive(Clone, Debug)] +pub struct CustomSignCommandSettings { + /// The command to run to sign the binary. + pub cmd: String, + /// The arguments to pass to the command. + /// + /// "%1" will be replaced with the path to the binary to be signed. + pub args: Vec, +} + /// The Windows bundle settings. #[derive(Clone, Debug)] pub struct WindowsSettings { @@ -504,7 +515,7 @@ pub struct WindowsSettings { /// By Default we use `signtool.exe` which can be found only on Windows so /// if you are on another platform and want to cross-compile and sign you will /// need to use another tool like `osslsigncode`. - pub sign_command: Option, + pub sign_command: Option, } impl Default for WindowsSettings { diff --git a/tooling/bundler/src/bundle/windows/sign.rs b/tooling/bundler/src/bundle/windows/sign.rs index 7ce21406128a..229c40f8c0b7 100644 --- a/tooling/bundler/src/bundle/windows/sign.rs +++ b/tooling/bundler/src/bundle/windows/sign.rs @@ -3,10 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT +use crate::bundle::settings::CustomSignCommandSettings; #[cfg(windows)] use crate::bundle::windows::util; use crate::{bundle::common::CommandExt, Settings}; -use anyhow::Context; #[cfg(windows)] use std::path::PathBuf; #[cfg(windows)] @@ -50,7 +50,7 @@ pub struct SignParams { pub certificate_thumbprint: String, pub timestamp_url: Option, pub tsp: bool, - pub sign_command: Option, + pub sign_command: Option, } #[cfg(windows)] @@ -136,16 +136,14 @@ pub fn verify(path: &Path) -> crate::Result { Ok(cmd.status()?.success()) } -pub fn sign_command_custom>(path: P, command: &str) -> crate::Result { +pub fn sign_command_custom>( + path: P, + command: &CustomSignCommandSettings, +) -> crate::Result { let path = path.as_ref(); - let mut args = command.trim().split(' '); - let bin = args - .next() - .context("custom signing command doesn't contain a bin?")?; - - let mut cmd = Command::new(bin); - for arg in args { + let mut cmd = Command::new(&command.cmd); + for arg in &command.args { if arg == "%1" { cmd.arg(path); } else { @@ -194,7 +192,10 @@ pub fn sign_command>(path: P, params: &SignParams) -> crate::Resu } } -pub fn sign_custom>(path: P, custom_command: &str) -> crate::Result<()> { +pub fn sign_custom>( + path: P, + custom_command: &CustomSignCommandSettings, +) -> crate::Result<()> { let path = path.as_ref(); log::info!(action = "Signing";"{} with a custom signing command", tauri_utils::display_path(path)); diff --git a/tooling/cli/CHANGELOG.md b/tooling/cli/CHANGELOG.md index 192133e35169..084e0d64962c 100644 --- a/tooling/cli/CHANGELOG.md +++ b/tooling/cli/CHANGELOG.md @@ -1,5 +1,38 @@ # Changelog +## \[2.0.0-rc.6] + +### New Features + +- [`da381e07f`](https://www.github.com/tauri-apps/tauri/commit/da381e07f3770988fe6d0859a02331b87cc6723f) ([#10696](https://www.github.com/tauri-apps/tauri/pull/10696) by [@lucasfernog](https://www.github.com/tauri-apps/tauri/../../lucasfernog)) Inject configured resources on mobile apps. + +### Bug Fixes + +- [`1a60822a4`](https://www.github.com/tauri-apps/tauri/commit/1a60822a4220b6dbb1ad7295a2e37d6c3004edad) ([#10699](https://www.github.com/tauri-apps/tauri/pull/10699) by [@lucasfernog](https://www.github.com/tauri-apps/tauri/../../lucasfernog)) Changed the `add` command to use a version requirement that matches the CLI's stable and prerelease numbers. + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-rc.5` +- Upgraded to `tauri-bundler@2.0.1-rc.4` + +## \[2.0.0-rc.5] + +### New Features + +- [`8d148a9e2`](https://www.github.com/tauri-apps/tauri/commit/8d148a9e2566edebfea2d75f32df7c9396d765a4) ([#10634](https://www.github.com/tauri-apps/tauri/pull/10634) by [@anatawa12](https://www.github.com/tauri-apps/tauri/../../anatawa12)) Custom sign command with object notation for whitespaces in the command path and arguments. + +### Bug Fixes + +- [`8ae52a615`](https://www.github.com/tauri-apps/tauri/commit/8ae52a615a11d934930001da63ce6ac8442c7efc) ([#10676](https://www.github.com/tauri-apps/tauri/pull/10676) by [@rdlabo](https://www.github.com/tauri-apps/tauri/../../rdlabo)) Change plugin template call to `register_ios_plugin` params to snake case +- [`7796a8fc6`](https://www.github.com/tauri-apps/tauri/commit/7796a8fc649cd7397a67048c71f8d1fbf822122a) ([#10687](https://www.github.com/tauri-apps/tauri/pull/10687) by [@lucasfernog](https://www.github.com/tauri-apps/tauri/../../lucasfernog)) Fix Swift plugin compilation on older versions. +- [`9b99ebab1`](https://www.github.com/tauri-apps/tauri/commit/9b99ebab17d6a043d82a7aeecfb76c56a995c287) ([#10431](https://www.github.com/tauri-apps/tauri/pull/10431) by [@mrguiman](https://www.github.com/tauri-apps/tauri/../../mrguiman)) Do not include the target arch when building and archiving the iOS application, + which makes Xcode project modifications more flexible. + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-rc.4` +- Upgraded to `tauri-bundler@2.0.1-rc.3` + ## \[2.0.0-rc.4] ### New Features diff --git a/tooling/cli/Cargo.lock b/tooling/cli/Cargo.lock index 9f033f28123b..8748a72901ee 100644 --- a/tooling/cli/Cargo.lock +++ b/tooling/cli/Cargo.lock @@ -557,9 +557,9 @@ dependencies = [ [[package]] name = "cargo-mobile2" -version = "0.13.2" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebaedf7b7e292b7f41f892f5c96ee15544e21814e89d0b6b8dc06740a69dabe5" +checksum = "6b933d7440e2fd78462ae586f959883710837c6145ddcd501e8adcf4cb57b2cb" dependencies = [ "colored", "core-foundation", @@ -5339,7 +5339,7 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tauri-bundler" -version = "2.0.1-rc.2" +version = "2.0.1-rc.4" dependencies = [ "anyhow", "ar", @@ -5368,7 +5368,7 @@ dependencies = [ "tar", "tauri-icns", "tauri-macos-sign", - "tauri-utils 2.0.0-rc.3", + "tauri-utils 2.0.0-rc.5", "tempfile", "thiserror", "time", @@ -5382,7 +5382,7 @@ dependencies = [ [[package]] name = "tauri-cli" -version = "2.0.0-rc.4" +version = "2.0.0-rc.6" dependencies = [ "anyhow", "axum", @@ -5442,7 +5442,7 @@ dependencies = [ "tauri-icns", "tauri-macos-sign", "tauri-utils 1.5.4", - "tauri-utils 2.0.0-rc.3", + "tauri-utils 2.0.0-rc.5", "tokio", "toml 0.8.10", "toml_edit 0.22.6", @@ -5523,7 +5523,7 @@ dependencies = [ [[package]] name = "tauri-utils" -version = "2.0.0-rc.3" +version = "2.0.0-rc.5" dependencies = [ "aes-gcm", "ctor", diff --git a/tooling/cli/Cargo.toml b/tooling/cli/Cargo.toml index 524ac93467d0..376548e4b736 100644 --- a/tooling/cli/Cargo.toml +++ b/tooling/cli/Cargo.toml @@ -3,7 +3,7 @@ members = [ "node" ] [package] name = "tauri-cli" -version = "2.0.0-rc.4" +version = "2.0.0-rc.6" authors = [ "Tauri Programme within The Commons Conservancy" ] edition = "2021" rust-version = "1.70" @@ -39,7 +39,7 @@ name = "cargo-tauri" path = "src/main.rs" [dependencies] -cargo-mobile2 = { version = "0.13.2", default-features = false } +cargo-mobile2 = { version = "0.13.3", default-features = false } jsonrpsee = { version = "0.24", features = [ "server" ] } jsonrpsee-core = "0.24" jsonrpsee-client-transport = { version = "0.24", features = [ "ws" ] } @@ -48,7 +48,7 @@ sublime_fuzzy = "0.7" clap_complete = "4" clap = { version = "4.5", features = [ "derive", "env" ] } anyhow = "1.0" -tauri-bundler = { version = "2.0.1-rc.2", default-features = false, path = "../bundler" } +tauri-bundler = { version = "2.0.1-rc.4", default-features = false, path = "../bundler" } colored = "2.1" serde = { version = "1.0", features = [ "derive" ] } serde_json = { version = "1.0", features = [ "preserve_order" ] } @@ -58,7 +58,7 @@ shared_child = "1.0" duct = "0.13" toml_edit = { version = "0.22", features = [ "serde" ] } json-patch = "2.0" -tauri-utils = { version = "2.0.0-rc.3", path = "../../core/tauri-utils", features = [ "isolation", "schema", "config-json5", "config-toml" ] } +tauri-utils = { version = "2.0.0-rc.5", path = "../../core/tauri-utils", features = [ "isolation", "schema", "config-json5", "config-toml" ] } tauri-utils-v1 = { version = "1", package = "tauri-utils", features = [ "isolation", "schema", "config-json5", "config-toml" ] } toml = "0.8" jsonschema = "0.18" diff --git a/tooling/cli/metadata-v2.json b/tooling/cli/metadata-v2.json index 4a05e7e2de7f..f193168a07b1 100644 --- a/tooling/cli/metadata-v2.json +++ b/tooling/cli/metadata-v2.json @@ -1,9 +1,9 @@ { "cli.js": { - "version": "2.0.0-rc.4", + "version": "2.0.0-rc.6", "node": ">= 10.0.0" }, - "tauri": "2.0.0-rc.3", - "tauri-build": "2.0.0-rc.3", - "tauri-plugin": "2.0.0-rc.3" + "tauri": "2.0.0-rc.5", + "tauri-build": "2.0.0-rc.5", + "tauri-plugin": "2.0.0-rc.5" } diff --git a/tooling/cli/node/CHANGELOG.md b/tooling/cli/node/CHANGELOG.md index 8ec330fdf201..49f92bf17227 100644 --- a/tooling/cli/node/CHANGELOG.md +++ b/tooling/cli/node/CHANGELOG.md @@ -1,5 +1,36 @@ # Changelog +## \[2.0.0-rc.6] + +### New Features + +- [`da381e07f`](https://www.github.com/tauri-apps/tauri/commit/da381e07f3770988fe6d0859a02331b87cc6723f) ([#10696](https://www.github.com/tauri-apps/tauri/pull/10696) by [@lucasfernog](https://www.github.com/tauri-apps/tauri/../../lucasfernog)) Inject configured resources on mobile apps. + +### Bug Fixes + +- [`1a60822a4`](https://www.github.com/tauri-apps/tauri/commit/1a60822a4220b6dbb1ad7295a2e37d6c3004edad) ([#10699](https://www.github.com/tauri-apps/tauri/pull/10699) by [@lucasfernog](https://www.github.com/tauri-apps/tauri/../../lucasfernog)) Changed the `add` command to use a version requirement that matches the CLI's stable and prerelease numbers. + +### Dependencies + +- Upgraded to `tauri-cli@2.0.0-rc.6` + +## \[2.0.0-rc.5] + +### New Features + +- [`8d148a9e2`](https://www.github.com/tauri-apps/tauri/commit/8d148a9e2566edebfea2d75f32df7c9396d765a4) ([#10634](https://www.github.com/tauri-apps/tauri/pull/10634) by [@anatawa12](https://www.github.com/tauri-apps/tauri/../../anatawa12)) Custom sign command with object notation for whitespaces in the command path and arguments. + +### Bug Fixes + +- [`8ae52a615`](https://www.github.com/tauri-apps/tauri/commit/8ae52a615a11d934930001da63ce6ac8442c7efc) ([#10676](https://www.github.com/tauri-apps/tauri/pull/10676) by [@rdlabo](https://www.github.com/tauri-apps/tauri/../../rdlabo)) Change plugin template call to `register_ios_plugin` params to snake case +- [`7796a8fc6`](https://www.github.com/tauri-apps/tauri/commit/7796a8fc649cd7397a67048c71f8d1fbf822122a) ([#10687](https://www.github.com/tauri-apps/tauri/pull/10687) by [@lucasfernog](https://www.github.com/tauri-apps/tauri/../../lucasfernog)) Fix Swift plugin compilation on older versions. +- [`9b99ebab1`](https://www.github.com/tauri-apps/tauri/commit/9b99ebab17d6a043d82a7aeecfb76c56a995c287) ([#10431](https://www.github.com/tauri-apps/tauri/pull/10431) by [@mrguiman](https://www.github.com/tauri-apps/tauri/../../mrguiman)) Do not include the target arch when building and archiving the iOS application, + which makes Xcode project modifications more flexible. + +### Dependencies + +- Upgraded to `tauri-cli@2.0.0-rc.5` + ## \[2.0.0-rc.4] ### New Features diff --git a/tooling/cli/node/npm/darwin-arm64/package.json b/tooling/cli/node/npm/darwin-arm64/package.json index bd0eb651f501..9297f731a733 100644 --- a/tooling/cli/node/npm/darwin-arm64/package.json +++ b/tooling/cli/node/npm/darwin-arm64/package.json @@ -1,6 +1,18 @@ { "name": "@tauri-apps/cli-darwin-arm64", "version": "0.0.0", + "repository": { + "type": "git", + "url": "git+https://github.com/tauri-apps/tauri.git" + }, + "homepage": "https://github.com/tauri-apps/tauri#readme", + "bugs": { + "url": "https://github.com/tauri-apps/tauri/issues" + }, + "contributors": [ + "Tauri Programme within The Commons Conservancy" + ], + "license": "Apache-2.0 OR MIT", "publishConfig": { "access": "public" }, @@ -14,7 +26,6 @@ "files": [ "cli.darwin-arm64.node" ], - "license": "MIT", "engines": { "node": ">= 10" } diff --git a/tooling/cli/node/npm/darwin-x64/package.json b/tooling/cli/node/npm/darwin-x64/package.json index 1e38685a4914..fa9072a4c1a2 100644 --- a/tooling/cli/node/npm/darwin-x64/package.json +++ b/tooling/cli/node/npm/darwin-x64/package.json @@ -1,6 +1,18 @@ { "name": "@tauri-apps/cli-darwin-x64", "version": "0.0.0", + "repository": { + "type": "git", + "url": "git+https://github.com/tauri-apps/tauri.git" + }, + "homepage": "https://github.com/tauri-apps/tauri#readme", + "bugs": { + "url": "https://github.com/tauri-apps/tauri/issues" + }, + "contributors": [ + "Tauri Programme within The Commons Conservancy" + ], + "license": "Apache-2.0 OR MIT", "publishConfig": { "access": "public" }, @@ -14,7 +26,6 @@ "files": [ "cli.darwin-x64.node" ], - "license": "MIT", "engines": { "node": ">= 10" } diff --git a/tooling/cli/node/npm/linux-arm-gnueabihf/package.json b/tooling/cli/node/npm/linux-arm-gnueabihf/package.json index 0e34825528b4..c1ad0efa7b1a 100644 --- a/tooling/cli/node/npm/linux-arm-gnueabihf/package.json +++ b/tooling/cli/node/npm/linux-arm-gnueabihf/package.json @@ -1,6 +1,18 @@ { "name": "@tauri-apps/cli-linux-arm-gnueabihf", "version": "0.0.0", + "repository": { + "type": "git", + "url": "git+https://github.com/tauri-apps/tauri.git" + }, + "homepage": "https://github.com/tauri-apps/tauri#readme", + "bugs": { + "url": "https://github.com/tauri-apps/tauri/issues" + }, + "contributors": [ + "Tauri Programme within The Commons Conservancy" + ], + "license": "Apache-2.0 OR MIT", "publishConfig": { "access": "public" }, @@ -14,7 +26,6 @@ "files": [ "cli.linux-arm-gnueabihf.node" ], - "license": "MIT", "engines": { "node": ">= 10" } diff --git a/tooling/cli/node/npm/linux-arm64-gnu/package.json b/tooling/cli/node/npm/linux-arm64-gnu/package.json index 4afe2ffa1535..559dac43496b 100644 --- a/tooling/cli/node/npm/linux-arm64-gnu/package.json +++ b/tooling/cli/node/npm/linux-arm64-gnu/package.json @@ -1,6 +1,18 @@ { "name": "@tauri-apps/cli-linux-arm64-gnu", "version": "0.0.0", + "repository": { + "type": "git", + "url": "git+https://github.com/tauri-apps/tauri.git" + }, + "homepage": "https://github.com/tauri-apps/tauri#readme", + "bugs": { + "url": "https://github.com/tauri-apps/tauri/issues" + }, + "contributors": [ + "Tauri Programme within The Commons Conservancy" + ], + "license": "Apache-2.0 OR MIT", "publishConfig": { "access": "public" }, @@ -17,7 +29,6 @@ "files": [ "cli.linux-arm64-gnu.node" ], - "license": "MIT", "engines": { "node": ">= 10" } diff --git a/tooling/cli/node/npm/linux-arm64-musl/package.json b/tooling/cli/node/npm/linux-arm64-musl/package.json index 204e9a563d14..a2e2b84cf823 100644 --- a/tooling/cli/node/npm/linux-arm64-musl/package.json +++ b/tooling/cli/node/npm/linux-arm64-musl/package.json @@ -1,6 +1,18 @@ { "name": "@tauri-apps/cli-linux-arm64-musl", "version": "0.0.0", + "repository": { + "type": "git", + "url": "git+https://github.com/tauri-apps/tauri.git" + }, + "homepage": "https://github.com/tauri-apps/tauri#readme", + "bugs": { + "url": "https://github.com/tauri-apps/tauri/issues" + }, + "contributors": [ + "Tauri Programme within The Commons Conservancy" + ], + "license": "Apache-2.0 OR MIT", "publishConfig": { "access": "public" }, @@ -17,7 +29,6 @@ "files": [ "cli.linux-arm64-musl.node" ], - "license": "MIT", "engines": { "node": ">= 10" } diff --git a/tooling/cli/node/npm/linux-x64-gnu/package.json b/tooling/cli/node/npm/linux-x64-gnu/package.json index e5c9e19bc5f6..ab41c91bca4c 100644 --- a/tooling/cli/node/npm/linux-x64-gnu/package.json +++ b/tooling/cli/node/npm/linux-x64-gnu/package.json @@ -1,6 +1,18 @@ { "name": "@tauri-apps/cli-linux-x64-gnu", "version": "0.0.0", + "repository": { + "type": "git", + "url": "git+https://github.com/tauri-apps/tauri.git" + }, + "homepage": "https://github.com/tauri-apps/tauri#readme", + "bugs": { + "url": "https://github.com/tauri-apps/tauri/issues" + }, + "contributors": [ + "Tauri Programme within The Commons Conservancy" + ], + "license": "Apache-2.0 OR MIT", "publishConfig": { "access": "public" }, @@ -17,7 +29,6 @@ "files": [ "cli.linux-x64-gnu.node" ], - "license": "MIT", "engines": { "node": ">= 10" } diff --git a/tooling/cli/node/npm/linux-x64-musl/package.json b/tooling/cli/node/npm/linux-x64-musl/package.json index 44e9fbab5b12..82deedabdcb6 100644 --- a/tooling/cli/node/npm/linux-x64-musl/package.json +++ b/tooling/cli/node/npm/linux-x64-musl/package.json @@ -1,6 +1,18 @@ { "name": "@tauri-apps/cli-linux-x64-musl", "version": "0.0.0", + "repository": { + "type": "git", + "url": "git+https://github.com/tauri-apps/tauri.git" + }, + "homepage": "https://github.com/tauri-apps/tauri#readme", + "bugs": { + "url": "https://github.com/tauri-apps/tauri/issues" + }, + "contributors": [ + "Tauri Programme within The Commons Conservancy" + ], + "license": "Apache-2.0 OR MIT", "publishConfig": { "access": "public" }, @@ -17,7 +29,6 @@ "files": [ "cli.linux-x64-musl.node" ], - "license": "MIT", "engines": { "node": ">= 10" } diff --git a/tooling/cli/node/npm/win32-arm64-msvc/package.json b/tooling/cli/node/npm/win32-arm64-msvc/package.json index b7f379b0415b..8a7000f58cec 100644 --- a/tooling/cli/node/npm/win32-arm64-msvc/package.json +++ b/tooling/cli/node/npm/win32-arm64-msvc/package.json @@ -1,6 +1,18 @@ { "name": "@tauri-apps/cli-win32-arm64-msvc", "version": "0.0.0", + "repository": { + "type": "git", + "url": "git+https://github.com/tauri-apps/tauri.git" + }, + "homepage": "https://github.com/tauri-apps/tauri#readme", + "bugs": { + "url": "https://github.com/tauri-apps/tauri/issues" + }, + "contributors": [ + "Tauri Programme within The Commons Conservancy" + ], + "license": "Apache-2.0 OR MIT", "publishConfig": { "access": "public" }, @@ -14,7 +26,6 @@ "files": [ "cli.win32-arm64-msvc.node" ], - "license": "MIT", "engines": { "node": ">= 10" } diff --git a/tooling/cli/node/npm/win32-ia32-msvc/package.json b/tooling/cli/node/npm/win32-ia32-msvc/package.json index d91ed34da797..54e0fa606303 100644 --- a/tooling/cli/node/npm/win32-ia32-msvc/package.json +++ b/tooling/cli/node/npm/win32-ia32-msvc/package.json @@ -1,6 +1,18 @@ { "name": "@tauri-apps/cli-win32-ia32-msvc", "version": "0.0.0", + "repository": { + "type": "git", + "url": "git+https://github.com/tauri-apps/tauri.git" + }, + "homepage": "https://github.com/tauri-apps/tauri#readme", + "bugs": { + "url": "https://github.com/tauri-apps/tauri/issues" + }, + "contributors": [ + "Tauri Programme within The Commons Conservancy" + ], + "license": "Apache-2.0 OR MIT", "publishConfig": { "access": "public" }, @@ -14,7 +26,6 @@ "files": [ "cli.win32-ia32-msvc.node" ], - "license": "MIT", "engines": { "node": ">= 10" } diff --git a/tooling/cli/node/npm/win32-x64-msvc/package.json b/tooling/cli/node/npm/win32-x64-msvc/package.json index b1e5d30c1584..edb078b36e1c 100644 --- a/tooling/cli/node/npm/win32-x64-msvc/package.json +++ b/tooling/cli/node/npm/win32-x64-msvc/package.json @@ -1,6 +1,18 @@ { "name": "@tauri-apps/cli-win32-x64-msvc", "version": "0.0.0", + "repository": { + "type": "git", + "url": "git+https://github.com/tauri-apps/tauri.git" + }, + "homepage": "https://github.com/tauri-apps/tauri#readme", + "bugs": { + "url": "https://github.com/tauri-apps/tauri/issues" + }, + "contributors": [ + "Tauri Programme within The Commons Conservancy" + ], + "license": "Apache-2.0 OR MIT", "publishConfig": { "access": "public" }, @@ -14,7 +26,6 @@ "files": [ "cli.win32-x64-msvc.node" ], - "license": "MIT", "engines": { "node": ">= 10" } diff --git a/tooling/cli/node/package.json b/tooling/cli/node/package.json index 663de17feebc..0c9a9cb5ef02 100644 --- a/tooling/cli/node/package.json +++ b/tooling/cli/node/package.json @@ -1,6 +1,6 @@ { "name": "@tauri-apps/cli", - "version": "2.0.0-rc.4", + "version": "2.0.0-rc.6", "description": "Command line interface for building Tauri apps", "funding": { "type": "opencollective", @@ -11,7 +11,7 @@ "url": "git+https://github.com/tauri-apps/tauri.git" }, "contributors": [ - "Tauri Team (https://tauri.app)" + "Tauri Programme within The Commons Conservancy" ], "license": "Apache-2.0 OR MIT", "bugs": { diff --git a/tooling/cli/schema.json b/tooling/cli/schema.json index 90c2831a36c0..dca49bf04be3 100644 --- a/tooling/cli/schema.json +++ b/tooling/cli/schema.json @@ -2033,10 +2033,14 @@ ] }, "signCommand": { - "description": "Specify a custom command to sign the binaries.\n This command needs to have a `%1` in it which is just a placeholder for the binary path,\n which we will detect and replace before calling the command.\n\n Example:\n ```text\n sign-cli --arg1 --arg2 %1\n ```\n\n By Default we use `signtool.exe` which can be found only on Windows so\n if you are on another platform and want to cross-compile and sign you will\n need to use another tool like `osslsigncode`.", - "type": [ - "string", - "null" + "description": "Specify a custom command to sign the binaries.\n This command needs to have a `%1` in args which is just a placeholder for the binary path,\n which we will detect and replace before calling the command.\n\n By Default we use `signtool.exe` which can be found only on Windows so\n if you are on another platform and want to cross-compile and sign you will\n need to use another tool like `osslsigncode`.", + "anyOf": [ + { + "$ref": "#/definitions/CustomSignCommandConfig" + }, + { + "type": "null" + } ] } }, @@ -2425,6 +2429,37 @@ } ] }, + "CustomSignCommandConfig": { + "description": "Custom Signing Command configuration.", + "anyOf": [ + { + "description": "A string notation of the script to execute.\n\n \"%1\" will be replaced with the path to the binary to be signed.\n\n This is a simpler notation for the command.\n Tauri will split the string with `' '` and use the first element as the command name and the rest as arguments.\n\n If you need to use whitespace in the command or arguments, use the object notation [`Self::ScriptWithOptions`].", + "type": "string" + }, + { + "description": "An object notation of the command.\n\n This is more complex notation for the command but\n this allows you to use whitespace in the command and arguments.", + "type": "object", + "required": [ + "args", + "cmd" + ], + "properties": { + "cmd": { + "description": "The command to run to sign the binary.", + "type": "string" + }, + "args": { + "description": "The arguments to pass to the command.\n\n \"%1\" will be replaced with the path to the binary to be signed.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + } + ] + }, "LinuxConfig": { "description": "Configuration for Linux bundles.\n\n See more: ", "type": "object", diff --git a/tooling/cli/src/add.rs b/tooling/cli/src/add.rs index 08635c589f6d..7b488b5fcc54 100644 --- a/tooling/cli/src/add.rs +++ b/tooling/cli/src/add.rs @@ -68,6 +68,8 @@ pub fn run(options: Options) -> Result<()> { .then_some(r#"cfg(any(target_os = "android", target_os = "ios"))"#) }); + let version = version.or(metadata.version_req.as_deref()); + cargo::install_one(cargo::CargoInstallOptions { name: &crate_name, version, diff --git a/tooling/cli/src/helpers/config.rs b/tooling/cli/src/helpers/config.rs index 52a4585b5031..2aba580f71af 100644 --- a/tooling/cli/src/helpers/config.rs +++ b/tooling/cli/src/helpers/config.rs @@ -110,6 +110,23 @@ pub fn nsis_settings(config: NsisConfig) -> tauri_bundler::NsisSettings { } } +pub fn custom_sign_settings( + config: CustomSignCommandConfig, +) -> tauri_bundler::CustomSignCommandSettings { + match config { + CustomSignCommandConfig::Command(command) => { + let mut tokens = command.split(' '); + tauri_bundler::CustomSignCommandSettings { + cmd: tokens.next().unwrap().to_string(), // split always has at least one element + args: tokens.map(String::from).collect(), + } + } + CustomSignCommandConfig::CommandWithOptions { cmd, args } => { + tauri_bundler::CustomSignCommandSettings { cmd, args } + } + } +} + fn config_handle() -> &'static ConfigHandle { static CONFIG_HANDLE: OnceLock = OnceLock::new(); CONFIG_HANDLE.get_or_init(Default::default) diff --git a/tooling/cli/src/helpers/fs.rs b/tooling/cli/src/helpers/fs.rs new file mode 100644 index 000000000000..dd7491db13d4 --- /dev/null +++ b/tooling/cli/src/helpers/fs.rs @@ -0,0 +1,21 @@ +// Copyright 2019-2024 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use anyhow::Result; +use std::path::Path; + +pub fn copy_file(from: impl AsRef, to: impl AsRef) -> Result<()> { + let from = from.as_ref(); + let to = to.as_ref(); + if !from.exists() { + return Err(anyhow::anyhow!("{:?} does not exist", from)); + } + if !from.is_file() { + return Err(anyhow::anyhow!("{:?} is not a file", from)); + } + let dest_dir = to.parent().expect("No data in parent"); + std::fs::create_dir_all(dest_dir)?; + std::fs::copy(from, to)?; + Ok(()) +} diff --git a/tooling/cli/src/helpers/mod.rs b/tooling/cli/src/helpers/mod.rs index 58bdd06edd90..e67929439c00 100644 --- a/tooling/cli/src/helpers/mod.rs +++ b/tooling/cli/src/helpers/mod.rs @@ -8,6 +8,7 @@ pub mod cargo_manifest; pub mod config; pub mod flock; pub mod framework; +pub mod fs; pub mod npm; pub mod plugins; pub mod prompts; diff --git a/tooling/cli/src/helpers/plugins.rs b/tooling/cli/src/helpers/plugins.rs index 52280635bae8..9c676150aeb5 100644 --- a/tooling/cli/src/helpers/plugins.rs +++ b/tooling/cli/src/helpers/plugins.rs @@ -10,6 +10,7 @@ pub struct PluginMetadata { pub mobile_only: bool, pub rust_only: bool, pub builder: bool, + pub version_req: Option, } // known plugins with particular cases @@ -55,5 +56,40 @@ pub fn known_plugins() -> HashMap<&'static str, PluginMetadata> { plugins.entry(p).or_default().rust_only = true; } + // known, but no particular config + for p in [ + "geolocation", + "deep-link", + "dialog", + "fs", + "http", + "notification", + "os", + "process", + "shell", + "upload", + "websocket", + ] { + plugins.entry(p).or_default(); + } + + let version_req = version_req(); + for plugin in plugins.values_mut() { + plugin.version_req.replace(version_req.clone()); + } + plugins } + +fn version_req() -> String { + let pre = env!("CARGO_PKG_VERSION_PRE"); + if pre.is_empty() { + env!("CARGO_PKG_VERSION_MAJOR").to_string() + } else { + format!( + "{}.0.0-{}", + env!("CARGO_PKG_VERSION_MAJOR"), + pre.split('.').next().unwrap() + ) + } +} diff --git a/tooling/cli/src/interface/rust.rs b/tooling/cli/src/interface/rust.rs index a2b74832368e..85ea919650eb 100644 --- a/tooling/cli/src/interface/rust.rs +++ b/tooling/cli/src/interface/rust.rs @@ -40,6 +40,7 @@ mod cargo_config; mod desktop; pub mod installation; pub mod manifest; +use crate::helpers::config::custom_sign_settings; use cargo_config::Config as CargoConfig; use manifest::{rewrite_manifest, Manifest}; @@ -1424,7 +1425,7 @@ fn tauri_config_to_bundle_settings( webview_install_mode: config.windows.webview_install_mode, webview_fixed_runtime_path: config.windows.webview_fixed_runtime_path, allow_downgrades: config.windows.allow_downgrades, - sign_command: config.windows.sign_command, + sign_command: config.windows.sign_command.map(custom_sign_settings), }, license: config.license.or_else(|| { settings diff --git a/tooling/cli/src/migrate/migrations/v1/frontend.rs b/tooling/cli/src/migrate/migrations/v1/frontend.rs index b68b59eb0f48..5afba76da921 100644 --- a/tooling/cli/src/migrate/migrations/v1/frontend.rs +++ b/tooling/cli/src/migrate/migrations/v1/frontend.rs @@ -65,10 +65,8 @@ pub fn migrate(app_dir: &Path) -> Result> { format!("{}.0.0", env!("CARGO_PKG_VERSION_MAJOR")) } else { format!( - "{}.{}.{}-{}.0", + "{}.0.0-{}.0", env!("CARGO_PKG_VERSION_MAJOR"), - env!("CARGO_PKG_VERSION_MINOR"), - env!("CARGO_PKG_VERSION_PATCH"), pre.split('.').next().unwrap() ) }; diff --git a/tooling/cli/src/migrate/migrations/v1/manifest.rs b/tooling/cli/src/migrate/migrations/v1/manifest.rs index 73acd1111c94..9a83d985decc 100644 --- a/tooling/cli/src/migrate/migrations/v1/manifest.rs +++ b/tooling/cli/src/migrate/migrations/v1/manifest.rs @@ -198,10 +198,8 @@ fn dependency_version() -> String { env!("CARGO_PKG_VERSION_MAJOR").to_string() } else { format!( - "{}.{}.{}-{}", + "{}.0.0-{}", env!("CARGO_PKG_VERSION_MAJOR"), - env!("CARGO_PKG_VERSION_MINOR"), - env!("CARGO_PKG_VERSION_PATCH"), pre.split('.').next().unwrap() ) } diff --git a/tooling/cli/src/mobile/android/build.rs b/tooling/cli/src/mobile/android/build.rs index ad29b1de38a0..557f4e1a890a 100644 --- a/tooling/cli/src/mobile/android/build.rs +++ b/tooling/cli/src/mobile/android/build.rs @@ -3,7 +3,7 @@ // SPDX-License-Identifier: MIT use super::{ - configure_cargo, delete_codegen_vars, ensure_init, env, get_app, get_config, inject_assets, + configure_cargo, delete_codegen_vars, ensure_init, env, get_app, get_config, inject_resources, log_finished, open_and_wait, MobileTarget, OptionsHandle, }; use crate::{ @@ -209,7 +209,7 @@ fn run_build( cli_options, )?; - inject_assets(config, tauri_config.lock().unwrap().as_ref().unwrap())?; + inject_resources(config, tauri_config.lock().unwrap().as_ref().unwrap())?; let apk_outputs = if options.apk { apk::build( diff --git a/tooling/cli/src/mobile/android/dev.rs b/tooling/cli/src/mobile/android/dev.rs index bb22c3fde9f6..89b666127b83 100644 --- a/tooling/cli/src/mobile/android/dev.rs +++ b/tooling/cli/src/mobile/android/dev.rs @@ -4,7 +4,7 @@ use super::{ configure_cargo, delete_codegen_vars, device_prompt, ensure_init, env, get_app, get_config, - inject_assets, open_and_wait, MobileTarget, + inject_resources, open_and_wait, MobileTarget, }; use crate::{ dev::Options as DevOptions, @@ -244,7 +244,7 @@ fn run_dev( cli_options, )?; - inject_assets(config, tauri_config.lock().unwrap().as_ref().unwrap())?; + inject_resources(config, tauri_config.lock().unwrap().as_ref().unwrap())?; if open { open_and_wait(config, &env) diff --git a/tooling/cli/src/mobile/android/mod.rs b/tooling/cli/src/mobile/android/mod.rs index ebbecfb3fe65..9a4ff0ee5912 100644 --- a/tooling/cli/src/mobile/android/mod.rs +++ b/tooling/cli/src/mobile/android/mod.rs @@ -25,6 +25,7 @@ use std::{ time::Duration, }; use sublime_fuzzy::best_match; +use tauri_utils::resources::ResourcePaths; use super::{ ensure_init, get_app, @@ -32,7 +33,10 @@ use super::{ log_finished, read_options, CliOptions, OptionsHandle, Target as MobileTarget, MIN_DEVICE_MATCH_SCORE, }; -use crate::{helpers::config::Config as TauriConfig, Result}; +use crate::{ + helpers::config::{BundleResources, Config as TauriConfig}, + Result, +}; mod android_studio_script; mod build; @@ -296,7 +300,7 @@ fn open_and_wait(config: &AndroidConfig, env: &Env) -> ! { } } -fn inject_assets(config: &AndroidConfig, tauri_config: &TauriConfig) -> Result<()> { +fn inject_resources(config: &AndroidConfig, tauri_config: &TauriConfig) -> Result<()> { let asset_dir = config .project_dir() .join("app/src/main") @@ -308,5 +312,18 @@ fn inject_assets(config: &AndroidConfig, tauri_config: &TauriConfig) -> Result<( serde_json::to_string(&tauri_config)?, )?; + let resources = match &tauri_config.bundle.resources { + Some(BundleResources::List(paths)) => Some(ResourcePaths::new(paths.as_slice(), true)), + Some(BundleResources::Map(map)) => Some(ResourcePaths::from_map(map, true)), + None => None, + }; + if let Some(resources) = resources { + for resource in resources.iter() { + let resource = resource?; + let dest = asset_dir.join(resource.target()); + crate::helpers::fs::copy_file(resource.path(), dest)?; + } + } + Ok(()) } diff --git a/tooling/cli/src/mobile/ios/build.rs b/tooling/cli/src/mobile/ios/build.rs index 74e1a3ef958c..f3022473613f 100644 --- a/tooling/cli/src/mobile/ios/build.rs +++ b/tooling/cli/src/mobile/ios/build.rs @@ -3,7 +3,7 @@ // SPDX-License-Identifier: MIT use super::{ - configure_cargo, detect_target_ok, ensure_init, env, get_app, get_config, inject_assets, + configure_cargo, detect_target_ok, ensure_init, env, get_app, get_config, inject_resources, log_finished, merge_plist, open_and_wait, MobileTarget, OptionsHandle, }; use crate::{ @@ -164,7 +164,7 @@ pub fn command(options: Options, noise_level: NoiseLevel) -> Result<()> { config.project_dir(), MobileTarget::Ios, )?; - inject_assets(&config)?; + inject_resources(&config, tauri_config.lock().unwrap().as_ref().unwrap())?; let info_plist_path = config .project_dir() diff --git a/tooling/cli/src/mobile/ios/dev.rs b/tooling/cli/src/mobile/ios/dev.rs index 80ff552c9cec..d8b382eac2ca 100644 --- a/tooling/cli/src/mobile/ios/dev.rs +++ b/tooling/cli/src/mobile/ios/dev.rs @@ -3,7 +3,7 @@ // SPDX-License-Identifier: MIT use super::{ - configure_cargo, device_prompt, ensure_init, env, get_app, get_config, inject_assets, + configure_cargo, device_prompt, ensure_init, env, get_app, get_config, inject_resources, merge_plist, open_and_wait, MobileTarget, }; use crate::{ @@ -166,6 +166,7 @@ fn run_command(options: Options, noise_level: NoiseLevel) -> Result<()> { dev_options.features.as_ref(), &Default::default(), ); + (interface, app, config) }; @@ -178,7 +179,7 @@ fn run_command(options: Options, noise_level: NoiseLevel) -> Result<()> { config.project_dir(), MobileTarget::Ios, )?; - inject_assets(&config)?; + inject_resources(&config, tauri_config.lock().unwrap().as_ref().unwrap())?; let info_plist_path = config .project_dir() diff --git a/tooling/cli/src/mobile/ios/mod.rs b/tooling/cli/src/mobile/ios/mod.rs index 9e53853a866c..44c5a7baf8f5 100644 --- a/tooling/cli/src/mobile/ios/mod.rs +++ b/tooling/cli/src/mobile/ios/mod.rs @@ -20,6 +20,7 @@ use cargo_mobile2::{ }; use clap::{Parser, Subcommand}; use sublime_fuzzy::best_match; +use tauri_utils::resources::ResourcePaths; use super::{ ensure_init, env, get_app, @@ -28,7 +29,10 @@ use super::{ MIN_DEVICE_MATCH_SCORE, }; use crate::{ - helpers::{app_paths::tauri_dir, config::Config as TauriConfig}, + helpers::{ + app_paths::tauri_dir, + config::{BundleResources, Config as TauriConfig}, + }, Result, }; @@ -304,9 +308,23 @@ fn open_and_wait(config: &AppleConfig, env: &Env) -> ! { } } -fn inject_assets(config: &AppleConfig) -> Result<()> { +fn inject_resources(config: &AppleConfig, tauri_config: &TauriConfig) -> Result<()> { let asset_dir = config.project_dir().join(DEFAULT_ASSET_DIR); - create_dir_all(asset_dir)?; + create_dir_all(&asset_dir)?; + + let resources = match &tauri_config.bundle.resources { + Some(BundleResources::List(paths)) => Some(ResourcePaths::new(paths.as_slice(), true)), + Some(BundleResources::Map(map)) => Some(ResourcePaths::from_map(map, true)), + None => None, + }; + if let Some(resources) = resources { + for resource in resources.iter() { + let resource = resource?; + let dest = asset_dir.join(resource.target()); + crate::helpers::fs::copy_file(resource.path(), dest)?; + } + } + Ok(()) } diff --git a/tooling/cli/templates/plugin/ios-spm/Package.swift b/tooling/cli/templates/plugin/ios-spm/Package.swift index ff9991fa99ff..faf3d3d6f5d7 100644 --- a/tooling/cli/templates/plugin/ios-spm/Package.swift +++ b/tooling/cli/templates/plugin/ios-spm/Package.swift @@ -6,6 +6,7 @@ import PackageDescription let package = Package( name: "tauri-plugin-{{ plugin_name }}", platforms: [ + .macOS(.v10_13), .iOS(.v13), ], products: [ diff --git a/tooling/cli/templates/plugin/src/mobile.rs b/tooling/cli/templates/plugin/src/mobile.rs index 0e255a50bb99..1a15b1f480ab 100644 --- a/tooling/cli/templates/plugin/src/mobile.rs +++ b/tooling/cli/templates/plugin/src/mobile.rs @@ -13,7 +13,7 @@ use crate::models::*; const PLUGIN_IDENTIFIER: &str = "{{ android_package_id }}"; #[cfg(target_os = "ios")] -tauri::ios_plugin_binding!(init_plugin_{{ plugin_name }}); +tauri::ios_plugin_binding!(init_plugin_{{ plugin_name_snake_case }}); // initializes the Kotlin or Swift plugin classes pub fn init( @@ -23,7 +23,7 @@ pub fn init( #[cfg(target_os = "android")] let handle = api.register_android_plugin(PLUGIN_IDENTIFIER, "ExamplePlugin")?; #[cfg(target_os = "ios")] - let handle = api.register_ios_plugin(init_plugin_{{ plugin_name }})?; + let handle = api.register_ios_plugin(init_plugin_{{ plugin_name_snake_case }})?; Ok({{ plugin_name_pascal_case }}(handle)) }