Compare commits

..

7 Commits

Author SHA1 Message Date
Lucas Nogueira
83a9e6c572 Merge remote-tracking branch 'origin/dev' into feat/command-tests 2023-01-04 19:00:48 -03:00
Lucas Nogueira
f7e86798c2 lint 2023-01-04 18:19:15 -03:00
Lucas Nogueira
936d46a41a struct arg test 2023-01-02 15:43:37 -03:00
Lucas Nogueira
a115f91c52 add future test 2023-01-02 15:21:49 -03:00
Lucas Nogueira
2624af9c24 add rename_all test 2022-12-09 09:02:06 -03:00
Lucas Nogueira
b0485d0187 add async command tests, command with arg 2022-12-08 17:02:58 -03:00
Lucas Nogueira
a2724b3e1c basic setup for command tests 2022-12-08 14:15:20 -03:00
529 changed files with 9970 additions and 18201 deletions

View File

@@ -0,0 +1,5 @@
---
"tauri-bundler": patch
---
Add dylib support to `tauri.bundle.macOS.frameworks`.

View File

@@ -0,0 +1,5 @@
---
"api": minor
---
Added the `additionalBrowserArgs` option when creating a window.

View File

@@ -0,0 +1,5 @@
---
"tauri-utils": minor
---
Added the `additional_browser_args` option to the window configuration.

View File

@@ -0,0 +1,7 @@
---
"tauri": minor
"tauri-runtime-wry": minor
"tauri-runtime": minor
---
Added the `additional_browser_args` option when creating a window.

6
.changes/cli-info.md Normal file
View File

@@ -0,0 +1,6 @@
---
"cli.rs": "patch"
---
Fix `tauri info` panicking when parsing crates version on a newly created project without a `Cargo.lock` file.

View File

@@ -1,16 +1,6 @@
{
"gitSiteUrl": "https://www.github.com/tauri-apps/tauri/",
"changeTags": {
"feat": "New Features",
"enhance": "Enhancements",
"bug": "Bug Fixes",
"pref": "Performance Improvements",
"changes": "What's Changed",
"sec": "Security fixes",
"deps": "Dependencies",
"breaking": "Breaking Changes"
},
"defaultChangeTag": "changes",
"timeout": 3600000,
"pkgManagers": {
"rust": {
"errorOnVersionRange": "^2.0.0-0",
@@ -133,13 +123,13 @@
}
},
"packages": {
"@tauri-apps/api": {
"api": {
"path": "./tooling/api",
"manager": "javascript",
"assets": [
{
"path": "./tooling/api/dist/tauri-apps-api-${ pkgFile.version }.tgz",
"name": "tauri-apps-api-${ pkgFile.version }.tgz"
"name": "api-${ pkgFile.version }.tgz"
}
],
"prepublish": [
@@ -221,7 +211,7 @@
"dependencies": ["tauri-codegen", "tauri-utils"],
"postversion": [
"node ../../.scripts/covector/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }",
"cargo build --manifest-path ../tauri-config-schema/Cargo.toml"
"cargo build --manifest-path ../config-schema/Cargo.toml"
],
"assets": [
{
@@ -241,26 +231,26 @@
],
"postversion": "node ../../.scripts/covector/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }"
},
"@tauri-apps/cli": {
"cli.js": {
"path": "./tooling/cli/node",
"manager": "javascript",
"getPublishedVersion": "node ../../../.scripts/covector/package-latest-version.js npm ${ pkgFile.pkg.name } ${ pkgFile.pkg.version }",
"dependencies": ["tauri-cli"],
"dependencies": ["cli.rs"],
"postversion": [
"node ../../../.scripts/covector/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }",
"cargo build --manifest-path ../../../core/tauri-config-schema/Cargo.toml"
"cargo build --manifest-path ../../../core/config-schema/Cargo.toml"
],
"prepublish": [],
"publish": [],
"postpublish": []
},
"tauri-cli": {
"cli.rs": {
"path": "./tooling/cli",
"manager": "rust",
"dependencies": ["tauri-bundler", "tauri-utils"],
"postversion": [
"cargo check",
"cargo build --manifest-path ../../core/tauri-config-schema/Cargo.toml"
"cargo build --manifest-path ../../core/config-schema/Cargo.toml"
],
"assets": [
{

View File

@@ -0,0 +1,5 @@
---
"api": "minor"
---
Added the `WindowOptions::contentProtected` option and `WebviewWindow#setContentProtected` to change it at runtime.

View File

@@ -0,0 +1,5 @@
---
"tauri-utils": "patch"
---
Added the `content_protected` option to the window configuration.

View File

@@ -0,0 +1,7 @@
---
"tauri": "minor"
"tauri-runtime": "minor"
"tauri-runtime-wry": "minor"
---
Added the `content_protected` option when creating a window and `Window::set_content_protected` to change it at runtime.

View File

@@ -0,0 +1,5 @@
---
"tauri": minor
---
Added `Window::on_navigation`.

View File

@@ -0,0 +1,5 @@
---
"tauri": "patch"
---
Sync `__TAURI_METADATA__.__windows` across all windows.

View File

@@ -0,0 +1,5 @@
---
"api": minor
---
Allow setting the text of the dialog buttons.

View File

@@ -0,0 +1,5 @@
---
"tauri": minor
---
Added `OkWithLabel` and `OkCancelWithLabels` variants to the `api::dialog::MessageDialogButtons` enum to set the text of the dialog buttons.

6
.changes/custom-icon.md Normal file
View File

@@ -0,0 +1,6 @@
---
"cli.rs": minor
"cli.js": minor
---
Add `--png` option for the `icon` command to generate custom icon sizes.

View File

@@ -0,0 +1,7 @@
---
"tauri-runtime-wry": minor
"tauri-runtime": minor
"tauri": minor
---
Added `Builder::device_event_filter` and `App::set_device_event_filter` methods.

5
.changes/fix-2549.md Normal file
View File

@@ -0,0 +1,5 @@
---
"tauri": "patch"
---
Fix resize glitch when double clicking a custom titlebar in the top resize area.

View File

@@ -0,0 +1,5 @@
---
"tauri": "patch"
---
Fix the filesystem scope allowing sub-directories of the directory picked by the dialog when `recursive` option was `false`.

5
.changes/heck-unicode.md Normal file
View File

@@ -0,0 +1,5 @@
---
"cli.rs": "patch"
---
Fix building apps with unicode characters in their `productName`.

8
.changes/is-minimized.md Normal file
View File

@@ -0,0 +1,8 @@
---
"tauri": minor
"tauri-runtime": minor
"tauri-runtime-wry": minor
"api": minor
---
Add `is_minimized()` window method.

8
.changes/nsis.md Normal file
View File

@@ -0,0 +1,8 @@
---
"tauri-bundler": minor
"tauri-utils": minor
"cli.rs": minor
"cli.js": minor
---
Add `nsis` bundle target

View File

@@ -0,0 +1,5 @@
---
"tauri": minor
---
Added support to `mailto:` and `tel:` links on the shell API.

View File

@@ -1,44 +1,31 @@
# Changes
##### via https://github.com/jbolda/covector
As you create PRs and make changes that require a version bump, please add a new markdown file in this folder. You do not note the version _number_, but rather the type of bump that you expect: major, minor, or patch. The filename is not important, as long as it is a `.md`, but we recommend that it represents the overall change for organizational purposes.
When you select the version bump required, you do _not_ need to consider dependencies. Only note the package with the actual change, and any packages that depend on that package will be bumped automatically in the process.
Use the following format:
```md
---
'package-a': patch
'package-b': patch
---
Change summary goes here
```
Summaries do not have a specific character limit, but are text only. These summaries are used within the (future implementation of) changelogs. They will give context to the change and also point back to the original PR if more details and context are needed.
Changes will be designated as a `major`, `minor` or `patch` as further described in [semver](https://semver.org/).
Given a version number MAJOR.MINOR.PATCH, increment the:
- MAJOR version when you make incompatible API changes,
- MINOR version when you add functionality in a backwards compatible manner, and
- PATCH version when you make backwards compatible bug fixes.
Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format, but will be discussed prior to usage (as extra steps will be necessary in consideration of merging and publishing).
Additionally you could specify a tag for the change file to group it with other changes by prefixing the bump with `:<tag>`, for example:
```md
---
'package-a': patch:bug
---
Change summary goes here
```
which will group this change file with other changes that specify the `bug` tag.
For list of available tags, see the `changeTags` key in [./config.json](./config.json)
# Changes
##### via https://github.com/jbolda/covector
As you create PRs and make changes that require a version bump, please add a new markdown file in this folder. You do not note the version _number_, but rather the type of bump that you expect: major, minor, or patch. The filename is not important, as long as it is a `.md`, but we recommend that it represents the overall change for organizational purposes.
When you select the version bump required, you do _not_ need to consider dependencies. Only note the package with the actual change, and any packages that depend on that package will be bumped automatically in the process.
Use the following format:
```md
---
"package-a": patch
"package-b": patch
---
Change summary goes here
```
Summaries do not have a specific character limit, but are text only. These summaries are used within the (future implementation of) changelogs. They will give context to the change and also point back to the original PR if more details and context are needed.
Changes will be designated as a `major`, `minor` or `patch` as further described in [semver](https://semver.org/).
Given a version number MAJOR.MINOR.PATCH, increment the:
- MAJOR version when you make incompatible API changes,
- MINOR version when you add functionality in a backwards compatible manner, and
- PATCH version when you make backwards compatible bug fixes.
Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format, but will be discussed prior to usage (as extra steps will be necessary in consideration of merging and publishing).

View File

@@ -0,0 +1,5 @@
---
"tauri-runtime": minor
---
Added `navigation_handler` field on `PendingWindow`.

View File

@@ -0,0 +1,5 @@
---
"tauri-build": "minor"
---
Add `WindowsAttributes::app_manifest` to specify the application manifest on Windows.

8
.changes/title-getter.md Normal file
View File

@@ -0,0 +1,8 @@
---
"tauri": "minor"
"api": "minor"
"tauri-runtime": "minor"
"tauri-runtime-wry": "minor"
---
Add `title` getter on window.

View File

@@ -0,0 +1,6 @@
---
"tauri-runtime": minor
"tauri-runtime-wry": minor
---
Added `TrayHandle::set_tooltip` and `SystemTray::with_tooltip`.

5
.changes/tray-tooltip.md Normal file
View File

@@ -0,0 +1,5 @@
---
"tauri": patch
---
Implement `SystemTray::with_tooltip` and `SystemTrayHandle::set_tooltip` for Windows and macOS.

7
.changes/url-getter.md Normal file
View File

@@ -0,0 +1,7 @@
---
"tauri-runtime": minor
"tauri-runtime-wry": minor
"tauri": minor
---
Added window's `url()` getter.

View File

@@ -0,0 +1,5 @@
---
'cli.rs': 'minor'
---
Add support for Cargo's workspace inheritance for the package version.

View File

@@ -0,0 +1,7 @@
---
"tauri": "patch"
"tauri-runtime": "patch"
"tauri-runtime-wry": "patch"
---
On Windows, change webview theme based on Window theme for more accurate `prefers-color-scheme` support.

View File

@@ -0,0 +1,6 @@
---
"tauri-bundler": "patch"
---
On Windows, the `msi` installer's `Launch App` checkbox will be checked by default.

View File

@@ -0,0 +1,5 @@
---
"tauri-runtime-wry": minor
---
Implement the webview navigation handler.

View File

@@ -54,20 +54,20 @@ Some Tauri packages will be automatically built when running one of the examples
### Packages Overview
- The JS API (`/tooling/api`) contains JS bindings to the builtin Rust functions in the Rust API.
- cli.rs (`/tooling/cli`) is the primary CLI for creating and developing Tauri apps.
- cli.js (`/tooling/cli/node`) is a Node.js CLI wrapper for `cli.rs`.
- Tauri Bundler (`/tooling/bundler`) is used by the Rust CLI to package executables into installers.
- Tauri Core (`/core/tauri`) is the heart of Tauri. It contains the code that starts the app, configures communication between Rust and the Webview, and ties all the other packages together.
- The Macros (`/core/tauri-macros`) are used by Tauri Core for various functions.
- Tauri Bundler (`/tooling/bundler`) is used by the Rust CLI to package executables into installers.
- The Rust CLI aka `tauri-cli` (`/tooling/cli`) is the primary CLI for creating and developing Tauri apps.
- The JS CLI aka `@tauri-apps/cli` (`/tooling/cli/node`) is a Node.js CLI wrapper for `tauri-cli`.
- The JS API aka `@tauri-apps/api` (`/tooling/api`) contains JS bindings to the builtin Rust functions in the Rust API.
### Developing The Node.js CLI (cli.js)
`cli.js` is a wrapper to `cli.rs` so most changes should be written on the Rust CLI. The `[Tauri repo root]/tooling/cli/node` folder contains only packaging scripts to properly publish the Rust CLI binaries to NPM.
### Developing Tauri Bundler and Rust CLI
The code for the bundler is located in `[Tauri repo root]/tooling/bundler`, and the code for the Rust CLI is located in `[Tauri repo root]/tooling/cli`. If you are using your local copy of `@tauri-apps/cli` (see above), any changes you make to the bundler and CLI will be automatically built and applied when running the build or dev command. Otherwise, running `cargo install --path .` in the Rust CLI directory will allow you to run `cargo tauri build` and `cargo tauri dev` anywhere, using the updated copy of the bundler and cli. You will have to run this command each time you make a change in either package.
### Developing The Node.js CLI (`@tauri-apps/cli`)
`@tauri-apps/cli` is a wrapper to `tauri-cli` so most changes should be written on the Rust CLI. The `[Tauri repo root]/tooling/cli/node` folder contains only packaging scripts to properly publish the Rust CLI binaries to NPM.
The code for the bundler is located in `[Tauri repo root]/tooling/bundler`, and the code for the Rust CLI is located in `[Tauri repo root]/tooling/cli`. If you are using your local copy of cli.js (see above), any changes you make to the bundler and CLI will be automatically built and applied when running the build or dev command. Otherwise, running `cargo install --path .` in the Rust CLI directory will allow you to run `cargo tauri build` and `cargo tauri dev` anywhere, using the updated copy of the bundler and cli. You will have to run this command each time you make a change in either package.
### Developing Tauri Core and Related Components (Rust API, Macros, Codegen, and Utils)

6
.github/FUNDING.yml vendored
View File

@@ -1,10 +1,6 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
# These are supported funding model platforms
github: tauri-apps
github: nothingismagick
patreon: #
open_collective: tauri
ko_fi: # Replace with a single Ko-fi username

View File

@@ -1,7 +1,3 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: 🐞 Bug Report
title: '[bug] '
description: Report a bug
@@ -30,10 +26,11 @@ body:
id: reproduction
attributes:
label: Reproduction
description: A link to a reproduction repo or steps to reproduce the behaviour.
description: Steps to reproduce the behavior.
placeholder: |
Please provide a minimal reproduction or steps to reproduce, see this guide https://stackoverflow.com/help/minimal-reproducible-example
Why reproduction is required? see this article https://antfu.me/posts/why-reproductions-are-required
1. Go to ...
2. Click on ...
3. See error
- type: textarea
id: expected-behavior
@@ -46,7 +43,6 @@ body:
attributes:
label: Platform and versions
description: "Output of `npm run tauri info` or `cargo tauri info`"
render: text
validations:
required: true
@@ -54,8 +50,8 @@ body:
id: logs
attributes:
label: Stack trace
render: text
render: shell
- type: textarea
id: context
attributes:

View File

@@ -1,7 +1,3 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
contact_links:
- name: 💬 Discord Chat
url: https://discord.com/invite/tauri

View File

@@ -1,7 +1,3 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: 💡 Feature Request
title: '[feat] '
description: Suggest an idea

3
.github/config.yml vendored
View File

@@ -1,3 +0,0 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

View File

@@ -1,14 +1,14 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: test updater artifacts
name: updater test artifacts
on:
schedule:
- cron: '0 0 * * *'
pull_request:
paths:
- '.github/workflows/test-updater-artifacts.yml'
- '.github/workflows/artifacts-updater.yml'
- 'examples/updater/**'
workflow_dispatch:
@@ -21,7 +21,7 @@ concurrency:
cancel-in-progress: true
jobs:
test:
build-artifacts:
runs-on: ${{ matrix.platform }}
strategy:
@@ -48,7 +48,7 @@ jobs:
core -> ../target
tooling/cli
- name: build and install `tauri-cli`
- name: build and install cli.rs
run: cargo install --path tooling/cli --force
- name: Check whether code signing should be enabled
id: enablecodesigning

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
@@ -10,7 +10,6 @@ on:
- cron: '0 0 * * *'
push:
paths:
- '.github/workflows/audit.yml'
- '**/Cargo.lock'
- '**/Cargo.toml'
- '**/package.json'
@@ -34,11 +33,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: audit workspace
run: yarn audit
- name: audit @tauri-apps/api
working-directory: tooling/api
run: yarn audit
- name: audit @tauri-apps/cli
- name: yarn audit
working-directory: tooling/cli/node
run: yarn audit

View File

@@ -1,14 +1,10 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: bench
name: benches
on:
push:
branches:
- dev
- 1.x
- next
workflow_dispatch:
env:
@@ -27,7 +23,7 @@ jobs:
matrix:
rust: [nightly]
platform:
- { target: x86_64-unknown-linux-gnu, os: ubuntu-20.04 }
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest }
runs-on: ${{ matrix.platform.os }}

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

View File

@@ -1,32 +0,0 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: check change tags
on:
pull_request:
paths:
- '.changes/*.md'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
list-files: shell
filters: |
changes:
- added|modified: '.changes/*.md'
- name: check
run: node ./.scripts/ci/check-change-tags.js ${{ steps.filter.outputs.changes_files }}
if: ${{ steps.filter.outputs.changes == 'true' }}

View File

@@ -1,8 +1,8 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: check generated files
name: Check generated files
on:
pull_request:
@@ -12,7 +12,15 @@ on:
- 'core/tauri/scripts/bundle.global.js'
- 'core/tauri-utils/src/config.rs'
- 'tooling/cli/schema.json'
- 'core/tauri-config-schema/schema.json'
- 'core/config-schema/schema.json'
push:
paths:
- '.github/workflows/check-generated-files.yml'
- 'tooling/api/src/**'
- 'core/tauri/scripts/bundle.global.js'
- 'core/tauri-utils/src/config.rs'
- 'tooling/cli/schema.json'
- 'core/config-schema/schema.json'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@@ -22,41 +30,41 @@ jobs:
changes:
runs-on: ubuntu-latest
outputs:
api: ${{ steps.filter.outputs.api }}
bundle: ${{ steps.filter.outputs.bundle }}
schema: ${{ steps.filter.outputs.schema }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
api:
bundle:
- 'tooling/api/src/**'
- 'core/tauri/scripts/bundle.global.js'
schema:
- 'core/tauri-utils/src/config.rs'
- 'tooling/cli/schema.json'
- 'core/tauri-config-schema/schema.json'
- 'core/config-schema/schema.json'
api:
check-bundle:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.api == 'true'
if: needs.changes.outputs.bundle == 'true'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- name: build api
- name: generate bundle
working-directory: tooling/api
run: yarn && yarn build
- name: check api
- name: check bundle
run: ./.scripts/ci/has-diff.sh
schema:
check-schema:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.schema == 'true'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- name: install stable
uses: actions-rs/toolchain@v1
@@ -77,7 +85,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path ./core/tauri-config-schema/Cargo.toml
args: --manifest-path ./core/config-schema/Cargo.toml
- name: check schema
run: ./.scripts/ci/has-diff.sh

View File

@@ -1,28 +0,0 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: check license headers
on:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
list-files: shell
filters: |
added:
- added: '**'
- name: check header license on new files
if: ${{ steps.filter.outputs.added == 'true' }}
run: node ./.scripts/ci/check-license-header.js ${{ steps.filter.outputs.added_files }}

View File

@@ -1,148 +0,0 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: covector version or publish
on:
push:
branches:
- 1.x
jobs:
run-integration-tests:
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: install stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: install Linux dependencies
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev libfuse2
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
core -> ../target
tooling/cli
- name: build CLI
uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path ./tooling/cli/Cargo.toml
- name: run integration tests
run: cargo test --test '*' -- --ignored
- name: run CLI tests
timeout-minutes: 30
run: |
cd ./tooling/cli/node
yarn
yarn build
yarn test
version-or-publish:
runs-on: ubuntu-latest
timeout-minutes: 65
outputs:
change: ${{ steps.covector.outputs.change }}
commandRan: ${{ steps.covector.outputs.commandRan }}
successfulPublish: ${{ steps.covector.outputs.successfulPublish }}
needs:
- run-integration-tests
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: 14
registry-url: 'https://registry.npmjs.org'
cache: yarn
cache-dependency-path: tooling/*/yarn.lock
- name: cargo login
run: cargo login ${{ secrets.ORG_CRATES_IO_TOKEN }}
- name: git config
run: |
git config --global user.name "${{ github.event.pusher.name }}"
git config --global user.email "${{ github.event.pusher.email }}"
- name: covector version or publish (publish when no change files present)
uses: jbolda/covector/packages/action@covector-v0
id: covector
env:
NODE_AUTH_TOKEN: ${{ secrets.ORG_NPM_TOKEN }}
CARGO_AUDIT_OPTIONS: ${{ secrets.CARGO_AUDIT_OPTIONS }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
command: 'version-or-publish'
createRelease: true
- name: Create Pull Request With Versions Bumped
if: steps.covector.outputs.commandRan == 'version'
uses: tauri-apps/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: release/version-updates-v1
title: Apply Version Updates From Current Changes (v1)
commit-message: 'apply version updates'
labels: 'version updates'
body: ${{ steps.covector.outputs.change }}
- name: Trigger doc update
if: |
steps.covector.outputs.successfulPublish == 'true' &&
steps.covector.outputs.packagesPublished != ''
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.ORG_TAURI_BOT_PAT }}
repository: tauri-apps/tauri-docs
event-type: update-docs
- name: Get `@tauri-apps/cli` release id
id: cliReleaseId
if: |
steps.covector.outputs.successfulPublish == 'true' &&
contains(steps.covector.outputs.packagesPublished, '@tauri-apps/cli')
run: |
echo '${{ steps.covector.outputs }}' > output.json
id=$(jq '.["-tauri-apps-cli-releaseId"]' < output.json)
rm output.json
echo "cliReleaseId=$id" >> "$GITHUB_OUTPUT"
- name: Trigger `@tauri-apps/cli` publishing workflow
if: |
steps.covector.outputs.successfulPublish == 'true' &&
contains(steps.covector.outputs.packagesPublished, '@tauri-apps/cli')
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.ORG_TAURI_BOT_PAT }}
repository: tauri-apps/tauri
event-type: publish-js-cli
client-payload: '{"releaseId": "${{ steps.cliReleaseId.outputs.cliReleaseId }}" }'
- name: Trigger `tauri-cli` publishing workflow
if: |
steps.covector.outputs.successfulPublish == 'true' &&
contains(steps.covector.outputs.packagesPublished, 'tauri-cli')
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.ORG_TAURI_BOT_PAT }}
repository: tauri-apps/tauri
event-type: publish-clirs

View File

@@ -1,8 +1,8 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: covector version or publish
name: version or publish
on:
push:
@@ -115,32 +115,21 @@ jobs:
repository: tauri-apps/tauri-docs
event-type: update-docs
- name: Get `@tauri-apps/cli` release id
id: cliReleaseId
- name: Trigger cli.js publishing workflow
if: |
steps.covector.outputs.successfulPublish == 'true' &&
contains(steps.covector.outputs.packagesPublished, '@tauri-apps/cli')
run: |
echo '${{ toJSON(steps.covector.outputs) }}' > output.json
id=$(jq '.["-tauri-apps-cli-releaseId"]' < output.json)
rm output.json
echo "cliReleaseId=$id" >> "$GITHUB_OUTPUT"
- name: Trigger `@tauri-apps/cli` publishing workflow
if: |
steps.covector.outputs.successfulPublish == 'true' &&
contains(steps.covector.outputs.packagesPublished, '@tauri-apps/cli')
contains(steps.covector.outputs.packagesPublished, 'cli.rs')
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.ORG_TAURI_BOT_PAT }}
repository: tauri-apps/tauri
event-type: publish-js-cli
client-payload: '{"releaseId": "${{ steps.cliReleaseId.outputs.cliReleaseId }}" }'
event-type: publish-clijs
client-payload: '{"releaseId": "${{ steps.covector.outputs.cli.js-releaseId }}" }'
- name: Trigger `tauri-cli` publishing workflow
- name: Trigger cli.rs publishing workflow
if: |
steps.covector.outputs.successfulPublish == 'true' &&
contains(steps.covector.outputs.packagesPublished, 'tauri-cli')
contains(steps.covector.outputs.packagesPublished, 'cli.rs')
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.ORG_TAURI_BOT_PAT }}

View File

@@ -1,7 +1,3 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: docker
on:

View File

@@ -1,17 +1,17 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: lint cli
name: cli clippy and fmt check
on:
push:
branches:
- dev
- 1.x
- next
pull_request:
paths:
- '.github/workflows/lint-cli.yml'
- '.github/workflows/lint-fmt-cli.yml'
- 'tooling/cli/**'
env:
@@ -23,7 +23,7 @@ concurrency:
cancel-in-progress: true
jobs:
fmt:
fmt_check:
runs-on: ubuntu-latest
steps:
@@ -41,7 +41,7 @@ jobs:
command: fmt
args: --manifest-path ./tooling/cli/Cargo.toml --all -- --check
clippy:
cli_clippy_check:
runs-on: ubuntu-latest
steps:

View File

@@ -1,17 +1,17 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: lint core
name: core clippy and fmt check
on:
push:
branches:
- dev
- 1.x
- next
pull_request:
paths:
- '.github/workflows/lint-core.yml'
- '.github/workflows/lint-fmt-core.yml'
- 'core/**'
- '!core/tauri/scripts/**'
- 'examples/**'
@@ -25,7 +25,7 @@ concurrency:
cancel-in-progress: true
jobs:
fmt:
fmt_check:
runs-on: ubuntu-latest
steps:
@@ -43,14 +43,14 @@ jobs:
command: fmt
args: --all -- --check
clippy:
core_clippy_check:
runs-on: ubuntu-latest
strategy:
matrix:
clippy:
- { args: '', key: 'empty' }
- {
args: '--features compression,wry,linux-protocol-headers,isolation,custom-protocol,api-all,cli,updater,system-tray,windows7-compat,http-multipart,test',
args: '--features compression,wry,linux-protocol-headers,isolation,custom-protocol,api-all,cli,updater,system-tray,windows7-compat,http-multipart',
key: 'all'
}
- { args: '--features custom-protocol', key: 'custom-protocol' }

View File

@@ -1,8 +1,8 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: lint js
name: api and cli.js lint check
on:
pull_request:
@@ -16,7 +16,7 @@ concurrency:
cancel-in-progress: true
jobs:
eslint-cli:
eslint-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
@@ -24,34 +24,24 @@ jobs:
with:
node-version: '14'
cache: yarn
cache-dependency-path: tooling/cli/node/yarn.lock
- name: install deps via yarn
cache-dependency-path: tooling/*/yarn.lock
- name: install cli.js deps via yarn
working-directory: ./tooling/cli/node/
run: yarn
# nothing to lint
#- name: run lint
#- name: run cli.js lint
# working-directory: ./tooling/cli/node/
# run: yarn lint
- name: run format
- name: run cli.js format
working-directory: ./tooling/cli/node/
run: yarn format:check
eslint-api:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
cache: yarn
cache-dependency-path: tooling/api/yarn.lock
- name: install deps via yarn
- name: install api deps via yarn
working-directory: ./tooling/api/
run: yarn
- name: run lint
- name: run api lint
working-directory: ./tooling/api/
run: yarn lint
- name: run format
- name: run api format
working-directory: ./tooling/api/
run: yarn format:check

View File

@@ -1,8 +1,4 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: publish `@tauri-apps/cli`
name: publish cli.js
env:
DEBUG: napi:*
APP_NAME: cli
@@ -11,10 +7,10 @@ on:
workflow_dispatch:
inputs:
releaseId:
description: 'ID of the `@tauri-apps/cli` release'
description: 'ID of the cli.js release'
required: true
repository_dispatch:
types: [publish-js-cli]
types: [publish-clijs]
defaults:
run:
@@ -40,18 +36,14 @@ jobs:
build: yarn build:release --target i686-pc-windows-msvc
target: i686-pc-windows-msvc
architecture: x64
- host: windows-latest
architecture: x64
target: aarch64-pc-windows-msvc
build: yarn build:release --target aarch64-pc-windows-msvc --features native-tls,native-tls-vendored --cargo-flags="--no-default-features"
- host: ubuntu-20.04
- host: ubuntu-18.04
target: x86_64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
build: |
cd tooling/cli/node
yarn build:release --target x86_64-unknown-linux-gnu
strip *.node
- host: ubuntu-20.04
- host: ubuntu-18.04
target: x86_64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: |
@@ -63,14 +55,14 @@ jobs:
build: |
yarn build:release --target=aarch64-apple-darwin
strip -x *.node
- host: ubuntu-20.04
- host: ubuntu-18.04
target: aarch64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
build: |
cd tooling/cli/node
yarn build:release --target aarch64-unknown-linux-gnu
aarch64-unknown-linux-gnu-strip *.node
- host: ubuntu-20.04
- host: ubuntu-18.04
architecture: x64
target: armv7-unknown-linux-gnueabihf
setup: |
@@ -79,7 +71,7 @@ jobs:
build: |
yarn build:release --target=armv7-unknown-linux-gnueabihf
arm-linux-gnueabihf-strip *.node
- host: ubuntu-20.04
- host: ubuntu-18.04
architecture: x64
target: aarch64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
@@ -88,6 +80,10 @@ jobs:
rustup target add aarch64-unknown-linux-musl
yarn build:release --target aarch64-unknown-linux-musl
/aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node
#- host: windows-latest
# architecture: x64
# target: aarch64-pc-windows-msvc
# build: yarn build:release --target aarch64-pc-windows-msvc
name: stable - ${{ matrix.settings.target }} - node@16
runs-on: ${{ matrix.settings.host }}
steps:
@@ -299,7 +295,7 @@ jobs:
shell: bash
- name: Install system dependencies
run: |
apk add openssl-dev musl-dev glib-dev cairo-dev pkgconfig gdk-pixbuf-dev webkit2gtk-dev curl gtk+3.0-dev
apk add openssl-dev musl-dev glib-dev cairo-dev pkgconfig gdk-pixbuf-dev webkit2gtk-dev curl libappindicator-dev gtk+3.0-dev
- name: Setup and run tests
run: |
yarn tauri --help

View File

@@ -1,8 +1,4 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: publish `tauri-cli`
name: publish cli.rs
env:
MACOSX_DEPLOYMENT_TARGET: '10.13'
on:
@@ -12,63 +8,50 @@ on:
jobs:
build:
runs-on: ${{ matrix.config.os }}
runs-on: ${{ matrix.target.platform }}
strategy:
fail-fast: false
matrix:
config:
- os: ubuntu-20.04
rust_target: x86_64-unknown-linux-gnu
ext: ''
args: ''
- os: macos-latest
rust_target: x86_64-apple-darwin
ext: ''
args: ''
- os: macos-latest
rust_target: aarch64-apple-darwin
ext: ''
args: ''
- os: windows-latest
rust_target: x86_64-pc-windows-msvc
ext: '.exe'
args: ''
- os: windows-latest
rust_target: aarch64-pc-windows-msvc
ext: '.exe'
args: '--no-default-features --features native-tls,native-tls-vendored'
target:
- {
name: 'x86_64-unknown-linux-gnu',
platform: 'ubuntu-18.04',
ext: ''
}
- { name: 'x86_64-apple-darwin', platform: 'macos-latest', ext: '' }
- {
name: 'x86_64-pc-windows-msvc',
platform: 'windows-latest',
ext: '.exe'
}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: 'Setup Rust'
uses: dtolnay/rust-toolchain@stable
- name: install stable
uses: actions-rs/toolchain@v1
with:
targets: ${{ matrix.config.rust_target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.config.rust_target }}
toolchain: stable
- name: install Linux dependencies
if: matrix.config.os == 'ubuntu-latest'
if: matrix.target.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev
- name: Build CLI
- name: build CLI
uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path ./tooling/cli/Cargo.toml --release ${{ matrix.config.args }}
args: --manifest-path ./tooling/cli/Cargo.toml --release
- name: Upload CLI
uses: actions/upload-artifact@v3
with:
name: cargo-tauri-${{ matrix.config.rust_target }}${{ matrix.config.ext }}
path: tooling/cli/target/release/cargo-tauri${{ matrix.config.ext }}
name: cargo-tauri-${{ matrix.target.name }}${{ matrix.target.ext }}
path: tooling/cli/target/release/cargo-tauri${{ matrix.target.ext }}
if-no-files-found: error
upload:
@@ -93,7 +76,7 @@ jobs:
- name: Publish release
uses: softprops/action-gh-release@50195ba7f6f93d1ac97ba8332a178e008ad176aa
with:
tag_name: tauri-cli-v${{ env.CLI_VERSION }}
tag_name: cli.rs-v${{ env.CLI_VERSION }}
files: |
outputs/cargo-tauri-*.zip
outputs/cargo-tauri-*.tgz

View File

@@ -1,14 +1,14 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: test and lint bundler
name: test bundler
on:
push:
branches:
- dev
- 1.x
- next
pull_request:
paths:
- '.github/workflows/test-bundler.yml'
@@ -23,7 +23,7 @@ concurrency:
cancel-in-progress: true
jobs:
test:
build-tauri-bundler:
runs-on: ${{ matrix.platform }}
strategy:
@@ -48,7 +48,7 @@ jobs:
cd ./tooling/bundler
cargo test
fmt:
fmt_check:
runs-on: ubuntu-latest
steps:
@@ -66,7 +66,7 @@ jobs:
command: fmt
args: --manifest-path ./tooling/bundler/Cargo.toml --all -- --check
clippy:
clippy-check:
runs-on: ubuntu-latest
steps:

View File

@@ -1,18 +1,18 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: test `@tauri-apps/cli`
name: test cli.js
on:
push:
branches:
- dev
- 1.x
- next
pull_request:
paths:
- '.github/workflows/test-cli-js.yml'
# currently` @tauri-apps/cli` only tests the template
# currently cli.js only tests the template
- 'tooling/cli/templates/app/**'
env:
@@ -24,7 +24,7 @@ concurrency:
cancel-in-progress: true
jobs:
test:
test-tauri-js-cli:
runs-on: ${{ matrix.platform }}
strategy:

View File

@@ -1,14 +1,14 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: test `tauri-cli`
name: test cli.rs
on:
push:
branches:
- dev
- 1.x
- next
pull_request:
paths:
- '.github/workflows/test-cli-rs.yml'
@@ -23,7 +23,7 @@ concurrency:
cancel-in-progress: true
jobs:
test:
test-tauri-cli:
runs-on: ${{ matrix.platform }}
strategy:

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
@@ -8,7 +8,7 @@ on:
push:
branches:
- dev
- 1.x
- next
pull_request:
paths:
- '.github/workflows/test-core.yml'
@@ -24,7 +24,7 @@ concurrency:
cancel-in-progress: true
jobs:
test:
test-tauri-core:
runs-on: ${{ matrix.platform.os }}
strategy:
@@ -39,12 +39,12 @@ jobs:
- {
target: x86_64-unknown-linux-gnu,
os: ubuntu-latest,
toolchain: '1.60.0'
toolchain: '1.59.0'
}
- {
target: x86_64-apple-darwin,
os: macos-latest,
toolchain: '1.60.0'
toolchain: '1.59.0'
}
features:
- {
@@ -56,7 +56,7 @@ jobs:
key: api-all
}
- {
args: --features compression,wry,linux-protocol-headers,isolation,custom-protocol,api-all,cli,updater,system-tray,windows7-compat,http-multipart,test,
args: --features compression,wry,linux-protocol-headers,isolation,custom-protocol,api-all,cli,updater,system-tray,windows7-compat,http-multipart,
key: all
}
@@ -82,31 +82,5 @@ jobs:
workspaces: core -> ../target
save-if: ${{ matrix.features.key == 'all' }}
- name: Downgrade crates with MSRV conflict
# The --precise flag can only be used once per invocation.
run: |
cargo update -p toml:0.7.8 --precise 0.7.3
cargo update -p toml_edit --precise 0.19.8
cargo update -p toml_datetime --precise 0.6.1
cargo update -p serde_spanned --precise 0.6.1
cargo update -p winnow --precise 0.4.1
cargo update -p time --precise 0.3.15
cargo update -p ignore --precise 0.4.18
cargo update -p raw-window-handle --precise 0.5.0
cargo update -p cargo_toml:0.15.3 --precise 0.15.2
cargo update -p zbus --precise 3.13.0
cargo update -p zbus_names --precise 2.5.0
cargo update -p is-terminal --precise 0.4.7
cargo update -p colored --precise 2.0.2
cargo update -p tempfile --precise 3.6.0
cargo update -p serde_with:3.3.0 --precise 3.0.0
cargo update -p tokio --precise 1.29.0
cargo update -p flate2 --precise 1.0.26
cargo update -p h2 --precise 0.3.20
cargo update -p reqwest --precise 0.11.18
cargo update -p cfg-expr:0.15.5 --precise 0.15.4
cargo update -p memchr --precise 2.6.2
cargo update -p async-executor --precise 1.5.1
- name: test
run: cargo test --target ${{ matrix.platform.target }} ${{ matrix.features.args }}

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
@@ -8,7 +8,7 @@ on:
push:
branches:
- dev
- 1.x
- next
env:
RUST_BACKTRACE: 1

View File

@@ -1,6 +1,6 @@
#!/bin/sh
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
@@ -16,7 +16,7 @@ else
fi
if [ -z "$(git diff --name-only tooling/cli/node)" ]; then
echo "skipping \`@tauri-apps/cli\` - no changes detected"
echo "skipping cli.js - no changes detected"
else
cd tooling/cli/node
yarn format

View File

@@ -9,4 +9,4 @@ dist
/tooling/cli/templates
/tooling/cli/node
/tooling/cli/schema.json
/core/tauri-config-schema/schema.json
/core/config-schema/schema.json

View File

@@ -1,7 +1,3 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
module.exports = {
singleQuote: true,
semi: false,

View File

@@ -1,6 +1,5 @@
#!/usr/bin/env pwsh
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

View File

@@ -1,6 +1,5 @@
#!/usr/bin/env sh
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

View File

@@ -1,79 +0,0 @@
#!/usr/bin/env node
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
const fs = require('fs')
const path = require('path')
const ignorePackages = [
'tauri-macros',
'tauri-codegen',
'tauri-runtime',
'tauri-runtime-wry',
'tauri-driver'
]
const covectorConfig = JSON.parse(
fs.readFileSync('.changes/config.json', 'utf8')
)
const tags = Object.keys(covectorConfig.changeTags)
const missingTagsFiles = {}
const unknownTagsFiles = {}
function checkChangeFiles(changeFiles) {
for (const file of changeFiles) {
const content = fs.readFileSync(file, 'utf8')
const [frontMatter] = /^---[\s\S.]*---\n/i.exec(content)
const packages = frontMatter
.split('\n')
.filter((l) => !(l === '---' || !l))
.map((l) => l.replace(/('|")/g, '').split(':'))
for (const [package, _, tag] of packages) {
if (!tag) {
if (ignorePackages.includes(package)) continue
if (!missingTagsFiles[file]) missingTagsFiles[file] = []
missingTagsFiles[file].push(package)
} else if (!tags.includes(tag)) {
if (!unknownTagsFiles[file]) unknownTagsFiles[file] = []
unknownTagsFiles[file].push({ package, tag })
}
}
}
const missingTagsEntries = Object.entries(missingTagsFiles)
const unknownTagsEntries = Object.entries(unknownTagsFiles)
if (missingTagsEntries.length > 0 || unknownTagsEntries.length > 0) {
for (const [file, packages] of missingTagsEntries) {
for (const package of packages) {
console.error(
`Package \`${package}\` is missing a change tag in ${file} `
)
}
}
for (const [file, packages] of unknownTagsEntries) {
for (const { package, tag } of packages) {
console.error(
`Package \`${package}\` has an uknown change tag ${tag} in ${file} `
)
}
}
process.exit(1)
}
}
const [_bin, _script, ...files] = process.argv
if (files.length > 0) {
checkChangeFiles(files.filter((f) => f.toLowerCase() !== 'readme.md'))
} else {
const changeFiles = fs
.readdirSync('.changes')
.filter((f) => f.endsWith('.md') && f.toLowerCase() !== 'readme.md')
.map((p) => path.join('.changes', p))
checkChangeFiles(changeFiles)
}

View File

@@ -1,117 +0,0 @@
#!/usr/bin/env node
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
const fs = require('fs')
const path = require('path')
const readline = require('readline')
const header = `Copyright 2019-2023 Tauri Programme within The Commons Conservancy
SPDX-License-Identifier: Apache-2.0
SPDX-License-Identifier: MIT`
const bundlerLicense =
'// Copyright 2016-2019 Cargo-Bundle developers <https://github.com/burtonageo/cargo-bundle>'
const extensions = ['.rs', '.js', '.ts', '.yml']
const ignore = [
'target',
'templates',
'node_modules',
'gen',
'dist',
'bundle.js',
'bundle.global.js'
]
async function checkFile(file) {
if (extensions.some((e) => file.endsWith(e))) {
const fileStream = fs.createReadStream(file)
const rl = readline.createInterface({
input: fileStream,
crlfDelay: Infinity
})
let contents = ``
let i = 0
for await (let line of rl) {
// ignore empty lines, allow shebang and bundler license
if (
line.length === 0 ||
line.startsWith('#!') ||
line === bundlerLicense
) {
continue
}
// strip comment marker
if (line.startsWith('// ')) {
line = line.substring(3)
} else if (line.startsWith('# ')) {
line = line.substring(2)
}
contents += line
if (++i === 3) {
break
}
contents += '\n'
}
if (contents !== header) {
return true
}
}
return false
}
async function check(src) {
const missingHeader = []
for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
const p = path.join(src, entry.name)
if (entry.isSymbolicLink() || ignore.includes(entry.name)) {
continue
}
if (entry.isDirectory()) {
const missing = await check(p)
missingHeader.push(...missing)
} else {
const isMissing = await checkFile(p)
if (isMissing) {
missingHeader.push(p)
}
}
}
return missingHeader
}
const [_bin, _script, ...files] = process.argv
if (files.length > 0) {
async function run() {
const missing = []
for (const f of files) {
const isMissing = await checkFile(f)
if (isMissing) {
missing.push(f)
}
}
if (missing.length > 0) {
console.log(missing.join('\n'))
process.exit(1)
}
}
run()
} else {
check('.').then((missing) => {
if (missing.length > 0) {
console.log(missing.join('\n'))
process.exit(1)
}
})
}

View File

@@ -1,9 +1,5 @@
#!/bin/bash
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
if git diff --quiet --ignore-submodules HEAD
then
echo "working directory is clean"

View File

@@ -1,9 +1,4 @@
#!/bin/bash
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
set -euxo pipefail
for o in outputs/*; do

View File

@@ -1,6 +1,5 @@
#!/usr/bin/env node
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
@@ -20,10 +19,10 @@ let url = null
switch (kind) {
case 'cargo':
url = `https://crates.io/api/v1/crates/${packageName}`
break
break;
case 'npm':
url = `https://registry.npmjs.org/${packageName}`
break
break;
default:
throw new Error('unexpected kind ' + kind)
}
@@ -31,7 +30,7 @@ switch (kind) {
const options = {
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
'Accept': 'application/json',
'User-Agent': 'tauri (https://github.com/tauri-apps/tauri)'
}
}
@@ -45,12 +44,10 @@ https.get(url, options, (response) => {
response.on('end', function () {
const data = JSON.parse(chunks.join(''))
if (kind === 'cargo') {
const versions = data.versions.filter((v) => v.num.startsWith(target))
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)
)
const versions = Object.keys(data.versions).filter(v => v.startsWith(target))
console.log(versions[versions.length - 1] || '0.0.0')
}
})

View File

@@ -1,13 +1,12 @@
#!/usr/bin/env node
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 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 version` step to
keep the `../tooling/cli/metadata.json` up to date with other version bumps. Long term
we should look to find a more "rusty way" to import / "pin" a version value in our tauri-cli
we should look to find a more "rusty way" to import / "pin" a version value in our cli.rs
rust binaries.
*/
@@ -15,7 +14,7 @@ const { readFileSync, writeFileSync } = require('fs')
const packageNickname = process.argv[2]
const filePath =
packageNickname === '@tauri-apps/cli'
packageNickname === 'cli.js'
? `../../../tooling/cli/metadata.json`
: `../../tooling/cli/metadata.json`
const bump = process.argv[3]
@@ -52,9 +51,9 @@ const metadata = JSON.parse(readFileSync(filePath, 'utf-8'))
// set field version
let version
if (packageNickname === '@tauri-apps/cli') {
version = inc(metadata['cli.js'].version)
metadata['cli.js'].version = version
if (packageNickname === 'cli.js') {
version = inc(metadata[packageNickname].version)
metadata[packageNickname].version = version
} else {
version = inc(metadata[packageNickname])
metadata[packageNickname] = version

View File

@@ -1,7 +1,3 @@
#!/bin/sh
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
docker build -t aarch64-unknown-linux-gnu:latest --file .docker/cross/aarch64.Dockerfile .docker/cross

View File

@@ -1,6 +1,5 @@
#!/usr/bin/env pwsh
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

View File

@@ -1,6 +1,5 @@
#!/usr/bin/env bash
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

View File

@@ -1,6 +1,5 @@
#!/usr/bin/env sh
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

View File

@@ -1,10 +1,6 @@
: Copyright 2019-2023 Tauri Programme within The Commons Conservancy
: SPDX-License-Identifier: Apache-2.0
: SPDX-License-Identifier: MIT
@ECHO OFF
REM Copyright 2019-2023 Tauri Programme within The Commons Conservancy
REM Copyright 2019-2022 Tauri Programme within The Commons Conservancy
REM SPDX-License-Identifier: Apache-2.0
REM SPDX-License-Identifier: MIT

View File

@@ -39,16 +39,16 @@ This is common code that is reused in many places and offers useful utilities li
### Tauri Tooling
#### [@tauri-apps/api](https://github.com/tauri-apps/tauri/tree/dev/tooling/api) [TS -> JS]
#### [api](https://github.com/tauri-apps/tauri/tree/dev/tooling/api) [TS -> JS]
A TypeScript library that creates `cjs` and `esm` JavaScript endpoints for you to import into your Frontend framework so that the Webview can call and listen to backend activity. We also ship the pure TypeScript, because for some frameworks this is more optimal. It uses the message passing of webviews to their hosts.
#### [bundler](https://github.com/tauri-apps/tauri/tree/dev/tooling/bundler) [RUST / SHELL]
The bundler is a library that builds a Tauri App for the platform triple it detects / is told. At the moment it currently supports macOS, Windows and Linux - but in the near future will support mobile platforms as well. May be used outside of Tauri projects.
#### [@tauri-apps/cli](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli/node) [JS]
It is a wrapper around [tauri-cli](https://github.com/tauri-apps/tauri/blob/dev/tooling/cli) using [napi-rs](https://github.com/napi-rs/napi-rs) to produce NPM packages for each platform.
#### [cli.js](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli/node) [JS]
It is a wrapper around [cli.rs](https://github.com/tauri-apps/tauri/blob/dev/tooling/cli) using [napi-rs](https://github.com/napi-rs/napi-rs) to produce NPM packages for each platform.
#### [tauri-cli](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli) [RUST]
#### [cli.rs](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli) [RUST]
This rust executable provides the full interface to all of the required activities for which the CLI is required. It will run on macOS, Windows, and Linux.
#### [create-tauri-app](https://github.com/tauri-apps/create-tauri-app) [JS]
@@ -67,6 +67,9 @@ Tauri uses WRY as the abstract layer responsible to determine which webview is u
# Additional tooling
## [binary-releases](https://github.com/tauri-apps/binary-releases)
This is the delivery mechanism for tauri prebuilt binaries: currently the cli.rs (used by cli.js) and rustup binaries (used by the deps install command of cli.js). These artifacts are automatically created on release.
## [tauri-action](https://github.com/tauri-apps/tauri-action)
This is a github workflow that builds tauri binaries for all platforms. It is not the fastest out there, but it gets the job done and is highly configurable. Even allowing you to create a (very basic) tauri app even if tauri is not setup.
@@ -116,7 +119,7 @@ This will do several things:
1. start the JS Framework devserver
2. begin the long process of downloading and compiling the rust libraries
3. open an application window with devtools enabled
4. keep a long-lived console alive
4. keep a long-lived console alive
If you change your HTML/CSS/TS/JS, your framework devserver should give you its best shot at instant hot module reloading and you will see the changes instantly.
@@ -146,7 +149,7 @@ After some time, the process will end and you can see the results in the `./src-
End users will be provided with binaries in ways that are appropriate for their systems. Whether macOS, Linux, or Windows, direct download or store installations - they will be able to follow procedures for installing and removing that they are used to.
## What does the Updating flow look like?
When a new version is ready, the developer publishes the new signed artifacts to a server (that they have configured within `tauri.conf.json`).
When a new version is ready, the developer publishes the new signed artifacts to a server (that they have configured within `tauri.conf.json`).
The application can poll this server to see if there is a new release. When there is a new release, the user is prompted to update. The application update is downloaded, verified (checksum & signature), updated, closed, and restarted.

View File

@@ -1,5 +1,4 @@
[workspace]
resolver = "2"
members = [
# core
"core/tauri",
@@ -9,11 +8,11 @@ members = [
"core/tauri-utils",
"core/tauri-build",
"core/tauri-codegen",
"core/tauri-config-schema",
"core/config-schema",
# integration tests
"core/tests/restart",
"core/tests/app-updater",
"core/tests/app-updater"
]
exclude = [
@@ -23,7 +22,7 @@ exclude = [
"examples/resources/src-tauri",
"examples/sidecar/src-tauri",
"examples/web/core",
"examples/workspace",
"examples/workspace"
]
# default to small, optimized workspace release binaries

View File

@@ -2,7 +2,7 @@
[![status](https://img.shields.io/badge/status-stable-blue.svg)](https://github.com/tauri-apps/tauri/tree/dev)
[![License](https://img.shields.io/badge/License-MIT%20or%20Apache%202-green.svg)](https://opencollective.com/tauri)
[![test core](https://img.shields.io/github/actions/workflow/status/tauri-apps/tauri/test-core.yml?label=test%20core&logo=github)](https://github.com/tauri-apps/tauri/actions/workflows/test-core.yml)
[![test library](https://img.shields.io/github/workflow/status/tauri-apps/tauri/test%20library?label=test%20library)](https://github.com/tauri-apps/tauri/actions?query=workflow%3A%22test+library%22)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Ftauri-apps%2Ftauri.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Ftauri-apps%2Ftauri?ref=badge_shield)
[![Chat Server](https://img.shields.io/badge/chat-discord-7289da.svg)](https://discord.gg/SpmNs4S)
[![website](https://img.shields.io/badge/website-tauri.app-purple.svg)](https://tauri.app)
@@ -25,12 +25,12 @@
### Tooling
| Component | Description | Version | Lin | Win | Mac |
| ------------------------------------------------------------------------------------ | ---------------------------------------- | ------------------------------------------------------------------------------------------------------ | --- | --- | --- |
| [**bundler**](https://github.com/tauri-apps/tauri/tree/dev/tooling/bundler) | manufacture the final binaries | [![](https://img.shields.io/crates/v/tauri-bundler.svg)](https://crates.io/crates/tauri-bundler) | ✅ | ✅ | ✅ |
| [**tauri-cli**](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli) | create, develop and build apps | [![](https://img.shields.io/crates/v/tauri-cli.svg)](https://crates.io/crates/tauri-cli) | ✅ | ✅ | ✅ |
| [**@tauri-apps/cli**](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli/node) | Node.js CLI wrapper for `tauri-cli` | [![](https://img.shields.io/npm/v/@tauri-apps/cli.svg)](https://www.npmjs.com/package/@tauri-apps/cli) | ✅ | ✅ | ✅ |
| [**@tauri-apps/api**](https://github.com/tauri-apps/tauri/tree/dev/tooling/api) | JS API for interaction with Rust backend | [![](https://img.shields.io/npm/v/@tauri-apps/api.svg)](https://www.npmjs.com/package/@tauri-apps/api) | ✅ | ✅ | ✅ |
| Component | Description | Version | Lin | Win | Mac |
| --------------------------------------------------------------------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------ | --- | --- | --- |
| [**bundler**](https://github.com/tauri-apps/tauri/tree/dev/tooling/bundler) | manufacture the final binaries | [![](https://img.shields.io/crates/v/tauri-bundler.svg)](https://crates.io/crates/tauri-bundler) | ✅ | ✅ | ✅ |
| [**api.js**](https://github.com/tauri-apps/tauri/tree/dev/tooling/api) | JS API for interaction with Rust backend | [![](https://img.shields.io/npm/v/@tauri-apps/api.svg)](https://www.npmjs.com/package/@tauri-apps/api) | ✅ | ✅ | ✅ |
| [**cli.rs**](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli) | create, develop and build apps | [![](https://img.shields.io/crates/v/tauri-cli.svg)](https://crates.io/crates/tauri-cli) | ✅ | ✅ | ✅ |
| [**cli.js**](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli/node) | Node.js CLI wrapper for cli.rs | [![](https://img.shields.io/npm/v/@tauri-apps/cli.svg)](https://www.npmjs.com/package/@tauri-apps/cli) | ✅ | ✅ | ✅ |
### Utilities and Plugins
@@ -75,8 +75,6 @@ For **running** Tauri apps we support the below configurations (these are automa
- `webkit2gtk`, `gtk3`, `libayatana-appindicator`<sup>1</sup>
- Fedora (latest 2 versions) with the following packages installed:
- `webkit2gtk3`, `gtk3`, `libappindicator-gtk3`<sup>1</sup>
- Void with the following packages installed:
- `webkit2gtk`, `gtk+3`, `libappindicator`<sup>1</sup>
<sup>1</sup> `appindicator` is only required if system trays are used

View File

@@ -0,0 +1,13 @@
[package]
name = "config-schema"
version = "0.0.0"
edition = "2021"
publish = false
[build-dependencies]
tauri-utils = { version = "1.0.0", features = [ "schema" ], path = "../tauri-utils" }
schemars = { version = "0.8", features = [ "url", "preserve_order" ] }
serde = { version = "1.0", features = [ "derive" ] }
serde_json = "1.0"
serde_with = "1.12"
url = { version = "2.3", features = [ "serde" ] }

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@@ -105,7 +105,6 @@
"print": false,
"requestUserAttention": false,
"setAlwaysOnTop": false,
"setClosable": false,
"setContentProtected": false,
"setCursorGrab": false,
"setCursorIcon": false,
@@ -117,9 +116,7 @@
"setIcon": false,
"setIgnoreCursorEvents": false,
"setMaxSize": false,
"setMaximizable": false,
"setMinSize": false,
"setMinimizable": false,
"setPosition": false,
"setResizable": false,
"setSize": false,
@@ -166,8 +163,6 @@
},
"security": {
"dangerousDisableAssetCspModification": false,
"dangerousRemoteDomainIpcAccess": [],
"dangerousUseHttpScheme": false,
"freezePrototype": false
},
"updater": {
@@ -213,7 +208,7 @@
"additionalProperties": false,
"definitions": {
"PackageConfig": {
"description": "The package configuration.\n\nSee more: https://tauri.app/v1/api/config#packageconfig",
"description": "The package configuration.",
"type": "object",
"properties": {
"productName": {
@@ -225,7 +220,7 @@
"pattern": "^[^/\\:*?\"<>|]+$"
},
"version": {
"description": "App version. It is a semver version number or a path to a `package.json` file containing the `version` field. If removed the version number from `Cargo.toml` is used.",
"description": "App version. It is a semver version number or a path to a `package.json` file containing the `version` field.",
"default": null,
"type": [
"string",
@@ -236,7 +231,7 @@
"additionalProperties": false
},
"TauriConfig": {
"description": "The Tauri configuration object.\n\nSee more: https://tauri.app/v1/api/config#tauriconfig",
"description": "The Tauri configuration object.",
"type": "object",
"properties": {
"pattern": {
@@ -387,7 +382,6 @@
"print": false,
"requestUserAttention": false,
"setAlwaysOnTop": false,
"setClosable": false,
"setContentProtected": false,
"setCursorGrab": false,
"setCursorIcon": false,
@@ -399,9 +393,7 @@
"setIcon": false,
"setIgnoreCursorEvents": false,
"setMaxSize": false,
"setMaximizable": false,
"setMinSize": false,
"setMinimizable": false,
"setPosition": false,
"setResizable": false,
"setSize": false,
@@ -423,8 +415,6 @@
"description": "Security configuration.",
"default": {
"dangerousDisableAssetCspModification": false,
"dangerousRemoteDomainIpcAccess": [],
"dangerousUseHttpScheme": false,
"freezePrototype": false
},
"allOf": [
@@ -518,7 +508,7 @@
]
},
"WindowConfig": {
"description": "The window configuration object.\n\nSee more: https://tauri.app/v1/api/config#windowconfig",
"description": "The window configuration object.",
"type": "object",
"properties": {
"label": {
@@ -613,22 +603,7 @@
"format": "double"
},
"resizable": {
"description": "Whether the window is resizable or not. When resizable is set to false, native window's maximize button is automatically disabled.",
"default": true,
"type": "boolean"
},
"maximizable": {
"description": "Whether the window's native maximize button is enabled or not. If resizable is set to false, this setting is ignored.\n\n## Platform-specific\n\n- **macOS:** Disables the \"zoom\" button in the window titlebar, which is also used to enter fullscreen mode. - **Linux / iOS / Android:** Unsupported.",
"default": true,
"type": "boolean"
},
"minimizable": {
"description": "Whether the window's native minimize button is enabled or not.\n\n## Platform-specific\n\n- **Linux / iOS / Android:** Unsupported.",
"default": true,
"type": "boolean"
},
"closable": {
"description": "Whether the window's native close button is enabled or not.\n\n## Platform-specific\n\n- **Linux:** \"GTK+ will do its best to convince the window manager not to show a close button. Depending on the system, this function may not have any effect when called on a window that is already visible\" - **iOS / Android:** Unsupported.",
"description": "Whether the window is resizable or not.",
"default": true,
"type": "boolean"
},
@@ -789,7 +764,7 @@
]
},
"CliConfig": {
"description": "describes a CLI configuration\n\nSee more: https://tauri.app/v1/api/config#cliconfig",
"description": "describes a CLI configuration",
"type": "object",
"properties": {
"description": {
@@ -1035,7 +1010,7 @@
"additionalProperties": false
},
"BundleConfig": {
"description": "Configuration for tauri-bundler.\n\nSee more: https://tauri.app/v1/api/config#bundleconfig",
"description": "Configuration for tauri-bundler.",
"type": "object",
"required": [
"identifier"
@@ -1076,14 +1051,13 @@
},
"resources": {
"description": "App resources to bundle. Each resource is a path to a file or directory. Glob patterns are supported.",
"anyOf": [
{
"$ref": "#/definitions/BundleResources"
},
{
"type": "null"
}
]
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"copyright": {
"description": "A copyright string associated with your application.",
@@ -1261,27 +1235,8 @@
}
]
},
"BundleResources": {
"description": "Definition for bundle resources. Can be either a list of paths to include or a map of source to target paths.",
"anyOf": [
{
"description": "A list of paths to include.",
"type": "array",
"items": {
"type": "string"
}
},
{
"description": "A map of source to target paths.",
"type": "object",
"additionalProperties": {
"type": "string"
}
}
]
},
"AppImageConfig": {
"description": "Configuration for AppImage bundles.\n\nSee more: https://tauri.app/v1/api/config#appimageconfig",
"description": "Configuration for AppImage bundles.",
"type": "object",
"properties": {
"bundleMediaFramework": {
@@ -1293,7 +1248,7 @@
"additionalProperties": false
},
"DebConfig": {
"description": "Configuration for Debian (.deb) bundles.\n\nSee more: https://tauri.app/v1/api/config#debconfig",
"description": "Configuration for Debian (.deb) bundles.",
"type": "object",
"properties": {
"depends": {
@@ -1313,19 +1268,12 @@
"additionalProperties": {
"type": "string"
}
},
"desktopTemplate": {
"description": "Path to a custom desktop file Handlebars template.\n\nAvailable variables: `categories`, `comment` (optional), `exec`, `icon` and `name`.",
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
},
"MacConfig": {
"description": "Configuration for the macOS bundles.\n\nSee more: https://tauri.app/v1/api/config#macconfig",
"description": "Configuration for the macOS bundles.",
"type": "object",
"properties": {
"frameworks": {
@@ -1385,7 +1333,7 @@
"additionalProperties": false
},
"WindowsConfig": {
"description": "Windows bundler configuration.\n\nSee more: https://tauri.app/v1/api/config#windowsconfig",
"description": "Windows bundler configuration.",
"type": "object",
"properties": {
"digestAlgorithm": {
@@ -1483,7 +1431,7 @@
"additionalProperties": false
},
{
"description": "Download the bootstrapper and run it. Requires an internet connection. Results in a smaller installer size, but is not recommended on Windows 7.",
"description": "Download the bootstrapper and run it. Requires internet connection. Results in a smaller installer size, but is not recommended on Windows 7.",
"type": "object",
"required": [
"type"
@@ -1504,7 +1452,7 @@
"additionalProperties": false
},
{
"description": "Embed the bootstrapper and run it. Requires an internet connection. Increases the installer size by around 1.8MB, but offers better support on Windows 7.",
"description": "Embed the bootstrapper and run it. Requires internet connection. Increases the installer size by around 1.8MB, but offers better support on Windows 7.",
"type": "object",
"required": [
"type"
@@ -1525,7 +1473,7 @@
"additionalProperties": false
},
{
"description": "Embed the offline installer and run it. Does not require an internet connection. Increases the installer size by around 127MB.",
"description": "Embed the offline installer and run it. Does not require internet connection. Increases the installer size by around 127MB.",
"type": "object",
"required": [
"type"
@@ -1569,7 +1517,7 @@
]
},
"WixConfig": {
"description": "Configuration for the MSI bundle using WiX.\n\nSee more: https://tauri.app/v1/api/config#wixconfig",
"description": "Configuration for the MSI bundle using WiX.",
"type": "object",
"properties": {
"language": {
@@ -1694,7 +1642,7 @@
]
},
"WixLanguageConfig": {
"description": "Configuration for a target language for the WiX build.\n\nSee more: https://tauri.app/v1/api/config#wixlanguageconfig",
"description": "Configuration for a target language for the WiX build.",
"type": "object",
"properties": {
"localePath": {
@@ -1711,13 +1659,6 @@
"description": "Configuration for the Installer bundle using NSIS.",
"type": "object",
"properties": {
"template": {
"description": "A custom .nsi template to use.",
"type": [
"string",
"null"
]
},
"license": {
"description": "The path to the license file to render on the installer.",
"type": [
@@ -1754,42 +1695,6 @@
"$ref": "#/definitions/NSISInstallerMode"
}
]
},
"languages": {
"description": "A list of installer languages. By default the OS language is used. If the OS language is not in the list of languages, the first language will be used. To allow the user to select the language, set `display_language_selector` to `true`.\n\nSee <https://github.com/kichik/nsis/tree/9465c08046f00ccb6eda985abbdbf52c275c6c4d/Contrib/Language%20files> for the complete list of languages.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"customLanguageFiles": {
"description": "A key-value pair where the key is the language and the value is the path to a custom `.nsh` file that holds the translated text for tauri's custom messages.\n\nSee <https://github.com/tauri-apps/tauri/blob/dev/tooling/bundler/src/bundle/windows/templates/nsis-languages/English.nsh> for an example `.nsh` file.\n\n**Note**: the key must be a valid NSIS language and it must be added to [`NsisConfig`] languages array,",
"type": [
"object",
"null"
],
"additionalProperties": {
"type": "string"
}
},
"displayLanguageSelector": {
"description": "Whether to display a language selector dialog before the installer and uninstaller windows are rendered or not. By default the OS language is selected, with a fallback to the first language in the `languages` array.",
"default": false,
"type": "boolean"
},
"compression": {
"description": "Set the compression algorithm used to compress files in the installer.\n\nSee <https://nsis.sourceforge.io/Reference/SetCompressor>",
"anyOf": [
{
"$ref": "#/definitions/NsisCompression"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
@@ -1820,32 +1725,6 @@
}
]
},
"NsisCompression": {
"description": "Compression algorithms used in the NSIS installer.\n\nSee <https://nsis.sourceforge.io/Reference/SetCompressor>",
"oneOf": [
{
"description": "ZLIB uses the deflate algorithm, it is a quick and simple method. With the default compression level it uses about 300 KB of memory.",
"type": "string",
"enum": [
"zlib"
]
},
{
"description": "BZIP2 usually gives better compression ratios than ZLIB, but it is a bit slower and uses more memory. With the default compression level it uses about 4 MB of memory.",
"type": "string",
"enum": [
"bzip2"
]
},
{
"description": "LZMA (default) is a new compression method that gives very good compression ratios. The decompression speed is high (10-20 MB/s on a 2 GHz CPU), the compression speed is lower. The memory size that will be used for decompression is the dictionary size plus a few KBs, the default is 8 MB.",
"type": "string",
"enum": [
"lzma"
]
}
]
},
"AllowlistConfig": {
"description": "Allowlist configuration. The allowlist is a translation of the [Cargo allowlist features](https://docs.rs/tauri/latest/tauri/#cargo-allowlist-features).\n\n# Notes\n\n- Endpoints that don't have their own allowlist option are enabled by default. - There is only \"opt-in\", no \"opt-out\". Setting an option to `false` has no effect.\n\n# Examples\n\n- * [`\"app-all\": true`](https://tauri.app/v1/api/config/#appallowlistconfig.all) will make the [hide](https://tauri.app/v1/api/js/app#hide) endpoint be available regardless of whether `hide` is set to `false` or `true` in the allowlist.",
"type": "object",
@@ -1889,7 +1768,6 @@
"print": false,
"requestUserAttention": false,
"setAlwaysOnTop": false,
"setClosable": false,
"setContentProtected": false,
"setCursorGrab": false,
"setCursorIcon": false,
@@ -1901,9 +1779,7 @@
"setIcon": false,
"setIgnoreCursorEvents": false,
"setMaxSize": false,
"setMaximizable": false,
"setMinSize": false,
"setMinimizable": false,
"setPosition": false,
"setResizable": false,
"setSize": false,
@@ -2065,7 +1941,7 @@
"additionalProperties": false
},
"FsAllowlistConfig": {
"description": "Allowlist for the file system APIs.\n\nSee more: https://tauri.app/v1/api/config#fsallowlistconfig",
"description": "Allowlist for the file system APIs.",
"type": "object",
"properties": {
"scope": {
@@ -2159,20 +2035,13 @@
"items": {
"type": "string"
}
},
"requireLiteralLeadingDot": {
"description": "Whether or not paths that contain components that start with a `.` will require that `.` appears literally in the pattern; `*`, `?`, `**`, or `[...]` will not match. This is useful because such files are conventionally considered hidden on Unix systems and it might be desirable to skip them when listing files.\n\nDefaults to `true` on Unix systems and `false` on Windows",
"type": [
"boolean",
"null"
]
}
}
}
]
},
"WindowAllowlistConfig": {
"description": "Allowlist for the window APIs.\n\nSee more: https://tauri.app/v1/api/config#windowallowlistconfig",
"description": "Allowlist for the window APIs.",
"type": "object",
"properties": {
"all": {
@@ -2200,21 +2069,6 @@
"default": false,
"type": "boolean"
},
"setMaximizable": {
"description": "Allows setting whether the window's native maximize button is enabled or not.",
"default": false,
"type": "boolean"
},
"setMinimizable": {
"description": "Allows setting whether the window's native minimize button is enabled or not.",
"default": false,
"type": "boolean"
},
"setClosable": {
"description": "Allows setting whether the window's native close button is enabled or not.",
"default": false,
"type": "boolean"
},
"setTitle": {
"description": "Allows changing the window title.",
"default": false,
@@ -2349,7 +2203,7 @@
"additionalProperties": false
},
"ShellAllowlistConfig": {
"description": "Allowlist for the shell APIs.\n\nSee more: https://tauri.app/v1/api/config#shellallowlistconfig",
"description": "Allowlist for the shell APIs.",
"type": "object",
"properties": {
"scope": {
@@ -2480,7 +2334,7 @@
]
},
"DialogAllowlistConfig": {
"description": "Allowlist for the dialog APIs.\n\nSee more: https://tauri.app/v1/api/config#dialogallowlistconfig",
"description": "Allowlist for the dialog APIs.",
"type": "object",
"properties": {
"all": {
@@ -2517,7 +2371,7 @@
"additionalProperties": false
},
"HttpAllowlistConfig": {
"description": "Allowlist for the HTTP APIs.\n\nSee more: https://tauri.app/v1/api/config#httpallowlistconfig",
"description": "Allowlist for the HTTP APIs.",
"type": "object",
"properties": {
"scope": {
@@ -2543,7 +2397,7 @@
"additionalProperties": false
},
"HttpAllowlistScope": {
"description": "HTTP API scope definition. It is a list of URLs that can be accessed by the webview when using the HTTP APIs. The scoped URL is matched against the request URL using a glob pattern.\n\nExamples: - \"https://*\": allows all HTTPS urls - \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path - \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"",
"description": "HTTP API scope definition. It is a list of URLs that can be accessed by the webview when using the HTTP APIs. The scoped URL is matched against the request URL using a glob pattern.\n\nExamples: - \"https://**\": allows all HTTPS urls - \"https://*.github.com/tauri-apps/tauri\": allows any subdomain of \"github.com\" with the \"tauri-apps/api\" path - \"https://myapi.service.com/users/*\": allows access to any URLs that begins with \"https://myapi.service.com/users/\"",
"type": "array",
"items": {
"type": "string",
@@ -2551,7 +2405,7 @@
}
},
"NotificationAllowlistConfig": {
"description": "Allowlist for the notification APIs.\n\nSee more: https://tauri.app/v1/api/config#notificationallowlistconfig",
"description": "Allowlist for the notification APIs.",
"type": "object",
"properties": {
"all": {
@@ -2563,7 +2417,7 @@
"additionalProperties": false
},
"GlobalShortcutAllowlistConfig": {
"description": "Allowlist for the global shortcut APIs.\n\nSee more: https://tauri.app/v1/api/config#globalshortcutallowlistconfig",
"description": "Allowlist for the global shortcut APIs.",
"type": "object",
"properties": {
"all": {
@@ -2575,7 +2429,7 @@
"additionalProperties": false
},
"OsAllowlistConfig": {
"description": "Allowlist for the OS APIs.\n\nSee more: https://tauri.app/v1/api/config#osallowlistconfig",
"description": "Allowlist for the OS APIs.",
"type": "object",
"properties": {
"all": {
@@ -2587,7 +2441,7 @@
"additionalProperties": false
},
"PathAllowlistConfig": {
"description": "Allowlist for the path APIs.\n\nSee more: https://tauri.app/v1/api/config#pathallowlistconfig",
"description": "Allowlist for the path APIs.",
"type": "object",
"properties": {
"all": {
@@ -2599,7 +2453,7 @@
"additionalProperties": false
},
"ProtocolAllowlistConfig": {
"description": "Allowlist for the custom protocols.\n\nSee more: https://tauri.app/v1/api/config#protocolallowlistconfig",
"description": "Allowlist for the custom protocols.",
"type": "object",
"properties": {
"assetScope": {
@@ -2625,7 +2479,7 @@
"additionalProperties": false
},
"ProcessAllowlistConfig": {
"description": "Allowlist for the process APIs.\n\nSee more: https://tauri.app/v1/api/config#processallowlistconfig",
"description": "Allowlist for the process APIs.",
"type": "object",
"properties": {
"all": {
@@ -2652,7 +2506,7 @@
"additionalProperties": false
},
"ClipboardAllowlistConfig": {
"description": "Allowlist for the clipboard APIs.\n\nSee more: https://tauri.app/v1/api/config#clipboardallowlistconfig",
"description": "Allowlist for the clipboard APIs.",
"type": "object",
"properties": {
"all": {
@@ -2674,7 +2528,7 @@
"additionalProperties": false
},
"AppAllowlistConfig": {
"description": "Allowlist for the app APIs.\n\nSee more: https://tauri.app/v1/api/config#appallowlistconfig",
"description": "Allowlist for the app APIs.",
"type": "object",
"properties": {
"all": {
@@ -2696,7 +2550,7 @@
"additionalProperties": false
},
"SecurityConfig": {
"description": "Security configuration.\n\nSee more: https://tauri.app/v1/api/config#securityconfig",
"description": "Security configuration.",
"type": "object",
"properties": {
"csp": {
@@ -2734,19 +2588,6 @@
"$ref": "#/definitions/DisabledCspModificationKind"
}
]
},
"dangerousRemoteDomainIpcAccess": {
"description": "Allow external domains to send command to Tauri.\n\nBy default, external domains do not have access to `window.__TAURI__`, which means they cannot communicate with the commands defined in Rust. This prevents attacks where an externally loaded malicious or compromised sites could start executing commands on the user's device.\n\nThis configuration allows a set of external domains to have access to the Tauri commands. When you configure a domain to be allowed to access the IPC, all subpaths are allowed. Subdomains are not allowed.\n\n**WARNING:** Only use this option if you either have internal checks against malicious external sites or you can trust the allowed external sites. You application might be vulnerable to dangerous Tauri command related attacks otherwise.",
"default": [],
"type": "array",
"items": {
"$ref": "#/definitions/RemoteDomainAccessScope"
}
},
"dangerousUseHttpScheme": {
"description": "Sets whether the custom protocols should use `http://<scheme>.localhost` instead of the default `https://<scheme>.localhost` on Windows.\n\n**WARNING:** Using a `http` scheme will allow mixed content when trying to fetch `http` endpoints and is therefore less secure but will match the behavior of the `<scheme>://localhost` protocols used on macOS and Linux.",
"default": false,
"type": "boolean"
}
},
"additionalProperties": false
@@ -2799,50 +2640,8 @@
}
]
},
"RemoteDomainAccessScope": {
"description": "External command access definition.",
"type": "object",
"required": [
"domain",
"windows"
],
"properties": {
"scheme": {
"description": "The URL scheme to allow. By default, all schemas are allowed.",
"type": [
"string",
"null"
]
},
"domain": {
"description": "The domain to allow.",
"type": "string"
},
"windows": {
"description": "The list of window labels this scope applies to.",
"type": "array",
"items": {
"type": "string"
}
},
"plugins": {
"description": "The list of plugins that are allowed in this scope. The names should be without the `tauri-plugin-` prefix, for example `\"store\"` for `tauri-plugin-store`.",
"default": [],
"type": "array",
"items": {
"type": "string"
}
},
"enableTauriAPI": {
"description": "Enables access to the Tauri API.",
"default": false,
"type": "boolean"
}
},
"additionalProperties": false
},
"UpdaterConfig": {
"description": "The Updater configuration object.\n\nSee more: https://tauri.app/v1/api/config#updaterconfig",
"description": "The Updater configuration object.",
"type": "object",
"properties": {
"active": {
@@ -2891,7 +2690,7 @@
"format": "uri"
},
"UpdaterWindowsConfig": {
"description": "The updater configuration for Windows.\n\nSee more: https://tauri.app/v1/api/config#updaterwindowsconfig",
"description": "The updater configuration for Windows.",
"type": "object",
"properties": {
"installerArgs": {
@@ -2925,7 +2724,7 @@
]
},
{
"description": "The quiet mode means there's no user interaction required. Requires admin privileges if the installer does.",
"description": "The quiet mode means there's no user interaction required. Requires admin privileges if the installer does (WiX).",
"type": "string",
"enum": [
"quiet"
@@ -2941,7 +2740,7 @@
]
},
"SystemTrayConfig": {
"description": "Configuration for application system tray icon.\n\nSee more: https://tauri.app/v1/api/config#systemtrayconfig",
"description": "Configuration for application system tray icon.",
"type": "object",
"required": [
"iconPath"
@@ -2972,7 +2771,7 @@
"additionalProperties": false
},
"BuildConfig": {
"description": "The Build configuration object.\n\nSee more: https://tauri.app/v1/api/config#buildconfig",
"description": "The Build configuration object.",
"type": "object",
"properties": {
"runner": {
@@ -3135,7 +2934,7 @@
]
},
"PluginConfig": {
"description": "The plugin configs holds a HashMap mapping a plugin name to its configuration object.\n\nSee more: https://tauri.app/v1/api/config#pluginconfig",
"description": "The plugin configs holds a HashMap mapping a plugin name to its configuration object.",
"type": "object",
"additionalProperties": true
}

View File

@@ -0,0 +1 @@
fn main() {}

View File

@@ -1,38 +1,5 @@
# Changelog
## \[1.4.1]
### Bug Fixes
- [`5ecb46b3`](https://www.github.com/tauri-apps/tauri/commit/5ecb46b3410afd1b5c82494c1e0a91d5a358c41a)([#7773](https://www.github.com/tauri-apps/tauri/pull/7773)) Automatically set rpath on macOS if frameworks are bundled and copy frameworks to `src-tauri/target/Frameworks` for usage in development.
- [`290e366a`](https://www.github.com/tauri-apps/tauri/commit/290e366ae98e9a52b1b43bfd3e285150427ebffa)([#7419](https://www.github.com/tauri-apps/tauri/pull/7419)) Correctly copy the WebView2 runtime in development when `webviewInstallMode` is used instead of `webviewFixedRuntimePath`.
### Dependencies
- Upgraded to `tauri-utils@1.5.0`
- Upgraded to `tauri-codegen@1.4.1`
## \[1.4.0]
### Enhancements
- [`52474e47`](https://www.github.com/tauri-apps/tauri/commit/52474e479d695865299d8c8d868fb98b99731020)([#7141](https://www.github.com/tauri-apps/tauri/pull/7141)) Enhance Cargo features check.
- [`af937290`](https://www.github.com/tauri-apps/tauri/commit/af93729031565a69d1fde6cf16bea3b9b6e43a65)([#6676](https://www.github.com/tauri-apps/tauri/pull/6676)) On Windows, set `LegalCopyright` and `FileDescription` file properties on the executable from `tauri.bundle.copyright` and `tauri.bundle.shortDescription`,
- [`d2710e9d`](https://www.github.com/tauri-apps/tauri/commit/d2710e9d2e8fd93975ef6494512370faa8cb3b7e)([#6944](https://www.github.com/tauri-apps/tauri/pull/6944)) Unpin `time`, `ignore`, and `winnow` crate versions. Developers now have to pin crates if needed themselves. A list of crates that need pinning to adhere to Tauri's MSRV will be visible in Tauri's GitHub workflow: https://github.com/tauri-apps/tauri/blob/dev/.github/workflows/test-core.yml#L85.
## \[1.3.0]
- Bump minimum supported Rust version to 1.60.
- [5fdc616d](https://www.github.com/tauri-apps/tauri/commit/5fdc616df9bea633810dcb814ac615911d77222c) feat: Use the zbus-backed of notify-rust ([#6332](https://www.github.com/tauri-apps/tauri/pull/6332)) on 2023-03-31
- Add initial support for building `nsis` bundles on non-Windows platforms.
- [60e6f6c3](https://www.github.com/tauri-apps/tauri/commit/60e6f6c3f1605f3064b5bb177992530ff788ccf0) feat(bundler): Add support for creating NSIS bundles on unix hosts ([#5788](https://www.github.com/tauri-apps/tauri/pull/5788)) on 2023-01-19
- Add `WindowsAttributes::app_manifest` to specify the application manifest on Windows.
- [bca09f7f](https://www.github.com/tauri-apps/tauri/commit/bca09f7f5ff1c9c5a4b51da043bdd5da668a179b) feat(tauri-build): add option to specify Windows manifest, closes [#5584](https://www.github.com/tauri-apps/tauri/pull/5584) ([#5730](https://www.github.com/tauri-apps/tauri/pull/5730)) on 2022-12-14
- Added support for Cargo's workspace inheritance for package information. The cli now also detects inherited `tauri` and `tauri-build` dependencies and disables manifest rewrites accordingly.
- [cd8c074a](https://www.github.com/tauri-apps/tauri/commit/cd8c074ae6592303d3f6844a4fb6d262eae913b2) feat(cli): add support for Cargo's workspace inheritance for the package version, closes [#5070](https://www.github.com/tauri-apps/tauri/pull/5070) ([#5775](https://www.github.com/tauri-apps/tauri/pull/5775)) on 2022-12-14
- [d20a7288](https://www.github.com/tauri-apps/tauri/commit/d20a728892eee1858ab525ab6216cd721f473ab5) feat: Further improve workspace inheritance, closes [#6122](https://www.github.com/tauri-apps/tauri/pull/6122), [#5070](https://www.github.com/tauri-apps/tauri/pull/5070) ([#6144](https://www.github.com/tauri-apps/tauri/pull/6144)) on 2023-01-26
- Pin `winnow` crate to 0.4.1 to keep the 1.60 MSRV.
## \[1.2.1]
- Fix `allowlist > app > show/hide` always disabled when `allowlist > app > all: false`.

View File

@@ -1,6 +1,6 @@
[package]
name = "tauri-build"
version = "1.4.1"
version = "1.2.1"
authors = [ "Tauri Programme within The Commons Conservancy" ]
categories = [ "gui", "web-programming" ]
license = "Apache-2.0 OR MIT"
@@ -8,7 +8,7 @@ homepage = "https://tauri.app"
repository = "https://github.com/tauri-apps/tauri/tree/dev/core/tauri-build"
description = "build time code to pair with https://crates.io/crates/tauri"
edition = "2021"
rust-version = "1.60"
rust-version = "1.59"
exclude = [ "CHANGELOG.md", "/target" ]
readme = "README.md"
@@ -19,17 +19,16 @@ rustdoc-args = [ "--cfg", "doc_cfg" ]
[dependencies]
anyhow = "1"
quote = { version = "1", optional = true }
tauri-codegen = { version = "1.4.1", path = "../tauri-codegen", optional = true }
tauri-utils = { version = "1.5.0", path = "../tauri-utils", features = [ "build", "resources" ] }
cargo_toml = "0.15"
serde = "1"
tauri-codegen = { version = "1.2.1", path = "../tauri-codegen", optional = true }
tauri-utils = { version = "1.2.1", path = "../tauri-utils", features = [ "build", "resources" ] }
cargo_toml = "0.14"
serde_json = "1"
heck = "0.4"
json-patch = "1.0"
tauri-winres = "0.1"
json-patch = "0.3"
[target."cfg(windows)".dependencies]
winres = "0.1"
semver = "1"
walkdir = "2"
dirs-next = "2"
[features]
codegen = [ "tauri-codegen", "quote" ]

View File

@@ -4,7 +4,7 @@
[![status](https://img.shields.io/badge/status-stable-blue.svg)](https://github.com/tauri-apps/tauri/tree/dev)
[![License](https://img.shields.io/badge/License-MIT%20or%20Apache%202-green.svg)](https://opencollective.com/tauri)
[![test core](https://img.shields.io/github/actions/workflow/status/tauri-apps/tauri/test-core.yml?label=test%20core&logo=github)](https://github.com/tauri-apps/tauri/actions/workflows/test-core.yml)
[![test library](https://img.shields.io/github/workflow/status/tauri-apps/tauri/test%20library?label=test%20library)](https://github.com/tauri-apps/tauri/actions?query=workflow%3A%22test+library%22)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Ftauri-apps%2Ftauri.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Ftauri-apps%2Ftauri?ref=badge_shield)
[![Chat Server](https://img.shields.io/badge/chat-discord-7289da.svg)](https://discord.gg/SpmNs4S)
[![website](https://img.shields.io/badge/website-tauri.app-purple.svg)](https://tauri.app)

View File

@@ -1,211 +0,0 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use anyhow::{anyhow, Result};
use cargo_toml::{Dependency, Manifest};
use tauri_utils::config::{Config, PatternKind, TauriConfig};
#[derive(Debug, Default, PartialEq, Eq)]
struct Diff {
remove: Vec<String>,
add: Vec<String>,
}
#[derive(Debug, Clone, Copy)]
enum DependencyKind {
Build,
Normal,
}
#[derive(Debug)]
struct AllowlistedDependency {
name: String,
alias: Option<String>,
kind: DependencyKind,
all_cli_managed_features: Option<Vec<&'static str>>,
expected_features: Vec<String>,
}
pub fn check(config: &Config, manifest: &mut Manifest) -> Result<()> {
let dependencies = vec![
AllowlistedDependency {
name: "tauri-build".into(),
alias: None,
kind: DependencyKind::Build,
all_cli_managed_features: Some(vec!["isolation"]),
expected_features: match config.tauri.pattern {
PatternKind::Isolation { .. } => vec!["isolation".to_string()],
_ => vec![],
},
},
AllowlistedDependency {
name: "tauri".into(),
alias: None,
kind: DependencyKind::Normal,
all_cli_managed_features: Some(TauriConfig::all_features()),
expected_features: config
.tauri
.features()
.into_iter()
.map(|f| f.to_string())
.collect::<Vec<String>>(),
},
];
for metadata in dependencies {
let mut name = metadata.name.clone();
let mut deps = find_dependency(manifest, &metadata.name, metadata.kind);
if deps.is_empty() {
if let Some(alias) = &metadata.alias {
deps = find_dependency(manifest, alias, metadata.kind);
name = alias.clone();
}
}
for dep in deps {
if let Err(error) = check_features(dep, &metadata) {
return Err(anyhow!("
The `{}` dependency features on the `Cargo.toml` file does not match the allowlist defined under `tauri.conf.json`.
Please run `tauri dev` or `tauri build` or {}.
", name, error));
}
}
}
Ok(())
}
fn find_dependency(manifest: &mut Manifest, name: &str, kind: DependencyKind) -> Vec<Dependency> {
let dep = match kind {
DependencyKind::Build => manifest.build_dependencies.remove(name),
DependencyKind::Normal => manifest.dependencies.remove(name),
};
if let Some(dep) = dep {
vec![dep]
} else {
let mut deps = Vec::new();
for target in manifest.target.values_mut() {
if let Some(dep) = match kind {
DependencyKind::Build => target.build_dependencies.remove(name),
DependencyKind::Normal => target.dependencies.remove(name),
} {
deps.push(dep);
}
}
deps
}
}
fn features_diff(current: &[String], expected: &[String]) -> Diff {
let mut remove = Vec::new();
let mut add = Vec::new();
for feature in current {
if !expected.contains(feature) {
remove.push(feature.clone());
}
}
for feature in expected {
if !current.contains(feature) {
add.push(feature.clone());
}
}
Diff { remove, add }
}
fn check_features(dependency: Dependency, metadata: &AllowlistedDependency) -> Result<(), String> {
let features = match dependency {
Dependency::Simple(_) => Vec::new(),
Dependency::Detailed(dep) => dep.features,
Dependency::Inherited(dep) => dep.features,
};
let diff = if let Some(all_cli_managed_features) = &metadata.all_cli_managed_features {
features_diff(
&features
.into_iter()
.filter(|f| all_cli_managed_features.contains(&f.as_str()))
.collect::<Vec<String>>(),
&metadata.expected_features,
)
} else {
features_diff(
&features
.into_iter()
.filter(|f| f.starts_with("allow-"))
.collect::<Vec<String>>(),
&metadata.expected_features,
)
};
let mut error_message = String::new();
if !diff.remove.is_empty() {
error_message.push_str("remove the `");
error_message.push_str(&diff.remove.join(", "));
error_message.push_str(if diff.remove.len() == 1 {
"` feature"
} else {
"` features"
});
if !diff.add.is_empty() {
error_message.push_str(" and ");
}
}
if !diff.add.is_empty() {
error_message.push_str("add the `");
error_message.push_str(&diff.add.join(", "));
error_message.push_str(if diff.add.len() == 1 {
"` feature"
} else {
"` features"
});
}
if error_message.is_empty() {
Ok(())
} else {
Err(error_message)
}
}
#[cfg(test)]
mod tests {
use super::Diff;
#[test]
fn array_diff() {
for (current, expected, result) in [
(vec![], vec![], Default::default()),
(
vec!["a".into()],
vec![],
Diff {
remove: vec!["a".into()],
add: vec![],
},
),
(vec!["a".into()], vec!["a".into()], Default::default()),
(
vec!["a".into(), "b".into()],
vec!["a".into()],
Diff {
remove: vec!["b".into()],
add: vec![],
},
),
(
vec!["a".into(), "b".into()],
vec!["a".into(), "c".into()],
Diff {
remove: vec!["b".into()],
add: vec!["c".into()],
},
),
] {
assert_eq!(super::features_diff(&current, &expected), result);
}
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@@ -1,24 +1,19 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
#![cfg_attr(doc_cfg, feature(doc_cfg))]
use anyhow::Context;
pub use anyhow::Result;
use cargo_toml::Manifest;
use heck::AsShoutySnakeCase;
use tauri_utils::{
config::{BundleResources, Config, WebviewInstallMode},
resources::{external_binaries, ResourcePaths},
};
use tauri_utils::resources::{external_binaries, resource_relpath, ResourcePaths};
use std::path::{Path, PathBuf};
mod allowlist;
#[cfg(feature = "codegen")]
mod codegen;
#[cfg(windows)]
mod static_vcruntime;
#[cfg(feature = "codegen")]
@@ -73,117 +68,11 @@ fn copy_binaries(
/// Copies resources to a path.
fn copy_resources(resources: ResourcePaths<'_>, path: &Path) -> Result<()> {
for resource in resources.iter() {
let resource = resource?;
println!("cargo:rerun-if-changed={}", resource.path().display());
copy_file(resource.path(), path.join(resource.target()))?;
}
Ok(())
}
#[cfg(unix)]
fn symlink_dir(src: &Path, dst: &Path) -> std::io::Result<()> {
std::os::unix::fs::symlink(src, dst)
}
/// Makes a symbolic link to a directory.
#[cfg(windows)]
fn symlink_dir(src: &Path, dst: &Path) -> std::io::Result<()> {
std::os::windows::fs::symlink_dir(src, dst)
}
/// Makes a symbolic link to a file.
#[cfg(unix)]
fn symlink_file(src: &Path, dst: &Path) -> std::io::Result<()> {
std::os::unix::fs::symlink(src, dst)
}
/// Makes a symbolic link to a file.
#[cfg(windows)]
fn symlink_file(src: &Path, dst: &Path) -> std::io::Result<()> {
std::os::windows::fs::symlink_file(src, dst)
}
fn copy_dir(from: &Path, to: &Path) -> Result<()> {
for entry in walkdir::WalkDir::new(from) {
let entry = entry?;
debug_assert!(entry.path().starts_with(from));
let rel_path = entry.path().strip_prefix(from)?;
let dest_path = to.join(rel_path);
if entry.file_type().is_symlink() {
let target = std::fs::read_link(entry.path())?;
if entry.path().is_dir() {
symlink_dir(&target, &dest_path)?;
} else {
symlink_file(&target, &dest_path)?;
}
} else if entry.file_type().is_dir() {
std::fs::create_dir(dest_path)?;
} else {
std::fs::copy(entry.path(), dest_path)?;
}
}
Ok(())
}
// Copies the framework under `{src_dir}/{framework}.framework` to `{dest_dir}/{framework}.framework`.
fn copy_framework_from(src_dir: &Path, framework: &str, dest_dir: &Path) -> Result<bool> {
let src_name = format!("{}.framework", framework);
let src_path = src_dir.join(&src_name);
if src_path.exists() {
copy_dir(&src_path, &dest_dir.join(&src_name))?;
Ok(true)
} else {
Ok(false)
}
}
// Copies the macOS application bundle frameworks to the target folder
fn copy_frameworks(dest_dir: &Path, frameworks: &[String]) -> Result<()> {
std::fs::create_dir_all(dest_dir).with_context(|| {
format!(
"Failed to create frameworks output directory at {:?}",
dest_dir
)
})?;
for framework in frameworks.iter() {
if framework.ends_with(".framework") {
let src_path = PathBuf::from(framework);
let src_name = src_path
.file_name()
.expect("Couldn't get framework filename");
let dest_path = dest_dir.join(src_name);
copy_dir(&src_path, &dest_path)?;
continue;
} else if framework.ends_with(".dylib") {
let src_path = PathBuf::from(framework);
if !src_path.exists() {
return Err(anyhow::anyhow!("Library not found: {}", framework));
}
let src_name = src_path.file_name().expect("Couldn't get library filename");
let dest_path = dest_dir.join(src_name);
copy_file(&src_path, &dest_path)?;
continue;
} else if framework.contains('/') {
return Err(anyhow::anyhow!(
"Framework path should have .framework extension: {}",
framework
));
}
if let Some(home_dir) = dirs_next::home_dir() {
if copy_framework_from(&home_dir.join("Library/Frameworks/"), framework, dest_dir)? {
continue;
}
}
if copy_framework_from(&PathBuf::from("/Library/Frameworks/"), framework, dest_dir)?
|| copy_framework_from(
&PathBuf::from("/Network/Library/Frameworks/"),
framework,
dest_dir,
)?
{
continue;
}
for src in resources {
let src = src?;
println!("cargo:rerun-if-changed={}", src.display());
let dest = path.join(resource_relpath(&src));
copy_file(&src, dest)?;
}
Ok(())
}
@@ -224,28 +113,10 @@ pub struct WindowsAttributes {
/// A string containing an [application manifest] to be included with the application on Windows.
///
/// Defaults to:
/// ```text
/// ```ignore
#[doc = include_str!("window-app-manifest.xml")]
/// ```
///
/// ## Warning
///
/// if you are using tauri's dialog APIs, you need to specify a dependency on Common Control v6 by adding the following to your custom manifest:
/// ```text
/// <dependency>
/// <dependentAssembly>
/// <assemblyIdentity
/// type="win32"
/// name="Microsoft.Windows.Common-Controls"
/// version="6.0.0.0"
/// processorArchitecture="*"
/// publicKeyToken="6595b64144ccf1df"
/// language="*"
/// />
/// </dependentAssembly>
/// </dependency>
/// ```
///
/// [application manifest]: https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests
app_manifest: Option<String>,
}
@@ -274,57 +145,39 @@ impl WindowsAttributes {
self
}
/// Sets the [application manifest] to be included with the application on Windows.
///
/// Defaults to:
/// ```text
#[doc = include_str!("window-app-manifest.xml")]
/// ```
///
/// ## Warning
///
/// if you are using tauri's dialog APIs, you need to specify a dependency on Common Control v6 by adding the following to your custom manifest:
/// ```text
/// <dependency>
/// <dependentAssembly>
/// <assemblyIdentity
/// type="win32"
/// name="Microsoft.Windows.Common-Controls"
/// version="6.0.0.0"
/// processorArchitecture="*"
/// publicKeyToken="6595b64144ccf1df"
/// language="*"
/// />
/// </dependentAssembly>
/// </dependency>
/// ```
/// Sets the Windows app [manifest].
///
/// # Example
///
/// The following manifest will brand the exe as requesting administrator privileges.
/// Thus, everytime it is executed, a Windows UAC dialog will appear.
///
/// Note that you can move the manifest contents to a separate file and use `include_str!("manifest.xml")`
/// instead of the inline string.
///
/// ```rust,no_run
/// let mut windows = tauri_build::WindowsAttributes::new();
/// windows = windows.app_manifest(r#"
/// <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
/// <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
/// <security>
/// <requestedPrivileges>
/// <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
/// </requestedPrivileges>
/// </security>
/// </trustInfo>
/// <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
/// <security>
/// <requestedPrivileges>
/// <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
/// </requestedPrivileges>
/// </security>
/// </trustInfo>
/// </assembly>
/// "#);
/// let attrs = tauri_build::Attributes::new().windows_attributes(windows);
/// tauri_build::try_build(attrs).expect("failed to run build script");
/// tauri_build::try_build(
/// tauri_build::Attributes::new().windows_attributes(windows)
/// ).expect("failed to run build script");
/// ```
///
/// Note that you can move the manifest contents to a separate file and use `include_str!("manifest.xml")`
/// instead of the inline string.
///
/// Defaults to:
/// ```ignore
#[doc = include_str!("window-app-manifest.xml")]
/// [manifest]: https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests
/// ```
#[must_use]
pub fn app_manifest<S: AsRef<str>>(mut self, manifest: S) -> Self {
self.app_manifest = Some(manifest.as_ref().to_string());
@@ -390,6 +243,8 @@ pub fn build() {
#[allow(unused_variables)]
pub fn try_build(attributes: Attributes) -> Result<()> {
use anyhow::anyhow;
use cargo_toml::{Dependency, Manifest};
use tauri_utils::config::{Config, TauriConfig};
println!("cargo:rerun-if-env-changed=TAURI_CONFIG");
println!("cargo:rerun-if-changed=tauri.conf.json");
@@ -414,22 +269,59 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
cfg_alias("dev", !has_feature("custom-protocol"));
let ws_path = get_workspace_dir()?;
let mut manifest =
Manifest::<cargo_toml::Value>::from_slice_with_metadata(&std::fs::read("Cargo.toml")?)?;
let mut manifest = Manifest::from_path("Cargo.toml")?;
if let Some(tauri) = manifest.dependencies.remove("tauri") {
let features = match tauri {
Dependency::Simple(_) => Vec::new(),
Dependency::Detailed(dep) => dep.features,
Dependency::Inherited(dep) => dep.features,
};
if let Ok(ws_manifest) = Manifest::from_path(ws_path.join("Cargo.toml")) {
Manifest::complete_from_path_and_workspace(
&mut manifest,
Path::new("Cargo.toml"),
Some((&ws_manifest, ws_path.as_path())),
)?;
} else {
Manifest::complete_from_path(&mut manifest, Path::new("Cargo.toml"))?;
let all_cli_managed_features = TauriConfig::all_features();
let diff = features_diff(
&features
.into_iter()
.filter(|f| all_cli_managed_features.contains(&f.as_str()))
.collect::<Vec<String>>(),
&config
.tauri
.features()
.into_iter()
.map(|f| f.to_string())
.collect::<Vec<String>>(),
);
let mut error_message = String::new();
if !diff.remove.is_empty() {
error_message.push_str("remove the `");
error_message.push_str(&diff.remove.join(", "));
error_message.push_str(if diff.remove.len() == 1 {
"` feature"
} else {
"` features"
});
if !diff.add.is_empty() {
error_message.push_str(" and ");
}
}
if !diff.add.is_empty() {
error_message.push_str("add the `");
error_message.push_str(&diff.add.join(", "));
error_message.push_str(if diff.add.len() == 1 {
"` feature"
} else {
"` features"
});
}
if !error_message.is_empty() {
return Err(anyhow!("
The `tauri` dependency features on the `Cargo.toml` file does not match the allowlist defined under `tauri.conf.json`.
Please run `tauri dev` or `tauri build` or {}.
", error_message));
}
}
allowlist::check(&config, &mut manifest)?;
let target_triple = std::env::var("TARGET").unwrap();
let out_dir = PathBuf::from(std::env::var("OUT_DIR").unwrap());
// TODO: far from ideal, but there's no other way to get the target dir, see <https://github.com/rust-lang/cargo/issues/5457>
@@ -451,55 +343,26 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
}
#[allow(unused_mut, clippy::redundant_clone)]
let mut resources = config
.tauri
.bundle
.resources
.clone()
.unwrap_or_else(|| BundleResources::List(Vec::new()));
if target_triple.contains("windows") {
if let Some(fixed_webview2_runtime_path) =
match &config.tauri.bundle.windows.webview_fixed_runtime_path {
Some(path) => Some(path),
None => match &config.tauri.bundle.windows.webview_install_mode {
WebviewInstallMode::FixedRuntime { path } => Some(path),
_ => None,
},
}
{
resources.push(fixed_webview2_runtime_path.display().to_string());
}
}
match resources {
BundleResources::List(res) => {
copy_resources(ResourcePaths::new(res.as_slice(), true), target_dir)?
}
BundleResources::Map(map) => copy_resources(ResourcePaths::from_map(&map, true), target_dir)?,
let mut resources = config.tauri.bundle.resources.clone().unwrap_or_default();
#[cfg(windows)]
if let Some(fixed_webview2_runtime_path) = &config.tauri.bundle.windows.webview_fixed_runtime_path
{
resources.push(fixed_webview2_runtime_path.display().to_string());
}
copy_resources(ResourcePaths::new(resources.as_slice(), true), target_dir)?;
if target_triple.contains("darwin") {
if let Some(frameworks) = &config.tauri.bundle.macos.frameworks {
if !frameworks.is_empty() {
let frameworks_dir = target_dir.parent().unwrap().join("Frameworks");
let _ = std::fs::remove_dir_all(&frameworks_dir);
// copy frameworks to the root `target` folder (instead of `target/debug` for instance)
// because the rpath is set to `@executable_path/../Frameworks`.
copy_frameworks(&frameworks_dir, frameworks)?;
// If we have frameworks, we need to set the @rpath
// https://github.com/tauri-apps/tauri/issues/7710
println!("cargo:rustc-link-arg=-Wl,-rpath,@executable_path/../Frameworks");
}
}
if let Some(version) = &config.tauri.bundle.macos.minimum_system_version {
println!("cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET={version}");
#[cfg(target_os = "macos")]
{
if let Some(version) = config.tauri.bundle.macos.minimum_system_version {
println!("cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET={}", version);
}
}
if target_triple.contains("windows") {
#[cfg(windows)]
{
use anyhow::Context;
use semver::Version;
use tauri_winres::{VersionInfo, WindowsResource};
use winres::{VersionInfo, WindowsResource};
fn find_icon<F: Fn(&&String) -> bool>(config: &Config, predicate: F, default: &str) -> PathBuf {
let icon_path = config
@@ -527,23 +390,27 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
res.set_manifest(include_str!("window-app-manifest.xml"));
}
if let Some(version_str) = &config.package.version {
if let Ok(v) = Version::parse(version_str) {
if let Some(sdk_dir) = &attributes.windows_attributes.sdk_dir {
if let Some(sdk_dir_str) = sdk_dir.to_str() {
res.set_toolkit_path(sdk_dir_str);
} else {
return Err(anyhow!(
"sdk_dir path is not valid; only UTF-8 characters are allowed"
));
}
}
if let Some(version) = &config.package.version {
if let Ok(v) = Version::parse(version) {
let version = v.major << 48 | v.minor << 32 | v.patch << 16;
res.set_version_info(VersionInfo::FILEVERSION, version);
res.set_version_info(VersionInfo::PRODUCTVERSION, version);
}
res.set("FileVersion", version_str);
res.set("ProductVersion", version_str);
res.set("FileVersion", version);
res.set("ProductVersion", version);
}
if let Some(product_name) = &config.package.product_name {
res.set("ProductName", product_name);
}
if let Some(short_description) = &config.tauri.bundle.short_description {
res.set("FileDescription", short_description);
}
if let Some(copyright) = &config.tauri.bundle.copyright {
res.set("LegalCopyright", copyright);
res.set("FileDescription", product_name);
}
res.set_icon_with_id(&window_icon_path.display().to_string(), "32512");
res.compile().with_context(|| {
@@ -595,22 +462,65 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
Ok(())
}
#[derive(serde::Deserialize)]
struct CargoMetadata {
workspace_root: PathBuf,
#[derive(Debug, Default, PartialEq, Eq)]
struct Diff {
remove: Vec<String>,
add: Vec<String>,
}
fn get_workspace_dir() -> Result<PathBuf> {
let output = std::process::Command::new("cargo")
.args(["metadata", "--no-deps", "--format-version", "1"])
.output()?;
if !output.status.success() {
return Err(anyhow::anyhow!(
"cargo metadata command exited with a non zero exit code: {}",
String::from_utf8(output.stderr)?
));
fn features_diff(current: &[String], expected: &[String]) -> Diff {
let mut remove = Vec::new();
let mut add = Vec::new();
for feature in current {
if !expected.contains(feature) {
remove.push(feature.clone());
}
}
Ok(serde_json::from_slice::<CargoMetadata>(&output.stdout)?.workspace_root)
for feature in expected {
if !current.contains(feature) {
add.push(feature.clone());
}
}
Diff { remove, add }
}
#[cfg(test)]
mod tests {
use super::Diff;
#[test]
fn array_diff() {
for (current, expected, result) in [
(vec![], vec![], Default::default()),
(
vec!["a".into()],
vec![],
Diff {
remove: vec!["a".into()],
add: vec![],
},
),
(vec!["a".into()], vec!["a".into()], Default::default()),
(
vec!["a".into(), "b".into()],
vec!["a".into()],
Diff {
remove: vec!["b".into()],
add: vec![],
},
),
(
vec!["a".into(), "b".into()],
vec!["a".into(), "c".into()],
Diff {
remove: vec!["b".into()],
add: vec!["c".into()],
},
),
] {
assert_eq!(super::features_diff(&current, &expected), result);
}
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
@@ -48,11 +48,11 @@ fn override_msvcrt_lib() {
let f = fs::OpenOptions::new()
.write(true)
.create_new(true)
.open(path);
.open(&path);
if let Ok(mut f) = f {
f.write_all(machine).unwrap();
f.write_all(bytes).unwrap();
}
// Add the output directory to the native library path.
println!("cargo:rustc-link-search=native={out_dir}");
println!("cargo:rustc-link-search=native={}", out_dir);
}

View File

@@ -1,25 +1,5 @@
# Changelog
## \[1.4.1]
### Dependencies
- Upgraded to `tauri-utils@1.5.0`
## \[1.4.0]
### Enhancements
- [`17d5a4f5`](https://www.github.com/tauri-apps/tauri/commit/17d5a4f51f244d3ff42014b5d1b075fad7c636a5)([#6706](https://www.github.com/tauri-apps/tauri/pull/6706)) Early panic if the PNG icon is not RGBA.
- [`d2710e9d`](https://www.github.com/tauri-apps/tauri/commit/d2710e9d2e8fd93975ef6494512370faa8cb3b7e)([#6944](https://www.github.com/tauri-apps/tauri/pull/6944)) Unpin `time`, `ignore`, and `winnow` crate versions. Developers now have to pin crates if needed themselves. A list of crates that need pinning to adhere to Tauri's MSRV will be visible in Tauri's GitHub workflow: https://github.com/tauri-apps/tauri/blob/dev/.github/workflows/test-core.yml#L85.
## \[1.3.0]
- Bump minimum supported Rust version to 1.60.
- [5fdc616d](https://www.github.com/tauri-apps/tauri/commit/5fdc616df9bea633810dcb814ac615911d77222c) feat: Use the zbus-backed of notify-rust ([#6332](https://www.github.com/tauri-apps/tauri/pull/6332)) on 2023-03-31
- Pin `time` to `0.3.15`.
- [3d16461b](https://www.github.com/tauri-apps/tauri/commit/3d16461b68583ba7db037fbc217786e79b46ddf2) fix(core): pin time to 0.3.15 ([#6312](https://www.github.com/tauri-apps/tauri/pull/6312)) on 2023-02-19
## \[1.2.1]
- Fix `allowlist > app > show/hide` always disabled when `allowlist > app > all: false`.

View File

@@ -1,6 +1,6 @@
[package]
name = "tauri-codegen"
version = "1.4.1"
version = "1.2.1"
authors = [ "Tauri Programme within The Commons Conservancy" ]
categories = [ "gui", "web-programming" ]
license = "Apache-2.0 OR MIT"
@@ -8,27 +8,27 @@ homepage = "https://tauri.app"
repository = "https://github.com/tauri-apps/tauri/tree/dev/core/tauri-codegen"
description = "code generation meant to be consumed inside of `tauri` through `tauri-build` or `tauri-macros`"
edition = "2021"
rust-version = "1.60"
rust-version = "1.59"
exclude = [ "CHANGELOG.md", "/target" ]
readme = "README.md"
[dependencies]
sha2 = "0.10"
base64 = "0.21"
base64 = "0.20"
proc-macro2 = "1"
quote = "1"
serde = { version = "1", features = [ "derive" ] }
serde_json = "1"
tauri-utils = { version = "1.5.0", path = "../tauri-utils", features = [ "build" ] }
tauri-utils = { version = "1.2.1", path = "../tauri-utils", features = [ "build" ] }
thiserror = "1"
walkdir = "2"
brotli = { version = "3", optional = true, default-features = false, features = [ "std" ] }
regex = { version = "1.7.1", optional = true }
regex = { version = "1.7.0", optional = true }
uuid = { version = "1", features = [ "v4" ] }
semver = "1"
ico = "0.3"
png = "0.17"
json-patch = "1.0"
json-patch = "0.3"
[target."cfg(target_os = \"macos\")".dependencies]
plist = "1"

View File

@@ -6,7 +6,7 @@
[![Chat Server](https://img.shields.io/badge/chat-on%20discord-7289da.svg)](https://discord.gg/SpmNs4S)
[![devto](https://img.shields.io/badge/blog-dev.to-black.svg)](https://dev.to/tauri)
[![test core](https://img.shields.io/github/actions/workflow/status/tauri-apps/tauri/test-core.yml?label=test%20core&logo=github)](https://github.com/tauri-apps/tauri/actions/workflows/test-core.yml)
![](https://img.shields.io/github/workflow/status/tauri-apps/tauri/test%20library?label=test%20library)
[![devto](https://img.shields.io/badge/documentation-site-purple.svg)](https://tauri.app)
[![https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg](https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg)](https://good-labs.github.io/greater-good-affirmation)

View File

@@ -1,13 +1,12 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use std::path::{Path, PathBuf};
use std::{ffi::OsStr, str::FromStr};
use base64::Engine;
use proc_macro2::TokenStream;
use quote::quote;
use proc_macro2::{Group, TokenStream, TokenTree};
use quote::{quote, TokenStreamExt};
use sha2::{Digest, Sha256};
use tauri_utils::assets::AssetKey;
@@ -58,10 +57,7 @@ fn map_core_assets(
let mut hasher = Sha256::new();
hasher.update(&script);
let hash = hasher.finalize();
scripts.push(format!(
"'sha256-{}'",
base64::engine::general_purpose::STANDARD.encode(hash)
));
scripts.push(format!("'sha256-{}'", base64::encode(hash)));
}
csp_hashes
.inline_scripts
@@ -78,10 +74,9 @@ fn map_core_assets(
let mut hasher = Sha256::new();
hasher.update(tauri_utils::pattern::isolation::IFRAME_STYLE);
let hash = hasher.finalize();
csp_hashes.styles.push(format!(
"'sha256-{}'",
base64::engine::general_purpose::STANDARD.encode(hash)
));
csp_hashes
.styles
.push(format!("'sha256-{}'", base64::encode(hash)));
}
}
@@ -176,10 +171,10 @@ pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsE
.tauri
.security
.dev_csp
.as_ref()
.or(config.tauri.security.csp.as_ref())
.clone()
.or_else(|| config.tauri.security.csp.clone())
} else {
config.tauri.security.csp.as_ref()
config.tauri.security.csp.clone()
};
if csp.is_some() {
options = options.with_csp();
@@ -350,11 +345,14 @@ pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsE
}
}
let out_path = out_dir.join("Info.plist");
info_plist
.to_file_xml(out_dir.join("Info.plist"))
.to_file_xml(&out_path)
.expect("failed to write Info.plist");
let info_plist_path = out_path.display().to_string();
quote!({
tauri::embed_plist::embed_info_plist!(concat!(std::env!("OUT_DIR"), "/Info.plist"));
#root::embed_plist::embed_info_plist!(#info_plist_path);
})
} else {
quote!(())
@@ -398,7 +396,7 @@ pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsE
assets: ::std::sync::Arc::new(#assets),
schema: #schema.into(),
key: #key.into(),
crypto_keys: std::boxed::Box::new(::tauri::utils::pattern::isolation::Keys::new().expect("unable to generate cryptographically secure keys for Tauri \"Isolation\" Pattern")),
crypto_keys: std::boxed::Box::new(#root::utils::pattern::isolation::Keys::new().expect("unable to generate cryptographically secure keys for Tauri \"Isolation\" Pattern")),
})
}
};
@@ -437,7 +435,70 @@ pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsE
#[cfg(not(feature = "shell-scope"))]
let shell_scope_config = quote!();
Ok(quote!(#root::Context::new(
fn compare_token_stream(a: TokenStream, b: TokenStream) -> bool {
if a.clone().into_iter().count() != b.clone().into_iter().count() {
return false;
}
for (a, b) in a.into_iter().zip(b) {
if !compare_token_tree(a, b) {
return false;
}
}
true
}
fn compare_token_tree(a: TokenTree, b: TokenTree) -> bool {
match (a, b) {
(TokenTree::Group(a), TokenTree::Group(b)) => compare_token_stream(a.stream(), b.stream()),
(TokenTree::Ident(a), TokenTree::Ident(b)) => b == a,
(TokenTree::Punct(a), TokenTree::Punct(b)) => a.to_string() == b.to_string(),
(TokenTree::Literal(a), TokenTree::Literal(b)) => a.to_string() == b.to_string(),
_ => false,
}
}
fn change_tree_tauri_root(
token: TokenTree,
previous: &Option<TokenTree>,
new: &mut TokenStream,
) -> bool {
match token {
TokenTree::Ident(i) if i == "utils" => {
new.append_all(quote!(tauri_utils));
false
}
TokenTree::Ident(i) => {
let ignore = match previous {
Some(TokenTree::Punct(p)) if p.as_char() == ':' => i == "tauri",
_ => false,
};
if !ignore {
new.append(i);
}
ignore
}
TokenTree::Group(g) => {
let mut stream = TokenStream::new();
let mut ignore = false;
let mut previous_token = None;
for token in g.stream() {
if ignore && matches!(token, TokenTree::Punct(_)) {
continue;
}
ignore = change_tree_tauri_root(token.clone(), &previous_token, &mut stream);
previous_token.replace(token);
}
new.append(Group::new(g.delimiter(), stream));
false
}
_ => {
new.append(token);
false
}
}
}
let context = quote!(#root::Context::new(
#config,
::std::sync::Arc::new(#assets),
#default_window_icon,
@@ -447,7 +508,23 @@ pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsE
#info_plist,
#pattern,
#shell_scope_config
)))
));
if compare_token_stream(root, quote!(crate)) {
let mut stream = TokenStream::new();
let mut ignore = false;
let mut previous_token = None;
for token in context {
if ignore && matches!(token, TokenTree::Punct(_)) {
continue;
}
ignore = change_tree_tauri_root(token.clone(), &previous_token, &mut stream);
previous_token.replace(token);
}
Ok(stream)
} else {
Ok(context)
}
}
fn ico_icon<P: AsRef<Path>>(
@@ -470,20 +547,15 @@ fn ico_icon<P: AsRef<Path>>(
let width = entry.width();
let height = entry.height();
let icon_file_name = path.file_name().unwrap();
let out_path = out_dir.join(icon_file_name);
let out_path = out_dir.join(path.file_name().unwrap());
write_if_changed(&out_path, &rgba).map_err(|error| EmbeddedAssetsError::AssetWrite {
path: path.to_owned(),
error,
})?;
let icon_file_name = icon_file_name.to_str().unwrap();
let icon = quote!(Some(
#root::Icon::Rgba {
rgba: include_bytes!(concat!(std::env!("OUT_DIR"), "/", #icon_file_name)).to_vec(),
width: #width,
height: #height
}));
let out_path = out_path.display().to_string();
let icon = quote!(Some(#root::Icon::Rgba { rgba: include_bytes!(#out_path).to_vec(), width: #width, height: #height }));
Ok(icon)
}
@@ -499,10 +571,9 @@ fn raw_icon<P: AsRef<Path>>(out_dir: &Path, path: P) -> Result<TokenStream, Embe
error,
})?;
let icon_path = path.file_name().unwrap().to_str().unwrap().to_string();
let icon = quote!(::std::option::Option::Some(
include_bytes!(concat!(std::env!("OUT_DIR"), "/", #icon_path)).to_vec()
));
let out_path = out_path.display().to_string();
let icon = quote!(Some(include_bytes!(#out_path).to_vec()));
Ok(icon)
}
@@ -519,13 +590,6 @@ fn png_icon<P: AsRef<Path>>(
let mut reader = decoder
.read_info()
.unwrap_or_else(|e| panic!("failed to read icon {}: {}", path.display(), e));
let (color_type, _) = reader.output_color_type();
if color_type != png::ColorType::Rgba {
panic!("icon {} is not RGBA", path.display());
}
let mut buffer: Vec<u8> = Vec::new();
while let Ok(Some(row)) = reader.next_row() {
buffer.extend(row.data());
@@ -533,21 +597,15 @@ fn png_icon<P: AsRef<Path>>(
let width = reader.info().width;
let height = reader.info().height;
let icon_file_name = path.file_name().unwrap();
let out_path = out_dir.join(icon_file_name);
let out_path = out_dir.join(path.file_name().unwrap());
write_if_changed(&out_path, &buffer).map_err(|error| EmbeddedAssetsError::AssetWrite {
path: path.to_owned(),
error,
})?;
let icon_file_name = icon_file_name.to_str().unwrap();
let icon = quote!(Some(
#root::Icon::Rgba {
rgba: include_bytes!(concat!(std::env!("OUT_DIR"), "/", #icon_file_name)).to_vec(),
width: #width,
height: #height,
}
));
let out_path = out_path.display().to_string();
let icon = quote!(Some(#root::Icon::Rgba { rgba: include_bytes!(#out_path).to_vec(), width: #width, height: #height }));
Ok(icon)
}

View File

@@ -1,8 +1,7 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use base64::Engine;
use proc_macro2::TokenStream;
use quote::{quote, ToTokens, TokenStreamExt};
use sha2::{Digest, Sha256};
@@ -182,10 +181,9 @@ impl CspHashes {
})?,
);
let hash = hasher.finalize();
self.scripts.push(format!(
"'sha256-{}'",
base64::engine::general_purpose::STANDARD.encode(hash)
));
self
.scripts
.push(format!("'sha256-{}'", base64::encode(hash)));
}
}
@@ -433,7 +431,6 @@ impl ToTokens for EmbeddedAssets {
// we expect phf related items to be in path when generating the path code
tokens.append_all(quote! {{
#[allow(unused)]
use ::tauri::utils::assets::{CspHash, EmbeddedAssets, phf, phf::phf_map};
EmbeddedAssets::new(phf_map! { #assets }, &[#global_hashes], phf_map! { #html_hashes })
}});

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

View File

@@ -1,14 +0,0 @@
[package]
name = "tauri-config-schema"
version = "0.0.0"
edition = "2021"
publish = false
[build-dependencies]
tauri-utils = { version = "1.0.0", features = [
"schema",
], path = "../tauri-utils" }
schemars = { version = "0.8", features = ["url", "preserve_order"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
url = { version = "2.3", features = ["serde"] }

View File

@@ -1,5 +0,0 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
fn main() {}

View File

@@ -1,23 +1,5 @@
# Changelog
## \[1.4.1]
### Dependencies
- Upgraded to `tauri-utils@1.5.0`
- Upgraded to `tauri-codegen@1.4.1`
## \[1.4.0]
### Enhancements
- [`d68a25e3`](https://www.github.com/tauri-apps/tauri/commit/d68a25e32e012e57a9e5225b589b9ecbea70a887)([#6124](https://www.github.com/tauri-apps/tauri/pull/6124)) Improve compiler error message when generating an async command that has a reference input and don't return a Result.
## \[1.3.0]
- Bump minimum supported Rust version to 1.60.
- [5fdc616d](https://www.github.com/tauri-apps/tauri/commit/5fdc616df9bea633810dcb814ac615911d77222c) feat: Use the zbus-backed of notify-rust ([#6332](https://www.github.com/tauri-apps/tauri/pull/6332)) on 2023-03-31
## \[1.2.1]
- Fix `allowlist > app > show/hide` always disabled when `allowlist > app > all: false`.

Some files were not shown because too many files have changed in this diff Show More