Compare commits

..

74 Commits

Author SHA1 Message Date
Lucas Nogueira
cf331cdc3e fix(core): lint 2024-07-01 23:54:56 -03:00
Lucas Nogueira
574076541a fix(ci): downgrade crates for MSRV check 2024-07-01 23:52:09 -03:00
github-actions[bot]
89f3048f52 apply version updates (#9871)
Co-authored-by: lucasfernog <lucasfernog@users.noreply.github.com>
2024-07-01 23:13:05 -03:00
Amr Bashir
08f57efefd fix(cli): parse --profile=<profile> syntax (#10136)
* fix(cli): parse `--profile=<profile>` syntax

ref: https://github.com/tauri-apps/tauri/issues/6255#issuecomment-2192466839

* Update tooling/cli/src/interface/rust.rs

* derive default

* safe check next arg

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2024-06-27 06:53:29 -03:00
Fabian-Lars
63da834ce4 ci: Fix msrv check (#10118)
* ci: Fix os_pipe precise version

* reading is hard

* downgrade syn

* more specific

* WHO DO YOU CALL UNSTABLE

* i just want to go to bed
2024-06-25 02:58:20 +03:00
chip
c2d3afa4fb prevent uncomment collision in 1.x invoke_key templating (fix #10084) (#10087)
* don't use invoke key template name in comment (fix #10084)

* undo whitespace change
2024-06-18 19:42:19 +03:00
Harry Mallon
924387092e feat: add dmg settings, cherry picked from #7964 (#8334)
* feat(bundler): add dmg settings, closes #4669 (#7964)

* fix(bundler): lint and cleanup for #7964 (#8275)

* fmt

---------

Co-authored-by: Andrew <andrey255@live.com>
Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app>
Co-authored-by: FabianLars <fabianlars@fabianlars.de>
2024-06-17 13:25:12 +02:00
Pylogmon
d2786bf699 chore(template): template format error (#10018)
* chore(template): template format error

* fix
2024-06-12 04:30:24 +03:00
Pylogmon
674accad75 fix: missing depends for rpm package (#10015)
* fix: missing depends for rpm package

* chore: add changes
2024-06-12 04:24:03 +03:00
Fabian-Lars
09152d83e1 ci(msrv-list): Downgrade os_pipe (#10014) 2024-06-11 21:12:44 +03:00
Fabian-Lars
3752eb1e6b ci(msrv-list): downgrade hyper earlier (#10002) 2024-06-06 17:42:42 +03:00
Fabian-Lars
d104abb656 fix(bench): Update time, backport of #9993 (#10000)
* fix(bench): Update time, backport of #9993

* x
2024-06-06 16:07:32 +03:00
anatawa12
940aa183c7 fix(nsis): run app as normal user (#9944) (#9995)
(cherry picked from commit 6f469534b0)

Co-authored-by: Tony <68118705+Legend-Master@users.noreply.github.com>
2024-06-06 15:00:23 +02:00
anatawa12
a423c52c1c fix(cli): not working with license.workspace = true (#9998) 2024-06-06 13:17:33 +02:00
anatawa12
c12ed92da5 fix(cli): Cargo.lock is not synchronized with Cargo.toml (#9996) 2024-06-06 13:05:13 +02:00
Pylogmon
8b66174f0d fix(bundler): fix error when renaming the downloaded zip of NSIS (#9956) 2024-06-05 04:47:03 +03:00
Lucas Fernandes Nogueira
07b02c9f96 fix(core): test invoke key, closes #9960 (#9972) 2024-06-04 17:02:18 -03:00
Jerry
8ee8f09390 fix(core): fix check temp path permission on mac os, fix #6256 (#9588)
* fix: check temp path permission on mac os

* chore: format code
2024-06-04 10:02:54 -03:00
Pylogmon
78fc841370 feat(bundler): add provides, conflicts and replaces for deb and rpm (#9942)
Backport of #9331
2024-06-04 04:47:17 +03:00
AnthonyNGarcia
a301be52d2 fix(windows): Fix Windows System User build failures by using the current directory for bundling tools (fix: 9895) (#9914)
Co-authored-by: amrbashir <amr.bashir2015@gmail.com>
2024-06-03 21:45:44 +03:00
muwoo
5909662766 feat(bundler): support custom sign command on Windows (#9902) 2024-06-03 21:34:49 +03:00
Harry Mallon
253595a22d feat(bundler): Add RPM packaging, closes #4402 (#5202) (#9809)
* feat(bundler): Add RPM packaging

* feat(bundler): Update 'rpm' to 0.13.1

* Fix fmt

Co-authored-by: Olivier Lemasle <olivier.lemasle@apalia.net>
Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app>
2024-05-28 22:31:29 -03:00
Fabian-Lars
a020828d0e feat(bundler/windows): Update wix to fix vulnerabilities and add arm support (#9861)
* feat(bundler/windows): Update wix to fix vulnerbilities and add arm support

* is this what it's complaining about?

* delete change file

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2024-05-28 22:31:16 -03:00
Amr Bashir
e48157da2f fix(core/shell/command): retry sending events when it fails, closes #7684 (#9698)
* fix(core/shell/command): retry sending events when it fails, closes #7684

* try normally first

* sleep first
2024-05-28 11:48:57 -03:00
Amr Bashir
44e3335da8 fix(core/shell): speedup Command.execute & fix extra new lines (#9796)
* fix(core/shell): speedup `Command.execute` & fix extra new lines (#9706)

* fix(core/shell): speedup `Command.execute` & fix extra new lines

The speed gains comes from running the Command in Rust fully and returning the result in one go instead of using events.

The extra new lines was a regression from https://github.com/tauri-apps/tauri/pull/6519

ref: https://github.com/tauri-apps/tauri/issues/7684#issuecomment-2100897383

* fix unix build

* clippy

* cleanup

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>

* lock file

* minor

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
2024-05-24 13:40:05 -03:00
github-actions[bot]
bf708a21a8 apply version updates (#9857)
Co-authored-by: lucasfernog <lucasfernog@users.noreply.github.com>
2024-05-22 23:10:41 -03:00
chip
f6d81dfe08 Merge pull request from GHSA-57fm-592m-34r7
* add __TAURI_INVOKE_KEY__ to ipc calls to detect initialized frames

* move ipc key check to start of on_message

* cargo +nightly fmt

* undo Cargo.toml formatting changes

* undo Cargo.toml formatting changes

* undo Cargo.toml formatting changes

* remove merged changefiles

* undo formatting changes to js files

* undo formatting changes to js files

* Update to patched wry  release

* fix: optional chaining is not supported on older webviews (#9529)

* Revert "undo formatting changes to js files"

This reverts commit a7ef0d91ea1b183e091ea65a2b201d65522cc1d5.

* Revert "undo formatting changes to js files"

This reverts commit 0fcfd4664b915af51b71e7ea68929fd5b6cb5fc3.

* revert core.js

* inject __TAURI_INVOKE_KEY__ to __TAURI_IPC__ instead

* remove unrelated changes file

* remove left over dbg! call

* change file

---------

Co-authored-by: Tillmann <28728469+tweidinger@users.noreply.github.com>
Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app>
2024-05-22 17:49:08 -03:00
木偶
50aabad1f6 refactor(updater/nsis): migrate run updater using powershell to ShellExecute (#9818) 2024-05-22 21:26:17 +03:00
github-actions[bot]
d78fa20d86 Apply Version Updates From Current Changes (v1) (#9793)
Co-authored-by: amrbashir <amrbashir@users.noreply.github.com>
2024-05-15 20:09:07 +03:00
Amr Bashir
3b69c1384b Revert "fix(core/shell): speedup Command.execute & fix extra new lines (#9706)" (#9792)
* Revert "fix(core/shell): speedup `Command.execute` & fix extra new lines (#9706)"

This reverts commit 7f885bd5ed.

* change file
2024-05-15 19:28:15 +03:00
Amr Bashir
704260bb3c fix(macos/dialog): avoid setting empty default_path (#9784)
closes #7566

ref: https://github.com/tauri-apps/tauri/issues/4065
ref: https://github.com/tauri-apps/tauri/pull/4028
ref: https://github.com/tauri-apps/tauri/issues/9762
2024-05-15 18:45:11 +03:00
Amr Bashir
36b082a9c8 ci: pull .crate file from workspace target directory (#9732) 2024-05-10 02:32:15 +03:00
github-actions[bot]
f45d35cf06 Apply Version Updates From Current Changes (v1) (#9730)
Co-authored-by: amrbashir <amrbashir@users.noreply.github.com>
2024-05-10 00:13:21 +03:00
Amr Bashir
ef35a793c5 fix(core): fix compilation when shell-execute or shell-sidecar (#9729)
* fix(core): fix compilation when `shell-execute` or `shell-sidecar`

regression from: https://github.com/tauri-apps/tauri/pull/9706

* change file
2024-05-09 23:56:52 +03:00
github-actions[bot]
15c62b5d99 Apply Version Updates From Current Changes (v1) (#9721)
* apply version updates

* fmt

---------

Co-authored-by: lucasfernog <lucasfernog@users.noreply.github.com>
Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2024-05-09 15:22:45 -03:00
Lucas Fernandes Nogueira
9b90b67ed2 Revert "Apply Version Updates From Current Changes (v1)" (#9724)
This reverts commit 6bb721cd3d.
2024-05-09 14:02:31 -03:00
Angel S. Moreno
f1b0b00159 docs: added example of tauri.allowlist.protocol (#9726) 2024-05-09 19:52:55 +03:00
github-actions[bot]
6bb721cd3d Apply Version Updates From Current Changes (v1) (#9709)
Co-authored-by: lucasfernog <lucasfernog@users.noreply.github.com>
2024-05-09 12:28:21 -03:00
Amr Bashir
7f885bd5ed fix(core/shell): speedup Command.execute & fix extra new lines (#9706)
* fix(core/shell): speedup `Command.execute` & fix extra new lines

The speed gains comes from running the Command in Rust fully and returning the result in one go instead of using events.

The extra new lines was a regression from https://github.com/tauri-apps/tauri/pull/6519

ref: https://github.com/tauri-apps/tauri/issues/7684#issuecomment-2100897383

* fix unix build

* clippy

* cleanup

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2024-05-09 18:14:53 +03:00
Lucas Fernandes Nogueira
2eb21378a6 fix(tauri-runtime-wry): window draw span not closing (#9718)
* fix(tauri-runtime-wry): window draw span not closing

* use .retain
2024-05-09 10:09:48 -03:00
Enkhjil Enkhbaatar
ab9ec42c10 fix(windows): nsis failed to resolve resources with $ in their name, closes #9657 (#9659) 2024-05-08 20:32:09 +03:00
github-actions[bot]
07b6f9fa83 apply version updates (#9683)
Co-authored-by: FabianLars <FabianLars@users.noreply.github.com>
2024-05-06 22:33:33 +02:00
Fabian-Lars
db9ec4e79c ci: fix msrv check (#9682)
* ci: fix msrv check
2024-05-06 21:59:34 +02:00
Fabian-Lars
2a9a28044b ci: fix msrv check (#9681) 2024-05-06 21:48:13 +02:00
Fabian-Lars
5ee5ed4dc6 fix: schemars 0.8.18 compatibility (#9680)
* fix: schemars 0.8.18 compatibility

backport of #9676

Co-authored-by: Hankung <73242257+Hankung7183@users.noreply.github.com>

* fix clippy lol

---------

Co-authored-by: Hankung <73242257+Hankung7183@users.noreply.github.com>
2024-05-06 21:35:01 +02:00
Amr Bashir
b8fd8e1bac refactor(nsis): use nsis's built-in com plugin instead of ApplicationID plugin (#9606)
* Use WinShell instead of ApplicationID

* Uninst shortcut before removing start menu one

* Use nsis's buit-in com plugin instead of WinShell

* Remove download ApplicationID code

* Add change file

* Clippy and format

* Allow dead code on extract_zip

* Qualify extract_zip path to make clippy happy

* Move macro up

Co-authored-by: Tony <68118705+Legend-Master@users.noreply.github.com>
2024-04-30 15:11:00 +03:00
Amr Bashir
0749a84ae0 chore(cli/deps): update nsis-tauri-utils to 0.3 (#9605) 2024-04-30 13:05:08 +02:00
Amr Bashir
80db9dff28 ci: use node 16 (#9600)
* ci: use lts node version in CI

* lts/*

* 16

* more 16
2024-04-29 17:33:28 +03:00
Fabian-Lars
532279b724 ci(1.x): Fix publishing of cli-macos-x64 (#9575)
* ci: Fix publishing of cli-macos-x64

* temp: only publish darwin-x64

* temp: wrong version

* temp: disable everything but darwin-x64

* temp: wrong test arch...

* temp: last one

* temp: last one for realsies

* remove temp stuff

* revert more
2024-04-29 16:23:18 +03:00
Lucas Fernandes Nogueira
3e98145ac3 fix(core): run plugin init script in a separate context (#9570)
* fix(core): run plugin init script in a separate context

* fix ci
2024-04-28 11:15:26 -03:00
Fabian-Lars
fd2f8ab774 ci(1.x): Remove nodejs14 test in cli.js publishing workflow (#9569) 2024-04-25 12:45:06 +02:00
github-actions[bot]
caddd5bdd8 Apply Version Updates From Current Changes (v1) (#9544)
* apply version updates

* downgrade tokio deps

---------

Co-authored-by: lucasfernog <lucasfernog@users.noreply.github.com>
Co-authored-by: Lucas Nogueira <lucas@tauri.app>
2024-04-22 12:34:26 -03:00
Lucas Fernandes Nogueira
72c2636527 chore(ci): fix MSRV downgrade (#9543) 2024-04-22 11:17:33 -03:00
Lucas Fernandes Nogueira
83e024c670 chore(ci): downgrade home crate (#9542)
* chore(ci): downgrade home crate

* chore: update deps
2024-04-22 10:57:59 -03:00
Lucas Fernandes Nogueira
07c9e352df fix(ci): downgrade cc crate for MSRV compatibility (#9541) 2024-04-22 10:15:52 -03:00
Fabian-Lars
d00178d60c ci: Fix package downgrades in covector workflow (#9538)
* ci: Fix package downgrades in covector workflow

* some more packages
2024-04-22 09:16:16 -03:00
Lucas Fernandes Nogueira
705da977a9 fix: optional chaining is not supported on older webviews (#9529) 2024-04-21 20:53:51 -03:00
Fabian-Lars
1675e41f05 fix(bundler): don't convert product name to snake case when cross compiling (#9481)
* fix(bundler): Don't convert product name to snake case when cross compiling

fixes #9221

* Update bundler-cross-uppercase-productname.md

* Update .changes/bundler-cross-uppercase-productname.md
2024-04-18 17:04:17 +02:00
Fabian-Lars
f9638b6315 fix(cli): append extension to app binary manually on rename (#9491)
fixes #9488
fixes #8848
2024-04-18 05:31:07 +02:00
Amr Bashir
aeddc40b9e fix(cli/info): fix crash when checking node version (#9411)
closes #9396
2024-04-15 11:39:17 +02:00
Amr Bashir
fe6f81fa88 chore: fix clippy false positive (#9329) 2024-04-01 13:11:09 -03:00
Jet Li
9dd67abd93 fix(cli): upgrade heck to better support Chinese/Japanese prodcut name on Linux (#9298) 2024-04-01 17:23:15 +02:00
Fabian-Lars
dbe81b8410 fix(bundler/nsis): Don't use /R flag on installation dir (#9282) 2024-03-27 00:55:57 +02:00
Fabian-Lars
017861e4d5 fix(bundler): Fix nsis resource paths on non-windows build systems. (#9281)
* fix(bundler): Fix nsis resource paths on non-windows build systems.

* remove leftover from alternative
2024-03-27 00:40:29 +02:00
Fabian-Lars
77cc49ac3c fix(cli): Clone Options struct after mutating it. (#9188) 2024-03-19 10:37:12 -03:00
Amr Bashir
e3b6d38d26 fix(core/path): remove suffix in basename only once (#9166)
* fix(core/path): remove suffix in basename only once

ref: #9064

* Update tooling/api/src/path.ts

---------

Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.app>
2024-03-18 08:40:18 -03:00
github-actions[bot]
b705f89a10 Apply Version Updates From Current Changes (v1) (#9074)
Co-authored-by: lucasfernog <lucasfernog@users.noreply.github.com>
2024-03-07 15:18:27 -03:00
Amr Bashir
97a05145fb fix(cli): migrate to stable features of log crate (#9119)
* fix(cli): migrate to stable features of `log` crate

* to_cow_str
2024-03-07 13:39:32 -03:00
anatawa12
b15948b11c fix(cli): use matched_path_or_any_parents when checking if a file is ignored (#8903)
* fix: taurignore ignoreing folders not working for watch

* docs: add to changes

* fix: panic: path is expected to be under the root

* Update taurignore-ignoring-folders-not-working-for-watch.md

* Update taurignore-ignoring-folders-not-working-for-watch.md
2024-03-06 21:12:41 +02:00
bifs
5163861588 fix(bundler): escape potentially problematic strings in an XML (#9040)
* fix(bundler): escape potentially problematic strings in an XML (#9030)

- replace characters invalid in XML with their escaped form to properly bundle resources with such characters in their pathnames.

* change file
2024-03-04 21:08:12 +02:00
github-actions[bot]
80a215a6f3 Apply Version Updates From Current Changes (v1) (#9013)
Co-authored-by: lucasfernog <lucasfernog@users.noreply.github.com>
2024-02-28 00:11:02 -03:00
Amr Bashir
01ae1218dc ci: downgrade thread_local to 1.1.7 in msrv list (#9012) 2024-02-27 23:03:28 -03:00
Amr Bashir
d42668ce17 fix(runtime-wry): avoid panic during clipboard initialization on wayland (#9003)
closes #8964
2024-02-27 14:35:22 -03:00
Amr Bashir
1ab0db6352 chore: port PR template from dev branch (#9004) 2024-02-27 18:48:00 +02:00
1348 changed files with 108669 additions and 139141 deletions

View File

@@ -1,9 +0,0 @@
[advisories]
ignore = [
# rsa Marvin Attack
"RUSTSEC-2023-0071",
# difference is unmaintained
"RUSTSEC-2020-0095",
# proc-macro-error is unmaintained
"RUSTSEC-2024-0370",
]

View File

@@ -1,4 +1,2 @@
[env]
# workaround needed to prevent `STATUS_ENTRYPOINT_NOT_FOUND` error in tests
# see https://github.com/tauri-apps/tauri/pull/4383#issuecomment-1212221864
__TAURI_WORKSPACE__ = "true"

View File

@@ -4,7 +4,7 @@
"feat": "New Features",
"enhance": "Enhancements",
"bug": "Bug Fixes",
"perf": "Performance Improvements",
"pref": "Performance Improvements",
"changes": "What's Changed",
"sec": "Security fixes",
"deps": "Dependencies",
@@ -13,26 +13,24 @@
"defaultChangeTag": "changes",
"pkgManagers": {
"rust": {
"errorOnVersionRange": "^2.0.0-0",
"version": true,
"getPublishedVersion": {
"use": "fetch:check",
"options": {
"url": "https://crates.io/api/v1/crates/${ pkg.pkgFile.pkg.package.name }/${ pkg.pkgFile.version }"
}
},
"getPublishedVersion": "node ../../.scripts/covector/package-latest-version.js cargo ${ pkgFile.pkg.package.name } ${ pkgFile.pkg.package.version }",
"prepublish": [
"sudo apt-get update",
"sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev",
"cargo install cargo-audit --features=fix",
{
"command": "echo '<details>\n<summary><em><h4>Cargo Audit</h4></em></summary>\n\n```'",
"dryRunCommand": true,
"pipe": true
},
{
"command": "cargo generate-lockfile",
"dryRunCommand": true,
"runFromRoot": true,
"pipe": true
},
{
"command": "echo '<details>\n<summary><em><h4>Cargo Audit</h4></em></summary>\n\n```'",
"dryRunCommand": true,
"pipe": true
},
{
"command": "cargo audit ${ process.env.CARGO_AUDIT_OPTIONS || '' }",
"dryRunCommand": true,
@@ -46,6 +44,11 @@
}
],
"publish": [
"sleep 15s",
{
"command": "cargo package --no-verify",
"dryRunCommand": true
},
{
"command": "echo '<details>\n<summary><em><h4>Cargo Publish</h4></em></summary>\n\n```'",
"dryRunCommand": true,
@@ -62,34 +65,34 @@
"pipe": true
}
],
"postpublish": {
"use": "fetch:check",
"options": {
"url": "https://crates.io/api/v1/crates/${ pkg.pkgFile.pkg.package.name }/${ pkg.pkgFile.version }"
},
"retries": [5000, 5000, 5000]
}
"postpublish": [
"git tag ${ pkg.pkg }-v${ pkgFile.versionMajor } -f",
"git tag ${ pkg.pkg }-v${ pkgFile.versionMajor }.${ pkgFile.versionMinor } -f",
"git push --tags -f"
],
"assets": [
{
"path": "./target/package/${ pkg.pkg }-${ pkgFile.version }.crate",
"name": "${ pkg.pkg }-${ pkgFile.version }.crate"
}
]
},
"javascript": {
"errorOnVersionRange": "^2.0.0-0",
"version": true,
"getPublishedVersion": {
"use": "fetch:check",
"options": {
"url": "https://registry.npmjs.com/${ pkg.pkgFile.pkg.name }/${ pkg.pkgFile.version }"
}
},
"getPublishedVersion": "node ../../.scripts/covector/package-latest-version.js npm ${ pkgFile.pkg.name } ${ pkgFile.pkg.version }",
"prepublish": [
{
"command": "echo '<details>\n<summary><em><h4>PNPM Audit</h4></em></summary>\n\n```'",
"command": "yarn",
"dryRunCommand": true
},
{
"command": "echo '<details>\n<summary><em><h4>Yarn Audit</h4></em></summary>\n\n```'",
"dryRunCommand": true,
"pipe": true
},
{
"command": "pnpm i --frozen-lockfile",
"dryRunCommand": true
},
{
"command": "pnpm audit",
"command": "yarn audit",
"dryRunCommand": true,
"runFromRoot": true,
"pipe": true
@@ -98,17 +101,22 @@
"command": "echo '```\n\n</details>\n'",
"dryRunCommand": true,
"pipe": true
},
{
"command": "npm pack",
"dryRunCommand": true
}
],
"publish": [
"sleep 15s",
{
"command": "echo '<details>\n<summary><em><h4>PNPM Publish</h4></em></summary>\n\n```'",
"command": "echo '<details>\n<summary><em><h4>Yarn Publish</h4></em></summary>\n\n```'",
"dryRunCommand": true,
"pipe": true
},
{
"command": "pnpm publish --access public --loglevel silly --no-git-checks",
"dryRunCommand": "npm publish --dry-run --access public --no-git-checks",
"command": "yarn publish --access public --loglevel silly",
"dryRunCommand": "npm publish --dry-run --access public",
"pipe": true
},
{
@@ -117,27 +125,57 @@
"pipe": true
}
],
"postpublish": {
"use": "fetch:check",
"options": {
"url": "https://registry.npmjs.com/${ pkg.pkgFile.pkg.name }/${ pkg.pkgFile.version }"
},
"retries": [5000, 5000, 5000]
}
"postpublish": [
"git tag ${ pkg.pkg }-v${ pkgFile.versionMajor } -f",
"git tag ${ pkg.pkg }-v${ pkgFile.versionMajor }.${ pkgFile.versionMinor } -f",
"git push --tags -f"
]
}
},
"packages": {
"@tauri-apps/api": {
"path": "./packages/api",
"path": "./tooling/api",
"manager": "javascript",
"publish": [
"assets": [
{
"command": "echo '<details>\n<summary><em><h4>PNPM Publish</h4></em></summary>\n\n```'",
"path": "./tooling/api/dist/tauri-apps-api-${ pkgFile.version }.tgz",
"name": "tauri-apps-api-${ pkgFile.version }.tgz"
}
],
"prepublish": [
{
"command": "yarn",
"dryRunCommand": true
},
{
"command": "echo '<details>\n<summary><em><h4>Yarn Audit</h4></em></summary>\n\n```'",
"dryRunCommand": true,
"pipe": true
},
{
"command": "pnpm npm-publish",
"command": "yarn audit",
"dryRunCommand": true,
"runFromRoot": true,
"pipe": true
},
{
"command": "echo '```\n\n</details>\n'",
"dryRunCommand": true,
"pipe": true
},
{
"command": "yarn npm-pack",
"dryRunCommand": true
}
],
"publish": [
{
"command": "echo '<details>\n<summary><em><h4>Yarn Publish</h4></em></summary>\n\n```'",
"dryRunCommand": true,
"pipe": true
},
{
"command": "yarn npm-publish",
"dryRunCommand": true,
"pipe": true
},
@@ -149,82 +187,92 @@
]
},
"tauri-utils": {
"path": "./crates/tauri-utils",
"manager": "rust"
},
"tauri-macos-sign": {
"path": "./crates/tauri-macos-sign",
"path": "./core/tauri-utils",
"manager": "rust"
},
"tauri-bundler": {
"path": "./crates/tauri-bundler",
"path": "./tooling/bundler",
"manager": "rust",
"dependencies": ["tauri-utils", "tauri-macos-sign"]
"dependencies": ["tauri-utils"]
},
"tauri-runtime": {
"path": "./crates/tauri-runtime",
"path": "./core/tauri-runtime",
"manager": "rust",
"dependencies": ["tauri-utils"]
},
"tauri-runtime-wry": {
"path": "./crates/tauri-runtime-wry",
"path": "./core/tauri-runtime-wry",
"manager": "rust",
"dependencies": ["tauri-utils", "tauri-runtime"]
},
"tauri-codegen": {
"path": "./crates/tauri-codegen",
"path": "./core/tauri-codegen",
"manager": "rust",
"dependencies": ["tauri-utils"]
},
"tauri-macros": {
"path": "./crates/tauri-macros",
"path": "./core/tauri-macros",
"manager": "rust",
"dependencies": ["tauri-codegen", "tauri-utils"]
},
"tauri-plugin": {
"path": "./crates/tauri-plugin",
"manager": "rust",
"dependencies": ["tauri-utils"],
"postversion": "node ../../.scripts/ci/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }"
},
"tauri-build": {
"path": "./crates/tauri-build",
"path": "./core/tauri-build",
"manager": "rust",
"dependencies": ["tauri-codegen", "tauri-utils"],
"postversion": "node ../../.scripts/ci/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }"
"postversion": [
"node ../../.scripts/covector/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }",
"cargo build --manifest-path ../tauri-config-schema/Cargo.toml"
],
"assets": [
{
"path": "./tooling/cli/schema.json",
"name": "schema.json"
}
]
},
"tauri": {
"path": "./crates/tauri",
"path": "./core/tauri",
"manager": "rust",
"dependencies": [
"tauri-macros",
"tauri-utils",
"tauri-runtime",
"tauri-runtime-wry",
"tauri-build"
"tauri-runtime-wry"
],
"postversion": [
"node ../../.scripts/ci/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }",
"cargo build --manifest-path ../tauri-schema-generator/Cargo.toml"
]
"postversion": "node ../../.scripts/covector/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }"
},
"@tauri-apps/cli": {
"path": "./packages/cli",
"path": "./tooling/cli/node",
"manager": "javascript",
"getPublishedVersion": "node ../../../.scripts/covector/package-latest-version.js npm ${ pkgFile.pkg.name } ${ pkgFile.pkg.version }",
"dependencies": ["tauri-cli"],
"postversion": "node ../../.scripts/ci/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }",
"postversion": [
"node ../../../.scripts/covector/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }",
"cargo build --manifest-path ../../../core/tauri-config-schema/Cargo.toml"
],
"prepublish": [],
"publish": [],
"postpublish": []
},
"tauri-cli": {
"path": "./crates/tauri-cli",
"path": "./tooling/cli",
"manager": "rust",
"dependencies": ["tauri-bundler", "tauri-utils", "tauri-macos-sign"]
"dependencies": ["tauri-bundler", "tauri-utils"],
"postversion": [
"cargo check",
"cargo build --manifest-path ../../core/tauri-config-schema/Cargo.toml"
],
"assets": [
{
"path": "${ pkg.path }/target/package/tauri-cli-${ pkgFile.version }.crate",
"name": "${ pkg.pkg }-${ pkgFile.version }.crate"
}
]
},
"tauri-driver": {
"path": "./crates/tauri-driver",
"manager": "rust"
"path": "./tooling/webdriver",
"manager": "rust",
"postversion": "cargo check"
}
}
}

View File

@@ -10,8 +10,8 @@ Use the following format:
```md
---
'package-a': 'patch:enhance'
'package-b': 'patch:enhance'
'package-a': patch
'package-b': patch
---
Change summary goes here
@@ -33,7 +33,7 @@ Additionally you could specify a tag for the change file to group it with other
```md
---
'package-a': 'patch:enhance'
'package-a': patch:bug
---
Change summary goes here

View File

@@ -5,8 +5,8 @@ FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}
# Derived from Tauri contribution and setup guides:
# See: https://github.com/tauri-apps/tauri/blob/dev/.github/CONTRIBUTING.md#development-guide
# See: https://v2.tauri.app/start/prerequisites/
ARG TAURI_BUILD_DEPS="build-essential curl libappindicator3-dev libgtk-3-dev librsvg2-dev libssl-dev libwebkit2gtk-4.1-dev wget"
# See: https://tauri.app/v1/guides/getting-started/prerequisites/#setting-up-linux
ARG TAURI_BUILD_DEPS="build-essential curl libappindicator3-dev libgtk-3-dev librsvg2-dev libssl-dev libwebkit2gtk-4.0-dev wget"
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get install -y --no-install-recommends $TAURI_BUILD_DEPS

View File

@@ -24,7 +24,7 @@ Prerequisites are mainly derived from VS Code's instructions for usage of develo
### A note on filesystem performance
Due to limitations in how Docker shares files between the Docker host and a container, it's also recommended that developers [clone Tauri source code into a container volume](https://code.visualstudio.com/remote/advancedcontainers/improve-performance#_use-clone-repository-in-container-volume). This is optional, but highly advised as many filesystem/IO heavy operations (`cargo build`, `pnpm install`, etc) will be very slow if they operate on directories shared with a Docker container from the Docker host.
Due to limitations in how Docker shares files between the Docker host and a container, it's also recommended that developers [clone Tauri source code into a container volume](https://code.visualstudio.com/remote/advancedcontainers/improve-performance#_use-clone-repository-in-container-volume). This is optional, but highly advised as many filesystem/IO heavy operations (`cargo build`, `yarn install`, etc) will be very slow if they operate on directories shared with a Docker container from the Docker host.
To do this, open your project with VS Code and run **Remote-Containers: Clone Repository in Container Volume...** from the Command Palette (<kbd>F1</kbd>).
@@ -33,7 +33,6 @@ To do this, open your project with VS Code and run **Remote-Containers: Clone Re
Docker Desktop provides facilities for [allowing the development container to connect to a service on the Docker host](https://docs.docker.com/desktop/windows/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host). So long as you have an X window server running on your Docker host, the devcontainer can connect to it and expose your Tauri GUI via an X window.
**Export the `DISPLAY` variable within the devcontainer terminal you launch your Tauri application from to expose your GUI outside of the devcontainer**.
```bash
export DISPLAY="host.docker.internal:0"
```

View File

@@ -1,4 +1,4 @@
FROM ubuntu:22.04
FROM ubuntu:18.04
ARG DEBIAN_FRONTEND=noninteractive
COPY common.sh lib.sh /
@@ -41,4 +41,4 @@ ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
RUN dpkg --add-architecture arm64
RUN apt-get update
RUN apt-get install --assume-yes --no-install-recommends libssl-dev:arm64 libdbus-1-dev:arm64 libsoup2.4-dev:arm64 libssl-dev:arm64 libgtk-3-dev:arm64 webkit2gtk-4.1-dev:arm64 libappindicator3-1:arm64 librsvg2-dev:arm64 patchelf:arm64
RUN apt-get install --assume-yes --no-install-recommends libssl-dev:arm64 libdbus-1-dev:arm64 libsoup2.4-dev:arm64 libssl-dev:arm64 libgtk-3-dev:arm64 webkit2gtk-4.0-dev:arm64 libappindicator3-1:arm64 librsvg2-dev:arm64 patchelf:arm64

View File

@@ -1,3 +1,4 @@
# Contributor Covenant Code of Conduct
## Our Pledge
@@ -17,23 +18,23 @@ diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our
community include:
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
- Focusing on what is best not just for us as individuals, but for the overall
* Focusing on what is best not just for us as individuals, but for the overall
community
Examples of unacceptable behavior include:
- The use of sexualized language or imagery, and sexual attention or advances of
* The use of sexualized language or imagery, and sexual attention or advances of
any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email address,
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
@@ -129,4 +130,4 @@ For answers to common questions about this code of conduct, see the FAQ at
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
[translations]: https://www.contributor-covenant.org/translations

View File

@@ -22,7 +22,7 @@ Hi! We, the maintainers, are really excited that you are interested in contribut
- Issues with no clear repro steps will not be triaged. If an issue labeled "need repro" receives no further input from the issue author for more than 5 days, it will be closed.
- If your issue is resolved but still open, don't hesitate to close it. In case you found a solution by yourself, it could be helpful to explain how you fixed it.
- If your issue is resolved but still open, dont hesitate to close it. In case you found a solution by yourself, it could be helpful to explain how you fixed it.
- Most importantly, we beg your patience: the team must balance your request against many other responsibilities — fixing other bugs, answering other questions, new features, new documentation, etc. The issue list is not paid support and we cannot make guarantees about how fast your issue can be resolved.
@@ -37,57 +37,54 @@ Hi! We, the maintainers, are really excited that you are interested in contribut
- Provide convincing reason to add this feature. Ideally you should open a suggestion issue first and have it greenlighted before working on it.
- If fixing a bug:
- If you are resolving a special issue, add `(fix: #xxxx[,#xxx])` (#xxxx is the issue id) in your PR title for a better release log, e.g. `fix: update entities encoding/decoding (fix #3899)`.
- Provide detailed description of the bug in the PR, or link to an issue that does.
- If the PR is meant to be released, follow the instructions in `.changes/readme.md` to log your changes. ie. [readme.md](https://github.com/tauri-apps/tauri/blob/dev/.changes/README.md)
## Development Guide
**NOTE: If you have any question don't hesitate to ask in our Discord server. We try to keep this guide to up guide, but if something doesn't work let us know.**
**NOTE: Tauri is undergoing rapid development right now, and the docs match the latest published version of Tauri. They are horribly out of date when compared with the code in the dev branch. This contributor guide is up-to-date, but it doesn't cover all of Tauri's functions in depth. If you have any questions, don't hesitate to ask in our Discord server.**
### General Setup
First, [join our Discord server](https://discord.gg/SpmNs4S) and let us know that you want to contribute. This way we can point you in the right direction and help ensure your contribution will be as helpful as possible.
To set up your machine for development, follow the [Tauri setup guide](https://v2.tauri.app/start/prerequisites/) to get all the tools you need to develop Tauri apps. The only additional tool you may need is [PNPM](https://pnpm.io/), it is only required if you are developing the Node CLI or API packages (`packages/cli` and `packages/api`). Next, fork and clone this repo. It is structured as a monorepo, which means that all the various Tauri packages are under the same repository. The development process varies depending on what part of Tauri you are contributing to, see the guides below for per-package instructions.
To set up your machine for development, follow the [Tauri setup guide](https://tauri.app/v1/guides/getting-started/prerequisites/) to get all the tools you need to develop Tauri apps. The only additional tool you may need is [Yarn](https://yarnpkg.com/), it is only required if you are developing the Node CLI or API packages (`tooling/cli/node` and `tooling/api`). Next, fork and clone this repo. It is structured as a monorepo, which means that all the various Tauri packages are under the same repository. The development process varies depending on what part of Tauri you are contributing to, see the guides below for per-package instructions.
Some Tauri packages will be automatically built when running one of the examples. Others, however, will need to be built beforehand. To initialize, execute these commands in the repository root:
Some Tauri packages will be automatically built when running one of the examples. Others, however, will need to be built beforehand. To build these automatically, run the `.scripts/setup.sh` (Linux and macOS) or `.scripts/setup.ps1` (Windows) script. This will install the Rust and Node.js CLI and build the JS API. After that, you should be able to run all the examples. Note that the setup script should be executed from the root folder of the repository in order to run correctly.
```bash
pnpm install
pnpm build
```
### Packages Overview
### Overview
See [Architecture](../ARCHITECTURE.md#major-components) for an overview of the packages in this repository.
- 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 Tauri Bundler and Rust CLI
The code for the bundler is located in `[Tauri repo root]/crates/tauri-bundler`, and the code for the Rust CLI is located in `[Tauri repo root]/crates/tauri-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.
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]/crates/tauri-cli` folder contains only packaging scripts to properly publish the Rust CLI binaries to NPM.
`@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.
### Developing Tauri Core and Related Components (Rust API, Macros, Codegen, and Utils)
The code for the Rust crates, including the Core, Macros, Utils, WRY runtime, and a few more are located in `[Tauri repo root]/crates/tauri-(macros/utils)`. The easiest way to test your changes is to use the `[Tauri repo root]/examples/helloworld` app. It automatically rebuilds and uses your local copy of the Tauri core packages. Just run `cargo run --example helloworld` after making changes to test them out.
The code for Tauri Core is located in `[Tauri repo root]/core/tauri`, and the Rust API, Macros, and Utils are in `[Tauri repo root]/core/tauri-(api/macros/utils)`. The easiest way to test your changes is to use the `[Tauri repo root]/examples/helloworld` app. It automatically rebuilds and uses your local copy of the Tauri core packages. Just run `yarn tauri build` or `yarn tauri dev` in the helloworld app directory after making changes to test them out. To use your local changes in another project, edit its `src-tauri/Cargo.toml` file so that the `tauri` key looks like `tauri = { path = "PATH", features = [ "api-all", "cli" ] }`, where `PATH` is the relative path to `[Tauri repo root]/core/tauri`. Then, your local copy of the Tauri core packages will be rebuilt and used whenever you build that project.
#### Building the documentation locally
You can build the Rust documentation locally running the following script:
```bash
$ RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features --open
$ RUSTDOCFLAGS="--cfg doc_cfg" cargo +nightly doc --all-features --open
```
### Developing the JS API
The JS API provides bindings between the developer's JS in the Webview and the builtin Tauri APIs, written in Rust. Its code is located in `[Tauri repo root]/packages/api`. After making changes to the code, run `pnpm build` to build it. To test your changes, we recommend using the API example app, located in `[Tauri repo root]/examples/api`. It will automatically use your local copy of the JS API and provides a helpful UI to test the various commands.
The JS API provides bindings between the developer's JS in the Webview and the builtin Tauri APIs, written in Rust. Its code is located in `[Tauri repo root]/tooling/api`. After making changes to the code, run `yarn build` to build it. To test your changes, we recommend using the API example app, located in `[Tauri repo root]/examples/api`. It will automatically use your local copy of the JS API and provides a helpful UI to test the various commands.
## Financial Contribution
Tauri is an MIT-licensed open source project. Its ongoing development can be supported via [GitHub Sponsors](https://github.com/sponsors/tauri-apps) or [Open Collective](https://opencollective.com/tauri). We prefer GitHub Sponsors as donations made are doubled through the matching fund program.
Tauri is an MIT-licensed open source project. Its ongoing development can be supported via [GitHub Sponsors](https://github.com/sponsors/nothingismagick) or [Open Collective](https://opencollective.com/tauri). We prefer GitHub Sponsors as donations made are doubled through the matching fund program.

2
.github/FUNDING.yml vendored
View File

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

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2024 Tauri Programme within The Commons Conservancy
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
@@ -44,8 +44,8 @@ body:
- type: textarea
id: info
attributes:
label: Full `tauri info` output
description: 'Output of `npm run tauri info` or `cargo tauri info`'
label: Platform and versions
description: "Output of `npm run tauri info` or `cargo tauri info`"
render: text
validations:
required: true

View File

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

View File

@@ -1,7 +1,8 @@
---
name: 📚 Docs Report
about: Create a report to help us improve the docs
title: '[docs] '
title: "[docs] "
labels: 'type: documentation'
assignees: ''
---

View File

@@ -1,11 +1,11 @@
# Copyright 2019-2024 Tauri Programme within The Commons Conservancy
# 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
labels: ['type: feature request']
labels: 'type: feature request'
body:
- type: textarea
@@ -22,7 +22,7 @@ body:
attributes:
label: "Describe the solution you'd like"
description: A clear description of what change you would like
placeholder: 'I would like to...'
placeholder: "I would like to..."
validations:
required: true
@@ -31,7 +31,7 @@ body:
attributes:
label: Alternatives considered
description: "Any alternative solutions you've considered"
- type: textarea
id: context
attributes:

View File

@@ -5,7 +5,7 @@ Before submitting a PR, please read https://github.com/tauri-apps/tauri/blob/dev
Examples of good title:
- fix(windows): fix race condition in event loop
- docs: update example for `App::show`
- docs: update docstrings
- feat: add `Window::set_fullscreen`
Examples of bad title:
@@ -14,7 +14,7 @@ Before submitting a PR, please read https://github.com/tauri-apps/tauri/blob/dev
- fix bugs
2. If there is a related issue, reference it in the PR text, e.g. closes #123.
3. If this change requires a new version, then add a change file in `.changes` directory with the appropriate bump, see https://github.com/tauri-apps/tauri/blob/dev/.changes/README.md
3. If this change requires a new version, then add a change file in `.changes` directory with the appropriate bump, see https://github.com/tauri-apps/tauri/blob/dev/.changes/readme.md
4. Ensure that all your commits are signed https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits
5. Ensure `cargo test` and `cargo clippy` passes.
6. Propose your changes as a draft PR if your work is still in progress.

62
.github/RELEASING.md vendored
View File

@@ -1,62 +0,0 @@
# Tauri Releasing Handbook
This handbook contains information about our release pipeline and how to deal with common issues.
This document is mainly intended for team members responsible for maintaining the project.
- [Covector](#covector)
- [Version Pull Request](#version-pull-request)
- [Releasing and Publishing](#releasing-and-publishing)
- [Publishing failed, what to do?](#publishing-failed-what-to-do)
## Covector
We use [`covector`](https://github.com/jbolda/covector) to manage our version bumps and release pipeline.
It can be configured in [`.changes/config.json`](../.changes/config.json) which includes how each package should be published step by step.
Some packages can't be published directly using `covector` as it requires to be built on a matrix of platforms
such as `tauri-cli` prebuilt binaries which is published using [publish-cli-rs.yml](./workflows/publish-cli-rs.yml)
and `@tauri-apps/cli` native Node.js modules which is published using using [publish-cli-js.yml](./workflows/publish-cli-js.yml)
both of which are triggered after `covector` has created a github release for both of them, see `Trigger @tauri-apps/cli publishing workflow`
and `Trigger tauri-cli publishing workflow` steps in [covector-version-or-publish.yml](./workflows/covector-version-or-publish.yml)
## Version Pull Request
On each pull request merged, [covector-version-or-publish.yml](./workflows/covector-version-or-publish.yml) workflow will run, and:
When there're change files inside `.changes` folder and they're not all included in `pre.json` (usually this is only when we are in `-alpha` to `-rc` phase), it will open/update an `Apply Version Updates From Current Changes` PR (https://github.com/tauri-apps/tauri/pull/11029 for example) that bumps all packages based on current existing change files and generate `CHANGELOG.md` entries. see `Create Pull Request With Versions Bumped` step in [covector-version-or-publish.yml](./workflows/covector-version-or-publish.yml).
Otherwise, covector will start to publish packages configured in [`.changes/config.json`](../.changes/config.json).
## Releasing and Publishing
Releasing can be as easy as merging the version pull request but here is a checklist to follow:
- [ ] Double check that every package is bumped correctly and there are no accidental major or minor being released unless that is indeed the intention.
- [ ] Make sure that there are no pending or unfinished [covector-version-or-publish.yml](./workflows/covector-version-or-publish.yml) workflow runs.
- [ ] Sign the Version PR before merging as we require signed commits
- [ ] `git fetch --all`
- [ ] `git checkout release/version-updates`
- [ ] `git commit --amend -S`
- [ ] `git push --force`
- [ ] Approve and merge the version pull request
## Publishing failed, what to do?
It is possible and due to many factors that one or many packages release can fail to release, there is no reason to panic, we can fix this.
Did all of the packages fail to release?
- yes?
- [ ] `git checkout -b revert-branch`
- [ ] `git revert HEAD~1`
- no?
- [ ] `git checkout -b revert-branch`
- [ ] `git revert HEAD~1 --no-commit`
- [ ] Edit the commit and revert only changes related to packages that failed to publish
- [ ] `git revert --continue`
Then:
- [ ] Make a pull request with reverted changes, get it approved and merged
- [ ] Fix the issue that caused releases to fail in another PR, get it approved and merged
- [ ] Repeat the release process again.

3
.github/config.yml vendored Normal file
View File

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

View File

@@ -1,31 +0,0 @@
<svg class="crabnebula-logo" width="100%" height="100%" viewBox="0 0 1204 210" version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
xml:space="preserve" xmlns:serif="http://www.serif.com/"
style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<style>
.crabnebula-logo path,
.crabnebula-logo rect {
fill: #001e42;
}
@media (prefers-color-scheme: dark) {
.crabnebula-logo path, .crabnebula-logo rect {
fill: #fff;
}
}
html[data-color-mode="dark"] .crabnebula-logo path,
html[data-color-mode="dark"] .crabnebula-logo rect {
fill: #fff;
}
</style>
<path d="M351.903,162.334C344.288,162.334 337.123,160.881 330.41,157.975C323.696,155.069 317.834,151.11 312.824,146.099C307.914,141.089 304.006,135.276 301.101,128.662C298.195,121.948 296.742,114.783 296.742,107.167C296.742,99.55 298.195,92.435 301.101,85.821C304.006,79.107 307.914,73.244 312.824,68.234C317.834,63.223 323.696,59.265 330.41,56.358C337.123,53.452 344.288,51.999 351.903,51.999C357.414,51.999 362.675,52.701 367.685,54.103C372.795,55.507 377.455,57.511 381.663,60.116C385.972,62.622 389.83,65.678 393.237,69.286C396.644,72.793 399.499,76.752 401.804,81.161L380.762,92.586C377.756,87.174 373.848,82.915 369.038,79.808C364.328,76.702 358.617,75.148 351.903,75.148C347.494,75.148 343.386,76 339.578,77.704C335.871,79.407 332.614,81.762 329.809,84.769C327.003,87.675 324.798,91.082 323.195,94.991C321.592,98.799 320.79,102.857 320.79,107.167C320.79,111.476 321.592,115.584 323.195,119.493C324.798,123.301 327.003,126.708 329.809,129.715C332.614,132.621 335.871,134.926 339.578,136.629C343.386,138.333 347.494,139.185 351.903,139.185C358.617,139.185 364.328,137.631 369.038,134.525C373.848,131.418 377.756,127.159 380.762,121.748L401.804,133.172C399.499,137.581 396.644,141.59 393.237,145.198C389.83,148.705 385.972,151.762 381.663,154.367C377.455,156.872 372.795,158.827 367.685,160.23C362.675,161.633 357.414,162.334 351.903,162.334Z" style="fill-rule:nonzero;stroke:black;stroke-width:0.55px;"/>
<path d="M413.821,85.37L436.517,85.37L436.517,96.644C437.72,93.337 439.924,90.481 443.131,88.076C446.437,85.671 450.195,84.468 454.403,84.468C455.506,84.468 456.658,84.518 457.86,84.619C459.063,84.719 460.366,84.969 461.768,85.37L461.768,108.369C460.065,107.768 458.412,107.317 456.808,107.016C455.205,106.716 453.502,106.565 451.698,106.565C446.788,106.565 443.03,108.269 440.425,111.676C437.82,115.083 436.517,119.493 436.517,124.904L436.517,160.53L413.821,160.53L413.821,85.37Z" style="fill-rule:nonzero;stroke:black;stroke-width:0.55px;"/>
<path d="M502.161,162.184C497.251,162.184 492.642,161.132 488.333,159.027C484.125,156.923 480.467,154.117 477.361,150.609C474.255,147.001 471.8,142.843 469.996,138.133C468.193,133.322 467.291,128.261 467.291,122.95C467.291,117.639 468.193,112.628 469.996,107.918C471.8,103.108 474.255,98.949 477.361,95.442C480.467,91.834 484.125,88.978 488.333,86.873C492.642,84.769 497.251,83.717 502.161,83.717C504.666,83.717 506.971,84.017 509.075,84.619C511.28,85.12 513.234,85.821 514.937,86.723C516.741,87.625 518.244,88.627 519.446,89.729C520.749,90.832 521.801,91.884 522.603,92.886L522.603,85.37L545.299,85.37L545.299,160.53L522.603,160.53L522.603,153.014C521.801,154.016 520.749,155.069 519.446,156.171C518.244,157.273 516.741,158.275 514.937,159.177C513.234,160.079 511.28,160.781 509.075,161.282C506.971,161.883 504.666,162.184 502.161,162.184ZM507.272,141.59C512.382,141.59 516.49,139.836 519.597,136.329C522.803,132.821 524.406,128.362 524.406,122.95C524.406,117.539 522.803,113.079 519.597,109.572C516.49,106.064 512.382,104.31 507.272,104.31C502.161,104.31 498.003,106.064 494.796,109.572C491.69,113.079 490.137,117.539 490.137,122.95C490.137,128.362 491.69,132.821 494.796,136.329C498.003,139.836 502.161,141.59 507.272,141.59Z" style="fill-rule:nonzero;stroke:black;stroke-width:0.55px;"/>
<path d="M607.116,162.184C604.611,162.184 602.256,161.883 600.051,161.282C597.947,160.781 595.993,160.079 594.19,159.177C592.486,158.275 590.983,157.273 589.681,156.171C588.378,155.069 587.376,154.016 586.674,153.014L586.674,160.53L563.979,160.53L563.979,47.79L586.674,47.79L586.674,92.886C587.376,91.884 588.378,90.832 589.681,89.729C590.983,88.627 592.486,87.625 594.19,86.723C595.993,85.821 597.947,85.12 600.051,84.619C602.256,84.017 604.611,83.717 607.116,83.717C612.026,83.717 616.585,84.769 620.793,86.873C625.102,88.978 628.81,91.834 631.916,95.442C635.022,98.949 637.477,103.108 639.281,107.918C641.084,112.628 641.986,117.639 641.986,122.95C641.986,128.261 641.084,133.322 639.281,138.133C637.477,142.843 635.022,147.001 631.916,150.609C628.81,154.117 625.102,156.923 620.793,159.027C616.585,161.132 612.026,162.184 607.116,162.184ZM602.005,141.59C607.116,141.59 611.224,139.836 614.33,136.329C617.537,132.821 619.14,128.362 619.14,122.95C619.14,117.539 617.537,113.079 614.33,109.572C611.224,106.064 607.116,104.31 602.005,104.31C596.895,104.31 592.737,106.064 589.53,109.572C586.424,113.079 584.871,117.539 584.871,122.95C584.871,128.362 586.424,132.821 589.53,136.329C592.737,139.836 596.895,141.59 602.005,141.59Z" style="fill-rule:nonzero;stroke:black;stroke-width:0.55px;"/>
<path d="M732.106,160.53L680.101,94.54L680.101,160.53L656.203,160.53L656.203,53.803L676.795,53.803L728.649,119.793L728.649,53.803L752.698,53.803L752.698,160.53L732.106,160.53Z" style="fill-rule:nonzero;stroke:black;stroke-width:0.55px;"/>
<path d="M806.852,162.184C801.341,162.184 796.13,161.282 791.22,159.478C786.411,157.674 782.202,155.069 778.595,151.661C774.988,148.254 772.132,144.145 770.028,139.335C767.923,134.425 766.871,128.963 766.871,122.95C766.871,117.338 767.823,112.177 769.727,107.467C771.731,102.657 774.487,98.498 777.994,94.991C781.601,91.483 785.809,88.727 790.619,86.723C795.429,84.719 800.69,83.717 806.401,83.717C811.311,83.717 816.021,84.518 820.53,86.122C825.139,87.625 829.147,89.93 832.554,93.036C835.961,96.043 838.666,99.851 840.67,104.461C842.775,108.97 843.827,114.282 843.827,120.395C843.827,121.397 843.777,122.549 843.677,123.852C843.677,125.055 843.576,126.558 843.376,128.362L788.816,128.362C789.517,132.871 791.671,136.228 795.279,138.433C798.886,140.538 802.844,141.59 807.153,141.59C811.562,141.59 815.319,140.738 818.425,139.034C821.632,137.231 823.937,135.226 825.339,133.022L842.173,145.649C838.666,150.659 833.857,154.668 827.744,157.674C821.732,160.681 814.768,162.184 806.852,162.184ZM821.281,113.48C820.279,109.471 818.275,106.615 815.269,104.912C812.263,103.108 809.107,102.206 805.8,102.206C804.096,102.206 802.393,102.406 800.69,102.807C798.986,103.208 797.383,103.859 795.88,104.761C794.377,105.663 793.024,106.816 791.822,108.219C790.719,109.622 789.918,111.376 789.417,113.48L821.281,113.48Z" style="fill-rule:nonzero;stroke:black;stroke-width:0.55px;"/>
<path d="M901.265,162.184C898.76,162.184 896.405,161.883 894.201,161.282C892.097,160.781 890.143,160.079 888.339,159.177C886.636,158.275 885.133,157.273 883.83,156.171C882.527,155.069 881.525,154.016 880.824,153.014L880.824,160.53L858.128,160.53L858.128,47.79L880.824,47.79L880.824,92.886C881.525,91.884 882.527,90.832 883.83,89.729C885.133,88.627 886.636,87.625 888.339,86.723C890.143,85.821 892.097,85.12 894.201,84.619C896.405,84.017 898.76,83.717 901.265,83.717C906.175,83.717 910.734,84.769 914.943,86.873C919.252,88.978 922.959,91.834 926.065,95.442C929.172,98.949 931.627,103.108 933.43,107.918C935.234,112.628 936.136,117.639 936.136,122.95C936.136,128.261 935.234,133.322 933.43,138.133C931.627,142.843 929.172,147.001 926.065,150.609C922.959,154.117 919.252,156.923 914.943,159.027C910.734,161.132 906.175,162.184 901.265,162.184ZM896.155,141.59C901.265,141.59 905.374,139.836 908.48,136.329C911.686,132.821 913.29,128.362 913.29,122.95C913.29,117.539 911.686,113.079 908.48,109.572C905.374,106.064 901.265,104.31 896.155,104.31C891.045,104.31 886.886,106.064 883.68,109.572C880.573,113.079 879.02,117.539 879.02,122.95C879.02,128.362 880.573,132.821 883.68,136.329C886.886,139.836 891.045,141.59 896.155,141.59Z" style="fill-rule:nonzero;stroke:black;stroke-width:0.55px;"/>
<path d="M977.812,162.184C968.493,162.184 961.429,159.077 956.619,152.864C951.81,146.651 949.405,138.433 949.405,128.211L949.405,85.37L972.101,85.37L972.101,124.303C972.101,129.815 972.952,134.074 974.656,137.08C976.459,140.087 979.466,141.59 983.674,141.59C987.983,141.59 991.39,140.037 993.895,136.93C996.5,133.823 997.803,128.813 997.803,121.898L997.803,85.37L1020.5,85.37L1020.5,160.53L997.803,160.53L997.803,152.864C995.999,155.469 993.444,157.674 990.137,159.478C986.83,161.282 982.722,162.184 977.812,162.184Z" style="fill-rule:nonzero;stroke:black;stroke-width:0.55px;"/>
<rect x="1039.11" y="47.79" width="22.701" height="112.74" style="fill-rule:nonzero;stroke:black;stroke-width:0.55px;"/>
<path d="M1110.86,162.184C1105.95,162.184 1101.34,161.132 1097.03,159.027C1092.83,156.923 1089.17,154.117 1086.06,150.609C1082.96,147.001 1080.5,142.843 1078.7,138.133C1076.89,133.322 1075.99,128.261 1075.99,122.95C1075.99,117.639 1076.89,112.628 1078.7,107.918C1080.5,103.108 1082.96,98.949 1086.06,95.442C1089.17,91.834 1092.83,88.978 1097.03,86.873C1101.34,84.769 1105.95,83.717 1110.86,83.717C1113.37,83.717 1115.67,84.017 1117.78,84.619C1119.98,85.12 1121.94,85.821 1123.64,86.723C1125.44,87.625 1126.95,88.627 1128.15,89.729C1129.45,90.832 1130.5,91.884 1131.3,92.886L1131.3,85.37L1154,85.37L1154,160.53L1131.3,160.53L1131.3,153.014C1130.5,154.016 1129.45,155.069 1128.15,156.171C1126.95,157.273 1125.44,158.275 1123.64,159.177C1121.94,160.079 1119.98,160.781 1117.78,161.282C1115.67,161.883 1113.37,162.184 1110.86,162.184ZM1115.97,141.59C1121.08,141.59 1125.19,139.836 1128.3,136.329C1131.5,132.821 1133.11,128.362 1133.11,122.95C1133.11,117.539 1131.5,113.079 1128.3,109.572C1125.19,106.064 1121.08,104.31 1115.97,104.31C1110.86,104.31 1106.7,106.064 1103.5,109.572C1100.39,113.079 1098.84,117.539 1098.84,122.95C1098.84,128.362 1100.39,132.821 1103.5,136.329C1106.7,139.836 1110.86,141.59 1115.97,141.59Z" style="fill-rule:nonzero;stroke:black;stroke-width:0.55px;"/>
<path d="M146.48,54.585C119.724,89.866 119.878,134.941 146.826,155.264C153.908,160.605 162.136,163.705 170.903,164.732C146.032,184.934 117.382,191.203 98.037,178.045C71.507,160 72.524,112.249 100.309,71.391C123.51,37.273 158.039,18.749 184.247,24.072C170.404,30.195 157.116,40.561 146.48,54.585ZM181.638,99.643C169.141,111.453 154.859,119.304 142.801,121.916C149.921,147.367 177.29,149.323 177.29,149.323C177.29,149.323 193.578,145.578 205.877,117.941C216.005,95.183 215.122,71.668 204.914,59.7C204.065,71.267 195.731,86.324 181.638,99.643Z" style="stroke:black;stroke-width:0.55px;"/>
</svg>

Before

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2024 Tauri Programme within The Commons Conservancy
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
@@ -14,7 +14,7 @@ on:
- '**/Cargo.lock'
- '**/Cargo.toml'
- '**/package.json'
- '**/pnpm-lock.yaml'
- '**/yarn.lock'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@@ -24,18 +24,21 @@ jobs:
audit-rust:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v2
- name: rust audit
uses: rustsec/audit-check@v1
uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
audit-js:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm i -g --force corepack
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- run: pnpm audit
- 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
working-directory: tooling/cli/node
run: yarn audit

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2024 Tauri Programme within The Commons Conservancy
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
@@ -8,16 +8,13 @@ on:
push:
branches:
- dev
- 1.x
workflow_dispatch:
pull_request:
paths:
- '.github/workflows/bench.yml'
- 'bench/**'
env:
RUST_BACKTRACE: 1
CARGO_PROFILE_DEV_DEBUG: 0 # This would add unnecessary bloat to the target folder, decreasing cache efficiency.
LC_ALL: en_US.UTF-8 # This prevents strace from changing its number format to use commas.
LC_ALL: en_US.UTF-8 # This prevents strace from changing it's number format to use commas.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@@ -30,22 +27,23 @@ jobs:
matrix:
rust: [nightly]
platform:
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest }
- { target: x86_64-unknown-linux-gnu, os: ubuntu-20.04 }
runs-on: ${{ matrix.platform.os }}
steps:
- uses: actions/checkout@v4
- name: install Rust ${{ matrix.rust }}
uses: dtolnay/rust-toolchain@master
- uses: actions/checkout@v2
- name: install ${{ matrix.rust }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
default: true
components: rust-src
targets: ${{ matrix.platform.target }}
target: ${{ matrix.platform.target }}
- name: setup python
uses: actions/setup-python@v5
uses: actions/setup-python@v2
with:
python-version: '3.10'
architecture: x64
@@ -54,26 +52,25 @@ jobs:
run: |
python -m pip install --upgrade pip
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
webkit2gtk-4.1 libayatana-appindicator3-dev \
xvfb \
at-spi2-core
wget https://github.com/sharkdp/hyperfine/releases/download/v1.18.0/hyperfine_1.18.0_amd64.deb
sudo dpkg -i hyperfine_1.18.0_amd64.deb
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev xvfb
wget https://github.com/sharkdp/hyperfine/releases/download/v1.11.0/hyperfine_1.11.0_amd64.deb
sudo dpkg -i hyperfine_1.11.0_amd64.deb
pip install memory_profiler
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
core -> ../target
tooling/bench/tests
- name: run benchmarks
run: |
cargo build --manifest-path bench/tests/cpu_intensive/src-tauri/Cargo.toml --release -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target ${{ matrix.platform.target }}
cargo build --manifest-path bench/tests/files_transfer/src-tauri/Cargo.toml --release -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target ${{ matrix.platform.target }}
cargo build --manifest-path bench/tests/helloworld/src-tauri/Cargo.toml --release -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target ${{ matrix.platform.target }}
xvfb-run --auto-servernum cargo run --manifest-path bench/Cargo.toml --bin run_benchmark
cargo build --release -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target ${{ matrix.platform.target }} --manifest-path tooling/bench/tests/Cargo.toml
xvfb-run --auto-servernum cargo run --manifest-path tooling/bench/Cargo.toml --bin run_benchmark
- name: clone benchmarks_results
if: github.repository == 'tauri-apps/tauri' && github.ref == 'refs/heads/dev'
uses: actions/checkout@v4
uses: actions/checkout@v2
with:
token: ${{ secrets.BENCH_PAT }}
path: gh-pages
@@ -82,7 +79,7 @@ jobs:
- name: push new benchmarks
if: github.repository == 'tauri-apps/tauri' && github.ref == 'refs/heads/dev'
run: |
cargo run --manifest-path bench/Cargo.toml --bin build_benchmark_jsons
cargo run --manifest-path tooling/bench/Cargo.toml --bin build_benchmark_jsons
cd gh-pages
git pull
git config user.name "tauri-bench"

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2024 Tauri Programme within The Commons Conservancy
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
@@ -17,21 +17,9 @@ jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: check change files end with .md
run: |
for file in .changes/*
do
if [[ ! "$file" =~ \.(md|json)$ ]]; then
echo ".changes directory should only contain files that end with .md"
echo "found an invalid file in .changes directory:"
echo "$file"
exit 1
fi
done
- uses: dorny/paths-filter@v3
- uses: dorny/paths-filter@v2
id: filter
with:
list-files: shell

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2024 Tauri Programme within The Commons Conservancy
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
@@ -8,11 +8,11 @@ on:
pull_request:
paths:
- '.github/workflows/check-generated-files.yml'
- 'packages/api/src/**'
- 'crates/tauri/scripts/bundle.global.js'
- 'crates/tauri-utils/src/config.rs'
- 'crates/tauri-cli/config.schema.json'
- 'crates/tauri-schema-generator/schemas/*.json'
- 'tooling/api/src/**'
- 'core/tauri/scripts/bundle.global.js'
- 'core/tauri-utils/src/config.rs'
- 'tooling/cli/schema.json'
- 'core/tauri-config-schema/schema.json'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@@ -25,36 +25,29 @@ jobs:
api: ${{ steps.filter.outputs.api }}
schema: ${{ steps.filter.outputs.schema }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
api:
- 'packages/api/src/**'
- 'crates/tauri/scripts/bundle.global.js'
- 'tooling/api/src/**'
- 'core/tauri/scripts/bundle.global.js'
schema:
- 'crates/tauri-utils/src/config.rs'
- 'crates/tauri-cli/config.schema.json'
- 'crates/tauri-schema-generator/schemas/*.json'
- 'core/tauri-utils/src/config.rs'
- 'tooling/cli/schema.json'
- 'core/tauri-config-schema/schema.json'
api:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.api == 'true'
steps:
- uses: actions/checkout@v4
- run: npm i -g --force corepack
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'pnpm'
- uses: actions/checkout@v3
- name: install deps
run: pnpm i --frozen-lockfile
- name: build api
run: pnpm build
working-directory: packages/api
working-directory: tooling/api
run: yarn && yarn build
- name: check api
run: ./.scripts/ci/has-diff.sh
@@ -63,10 +56,13 @@ jobs:
needs: changes
if: needs.changes.outputs.schema == 'true'
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: install stable
uses: dtolnay/rust-toolchain@stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: install Linux dependencies
run: |
@@ -74,9 +70,14 @@ jobs:
sudo apt-get install -y libgtk-3-dev
- uses: Swatinem/rust-cache@v2
with:
workspaces: core -> ../target
- name: generate schemas
run: cargo build --manifest-path ./crates/tauri-schema-generator/Cargo.toml
- name: generate schema.json
uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path ./core/tauri-config-schema/Cargo.toml
- name: check schemas
- name: check schema
run: ./.scripts/ci/has-diff.sh

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2024 Tauri Programme within The Commons Conservancy
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
@@ -15,8 +15,8 @@ jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
list-files: shell

View File

@@ -1,30 +0,0 @@
# Copyright 2019-2024 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: covector comment
on:
workflow_run:
workflows: [covector status] # the `name` of the workflow run on `pull_request` running `status` with `comment: true`
types:
- completed
# note all other permissions are set to none if not specified
# and these set the permissions for `secrets.GITHUB_TOKEN`
permissions:
# to read the action artifacts on `covector status` workflows
actions: read
# to write the comment
pull-requests: write
jobs:
comment:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success' &&
(github.event.workflow_run.head_repository.full_name != github.repository || github.actor == 'dependabot[bot]')
steps:
- name: covector status
uses: jbolda/covector/packages/action@covector-v0
with:
token: ${{ secrets.GITHUB_TOKEN }}
command: 'status'

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2024 Tauri Programme within The Commons Conservancy
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
@@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: covector status
@@ -18,5 +18,3 @@ jobs:
id: covector
with:
command: 'status'
token: ${{ secrets.GITHUB_TOKEN }}
comment: true

View File

@@ -0,0 +1,242 @@
# 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
- v1/msrv-check
jobs:
msrv-list:
runs-on: ${{ matrix.platform.os }}
strategy:
fail-fast: false
matrix:
platform:
- {
target: x86_64-pc-windows-msvc,
os: windows-latest,
toolchain: '1.61.0'
}
- {
target: x86_64-unknown-linux-gnu,
os: ubuntu-latest,
toolchain: '1.60.0'
}
- {
target: x86_64-apple-darwin,
os: macos-13,
toolchain: '1.60.0'
}
steps:
- uses: actions/checkout@v4
- name: install rust ${{ matrix.platform.toolchain }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.platform.toolchain }}
target: ${{ matrix.platform.target }}
override: true
default: true
- name: install Linux dependencies
if: contains(matrix.platform.target, 'unknown-linux')
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
- uses: Swatinem/rust-cache@v2
- name: delete lockfile
run: rm Cargo.lock
- name: Downgrade crates with MSRV conflict
# The --precise flag can only be used once per invocation.
run: |
cargo update -p system-deps:6.2.2 --precise 6.1.1
cargo update -p toml:0.7.8 --precise 0.7.3
cargo update -p toml_edit:0.19.15 --precise 0.19.8
cargo update -p embed-resource --precise 2.3.0
cargo update -p notify-rust --precise 4.10.0
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 plist --precise 1.5.1
cargo update -p serde_with:3.8.2 --precise 3.0.0
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 colored --precise 2.0.2
cargo update -p arboard --precise 3.2.1
cargo update -p tempfile --precise 3.6.0
cargo update -p tokio --precise 1.29.0
cargo update -p flate2 --precise 1.0.26
cargo update -p hyper --precise 0.14.28
cargo update -p h2 --precise 0.3.20
cargo update -p reqwest --precise 0.11.18
cargo update -p bstr --precise 1.6.2
cargo update -p cfg-expr:0.15.8 --precise 0.15.4
cargo update -p memchr --precise 2.6.2
cargo update -p async-executor --precise 1.5.1
cargo update -p proptest --precise 1.2.0
cargo update -p regex --precise 1.9.6
cargo update -p bstr --precise 1.6.2
cargo update -p backtrace --precise 0.3.68
cargo update -p blocking --precise 1.4.1
cargo update -p ignore --precise 0.4.18
cargo update -p globset --precise 0.4.13
cargo update -p crossbeam-channel --precise 0.5.8
cargo update -p crossbeam-utils --precise 0.8.16
cargo update -p image --precise 0.24.4
cargo update -p async-process --precise 1.7.0
cargo update -p is-terminal --precise 0.4.7
cargo update -p tar --precise 0.4.39
cargo update -p serde_json --precise 1.0.97
cargo update -p petgraph --precise 0.6.3
cargo update -p os_str_bytes --precise 6.5.1
cargo update -p thread_local --precise 1.1.7
cargo update -p cc --precise 1.0.94
cargo update -p home --precise 0.5.5
cargo update -p tree_magic_mini --precise 3.0.3
cargo update -p tokio-test --precise 0.4.3
cargo update -p tokio-stream --precise 0.1.14
cargo update -p tokio-util --precise 0.7.10
cargo update -p os_pipe --precise 1.1.5
cargo update -p syn:2.0.68 --precise 2.0.67
cargo update -p derive_more --precise 0.99.17
cargo update -p native-tls --precise 0.2.11
- name: test build
run: cargo check --target ${{ matrix.platform.target }} --features tracing,compression,wry,linux-protocol-headers,isolation,custom-protocol,api-all,cli,updater,system-tray,windows7-compat,http-multipart,test
run-integration-tests:
runs-on: ${{ matrix.platform }}
needs: msrv-list
if: github.ref == 'refs/heads/1.x'
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-13, windows-latest]
steps:
- uses: actions/checkout@v4
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@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: 16
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: 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:
event-type: publish-js-cli
client-payload: >-
{"releaseId": "${{ steps.covector.outputs['-tauri-apps-cli-releaseId'] }}" }
- 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:
event-type: publish-clirs

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2024 Tauri Programme within The Commons Conservancy
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
@@ -19,29 +19,30 @@ jobs:
platform: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v2
with:
fetch-depth: 0
- run: npm i -g --force corepack
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: install stable
uses: dtolnay/rust-toolchain@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.1 libayatana-appindicator3-dev libfuse2 librsvg2-dev
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
run: cargo build --manifest-path ./crates/tauri-cli/Cargo.toml
uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path ./tooling/cli/Cargo.toml
- name: run integration tests
run: cargo test --test '*' -- --ignored
@@ -49,19 +50,14 @@ jobs:
- name: run CLI tests
timeout-minutes: 30
run: |
cd ./packages/cli
pnpm i --frozen-lockfile
pnpm build
pnpm test
cd ./tooling/cli/node
yarn
yarn build
yarn test
version-or-publish:
runs-on: ubuntu-latest
timeout-minutes: 65
permissions:
actions: write # required for workflow_dispatch
contents: write # required to create new releases
pull-requests: write # required to open version update pr
id-token: write # pnpm provenance
outputs:
change: ${{ steps.covector.outputs.change }}
commandRan: ${{ steps.covector.outputs.commandRan }}
@@ -70,15 +66,15 @@ jobs:
- run-integration-tests
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v2
with:
fetch-depth: 0
- run: npm i -g --force corepack
- uses: actions/setup-node@v4
- uses: actions/setup-node@v2
with:
node-version: 20
node-version: 16
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'
cache: yarn
cache-dependency-path: tooling/*/yarn.lock
- name: cargo login
run: cargo login ${{ secrets.ORG_CRATES_IO_TOKEN }}
@@ -87,31 +83,20 @@ jobs:
git config --global user.name "${{ github.event.pusher.name }}"
git config --global user.email "${{ github.event.pusher.email }}"
- name: install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.1 libayatana-appindicator3-dev librsvg2-dev
- 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 }}
NPM_CONFIG_PROVENANCE: true
with:
command: 'version-or-publish'
token: ${{ secrets.GITHUB_TOKEN }}
command: 'version-or-publish'
createRelease: true
recognizeContributors: true
- name: Sync Cargo.lock
if: steps.covector.outputs.commandRan == 'version'
run: cargo tree --depth 0
- name: Create Pull Request With Versions Bumped
if: steps.covector.outputs.commandRan == 'version'
uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # 7.0.6
uses: tauri-apps/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: release/version-updates
@@ -124,7 +109,7 @@ jobs:
if: |
steps.covector.outputs.successfulPublish == 'true' &&
steps.covector.outputs.packagesPublished != ''
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # 3.0.0
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.ORG_TAURI_BOT_PAT }}
repository: tauri-apps/tauri-docs
@@ -134,14 +119,16 @@ jobs:
if: |
steps.covector.outputs.successfulPublish == 'true' &&
contains(steps.covector.outputs.packagesPublished, '@tauri-apps/cli')
run: gh workflow run 31554138 -r dev -f releaseId=${{ steps.covector.outputs['-tauri-apps-cli-releaseId'] }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: peter-evans/repository-dispatch@v1
with:
event-type: publish-js-cli
client-payload: >-
{"releaseId": "${{ steps.covector.outputs['-tauri-apps-cli-releaseId'] }}" }
- name: Trigger `tauri-cli` publishing workflow
if: |
steps.covector.outputs.successfulPublish == 'true' &&
contains(steps.covector.outputs.packagesPublished, 'tauri-cli')
run: gh workflow run 31554139 -r dev
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: peter-evans/repository-dispatch@v1
with:
event-type: publish-clirs

View File

@@ -1,25 +0,0 @@
# Copyright 2019-2024 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: deploy schema worker
on:
push:
branches:
- dev
paths:
- '.github/workflows/deploy-schema-worker.yml'
- 'crates/tauri-schema-worker/**'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cloudflare/wrangler-action@v3
with:
command: deploy
workingDirectory: 'crates/tauri-schema-worker'
apiToken: ${{ secrets.SCHEMA_WORKER_CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.SCHEMA_WORKER_CLOUDFLARE_ACCOUNT_ID }}

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2024 Tauri Programme within The Commons Conservancy
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
@@ -17,10 +17,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v3
- name: install stable
uses: dtolnay/rust-toolchain@stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: install Linux dependencies
run: |
@@ -31,20 +33,23 @@ jobs:
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Upload cross
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: cross
path: '~/.cargo/bin/cross'
if-no-files-found: error
- name: build CLI
run: cargo build --manifest-path ./crates/tauri-cli/Cargo.toml
uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path ./tooling/cli/Cargo.toml
- name: Upload CLI
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: cargo-tauri
path: crates/tauri-cli/target/debug/cargo-tauri
path: tooling/cli/target/debug/cargo-tauri
if-no-files-found: error
docker:
@@ -59,27 +64,29 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v3
- name: install stable
uses: dtolnay/rust-toolchain@stable
uses: actions-rs/toolchain@v1
with:
targets: ${{ matrix.target.name }}
toolchain: stable
override: true
default: true
target: ${{ matrix.target.name }}
- run: npm i -g --force corepack
- name: Setup node
uses: actions/setup-node@v4
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
node-version: 16
- name: Download cross
uses: actions/download-artifact@v4.1.7
uses: actions/download-artifact@v3
with:
name: cross
path: '~/.cargo/bin'
- name: Download CLI
uses: actions/download-artifact@v4.1.7
uses: actions/download-artifact@v3
with:
name: cargo-tauri
path: 'examples/api'
@@ -108,14 +115,14 @@ jobs:
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.1 libayatana-appindicator3-dev
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
- name: Test
run: |
cd packages/api
pnpm i --frozen-lockfile && pnpm build
cd tooling/api
yarn && yarn build
cd ../../examples/api
pnpm i --frozen-lockfile
yarn
. .setup-cross.sh
chmod +x cargo-tauri
chmod +x $HOME/.cargo/bin/cross

View File

@@ -1,51 +0,0 @@
# Copyright 2019-2024 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: check formatting
on:
pull_request:
jobs:
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: install Rust stable and rustfmt
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: run cargo fmt
run: cargo fmt --all -- --check
prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm i -g --force corepack
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'pnpm'
- run: pnpm i --frozen-lockfile
- run: pnpm format:check
taplo:
name: taplo (.toml files)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: install taplo-cli
uses: taiki-e/install-action@v2
with:
tool: taplo-cli
- run: taplo fmt --check --diff

70
.github/workflows/lint-cli.yml vendored Normal file
View File

@@ -0,0 +1,70 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: lint cli
on:
push:
branches:
- dev
- 1.x
pull_request:
paths:
- '.github/workflows/lint-cli.yml'
- 'tooling/cli/**'
env:
RUST_BACKTRACE: 1
CARGO_PROFILE_DEV_DEBUG: 0 # This would add unnecessary bloat to the target folder, decreasing cache efficiency.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --manifest-path ./tooling/cli/Cargo.toml --all -- --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: clippy
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev
- uses: Swatinem/rust-cache@v2
with:
workspaces: tooling/cli
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --manifest-path ./tooling/cli/Cargo.toml --all-targets --all-features -- -D warnings
name: cli

83
.github/workflows/lint-core.yml vendored Normal file
View File

@@ -0,0 +1,83 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: lint core
on:
push:
branches:
- dev
- 1.x
pull_request:
paths:
- '.github/workflows/lint-core.yml'
- 'core/**'
- '!core/tauri/scripts/**'
- 'examples/**'
env:
RUST_BACKTRACE: 1
CARGO_PROFILE_DEV_DEBUG: 0 # This would add unnecessary bloat to the target folder, decreasing cache efficiency.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
clippy:
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',
key: 'all'
}
- { args: '--features custom-protocol', key: 'custom-protocol' }
- { args: '--features api-all', key: 'api-all' }
steps:
- uses: actions/checkout@v2
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: clippy
- uses: Swatinem/rust-cache@v2
with:
workspaces: core -> ../target
save-if: ${{ matrix.clippy.key == 'all' }}
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --manifest-path ./core/tauri/Cargo.toml --all-targets ${{ matrix.clippy.args }} -- -D warnings
name: ${{ matrix.clippy.key }}

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2024 Tauri Programme within The Commons Conservancy
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
@@ -8,33 +8,53 @@ on:
pull_request:
paths:
- '.github/workflows/lint-js.yml'
- 'packages/**'
- 'tooling/cli/node/**'
- 'tooling/api/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
eslint:
eslint-cli:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm i -g --force corepack
- uses: actions/setup-node@v4
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 'lts/*'
cache: 'pnpm'
- run: pnpm i --frozen-lockfile
- run: pnpm eslint:check
node-version: 16
cache: yarn
cache-dependency-path: tooling/cli/node/yarn.lock
- name: install deps via yarn
working-directory: ./tooling/cli/node/
run: yarn
# nothing to lint
#- name: run lint
# working-directory: ./tooling/cli/node/
# run: yarn lint
- name: run format
working-directory: ./tooling/cli/node/
run: yarn format:check
typescript:
eslint-api:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm i -g --force corepack
- uses: actions/setup-node@v4
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 'lts/*'
cache: 'pnpm'
- run: pnpm i --frozen-lockfile
- run: pnpm ts:check
node-version: 16
cache: yarn
cache-dependency-path: tooling/api/yarn.lock
- name: install deps via yarn
working-directory: ./tooling/api/
run: yarn
- name: run ts:check
working-directory: ./tooling/api/
run: yarn ts:check
- name: run lint
working-directory: ./tooling/api/
run: yarn lint
- name: run format
working-directory: ./tooling/api/
run: yarn format:check

View File

@@ -1,43 +0,0 @@
# Copyright 2019-2024 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: lint rust
on:
push:
branches:
- dev
pull_request:
paths:
- '.github/workflows/lint-cli.yml'
- 'crates/**'
env:
RUST_BACKTRACE: 1
CARGO_PROFILE_DEV_DEBUG: 0 # This would add unnecessary bloat to the target folder, decreasing cache efficiency.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: install rust stable and clippy
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.1 libayatana-appindicator3-dev
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --all-targets --all-features -- -D warnings

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2024 Tauri Programme within The Commons Conservancy
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
@@ -18,7 +18,7 @@ on:
defaults:
run:
working-directory: packages/cli/
working-directory: tooling/cli/node/
jobs:
build:
@@ -30,47 +30,45 @@ jobs:
target: x86_64-apple-darwin
architecture: x64
build: |
pnpm build --target=x86_64-apple-darwin
yarn build:release --target=x86_64-apple-darwin
strip -x *.node
- host: windows-latest
build: pnpm build
build: yarn build:release
target: x86_64-pc-windows-msvc
architecture: x64
- host: windows-latest
build: pnpm build --target i686-pc-windows-msvc
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: pnpm build --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
target: x86_64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
build: |
npm i -g --force corepack
cd packages/cli
pnpm build --target x86_64-unknown-linux-gnu
cd tooling/cli/node
yarn build:release --target x86_64-unknown-linux-gnu
strip *.node
- host: ubuntu-20.04
target: x86_64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: |
cd packages/cli
pnpm build
cd tooling/cli/node
yarn build:release
strip *.node
- host: macos-latest
target: aarch64-apple-darwin
build: |
pnpm build --features native-tls-vendored --target=aarch64-apple-darwin
yarn build:release --target=aarch64-apple-darwin
strip -x *.node
- host: ubuntu-20.04
target: aarch64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
build: |
npm i -g --force corepack
cd packages/cli
pnpm build --target aarch64-unknown-linux-gnu
cd tooling/cli/node
yarn build:release --target aarch64-unknown-linux-gnu
aarch64-unknown-linux-gnu-strip *.node
- host: ubuntu-20.04
architecture: x64
@@ -79,53 +77,49 @@ jobs:
sudo apt-get update
sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf -y
build: |
pnpm build --target=armv7-unknown-linux-gnueabihf
yarn build:release --target=armv7-unknown-linux-gnueabihf
arm-linux-gnueabihf-strip *.node
- host: ubuntu-20.04
architecture: x64
target: aarch64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: |
cd packages/cli
cd tooling/cli/node
rustup target add aarch64-unknown-linux-musl
pnpm build --target aarch64-unknown-linux-musl
yarn build:release --target aarch64-unknown-linux-musl
/aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node
- host: ubuntu-22.04
architecture: x64
target: riscv64gc-unknown-linux-gnu
setup: |
sudo apt-get update
sudo apt-get install gcc-riscv64-linux-gnu g++-riscv64-linux-gnu -y
build: |
pnpm build --target=riscv64gc-unknown-linux-gnu
riscv64-linux-gnu-strip *.node
name: stable - ${{ matrix.settings.target }} - node@20
name: stable - ${{ matrix.settings.target }} - node@16
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v4
- run: npm i -g --force corepack
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v4
uses: actions/setup-node@v3
if: ${{ !matrix.settings.docker }}
with:
node-version: 20
cache: 'pnpm'
node-version: 16
check-latest: true
cache: yarn
cache-dependency-path: 'tooling/cli/node/yarn.lock'
architecture: ${{ matrix.settings.architecture }}
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install
uses: actions-rs/toolchain@v1
if: ${{ !matrix.settings.docker }}
with:
targets: ${{ matrix.settings.target }}
profile: minimal
override: true
toolchain: stable
target: ${{ matrix.settings.target }}
- uses: Swatinem/rust-cache@v1
with:
key: ${{ matrix.settings.target }}
working-directory: 'tooling/cli/'
if: ${{ matrix.settings.docker }}
- name: Setup toolchain
run: ${{ matrix.settings.setup }}
if: ${{ matrix.settings.setup }}
shell: bash
- name: Install dependencies
run: pnpm i --frozen-lockfile --ignore-scripts
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
- name: Build in docker
uses: addnab/docker-run-action@v3
@@ -141,16 +135,16 @@ jobs:
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: bindings-${{ matrix.settings.target }}
path: packages/cli/${{ env.APP_NAME }}.*.node
path: tooling/cli/node/${{ env.APP_NAME }}.*.node
if-no-files-found: error
# build-freebsd:
# runs-on: macos-10.15
# name: Build FreeBSD
# steps:
# - uses: actions/checkout@v4
# - uses: actions/checkout@v3
# - name: Build
# id: build
# uses: vmactions/freebsd-vm@v0.1.6
@@ -164,9 +158,9 @@ jobs:
# usesh: true
# mem: 3000
# prepare: |
# pkg install -y curl node14 python2
# pkg install -y curl node16 python2
# curl -qL https://www.npmjs.com/install.sh | sh
# npm install -g pnpm
# npm install -g yarn
# curl https://sh.rustup.rs -sSf --output rustup.sh
# sh rustup.sh -y --profile minimal --default-toolchain stable
# export PATH="/usr/local/cargo/bin:$PATH"
@@ -174,8 +168,8 @@ jobs:
# rustc --version
# echo "~~~~ node -v ~~~~"
# node -v
# echo "~~~~ pnpm --version ~~~~"
# pnpm --version
# echo "~~~~ yarn --version ~~~~"
# yarn --version
# run: |
# export PATH="/usr/local/cargo/bin:$PATH"
# pwd
@@ -183,17 +177,17 @@ jobs:
# whoami
# env
# freebsd-version
# cd ./packages/cli/
# pnpm i --frozen-lockfile --ignore-scripts
# pnpm build
# cd ./tooling/cli/node/
# yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
# yarn build:release
# strip -x *.node
# rm -rf node_modules
# rm -rf ../../target
# rm -rf ../target
# - name: Upload artifact
# uses: actions/upload-artifact@v4
# uses: actions/upload-artifact@v3
# with:
# name: bindings-freebsd
# path: packages/cli/${{ env.APP_NAME }}.*.node
# path: tooling/cli/node/${{ env.APP_NAME }}.*.node
# if-no-files-found: error
test-macOS-windows-binding:
name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }}
@@ -204,33 +198,35 @@ jobs:
matrix:
settings:
- host: macos-latest
target: aarch64-apple-darwin
target: 'aarch64-apple-darwin'
- host: windows-latest
target: x86_64-pc-windows-msvc
node:
- '16'
- '18'
- '20'
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v4
- run: npm i -g --force corepack
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v4
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'pnpm'
check-latest: true
cache: yarn
cache-dependency-path: 'tooling/cli/node/yarn.lock'
- name: Install dependencies
run: pnpm i --frozen-lockfile --ignore-scripts
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
- name: Download artifacts
uses: actions/download-artifact@v4.1.7
uses: actions/download-artifact@v3
with:
name: bindings-${{ matrix.settings.target }}
path: 'packages/cli/'
path: 'tooling/cli/node/'
- name: List packages
run: ls -R .
shell: bash
- name: Test bindings
run: pnpm test
run: yarn test
test-linux-x64-gnu-binding:
name: Test bindings on Linux-x64-gnu - node@${{ matrix.node }}
needs:
@@ -239,33 +235,35 @@ jobs:
fail-fast: false
matrix:
node:
- '16'
- '18'
- '20'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm i -g --force corepack
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v4
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'pnpm'
check-latest: true
cache: yarn
cache-dependency-path: 'tooling/cli/node/yarn.lock'
- name: Install dependencies
run: pnpm i --frozen-lockfile --ignore-scripts
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
- name: Download artifacts
uses: actions/download-artifact@v4.1.7
uses: actions/download-artifact@v3
with:
name: bindings-x86_64-unknown-linux-gnu
path: 'packages/cli'
path: 'tooling/cli/node/'
- name: List packages
run: ls -R .
shell: bash
- name: install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.1 libayatana-appindicator3-dev librsvg2-dev
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
- name: Test bindings
run: pnpm test
run: yarn test
test-linux-x64-musl-binding:
name: Test bindings on x86_64-unknown-linux-musl - node@${{ matrix.node }}
needs:
@@ -274,38 +272,40 @@ jobs:
fail-fast: false
matrix:
node:
- '16'
- '18'
- '20'
runs-on: ubuntu-latest
container:
image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
steps:
- uses: actions/checkout@v4
- run: npm i -g --force corepack
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v4
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'pnpm'
check-latest: true
cache: yarn
cache-dependency-path: 'tooling/cli/node/yarn.lock'
- name: Install dependencies
run: pnpm i --frozen-lockfile --ignore-scripts
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
- name: Download artifacts
uses: actions/download-artifact@v4.1.7
uses: actions/download-artifact@v3
with:
name: bindings-x86_64-unknown-linux-musl
path: 'packages/cli/'
path: 'tooling/cli/node/'
- name: List packages
run: ls -R .
shell: bash
- name: Setup and run tests
run: |
pnpm tauri --help
yarn tauri --help
ls -la
#- name: Setup and run tests
# run: |
# rustup install stable
# rustup default stable
# pnpm test
# yarn test
# ls -la
test-linux-arm-bindings:
name: Test bindings on ${{ matrix.image }} - node@${{ matrix.node }}
@@ -315,6 +315,7 @@ jobs:
fail-fast: false
matrix:
node:
- '16'
- '18'
- '20'
image:
@@ -324,20 +325,22 @@ jobs:
steps:
- run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
working-directory: ${{ github.workspace }}
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: List packages
run: ls -R .
shell: bash
- name: Install dependencies
run: yarn install --ignore-scripts --ignore-platform --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
- name: Download aarch64-gnu artifacts
uses: actions/download-artifact@v4.1.7
uses: actions/download-artifact@v3
with:
name: bindings-aarch64-unknown-linux-gnu
path: 'packages/cli'
path: 'tooling/cli/node/'
- name: Download armv7-gnueabihf artifacts
uses: actions/download-artifact@v4.1.7
uses: actions/download-artifact@v3
with:
name: bindings-armv7-unknown-linux-gnueabihf
path: 'packages/cli/'
path: 'tooling/cli/node/'
# TODO: actually run test, blocked by https://github.com/rust-lang/cargo/issues/8719
- uses: addnab/docker-run-action@v3
with:
@@ -348,15 +351,15 @@ jobs:
set -e
export PATH=/usr/local/cargo/bin/:/usr/local/fnm:$PATH
apt-get update
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install --no-install-recommends -y unzip libayatana-appindicator3-dev
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install --no-install-recommends -y unzip webkit2gtk-4.0 libayatana-appindicator3-dev
bash
curl https://sh.rustup.rs -sSf | bash -s -- -y
curl -fsSL https://fnm.vercel.app/install | bash -s -- --install-dir "/usr/local/fnm" --skip-shell
eval "$(fnm env --use-on-cd)"
fnm install ${{ matrix.node }}
fnm use ${{ matrix.node }}
cd packages/cli
node tauri.js --help
cd tooling/cli/node
yarn tauri --help
ls -la
publish:
name: Publish
@@ -367,25 +370,23 @@ jobs:
- test-linux-x64-gnu-binding
- test-linux-x64-musl-binding
#- test-linux-arm-bindings
permissions:
contents: write # update release
id-token: write # npm provenance
steps:
- uses: actions/checkout@v4
- run: npm i -g --force corepack
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v4
uses: actions/setup-node@v3
with:
node-version: 20
cache: 'pnpm'
check-latest: true
cache: yarn
cache-dependency-path: 'tooling/cli/node/yarn.lock'
- name: Install dependencies
run: pnpm i --frozen-lockfile --ignore-scripts
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
- name: Download all artifacts
uses: actions/download-artifact@v4.1.7
uses: actions/download-artifact@v3
with:
path: packages/cli/artifacts
path: tooling/cli/node/artifacts
- name: Move artifacts
run: pnpm artifacts
run: yarn artifacts
- name: List packages
run: ls -R ./npm
shell: bash
@@ -396,5 +397,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.ORG_NPM_TOKEN }}
RELEASE_ID: ${{ github.event.client_payload.releaseId || inputs.releaseId }}
NPM_CONFIG_PROVENANCE: true
RELEASE_ID: ${{ github.event.client_payload.releaseId || github.event.inputs.releaseId }}

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2024 Tauri Programme within The Commons Conservancy
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
@@ -37,10 +37,11 @@ jobs:
- os: windows-latest
rust_target: aarch64-pc-windows-msvc
ext: '.exe'
args: ''
args: '--no-default-features --features native-tls,native-tls-vendored'
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v3
- name: 'Setup Rust'
uses: dtolnay/rust-toolchain@stable
@@ -58,13 +59,16 @@ jobs:
sudo apt-get install -y libgtk-3-dev
- name: Build CLI
run: cargo build --manifest-path ./crates/tauri-cli/Cargo.toml --profile release-size-optimized ${{ matrix.config.args }}
uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path ./tooling/cli/Cargo.toml --release ${{ matrix.config.args }}
- name: Upload CLI
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: cargo-tauri-${{ matrix.config.rust_target }}${{ matrix.config.ext }}
path: target/release-size-optimized/cargo-tauri${{ matrix.config.ext }}
path: tooling/cli/target/release/cargo-tauri${{ matrix.config.ext }}
if-no-files-found: error
upload:
@@ -73,10 +77,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v3
- name: Download built CLIs
uses: actions/download-artifact@v4.1.7
uses: actions/download-artifact@v3
with:
path: outputs
@@ -84,7 +88,7 @@ jobs:
run: ./.scripts/ci/pack-cli.sh
- name: Get CLI version
run: echo "CLI_VERSION=$(cat crates/tauri-cli/metadata-v2.json | jq '."cli.js".version' -r)" >> $GITHUB_ENV
run: echo "CLI_VERSION=$(cat tooling/cli/metadata.json | jq '."cli.js".version' -r)" >> $GITHUB_ENV
- name: Publish release
uses: softprops/action-gh-release@50195ba7f6f93d1ac97ba8332a178e008ad176aa

View File

@@ -1,44 +0,0 @@
# Copyright 2019-2024 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: supply chain health status
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
push:
branches:
- dev
paths:
- '.github/workflows/supply-chain.yml'
- '**/Cargo.lock'
- '**/Cargo.toml'
jobs:
cargo-vet:
name: check rust dependencies with cargo vet
runs-on: ubuntu-latest
env:
CARGO_VET_VERSION: 0.9.1
steps:
- uses: actions/checkout@master
- name: Install Rust
run: rustup update stable && rustup default stable
- uses: actions/cache@v4
with:
path: ${{ runner.tool_cache }}/cargo-vet
key: cargo-vet-bin-${{ env.CARGO_VET_VERSION }}
- name: Add the tool cache directory to the search path
run: echo "${{ runner.tool_cache }}/cargo-vet/bin" >> $GITHUB_PATH
- name: Ensure that the tool cache is populated with the cargo-vet binary
run: cargo install --root ${{ runner.tool_cache }}/cargo-vet --version ${{ env.CARGO_VET_VERSION }} cargo-vet
# Enable this again to break the workflow once we have a reasonable amount of suggestions to get to a clean base line
# - name: Invoke cargo-vet
# run: cargo vet --locked
- name: Provide audit suggestions
run: cargo vet suggest

View File

@@ -1,106 +0,0 @@
# Copyright 2019-2024 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: test android
on:
pull_request:
paths:
- '.github/workflows/test-android.yml'
- 'crates/tauri-cli/templates/mobile/android/**'
- 'crates/tauri-cli/src/mobile/**'
- '!crates/tauri-cli/src/mobile/ios.rs'
- '!crates/tauri-cli/src/mobile/ios/**'
- 'crates/tauri-build/src/mobile.rs'
- 'crates/tauri/mobile/android/**'
- 'crates/tauri/mobile/android-codegen/**'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: install Rust 1.77.2
uses: dtolnay/rust-toolchain@1.77.2
- name: install Linux dependencies
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.1
- run: npm i -g --force corepack
- name: setup node
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'pnpm'
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
cache: 'gradle'
- name: Setup NDK
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r25b
local-cache: true
# TODO check after https://github.com/nttld/setup-ndk/issues/518 is fixed
- name: Restore Android Symlinks
if: matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-latest'
run: |
directory="${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin"
find "$directory" -type l | while read link; do
current_target=$(readlink "$link")
new_target="$directory/$(basename "$current_target")"
ln -sf "$new_target" "$link"
echo "Changed $(basename "$link") from $current_target to $new_target"
done
- uses: Swatinem/rust-cache@v2
- name: build CLI
run: cargo build --manifest-path ./crates/tauri-cli/Cargo.toml
- name: move CLI to cargo bin dir
if: matrix.platform != 'windows-latest'
run: mv ./target/debug/cargo-tauri $HOME/.cargo/bin
- name: move CLI to cargo bin dir
if: matrix.platform == 'windows-latest'
run: mv ./target/debug/cargo-tauri.exe $HOME/.cargo/bin
- run: pnpm i --frozen-lockfile
- name: build Tauri API
working-directory: ./packages/api
run: pnpm build
- name: init Android Studio project
working-directory: ./examples/api
run: cargo tauri android init
env:
NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
- name: build APK
working-directory: ./examples/api
run: cargo tauri android build
env:
NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2024 Tauri Programme within The Commons Conservancy
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
@@ -8,12 +8,12 @@ on:
push:
branches:
- dev
- 1.x
pull_request:
paths:
- '.github/workflows/test-cli-js.yml'
- 'packages/cli/**'
# currently` @tauri-apps/cli` only tests the template
- 'crates/tauri-cli/templates/app/**'
- 'tooling/cli/templates/app/**'
env:
RUST_BACKTRACE: 1
@@ -33,30 +33,36 @@ jobs:
platform: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v2
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
- run: npm i -g --force corepack
- name: setup node
uses: actions/setup-node@v4
uses: actions-rs/toolchain@v1
with:
node-version: 'lts/*'
cache: 'pnpm'
toolchain: stable
override: true
- name: setup node
uses: actions/setup-node@v2
with:
node-version: 16
cache: yarn
cache-dependency-path: tooling/cli/node/yarn.lock
- name: install Linux dependencies
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.1 libayatana-appindicator3-dev librsvg2-dev
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
tooling/cli
tooling/cli/node/test/jest/fixtures/empty/src-tauri
- name: test
timeout-minutes: 30
run: |
cd ./packages/cli
pnpm i --frozen-lockfile
pnpm build
pnpm test
cd ./tooling/cli/node
yarn
yarn build
yarn test

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2024 Tauri Programme within The Commons Conservancy
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
@@ -8,12 +8,11 @@ on:
push:
branches:
- dev
- 1.x
pull_request:
paths:
- '.github/workflows/test-cli-rs.yml'
- 'crates/tauri-utils/**'
- 'crates/tauri-bundler/**'
- 'crates/tauri-cli/**'
- 'tooling/cli/**'
env:
RUST_BACKTRACE: 1
@@ -25,36 +24,34 @@ concurrency:
jobs:
test:
runs-on: ${{ matrix.platform.os }}
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform:
- { target: x86_64-pc-windows-msvc, os: windows-latest }
- {
target: aarch64-pc-windows-msvc,
os: windows-latest,
args: --no-default-features --features native-tls-vendored
}
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest }
- { target: x86_64-apple-darwin, os: macos-latest }
platform: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v2
- name: 'Setup Rust'
uses: dtolnay/rust-toolchain@1.77.2
- name: install stable
uses: actions-rs/toolchain@v1
with:
targets: ${{ matrix.platform.target }}
toolchain: stable
override: true
- name: install Linux dependencies
if: matrix.platform.os == 'ubuntu-latest'
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.1 libayatana-appindicator3-dev librsvg2-dev
sudo apt-get install -y libgtk-3-dev
- uses: Swatinem/rust-cache@v2
with:
workspaces: tooling/cli
- name: test CLI
run: cargo test --manifest-path ./crates/tauri-cli/Cargo.toml ${{ matrix.platform.args }}
uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path ./tooling/cli/Cargo.toml

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2024 Tauri Programme within The Commons Conservancy
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
@@ -8,15 +8,12 @@ on:
push:
branches:
- dev
- 1.x
pull_request:
paths:
- '.github/workflows/test-core.yml'
- 'crates/**'
- '!crates/tauri/scripts/**'
- '!crates/tauri-cli/**'
- '!crates/tauri-bundler/**'
- '!crates/tauri-macos-sign/**'
- '!crates/tauri-schema-generator/**'
- 'core/**'
- '!core/tauri/scripts/**'
env:
RUST_BACKTRACE: 1
@@ -37,68 +34,53 @@ jobs:
- {
target: x86_64-pc-windows-msvc,
os: windows-latest,
toolchain: '1.77.2',
cross: false,
command: 'test'
toolchain: '1.61.0'
}
- {
target: x86_64-unknown-linux-gnu,
os: ubuntu-latest,
toolchain: '1.77.2',
cross: false,
command: 'test'
toolchain: '1.60.0'
}
- {
target: aarch64-apple-darwin,
os: macos-14,
toolchain: '1.77.2',
cross: false,
command: 'test'
}
- {
target: aarch64-apple-ios,
os: macos-latest,
toolchain: '1.77.2',
cross: false,
command: 'build'
}
- {
target: aarch64-linux-android,
os: ubuntu-latest,
toolchain: '1.77.2',
cross: true,
command: 'build'
target: x86_64-apple-darwin,
os: macos-13,
toolchain: '1.60.0'
}
features:
- { args: --no-default-features, key: no-default }
- { args: --all-features, key: all }
- {
args: --no-default-features,
key: no-default
}
- {
args: --features api-all,
key: api-all
}
- {
args: --features tracing,compression,wry,linux-protocol-headers,isolation,custom-protocol,api-all,cli,updater,system-tray,windows7-compat,http-multipart,test,
key: all
}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v2
- name: install Rust
uses: dtolnay/rust-toolchain@master
- name: install stable
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.platform.toolchain }}
targets: ${{ matrix.platform.target }}
target: ${{ matrix.platform.target }}
override: true
default: true
- name: install Linux dependencies
if: contains(matrix.platform.target, 'unknown-linux')
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.1 libxdo-dev libayatana-appindicator3-dev
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
- uses: Swatinem/rust-cache@v2
with:
prefix-key: v2
workspaces: core -> ../target
save-if: ${{ matrix.features.key == 'all' }}
- name: test
if: ${{ !matrix.platform.cross }}
run: cargo ${{ matrix.platform.command }} --target ${{ matrix.platform.target }} ${{ matrix.features.args }} --manifest-path crates/tauri/Cargo.toml
- name: test (using cross)
if: ${{ matrix.platform.cross }}
run: |
cargo install cross --git https://github.com/cross-rs/cross --rev ac4c11cedc97cd7c27faed36e55377a90e6ed618 --locked
cross ${{ matrix.platform.command }} --target ${{ matrix.platform.target }} ${{ matrix.features.args }} --manifest-path crates/tauri/Cargo.toml
run: cargo test --target ${{ matrix.platform.target }} ${{ matrix.features.args }}

93
.github/workflows/test-lint-bundler.yml vendored Normal file
View File

@@ -0,0 +1,93 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: test and lint bundler
on:
push:
branches:
- dev
- 1.x
pull_request:
paths:
- '.github/workflows/test-bundler.yml'
- 'tooling/bundler/**'
env:
RUST_BACKTRACE: 1
CARGO_PROFILE_DEV_DEBUG: 0 # This would add unnecessary bloat to the target folder, decreasing cache efficiency.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- name: install stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: tooling/bundler
- name: test
run: |
cd ./tooling/bundler
cargo test
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --manifest-path ./tooling/bundler/Cargo.toml --all -- --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install minimal stable with clippy and rustfmt
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
default: true
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
workspaces: tooling/bundler
- name: clippy check
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --manifest-path ./tooling/bundler/Cargo.toml --all-targets -- -D warnings
name: bundler

View File

@@ -0,0 +1,107 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: test updater artifacts
on:
schedule:
- cron: '0 0 * * *'
pull_request:
paths:
- '.github/workflows/test-updater-artifacts.yml'
- 'examples/updater/**'
workflow_dispatch:
env:
RUST_BACKTRACE: 1
CARGO_PROFILE_DEV_DEBUG: 0 # This would add unnecessary bloat to the target folder, decreasing cache efficiency.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- 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
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
core -> ../target
tooling/cli
- name: build and install `tauri-cli`
run: cargo install --path tooling/cli --force
- name: Check whether code signing should be enabled
id: enablecodesigning
env:
ENABLE_CODE_SIGNING: ${{ secrets.APPLE_CERTIFICATE }}
run: |
echo "Enable code signing: ${{ env.ENABLE_CODE_SIGNING != '' }}"
echo "::set-output name=enabled::${{ env.ENABLE_CODE_SIGNING != '' }}"
# run only on tauri-apps/tauri repo (require secrets)
- name: build sample artifacts + code signing (updater)
if: steps.enablecodesigning.outputs.enabled == 'true'
working-directory: ./examples/updater
run: |
yarn install
cargo tauri build --verbose
env:
# Notarization (disabled)
# FIXME: enable only on `dev` push maybe? as it take some times...
#
# APPLE_ID: ${{ secrets.APPLE_ID }}
# APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
# Apple code signing testing
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
# Updater signature is exposed here to make sure it works in PR's
TAURI_PRIVATE_KEY: dW50cnVzdGVkIGNvbW1lbnQ6IHJzaWduIGVuY3J5cHRlZCBzZWNyZXQga2V5ClJXUlRZMEl5YTBGV3JiTy9lRDZVd3NkL0RoQ1htZmExNDd3RmJaNmRMT1ZGVjczWTBKZ0FBQkFBQUFBQUFBQUFBQUlBQUFBQWdMekUzVkE4K0tWQ1hjeGt1Vkx2QnRUR3pzQjVuV0ZpM2czWXNkRm9hVUxrVnB6TUN3K1NheHJMREhQbUVWVFZRK3NIL1VsMDBHNW5ET1EzQno0UStSb21nRW4vZlpTaXIwZFh5ZmRlL1lSN0dKcHdyOUVPclVvdzFhVkxDVnZrbHM2T1o4Tk1NWEU9Cg==
TAURI_KEY_PASSWORD:
# run on PRs and forks
- name: build sample artifacts (updater)
if: steps.enablecodesigning.outputs.enabled != 'true'
working-directory: ./examples/updater
run: |
yarn install
cargo tauri build --verbose
env:
TAURI_PRIVATE_KEY: dW50cnVzdGVkIGNvbW1lbnQ6IHJzaWduIGVuY3J5cHRlZCBzZWNyZXQga2V5ClJXUlRZMEl5YTBGV3JiTy9lRDZVd3NkL0RoQ1htZmExNDd3RmJaNmRMT1ZGVjczWTBKZ0FBQkFBQUFBQUFBQUFBQUlBQUFBQWdMekUzVkE4K0tWQ1hjeGt1Vkx2QnRUR3pzQjVuV0ZpM2czWXNkRm9hVUxrVnB6TUN3K1NheHJMREhQbUVWVFZRK3NIL1VsMDBHNW5ET1EzQno0UStSb21nRW4vZlpTaXIwZFh5ZmRlL1lSN0dKcHdyOUVPclVvdzFhVkxDVnZrbHM2T1o4Tk1NWEU9Cg==
TAURI_KEY_PASSWORD:
# upload assets
- uses: actions/upload-artifact@v2
if: matrix.platform == 'ubuntu-latest'
with:
name: linux-updater-artifacts
path: ./examples/updater/src-tauri/target/release/bundle/appimage/updater-example_*.AppImage.*
- uses: actions/upload-artifact@v2
if: matrix.platform == 'windows-latest'
with:
name: windows-updater-artifacts
path: ./examples/updater/src-tauri/target/release/bundle/msi/*
- uses: actions/upload-artifact@v2
if: matrix.platform == 'macos-latest'
with:
name: macos-updater-artifacts
path: ./examples/updater/src-tauri/target/release/bundle/macos/updater-example.app.tar.*

View File

@@ -1,4 +1,4 @@
# Copyright 2019-2024 Tauri Programme within The Commons Conservancy
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
@@ -8,6 +8,7 @@ on:
push:
branches:
- dev
- 1.x
env:
RUST_BACKTRACE: 1
@@ -31,32 +32,30 @@ jobs:
bundler: ${{ steps.filter.outputs.bundler }}
cli: ${{ steps.filter.outputs.cli }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
tauri:
- 'crates/tauri/**'
- '!crates/tauri/scripts/**'
- 'core/tauri/**'
- '!core/tauri/scripts/**'
build:
- 'crates/tauri-build/**'
- 'core/tauri-build/**'
codegen:
- 'crates/tauri-codegen/**'
- 'core/tauri-codegen/**'
macros:
- 'crates/tauri-macros/**'
- 'core/tauri-macros/**'
runtime:
- 'crates/tauri-runtime/**'
- 'core/tauri-runtime/**'
wry:
- 'crates/tauri-runtime-wry/**'
- 'core/tauri-runtime-wry/**'
utils:
- 'crates/tauri-utils/**'
- 'core/tauri-utils/**'
bundler:
- 'crates/tauri-bundler/**'
- 'tooling/bundler/**'
cli:
- 'crates/tauri-cli/**'
macossign:
- 'crates/tauri-macos-sign/**'
- 'tooling/cli/**'
setup:
runs-on: ubuntu-latest
@@ -70,20 +69,24 @@ jobs:
needs.changes.outputs.wry == 'true' ||
needs.changes.outputs.utils == 'true' ||
needs.changes.outputs.bundler == 'true' ||
needs.changes.outputs.cli == 'true' ||
needs.changes.outputs.macossign == 'true'
needs.changes.outputs.cli == 'true'
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v2
- name: Install Rust nightly
uses: dtolnay/rust-toolchain@nightly
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
- name: Install udeps
run: cargo install cargo-udeps --locked --force
- uses: actions-rs/cargo@v1
with:
command: install
args: cargo-udeps --locked --force
- name: Upload udeps
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: udeps
path: '~/.cargo/bin/cargo-udeps'
@@ -101,20 +104,18 @@ jobs:
UTILS: ${{ needs.changes.outputs.utils == 'true' }}
BUNDLER: ${{ needs.changes.outputs.bundler == 'true' }}
CLI: ${{ needs.changes.outputs.cli == 'true' }}
MACOSSIGN: ${{ needs.changes.outputs.macossign == 'true' }}
run: |
crates=()
if [ "${TAURI}" == "true" ]; then crates[${#crates[@]}]="\"./crates/tauri\""; fi
if [ "${BUILD}" == "true" ]; then crates[${#crates[@]}]="\"./crates/tauri-build\""; fi
if [ "${CODEGEN}" == "true" ]; then crates[${#crates[@]}]="\"./crates/tauri-codegen\""; fi
if [ "${MACROS}" == "true" ]; then crates[${#crates[@]}]="\"./crates/tauri-macros\""; fi
if [ "${RUNTIME}" == "true" ]; then crates[${#crates[@]}]="\"./crates/tauri-runtime\""; fi
if [ "${WRY}" == "true" ]; then crates[${#crates[@]}]="\"./crates/tauri-runtime-wry\""; fi
if [ "${UTILS}" == "true" ]; then crates[${#crates[@]}]="\"./crates/tauri-utils\""; fi
if [ "${BUNDLER}" == "true" ]; then crates[${#crates[@]}]="\"./crates/tauri-bundler\""; fi
if [ "${CLI}" == "true" ]; then crates[${#crates[@]}]="\"./crates/tauri-cli\""; fi
if [ "${MACOSSIGN}" == "true" ]; then crates[${#crates[@]}]="\"./crates/tauri-macos-sign\""; fi
echo "matrix=[$crates]" >> "$GITHUB_OUTPUT"
if [ "${TAURI}" == "true" ]; then crates[${#crates[@]}]="\"./core/tauri\""; fi
if [ "${BUILD}" == "true" ]; then crates[${#crates[@]}]="\"./core/tauri-build\""; fi
if [ "${CODEGEN}" == "true" ]; then crates[${#crates[@]}]="\"./core/tauri-codegen\""; fi
if [ "${MACROS}" == "true" ]; then crates[${#crates[@]}]="\"./core/tauri-macros\""; fi
if [ "${RUNTIME}" == "true" ]; then crates[${#crates[@]}]="\"./core/tauri-runtime\""; fi
if [ "${WRY}" == "true" ]; then crates[${#crates[@]}]="\"./core/tauri-runtime-wry\""; fi
if [ "${UTILS}" == "true" ]; then crates[${#crates[@]}]="\"./core/tauri-utils\""; fi
if [ "${BUNDLER}" == "true" ]; then crates[${#crates[@]}]="\"./tooling/bundler\""; fi
if [ "${CLI}" == "true" ]; then crates[${#crates[@]}]="\"./tooling/cli\""; fi
echo ::set-output name=matrix::[$crates]
outputs:
matrix: ${{ steps.create-matrix.outputs.matrix }}
@@ -125,10 +126,13 @@ jobs:
matrix:
path: ${{ fromJson(needs.setup.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v2
- name: Install Rust nightly
uses: dtolnay/rust-toolchain@nightly
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
- name: install dependencies
run: |
@@ -136,9 +140,14 @@ jobs:
sudo apt-get install -y libgtk-3-dev
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
core -> ../target
tooling/cli
tooling/bundler
- name: Download udeps
uses: actions/download-artifact@v4.1.7
uses: actions/download-artifact@v3
with:
name: udeps
path: '~/.cargo/bin'
@@ -148,7 +157,9 @@ jobs:
- name: Install required packages
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.1 libayatana-appindicator3-dev
sudo apt-get install -y webkit2gtk-4.0 libayatana-appindicator3-dev
- name: Run udeps
run: cargo udeps --manifest-path ${{ matrix.path }}/Cargo.toml --all-targets --all-features
- uses: actions-rs/cargo@v1
with:
command: udeps
args: --manifest-path ${{ matrix.path }}/Cargo.toml --all-targets --all-features

107
.gitignore vendored
View File

@@ -1,54 +1,89 @@
# dependency directories
node_modules/
# Optional npm and yarn cache directory
.npm/
.yarn/
# Output of 'npm pack'
*.tgz
# dotenv environment variables file
.env
# .vscode workspace settings file
.vscode/settings.json
.vscode/launch.json
.vscode/tasks.json
# npm, yarn and bun lock files
package-lock.json
yarn.lock
bun.lockb
# rust compiled folders
target/
# test video for streaming example
streaming_example_test_video.mp4
# examples /gen directory
/examples/**/src-tauri/gen/
/bench/**/src-tauri/gen/
# logs
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# runtime data
# smoke-tests repo
/smoke-tests
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# miscellaneous
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Typescript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional yarn cache directory
.yarn
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
/.vs
.DS_Store
.Thumbs.db
*.sublime*
.idea
debug.log
package-lock.json
.vscode/settings.json
*/.vscode/
proptest-regressions/
TODO.md
# rust compiled folders
target
# lock for libs
#/Cargo.lock Committed to prevent msrv checks from failing
/tooling/bench/tests/Cargo.lock
/yarn.lock
# ignore frida handlers
__handlers__/
# benches
gh-pages
test_video.mp4
# old cli directories
/tooling/cli.js
/tooling/cli.rs

1
.husky/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
_

24
.husky/pre-commit Executable file
View File

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

View File

@@ -1,40 +1,12 @@
/audits
/.github
/.husky
/.vscode
# change files are hand-written and shouldn't be formatted
/.changes/*
!/.changes/config.json
# dependcies and artifacts directories
node_modules/
target/
dist/
# lock files
pnpm-lock.yaml
# autogenerated and minimized js file
crates/tauri/scripts/bundle.global.js
# this file is an IIFE, shouldn't be formatted
crates/tauri/scripts/process-ipc-message-fn.js
# cli templates should be formatted manually
# it also includes invalid json files that
# prettier can't handle
crates/tauri-cli/templates
# autogenerated files
**/autogenerated/**/*.md
packages/cli/index.js
packages/cli/index.d.ts
crates/tauri-schema-worker/.wrangler
CHANGELOG.md
*schema.json
# WiX templates
*.wxs
# examples /gen directory
examples/**/src-tauri/gen
bench/**/src-tauri/gen
/audits
node_modules
target
dist
/core/tauri/scripts
/tooling/cli/templates
/tooling/cli/node
/tooling/cli/schema.json
/core/tauri-config-schema/schema.json

View File

@@ -1,6 +1,5 @@
{
"singleQuote": true,
"semi": false,
"trailingComma": "none",
"experimentalOperatorPosition": "start"
"trailingComma": "none"
}

55
.scripts/cargo-check.ps1 Executable file
View File

@@ -0,0 +1,55 @@
#!/usr/bin/env pwsh
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
# note: you can pass in the cargo sub-commands used to check manually.
# allowed commands: check, clippy, fmt, test
# default: clippy, fmt, test
# set the script arguments if none are found
if(-Not $args) {
$args=@("clippy","fmt","test")
}
# exit the script early if the last command returned an error
function check_error {
if($LASTEXITCODE -ne 0 ) {
Exit $LASTEXITCODE
}
}
function run {
$command, $_args = $args
Write-Output "[$command]"
cargo $command --workspace --all-targets --all-features $_args
check_error
}
foreach ($command in $args) {
Switch ($command) {
"check" {
run check
break
}
"test" {
run test
break
}
"clippy" {
run clippy "--" -D warnings
break
}
"fmt" {
Write-Output "[$command] checking formatting"
cargo +nightly fmt "--" --check
check_error
}
default {
Write-Output "[cargo-check.ps1] Unknown cargo sub-command: $command"
Exit 1
}
}
}

45
.scripts/cargo-check.sh Executable file
View File

@@ -0,0 +1,45 @@
#!/usr/bin/env sh
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
# note: you can pass in the cargo sub-commands used to check manually.
# allowed commands: check, clippy, fmt, test
# default: clippy, fmt, test
# exit the script early if any of the commands return an error
set -e
# set the script arguments if none are found
if [ -z "$*" ]; then
set -- "clippy" "fmt" "test"
fi
# run n+1 times, where n is the amount of mutually exclusive features.
# the extra run is for all the crates without mutually exclusive features.
# as many features as possible are enabled at for each command
run() {
command=$1
shift 1
cargo "$command" --workspace --all-targets --all-features "$@"
}
for command in "$@"; do
case "$command" in
check | test)
run "$command"
;;
clippy)
run clippy -- -D warnings
;;
fmt)
echo "[$command] checking formatting"
cargo +nightly fmt -- --check
;;
*)
echo "[cargo-check.sh] Unknown cargo sub-command: $command"
exit 1
;;
esac
done

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env node
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
@@ -69,9 +69,7 @@ function checkChangeFiles(changeFiles) {
const [_bin, _script, ...files] = process.argv
if (files.length > 0) {
checkChangeFiles(
files.filter((f) => f.toLowerCase() !== '.changes/readme.md')
)
checkChangeFiles(files.filter((f) => f.toLowerCase() !== 'readme.md'))
} else {
const changeFiles = fs
.readdirSync('.changes')

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env node
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
@@ -8,29 +8,25 @@ const fs = require('fs')
const path = require('path')
const readline = require('readline')
const header = `Copyright 2019-2024 Tauri Programme within The Commons Conservancy
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 denoLicense =
'// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.'
const extensions = ['.rs', '.js', '.ts', '.yml', '.swift', '.kt']
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))
&& !ignore.some((i) => file.includes(`/${i}/`) || path.basename(file) == i)
) {
if (extensions.some((e) => file.endsWith(e))) {
const fileStream = fs.createReadStream(file)
const rl = readline.createInterface({
input: fileStream,
@@ -42,11 +38,9 @@ async function checkFile(file) {
for await (let line of rl) {
// ignore empty lines, allow shebang and bundler license
if (
line.length === 0
|| line.startsWith('#!')
|| line.startsWith('// swift-tools-version:')
|| line === bundlerLicense
|| line === denoLicense
line.length === 0 ||
line.startsWith('#!') ||
line === bundlerLicense
) {
continue
}

View File

@@ -1,15 +1,13 @@
#!/bin/bash
# Copyright 2019-2024 Tauri Programme within The Commons Conservancy
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
git_output=$(git diff --ignore-submodules --name-only HEAD)
if [ -z "$git_output" ];
if git diff --quiet --ignore-submodules HEAD
then
echo "working directory is clean"
echo "working directory is clean"
else
echo "found diff:"
echo "$git_output"
echo "found diff"
exit 1
fi

View File

@@ -1,6 +1,6 @@
#!/bin/bash
# Copyright 2019-2024 Tauri Programme within The Commons Conservancy
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
@@ -10,7 +10,7 @@ for o in outputs/*; do
pushd "$o"
chmod +x cargo-tauri*
cp ../../crates/tauri-cli/LICENSE* ../../crates/tauri-cli/README.md .
cp ../../tooling/cli/LICENSE* ../../tooling/cli/README.md .
target=$(basename "$o" | cut -d. -f1)
if grep -qE '(apple|windows)' <<< "$target"; then

View File

@@ -0,0 +1,57 @@
#!/usr/bin/env node
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
/*
This script is solely intended to be run as part of the `covector publish` step to
check the latest version of a crate, considering the current minor version.
*/
const https = require('https')
const kind = process.argv[2]
const packageName = process.argv[3]
const packageVersion = process.argv[4]
const target = packageVersion.substring(0, packageVersion.lastIndexOf('.'))
let url = null
switch (kind) {
case 'cargo':
url = `https://crates.io/api/v1/crates/${packageName}`
break
case 'npm':
url = `https://registry.npmjs.org/${packageName}`
break
default:
throw new Error('unexpected kind ' + kind)
}
const options = {
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
'User-Agent': 'tauri (https://github.com/tauri-apps/tauri)'
}
}
https.get(url, options, (response) => {
let chunks = []
response.on('data', function (chunk) {
chunks.push(chunk)
})
response.on('end', function () {
const data = JSON.parse(chunks.join(''))
if (kind === 'cargo') {
const versions = data.versions.filter((v) => v.num.startsWith(target))
console.log(versions.length ? versions[0].num : '0.0.0')
} else if (kind === 'npm') {
const versions = Object.keys(data.versions).filter((v) =>
v.startsWith(target)
)
console.log(versions[versions.length - 1] || '0.0.0')
}
})
})

View File

@@ -1,27 +1,28 @@
#!/usr/bin/env node
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
// Copyright 2019-2023 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 `../../crates/tauri-cli/metadata-v2.json` up to date with other version bumps. Long term
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
rust binaries.
*/
const { readFileSync, writeFileSync } = require('fs')
const { resolve } = require('path')
const packageNickname = process.argv[2]
const filePath = resolve(__dirname, '../../crates/tauri-cli/metadata-v2.json')
const filePath =
packageNickname === '@tauri-apps/cli'
? `../../../tooling/cli/metadata.json`
: `../../tooling/cli/metadata.json`
const bump = process.argv[3]
let index = null
switch (bump) {
case 'major':
case 'premajor':
index = 0
break
case 'minor':
@@ -30,10 +31,6 @@ switch (bump) {
case 'patch':
index = 2
break
case 'prerelease':
case 'prepatch':
index = 3
break
default:
throw new Error('unexpected bump ' + bump)
}
@@ -47,12 +44,6 @@ const inc = (version) => {
v[i] = 0
}
}
if (bump === 'premajor') {
const pre = JSON.parse(
readFileSync(resolve(__dirname, '../../.changes/pre.json'), 'utf-8')
)
return `${v.join('.')}-${pre.tag}.0`
}
return v.join('.')
}
@@ -70,5 +61,5 @@ if (packageNickname === '@tauri-apps/cli') {
}
writeFileSync(filePath, JSON.stringify(metadata, null, 2) + '\n')
console.log(`wrote ${version} for ${packageNickname} into metadata-v2.json`)
console.log(`wrote ${version} for ${packageNickname} into metadata.json`)
console.dir(metadata)

7
.scripts/docker/build.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/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

30
.scripts/setup.ps1 Normal file
View File

@@ -0,0 +1,30 @@
#!/usr/bin/env pwsh
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
echo "Building API definitions..."
cd tooling\api
yarn; yarn build
cd ..\..
echo "Installing the Tauri Rust CLI..."
cd tooling\cli
cargo install --path .
cd ..\..
echo "Tauri Rust CLI installed. Run it with '$ cargo tauri [COMMAND]'."
$yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes"
$no = New-Object System.Management.Automation.Host.ChoiceDescription "&No"
$options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no)
$result = $host.ui.PromptForChoice("Node.js CLI", "Do you want to install the Node.js CLI?", $options, 1)
switch ($result) {
0{
cd tooling\cli\node
yarn; yarn build; yarn link
cd ..\..
echo "Tauri Node.js CLI installed. use `yarn link @tauri-apps/cli` and run it with '$ yarn tauri [COMMAND]'."
}
}

29
.scripts/setup.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/usr/bin/env bash
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
echo "Building API definitions..."
cd tooling/api
yarn && yarn build
cd ../..
echo "Building the Tauri Rust CLI..."
cd tooling/cli
cargo install --path .
cd ../..
echo "Tauri Rust CLI installed. Run it with '$ cargo tauri [COMMAND]'."
echo "Do you want to install the Node.js CLI?"
select yn in "Yes" "No"; do
case $yn in
Yes )
cd tooling/cli/node
yarn && yarn build && yarn link
cd ../../..
echo "Tauri Node.js CLI installed. use `yarn link @tauri-apps/cli` and run it with '$ yarn tauri [COMMAND]'."
break;;
No ) break;;
esac
done

24
.scripts/update-lockfiles.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/usr/bin/env sh
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
declare -a examples=("api" "sidecar" "updater" "resources" "tauri-dynamic-lib" "workspace")
declare -a tooling=("bench" "cli" "webdriver")
for example in "${examples[@]}"
do
cd examples/$example/src-tauri
cargo update
cargo build
cd ../../..
done
for tooling in "${tooling[@]}"
do
cd tooling/$tooling
cargo update
cargo build
cd ../..
done

View File

@@ -0,0 +1,66 @@
: 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 SPDX-License-Identifier: Apache-2.0
REM SPDX-License-Identifier: MIT
ECHO Make EXE From BAT
ECHO.
ECHO.
REM Usage:
REM MakeExeFromBat BatFileToConvert [IncludeFile1] [IncludeFile2] [...]
REM
REM Required Parameters:
REM BatFileToConvert
REM Source batch file to use to produce the output Exe file.
REM
REM Optional Parameters:
REM IncludeFile
REM Additional files to include in the Exe file.
REM You can include external tools used by the batch file so they are available on the executing machine.
SETLOCAL
REM Configuration (no quotes needed):
SET PathTo7Zip=
REM ---- Do not modify anything below this line ----
SET OutputFile="%~n1.exe"
SET SourceFiles="%TEMP%MakeEXE_files.txt"
SET Config="%TEMP%MakeEXE_config.txt"
SET Source7ZFile="%Temp%MakeEXE.7z"
REM Remove existing files
IF EXIST %OutputFile% DEL %OutputFile%
REM Build source archive
ECHO "%~dpnx1" > %SourceFiles%
:AddInclude
IF {%2}=={} GOTO EndInclude
ECHO "%~dpnx2" >> %SourceFiles%
SHIFT /2
GOTO AddInclude
:EndInclude
"%PathTo7Zip%7za.exe" a %Source7ZFile% @%SourceFiles%
REM Build config file
ECHO ;!@Install@!UTF-8! > %Config%
ECHO RunProgram="%~nx1" >> %Config%
ECHO ;!@InstallEnd@! >> %Config%
REM Build EXE
COPY /B "%PathTo7Zip%7zsd.sfx" + %Config% + %Source7ZFile% %OutputFile%
REM Clean up
IF EXIST %SourceFiles% DEL %SourceFiles%
IF EXIST %Config% DEL %Config%
IF EXIST %Source7ZFile% DEL %Source7ZFile%
ENDLOCAL

View File

@@ -1,16 +0,0 @@
.changes
.devcontainer
.docker
.github
.scripts
.vscode
audits
bench
packages/api
packages/cli
crates/tauri-cli
crates/tauri-bundler
crates/tauri-driver
crates/tauri-macos-sign
crates/tauri-schema-generator
crates/tests

View File

@@ -1,8 +1,7 @@
{
"recommendations": [
"rust-lang.rust-analyzer",
"ms-vscode-remote.vscode-remote-extensionpack",
"EditorConfig.EditorConfig",
"esbenp.prettier-vscode",
"tamasfe.even-better-toml"
"esbenp.prettier-vscode"
]
}

View File

@@ -1,134 +1,105 @@
# The Tauri Architecture
https://tauri.app
<https://tauri.app>
<https://github.com/tauri-apps/tauri>
https://github.com/tauri-apps/tauri
## Introduction
Tauri is a polyglot and generic toolkit that is very composable and allows engineers to make a wide variety of applications. It is used for building applications for Desktop Computers using a combination of Rust tools and HTML rendered in a Webview. Apps built with Tauri can ship with any number of pieces of an optional JS API / Rust API so that webviews can control the system via message passing. In fact, developers can extend the default API with their own functionality and bridge the Webview and Rust-based backend easily.
Tauri apps can have custom menus and have tray-type interfaces. They can be updated, and are managed by the user's operating system as expected. They are very small, because they use the OS's webview. They do not ship a runtime, since the final binary is compiled from Rust. This makes the reversing of Tauri apps not a trivial task.
## What Tauri is NOT
- Tauri is not a lightweight kernel wrapper...instead it directly uses [WRY](#wry) and [TAO](#tao) to do the heavy-lifting in making system calls to the OS.
- Tauri is not a VM or virtualized environment...instead it is an application toolkit that allows making Webview OS applications.
## Major Components
The following section briefly describes the roles of the various parts of Tauri.
### Tauri Core [STABLE RUST]
#### [tauri](https://github.com/tauri-apps/tauri/tree/dev/crates/tauri)
#### [tauri](https://github.com/tauri-apps/tauri/tree/dev/core/tauri)
This is the major crate that holds everything together. It brings the runtimes, macros, utilities and API into one final product. It reads the `tauri.conf.json` file at compile time in order to bring in features and undertake actual configuration of the app (and even the `Cargo.toml` file in the project's folder). It handles script injection (for polyfills / prototype revision) at runtime, hosts the API for systems interaction, and even manages updating.
#### [tauri-build](https://github.com/tauri-apps/tauri/tree/dev/crates/tauri-build)
#### [tauri-build](https://github.com/tauri-apps/tauri/tree/dev/core/tauri-build)
Apply the macros at build-time in order to rig some special features needed by `cargo`.
#### [tauri-codegen](https://github.com/tauri-apps/tauri/tree/dev/crates/tauri-codegen)
#### [tauri-codegen](https://github.com/tauri-apps/tauri/tree/dev/core/tauri-codegen)
- Embed, hash, and compress assets, including icons for the app as well as the system-tray.
- Parse `tauri.conf.json` at compile time and generate the Config struct.
#### [tauri-macros](https://github.com/tauri-apps/tauri/tree/dev/crates/tauri-macros)
#### [tauri-macros](https://github.com/tauri-apps/tauri/tree/dev/core/tauri-macros)
Create macros for the context, handler, and commands by leveraging the `tauri-codegen` crate.
#### [tauri-runtime](https://github.com/tauri-apps/tauri/tree/dev/crates/tauri-runtime)
#### [tauri-runtime](https://github.com/tauri-apps/tauri/tree/dev/core/tauri-runtime)
This is the glue layer between tauri itself and lower level webview libraries.
#### [tauri-runtime-wry](https://github.com/tauri-apps/tauri/tree/dev/crates/tauri-runtime-wry)
#### [tauri-runtime-wry](https://github.com/tauri-apps/tauri/tree/dev/core/tauri-runtime-wry)
This crate opens up direct systems-level interactions specifically for WRY, such as printing, monitor detection, and other windowing related tasks. `tauri-runtime` implementation for WRY.
#### [tauri-utils](https://github.com/tauri-apps/tauri/tree/dev/crates/tauri-utils)
#### [tauri-utils](https://github.com/tauri-apps/tauri/tree/dev/core/tauri-utils)
This is common code that is reused in many places and offers useful utilities like parsing configuration files, detecting platform triples, injecting the CSP, and managing assets.
### Tauri Tooling
#### [@tauri-apps/api](https://github.com/tauri-apps/tauri/tree/dev/packages/api) [TS -> JS]
#### [@tauri-apps/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/crates/tauri-bundler) [RUST / SHELL]
#### [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/packages/cli) [JS]
It is a wrapper around [tauri-cli](https://github.com/tauri-apps/tauri/blob/dev/crates/tauri-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/crates/tauri-cli) [RUST]
#### [@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.
#### [tauri-cli](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]
This is a toolkit that will enable engineering teams to rapidly scaffold out a new tauri-apps project using the frontend framework of their choice (as long as it has been configured).
# External Crates
The Tauri-Apps organisation maintains two "upstream" crates from Tauri, namely TAO for creating and managing application windows, and WRY for interfacing with the Webview that lives within the window.
## [TAO](https://github.com/tauri-apps/tao)
Cross-platform application window creation library in Rust that supports all major platforms like Windows, macOS, Linux, iOS and Android. Written in Rust, it is a fork of [winit](https://github.com/rust-windowing/winit) that we have extended for our own needs like menu bar and system tray.
## [WRY](https://github.com/tauri-apps/wry)
## [WRY](https://github.com/tauri-apps/wry)
WRY is a cross-platform WebView rendering library in Rust that supports all major desktop platforms like Windows, macOS, and Linux.
Tauri uses WRY as the abstract layer responsible to determine which webview is used (and how interactions are made).
# Additional tooling
## [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.
## [create-pull-request](https://github.com/tauri-apps/create-pull-request)
Because this is a very risky (potentially destructive) github action, we forked it in order to have strong guarantees that the code we think is running is actually the code that is running.
## [vue-cli-plugin-tauri](https://github.com/tauri-apps/vue-cli-plugin-tauri)
This plugin allows you to very quickly install tauri in a vue-cli project.
## [tauri-vscode](https://github.com/tauri-apps/tauri-vscode)
This project enhances the VS Code interface with several nice-to-have features.
# Tauri Plugins [documentation](https://v2.tauri.app/develop/plugins/)
# Tauri Plugins [documentation](https://tauri.app/v1/guides/features/plugin/)
Generally speaking, plugins are authored by third parties (even though there may be official, supported plugins). A plugin generally does 3 things:
1. It provides rust code to do "something".
2. It provides interface glue to make it easy to integrate into an app.
3. It provides a JS API for interfacing with the rust code.
Here are several examples of Tauri Plugins:
- <https://github.com/tauri-apps/tauri-plugin-sql>
- <https://github.com/tauri-apps/tauri-plugin-stronghold>
- <https://github.com/tauri-apps/tauri-plugin-authenticator>
- https://github.com/tauri-apps/tauri-plugin-sql
- https://github.com/tauri-apps/tauri-plugin-stronghold
- https://github.com/tauri-apps/tauri-plugin-authenticator
# Workflows
## What does the Development flow look like?
A developer must first install the prerequisite toolchains for creating a Tauri app. At the very least this will entail installing rust & cargo, and most likely also a modern version of node.js and potentially another package manager. Some platforms may also require other tooling and libraries, but this has been documented carefully in the respective platform docs.
Because of the many ways to build front-ends, we will stick with a common node.js based approach for development. (Note: Tauri does not by default ship a node.js runtime.)
The easiest way to do this is to run the following:
```
npm create tauri-app
npx create-tauri-app
```
Which will ask you a bunch of questions about the framework you want to install and then create everything you need in a single folder - some via the placement of template files and some through normal installation procedures of your framework.
@@ -136,17 +107,12 @@ Which will ask you a bunch of questions about the framework you want to install
> If you don't use this process, you will have to manually install the tauri cli, initialise tauri and manually configure the `tauri.conf.json` file.
Once everything is installed, you can run:
```
pnpm tauri dev
-or-
yarn tauri dev
-or-
npm run tauri dev
```
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
@@ -159,9 +125,10 @@ If you modify your rust code or anything in the Cargo.toml, the window will clos
If you need to get deeper insight into your current project, or triage requires investigation of installed components, just run:
```
pnpm tauri info
yarn tauri info
```
## What does the Release flow look like?
The release flow begins with proper configuration in the `tauri.conf.json` file. In this file, the developer can configure not only the basic behaviour of the application (like window size and decoration), they can also provide settings for signing and updating.
@@ -169,25 +136,21 @@ The release flow begins with proper configuration in the `tauri.conf.json` file.
Depending upon the operating system that the developer (or CI) is building the application on, there will be an app built for them for that system. (Cross compilation is not currently available, however there is an official [GitHub Action](https://github.com/tauri-apps/tauri-action) that can be used to build for all platforms.)
To kick off this process, just:
```
pnpm tauri build
yarn tauri build
```
After some time, the process will end and you can see the results in the `./src-tauri/target/release` folder.
## What does the End-User flow look like?
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`).
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.
## License
Tauri itself is licensed under MIT or Apache-2.0. If you repackage it and modify any source code, it is your responsibility to verify that you are complying with all upstream licenses. Tauri is provided AS-IS with no explicit claim for suitability for any purpose.
Here you may peruse our [Software Bill of Materials](https://app.fossa.com/projects/git%2Bgithub.com%2Ftauri-apps%2Ftauri).

9042
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,49 +1,30 @@
[workspace]
resolver = "2"
members = [
"crates/tauri",
"crates/tauri-runtime",
"crates/tauri-runtime-wry",
"crates/tauri-macros",
"crates/tauri-utils",
"crates/tauri-build",
"crates/tauri-codegen",
"crates/tauri-plugin",
"crates/tauri-schema-generator",
"crates/tauri-schema-worker",
"crates/tauri-cli",
"crates/tauri-bundler",
"crates/tauri-macos-sign",
"crates/tauri-driver",
# @tauri-apps/cli rust project
"packages/cli",
# core
"core/tauri",
"core/tauri-runtime",
"core/tauri-runtime-wry",
"core/tauri-macros",
"core/tauri-utils",
"core/tauri-build",
"core/tauri-codegen",
"core/tauri-config-schema",
# integration tests
"crates/tests/restart",
"crates/tests/acl",
# bench
"bench",
"bench/tests/cpu_intensive/src-tauri",
"bench/tests/files_transfer/src-tauri",
"bench/tests/helloworld/src-tauri",
# examples
"examples/file-associations/src-tauri",
"examples/resources/src-tauri",
"examples/api/src-tauri",
"examples/api/src-tauri/tauri-plugin-sample",
"core/tests/restart",
"core/tests/app-updater",
]
resolver = "2"
[workspace.package]
authors = ["Tauri Programme within The Commons Conservancy"]
homepage = "https://tauri.app/"
repository = "https://github.com/tauri-apps/tauri"
categories = ["gui", "web-programming"]
license = "Apache-2.0 OR MIT"
edition = "2021"
rust-version = "1.77.2"
exclude = [
# examples that can be compiled with the tauri CLI
"examples/api/src-tauri",
"examples/updater/src-tauri",
"examples/resources/src-tauri",
"examples/sidecar/src-tauri",
"examples/web/core",
"examples/workspace",
]
# default to small, optimized workspace release binaries
[profile.release]
@@ -52,22 +33,3 @@ codegen-units = 1
lto = true
incremental = false
opt-level = "s"
strip = true
# profiles for tauri-cli
[profile.dev.package.miniz_oxide]
opt-level = 3
[profile.release-size-optimized]
inherits = "release"
codegen-units = 1
lto = true
incremental = false
opt-level = "s"
# Temporary patch to schemars to preserve newlines in docstrings for our reference docs schemas
# See https://github.com/GREsau/schemars/issues/120 for reference
[patch.crates-io]
schemars_derive = { git = 'https://github.com/tauri-apps/schemars.git', branch = 'feat/preserve-description-newlines' }
tauri = { path = "./crates/tauri" }
tauri-plugin = { path = "./crates/tauri-plugin" }

View File

@@ -6,7 +6,7 @@ PackageSupplier: Organization: The Tauri Programme in the Commons Conservancy
PackageHomePage: https://tauri.app
PackageLicenseDeclared: Apache-2.0
PackageLicenseDeclared: MIT
PackageCopyrightText: 2019-2025, The Tauri Programme in the Commons Conservancy
PackageCopyrightText: 2019-2022, The Tauri Programme in the Commons Conservancy
PackageSummary: <text>Tauri is a rust project that enables developers to make secure
and small desktop applications using a web frontend.
</text>

161
README.md
View File

@@ -9,49 +9,121 @@
[![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)
[![support](https://img.shields.io/badge/sponsor-Open%20Collective-blue.svg)](https://opencollective.com/tauri)
## Current Releases
### Core
| Component | Description | Version | Lin | Win | Mac |
| -------------------------------------------------------------------------------------------- | ----------------------------------------- | -------------------------------------------------------------------------------------------------------- | --- | --- | --- |
| [**tauri**](https://github.com/tauri-apps/tauri/tree/dev/core/tauri) | runtime core | [![](https://img.shields.io/crates/v/tauri.svg)](https://crates.io/crates/tauri) | ✅ | ✅ | ✅ |
| [**tauri-build**](https://github.com/tauri-apps/tauri/tree/dev/core/tauri-build) | applies macros at build-time | [![](https://img.shields.io/crates/v/tauri-build.svg)](https://crates.io/crates/tauri-build) | ✅ | ✅ | ✅ |
| [**tauri-codegen**](https://github.com/tauri-apps/tauri/tree/dev/core/tauri-codegen) | handles assets, parses tauri.conf.json | [![](https://img.shields.io/crates/v/tauri-codegen.svg)](https://crates.io/crates/tauri-codegen) | ✅ | ✅ | ✅ |
| [**tauri-macros**](https://github.com/tauri-apps/tauri/tree/dev/core/tauri-macros) | creates macros using tauri-codegen | [![](https://img.shields.io/crates/v/tauri-macros.svg)](https://crates.io/crates/tauri-macros) | ✅ | ✅ | ✅ |
| [**tauri-runtime**](https://github.com/tauri-apps/tauri/tree/dev/core/tauri-runtime) | layer between Tauri and webview libraries | [![](https://img.shields.io/crates/v/tauri-runtime.svg)](https://crates.io/crates/tauri-runtime) | ✅ | ✅ | ✅ |
| [**tauri-runtime-wry**](https://github.com/tauri-apps/tauri/tree/dev/core/tauri-runtime-wry) | enables system-level interaction via WRY | [![](https://img.shields.io/crates/v/tauri-runtime-wry.svg)](https://crates.io/crates/tauri-runtime-wry) | ✅ | ✅ | ✅ |
| [**tauri-utils**](https://github.com/tauri-apps/tauri/tree/dev/core/tauri-utils) | common code used across the tauri crates | [![](https://img.shields.io/crates/v/tauri-utils.svg)](https://crates.io/crates/tauri-utils) | ✅ | ✅ | ✅ |
### 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) | ✅ | ✅ | ✅ |
### Utilities and Plugins
| Component | Description | Version | Lin | Win | Mac |
| ------------------------------------------------------------------------------- | ------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | --- | --- | --- |
| [**create-tauri-app**](https://github.com/tauri-apps/create-tauri-app) | Get started with your first Tauri app | [![](https://img.shields.io/npm/v/create-tauri-app.svg)](https://www.npmjs.com/package/create-tauri-app) | ✅ | ✅ | ✅ |
| [**vue-cli-plugin-tauri**](https://github.com/tauri-apps/vue-cli-plugin-tauri/) | Vue CLI plugin for Tauri | [![](https://img.shields.io/npm/v/vue-cli-plugin-tauri.svg)](https://www.npmjs.com/package/vue-cli-plugin-tauri) | ✅ | ✅ | ✅ |
## Introduction
Tauri is a framework for building tiny, blazingly fast binaries for all major desktop platforms. Developers can integrate any front-end framework that compiles to HTML, JS and CSS for building their user interface. The backend of the application is a rust-sourced binary with an API that the front-end can interact with.
The user interface in Tauri apps currently leverages [`tao`](https://docs.rs/tao) as a window handling library on macOS, Windows, Linux, Android and iOS. To render your application, Tauri uses [WRY](https://github.com/tauri-apps/wry), a library which provides a unified interface to the system webview, leveraging WKWebView on macOS & iOS, WebView2 on Windows, WebKitGTK on Linux and Android System WebView on Android.
The user interface in Tauri apps currently leverages [`tao`](https://docs.rs/tao) as a window handling library on macOS and Windows, and [`gtk`](https://gtk-rs.org/docs/gtk/) on Linux via the **Tauri-team** incubated and maintained [WRY](https://github.com/tauri-apps/wry), which creates a unified interface to the system webview (and other goodies like Menu and Taskbar), leveraging WebKit on macOS, WebView2 on Windows and WebKitGTK on Linux.
To learn more about the details of how all of these pieces fit together, please consult this [ARCHITECTURE.md](https://github.com/tauri-apps/tauri/blob/dev/ARCHITECTURE.md) document.
## Getting Started
## Get Started
If you are interested in making a tauri app, please visit the [documentation website](https://tauri.app).
The quickest way to get started is to install the [prerequisites](https://v2.tauri.app/start/prerequisites/) for your system and create a new project with [`create-tauri-app`](https://github.com/tauri-apps/create-tauri-app/#usage). For example with `npm`:
```sh
npm create tauri-app@latest
```
## Features
The list of Tauri's features includes, but is not limited to:
- Built-in app bundler to create app bundles in formats like `.app`, `.dmg`, `.deb`, `.rpm`, `.AppImage` and Windows installers like `.exe` (via NSIS) and `.msi` (via WiX).
- Built-in self updater (desktop only)
- System tray icons
- Native notifications
- Native WebView Protocol (tauri doesn't create a localhost http(s) server to serve the WebView contents)
- GitHub action for streamlined CI
- VS Code extension
If you are interested in making a tauri app, please visit the [documentation website](https://tauri.app). This README is directed towards those who are interested in contributing to the core library. But if you just want a quick overview about where `tauri` is at in its development, here's a quick burndown:
### Platforms
Tauri currently supports development and distribution on the following platforms:
| Platform | Versions |
| :--------- | :-------------------------------------------------------------------------------------------------------------- |
| Windows | 7 and above |
| macOS | 10.15 and above |
| Linux | webkit2gtk 4.0 for Tauri v1 (for example Ubuntu 18.04). webkit2gtk 4.1 for Tauri v2 (for example Ubuntu 22.04). |
| iOS/iPadOS | 9 and above |
| Android | 7 and above (currently 8 and above) |
| Platform | Versions |
| :----------------------- | :-------------- |
| Windows | 7 and above |
| macOS | 10.15 and above |
| Linux | See below |
| iOS/iPadOS (coming soon) | |
| Android (coming soon) | |
## Contributing
**Linux Support**
For **developing** Tauri apps refer to the [Getting Started guide on tauri.app](https://tauri.app/v1/guides/getting-started/prerequisites#setting-up-linux).
For **running** Tauri apps we support the below configurations (these are automatically added as dependencies for .deb and are bundled for AppImage so that your users don't need to manually install them):
- Debian (Ubuntu 18.04 and above or equivalent) with the following packages installed:
- `libwebkit2gtk-4.0-37`, `libgtk-3-0`, `libayatana-appindicator3-1`<sup>1</sup>
- Arch with the following packages installed:
- `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
### Features
- [x] Desktop Bundler (.app, .dmg, .deb, AppImage, .msi)
- [x] Self Updater
- [x] App Signing
- [x] Native Notifications (toast)
- [x] App Tray
- [x] Core Plugin System
- [x] Scoped Filesystem
- [x] Sidecar
### Security Features
- [x] localhost-free (:fire:)
- [x] custom protocol for secure mode
- [x] Dynamic ahead of Time Compilation (dAoT) with functional tree-shaking
- [x] functional Address Space Layout Randomization
- [x] OTP salting of function names and messages at runtime
- [x] CSP Injection
### Utilities
- [x] Rust-based CLI
- [x] GH Action for creating binaries for all platforms
- [x] VS Code Extension
## Development
Tauri is a system composed of a number of moving pieces:
### Infrastructure
- Git for code management
- GitHub for project management
- GitHub actions for CI and CD
- Discord for discussions
- Netlify-hosted documentation website
- DigitalOcean Meilisearch instance
### Operating systems
Tauri core can be developed on Mac, Linux and Windows, but you are encouraged to use the latest possible operating systems and build tools for your OS.
### Contributing
Before you start working on something, it's best to check if there is an existing issue first. It's also a good idea to stop by the Discord server and confirm with the team if it makes sense or if someone else is already working on it.
@@ -61,31 +133,32 @@ Thank you to everyone contributing to Tauri!
### Documentation
Documentation in a polyglot system is a tricky proposition. To this end, we prefer to use inline documentation in the Rust & JS source code as much as possible. Check out the hosting repository for the documentation site for further information: <https://github.com/tauri-apps/tauri-docs>
Documentation in a polyglot system is a tricky proposition. To this end, we prefer to use inline documentation of Rust code and at JSDoc in typescript / javascript code. We autocollect these and publish them using Docusaurus v2 and netlify. Here is the hosting repository for the documentation site: https://github.com/tauri-apps/tauri-docs
## Partners
### Testing & Linting
<table>
<tbody>
<tr>
<td align="center" valign="middle">
<a href="https://crabnebula.dev" target="_blank">
<img src=".github/sponsors/crabnebula.svg" alt="CrabNebula" width="283">
</a>
</td>
</tr>
</tbody>
</table>
Test all the things! We have a number of test suites, but are always looking to improve our coverage:
For the complete list of sponsors please visit our [website](https://tauri.app#sponsors) and [Open Collective](https://opencollective.com/tauri).
- Rust (`cargo test`) => sourced via inline `#[cfg(test)]` declarations
- Typescript (`jest`) => via spec files
- Smoke Tests (run on merges to latest)
- eslint, clippy
### CI/CD
We recommend you read this article to understand better how we run our pipelines: https://www.jacobbolda.com/setting-up-ci-and-cd-for-tauri/
## Organization
Tauri aims to be a sustainable collective based on principles that guide [sustainable free and open software communities](https://sfosc.org). To this end it has become a Programme within the [Commons Conservancy](https://commonsconservancy.org/), and you can contribute financially via [Open Collective](https://opencollective.com/tauri).
## Semver
**tauri** is following [Semantic Versioning 2.0](https://semver.org/).
## Licenses
Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy.
Code: (c) 2015 - 2021 - The Tauri Programme within The Commons Conservancy.
MIT or MIT/Apache 2.0 where applicable.

View File

@@ -10,8 +10,8 @@
## Reporting a Vulnerability
If you have found a potential security threat, vulnerability or exploit in Tauri
or one of its upstream dependencies, please DON'T create a pull-request, DON'T
file an issue on GitHub, DON'T mention it on Discord and DON'T create a forum thread.
or one of its upstream dependencies, please DONT create a pull-request, DONT
file an issue on GitHub, DONT mention it on Discord and DONT create a forum thread.
Please submit your report via the GitHub Private Vulnerability Disclosure functionality.
@@ -24,5 +24,5 @@ Additionally, we may ask you to independently verify our patch, which will be av
Depending on your decision to accept or deny credit for the vulnerability, you will be publicly attributed to the vulnerability and may be mentioned in our announcements.
At the current time we do not have the financial ability to reward bounties,
At the current time we do not have the financial ability to reward bounties,
but in extreme cases will at our discretion consider a reward.

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -1,8 +0,0 @@
body {
font-family:
-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial,
sans-serif;
margin: auto;
max-width: 38rem;
padding: 2rem;
}

View File

@@ -1,16 +0,0 @@
[package]
name = "bench_cpu_intensive"
version = "0.1.0"
description = "A very simple Tauri Application"
edition = "2021"
rust-version = "1.77.2"
[build-dependencies]
tauri-build = { path = "../../../../crates/tauri-build", features = [
"codegen",
] }
[dependencies]
serde_json = "1"
serde = { version = "1", features = ["derive"] }
tauri = { path = "../../../../crates/tauri", features = [] }

View File

@@ -1,33 +0,0 @@
{
"$schema": "../../../../crates/tauri-schema-generator/schemas/config.schema.json",
"identifier": "com.tauri.dev",
"build": {
"frontendDist": "../public"
},
"app": {
"withGlobalTauri": true,
"windows": [
{
"title": "Welcome to Tauri!",
"width": 800,
"height": 600,
"resizable": true,
"fullscreen": false
}
],
"security": {
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc: http://ipc.localhost"
}
},
"bundle": {
"active": true,
"targets": "all",
"icon": [
"../../../../examples/.icons/32x32.png",
"../../../../examples/.icons/128x128.png",
"../../../../examples/.icons/128x128@2x.png",
"../../../../examples/.icons/icon.icns",
"../../../../examples/.icons/icon.ico"
]
}
}

View File

@@ -1,16 +0,0 @@
[package]
name = "bench_files_transfer"
version = "0.1.0"
description = "A very simple Tauri Application"
edition = "2021"
rust-version = "1.77.2"
[build-dependencies]
tauri-build = { path = "../../../../crates/tauri-build", features = [
"codegen",
] }
[dependencies]
serde_json = "1"
serde = { version = "1", features = ["derive"] }
tauri = { path = "../../../../crates/tauri", features = [] }

View File

@@ -1,30 +0,0 @@
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
use std::fs::read;
use tauri::{command, ipc::Response, path::BaseDirectory, AppHandle, Manager, Runtime};
#[command]
fn app_should_close(exit_code: i32) {
std::process::exit(exit_code);
}
#[command]
async fn read_file<R: Runtime>(app: AppHandle<R>) -> Result<Response, String> {
let path = app
.path()
.resolve(".tauri_3mb.json", BaseDirectory::Home)
.map_err(|e| e.to_string())?;
let contents = read(path).map_err(|e| e.to_string())?;
Ok(Response::new(contents))
}
fn main() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![app_should_close, read_file])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}

View File

@@ -1,33 +0,0 @@
{
"$schema": "../../../../crates/tauri-schema-generator/schemas/config.schema.json",
"identifier": "com.tauri.dev",
"build": {
"frontendDist": "../public"
},
"app": {
"withGlobalTauri": true,
"windows": [
{
"title": "Welcome to Tauri!",
"width": 800,
"height": 600,
"resizable": true,
"fullscreen": false
}
],
"security": {
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc: http://ipc.localhost"
}
},
"bundle": {
"active": true,
"targets": "all",
"icon": [
"../../../../examples/.icons/32x32.png",
"../../../../examples/.icons/128x128.png",
"../../../../examples/.icons/128x128@2x.png",
"../../../../examples/.icons/icon.icns",
"../../../../examples/.icons/icon.ico"
]
}
}

View File

@@ -1,16 +0,0 @@
[package]
name = "bench_helloworld"
version = "0.1.0"
description = "A very simple Tauri Application"
edition = "2021"
rust-version = "1.77.2"
[build-dependencies]
tauri-build = { path = "../../../../crates/tauri-build", features = [
"codegen",
] }
[dependencies]
serde_json = "1"
serde = { version = "1", features = ["derive"] }
tauri = { path = "../../../../crates/tauri", features = [] }

View File

@@ -1,35 +0,0 @@
{
"$schema": "../../../../crates/tauri-schema-generator/schemas/config.schema.json",
"identifier": "com.tauri.dev",
"build": {
"frontendDist": "../public",
"beforeDevCommand": "",
"beforeBuildCommand": ""
},
"app": {
"withGlobalTauri": true,
"windows": [
{
"title": "Welcome to Tauri!",
"width": 800,
"height": 600,
"resizable": true,
"fullscreen": false
}
],
"security": {
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc: http://ipc.localhost"
}
},
"bundle": {
"active": true,
"targets": "all",
"icon": [
"../../../../examples/.icons/32x32.png",
"../../../../examples/.icons/128x128.png",
"../../../../examples/.icons/128x128@2x.png",
"../../../../examples/.icons/icon.icns",
"../../../../examples/.icons/icon.ico"
]
}
}

View File

@@ -0,0 +1,285 @@
# Changelog
## \[1.5.3]
### Dependencies
- Upgraded to `tauri-utils@1.6.0`
- Upgraded to `tauri-codegen@1.4.4`
## \[1.5.2]
### Dependencies
- Upgraded to `tauri-utils@1.5.4`
- Upgraded to `tauri-codegen@1.4.3`
## \[1.5.1]
### Dependencies
- Upgraded to `tauri-utils@1.5.2`
- Upgraded to `tauri-codegen@1.4.2`
## \[1.5.0]
### What's Changed
- [`d1e09da0`](https://www.github.com/tauri-apps/tauri/commit/d1e09da084b849b9e384fc27ed250dd17e72c7a3)([#7918](https://www.github.com/tauri-apps/tauri/pull/7918)) Bump to 1.5 due to tauri-utils dependency bump.
## \[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`.
- Bumped due to a bump in tauri-utils.
- [bb251087](https://www.github.com/tauri-apps/tauri/commit/bb2510876d0bdff736d36bf3a465cdbe4ad2b90c) fix(core): extend allowlist with `app`'s allowlist, closes [#5650](https://www.github.com/tauri-apps/tauri/pull/5650) ([#5652](https://www.github.com/tauri-apps/tauri/pull/5652)) on 2022-11-18
## \[1.2.0]
- - [7d9aa398](https://www.github.com/tauri-apps/tauri/commit/7d9aa3987efce2d697179ffc33646d086c68030c) feat: bump MSRV to 1.59 ([#5296](https://www.github.com/tauri-apps/tauri/pull/5296)) on 2022-09-28
## \[1.1.1]
- Add missing allowlist config for `set_cursor_grab`, `set_cursor_visible`, `set_cursor_icon` and `set_cursor_position` APIs.
- Bumped due to a bump in tauri-utils.
- [c764408d](https://www.github.com/tauri-apps/tauri/commit/c764408da7fae123edd41115bda42fa75a4731d2) fix: Add missing allowlist config for cursor apis, closes [#5207](https://www.github.com/tauri-apps/tauri/pull/5207) ([#5211](https://www.github.com/tauri-apps/tauri/pull/5211)) on 2022-09-16
## \[1.1.0]
- Rerun codegen if assets or icons change.
- [ff8fd761](https://www.github.com/tauri-apps/tauri/commit/ff8fd7619ae894b70f149b192d8635d842827141) fix(tauri-build): rerun if assets or icons change ([#4910](https://www.github.com/tauri-apps/tauri/pull/4910)) on 2022-08-10
- Create the `desktop` and `mobile` cfg aliases.
- [c04d0340](https://www.github.com/tauri-apps/tauri/commit/c04d0340e2f163483f3556c7aabe35322ee71e6a) feat(core): prepare build for mobile targets ([#4830](https://www.github.com/tauri-apps/tauri/pull/4830)) on 2022-08-02
- Added support to configuration files in TOML format (Tauri.toml file).
- [ae83d008](https://www.github.com/tauri-apps/tauri/commit/ae83d008f9e1b89bfc8dddaca42aa5c1fbc36f6d) feat: add support to TOML config file `Tauri.toml`, closes [#4806](https://www.github.com/tauri-apps/tauri/pull/4806) ([#4813](https://www.github.com/tauri-apps/tauri/pull/4813)) on 2022-08-02
- Enhance the dialog style on Windows via the manifest dependency `Microsoft.Windows.Common-Controls v6.0.0.0`.
- [5c5c42ed](https://www.github.com/tauri-apps/tauri/commit/5c5c42edb64adf4250af6891d7d226fda7d4d783) feat(build): use modern dialog styles on Windows, closes [#4709](https://www.github.com/tauri-apps/tauri/pull/4709) ([#4840](https://www.github.com/tauri-apps/tauri/pull/4840)) on 2022-08-02
- Fix root of codegen output when using the `CodegenContext` API.
- [ed581950](https://www.github.com/tauri-apps/tauri/commit/ed581950ea6fd0afee47aa73fb63083d2483429f) fix(tauri-build): use `::tauri` as root for the CodegenContext ([#4894](https://www.github.com/tauri-apps/tauri/pull/4894)) on 2022-08-08
- Return an error if a sidecar is configured with the same file name as the application.
- [5cc1fd0f](https://www.github.com/tauri-apps/tauri/commit/5cc1fd0f7b01b257a461d4e867ddc8cd5072ff15) feat(tauri-build): validate sidecar name, closes [#4780](https://www.github.com/tauri-apps/tauri/pull/4780) closes [#4823](https://www.github.com/tauri-apps/tauri/pull/4823) ([#4814](https://www.github.com/tauri-apps/tauri/pull/4814)) on 2022-08-02
- Only rewrite temporary icon files when the content change, avoid needless rebuilds.
- [f957cbb5](https://www.github.com/tauri-apps/tauri/commit/f957cbb56ccbd8d1c047a978b4579946252a6fd2) fix(codegen): write output file when contents change ([#4889](https://www.github.com/tauri-apps/tauri/pull/4889)) on 2022-08-09
## \[1.0.4]
- Reduce the amount of allocations when converting cases.
- [bc370e32](https://www.github.com/tauri-apps/tauri/commit/bc370e326810446e15b1f50fb962b980114ba16b) feat: reduce the amount of `heck`-related allocations ([#4634](https://www.github.com/tauri-apps/tauri/pull/4634)) on 2022-07-11
## \[1.0.3]
- Improve configuration deserialization error messages.
- [9170c920](https://www.github.com/tauri-apps/tauri/commit/9170c9207044fa561535f624916dfdbaa41ff79d) feat(core): improve config deserialization error messages ([#4607](https://www.github.com/tauri-apps/tauri/pull/4607)) on 2022-07-06
- The `TAURI_CONFIG` environment variable now represents the configuration to be merged instead of the entire JSON.
- [fa028ebf](https://www.github.com/tauri-apps/tauri/commit/fa028ebf3c8ca7b43a70d283a01dbea86217594f) refactor: do not pass entire config from CLI to core, send patch instead ([#4598](https://www.github.com/tauri-apps/tauri/pull/4598)) on 2022-07-06
## \[1.0.2]
- Expose `platform::windows_version` function.
- Bumped due to a bump in tauri-utils.
- [bf764e83](https://www.github.com/tauri-apps/tauri/commit/bf764e83e01e7443e6cc54572001e1c98c357465) feat(utils): expose `windows_version` function ([#4534](https://www.github.com/tauri-apps/tauri/pull/4534)) on 2022-06-30
## \[1.0.1]
- Changed the `BundleConfig::targets` to a `BundleTarget` enum to enhance generated documentation.
- Bumped due to a bump in tauri-utils.
- [31c15cd2](https://www.github.com/tauri-apps/tauri/commit/31c15cd2bd94dbe39fb94982a15cbe02ac5d8925) docs(config): enhance documentation for bundle targets, closes [#3251](https://www.github.com/tauri-apps/tauri/pull/3251) ([#4418](https://www.github.com/tauri-apps/tauri/pull/4418)) on 2022-06-21
- Added `platform::is_windows_7`.
- Bumped due to a bump in tauri-utils.
- [57039fb2](https://www.github.com/tauri-apps/tauri/commit/57039fb2166571de85271b014a8711a29f06be1a) fix(core): add windows 7 notification support ([#4491](https://www.github.com/tauri-apps/tauri/pull/4491)) on 2022-06-28
- Suppress unused variable warning in release builds.
- Bumped due to a bump in tauri-utils.
- [45981851](https://www.github.com/tauri-apps/tauri/commit/45981851e35119266c1a079e1ff27a39f1fdfaed) chore(lint): unused variable warnings for release builds ([#4411](https://www.github.com/tauri-apps/tauri/pull/4411)) on 2022-06-22
- Added webview install mode options.
- Bumped due to a bump in tauri-utils.
- [2ca762d2](https://www.github.com/tauri-apps/tauri/commit/2ca762d207030a892a6d128b519e150e2d733468) feat(bundler): extend webview2 installation options, closes [#2882](https://www.github.com/tauri-apps/tauri/pull/2882) [#2452](https://www.github.com/tauri-apps/tauri/pull/2452) ([#4466](https://www.github.com/tauri-apps/tauri/pull/4466)) on 2022-06-26
## \[1.0.0]
- Upgrade to `stable`!
- [f4bb30cc](https://www.github.com/tauri-apps/tauri/commit/f4bb30cc73d6ba9b9ef19ef004dc5e8e6bb901d3) feat(covector): prepare for v1 ([#4351](https://www.github.com/tauri-apps/tauri/pull/4351)) on 2022-06-15
## \[1.0.0-rc.15]
- Read the tray icon path relatively to the config directory.
- Bumped due to a bump in tauri-codegen.
- [562e8ca2](https://www.github.com/tauri-apps/tauri/commit/562e8ca23facf1a8e5fa6c8cdf872357d3523a78) fix(codegen): tray icon path is relative to the config directory on 2022-06-15
## \[1.0.0-rc.14]
- Do not copy the tray icon to the output directory on Linux since it is embedded in the binary.
- [4ce8e228](https://www.github.com/tauri-apps/tauri/commit/4ce8e228134cd3f22973b74ef26ca0d165fbbbd9) refactor(core): use `Icon` for tray icons ([#4342](https://www.github.com/tauri-apps/tauri/pull/4342)) on 2022-06-14
## \[1.0.0-rc.13]
- Copy `tauri.conf.json > tauri.bundle.windows.webview_fixed_runtime_path` as a resource to the target directory to fix development usage of a fixed Webview2 runtime path.
- [8a634895](https://www.github.com/tauri-apps/tauri/commit/8a63489567b9fa86e404ad42b5b30c64361efe85) fix(build): fixed Webview2 runtime path in development, closes [#4308](https://www.github.com/tauri-apps/tauri/pull/4308) on 2022-06-10
- Improve usage of the GNU toolchain on Windows by copying the Webview2Loader.dll file to the target directory.
- [58a6879b](https://www.github.com/tauri-apps/tauri/commit/58a6879b82e3a82027604cdd0913caacaaab5c76) feat(tauri-build): improve Windows GNU toolchain usage, closes [#4319](https://www.github.com/tauri-apps/tauri/pull/4319) ([#4323](https://www.github.com/tauri-apps/tauri/pull/4323)) on 2022-06-12
- Only statically link the VC runtime when the `STATIC_VCRUNTIME` environment variable is set to `true` (automatically done by the Tauri CLI).
- [d703d27a](https://www.github.com/tauri-apps/tauri/commit/d703d27a707edc028f13b35603205da1133fcc2b) fix(build): statically link VC runtime only on `tauri build` ([#4292](https://www.github.com/tauri-apps/tauri/pull/4292)) on 2022-06-07
## \[1.0.0-rc.12]
- Statically link the Visual C++ runtime instead of using a merge module on the installer.
- [bb061509](https://www.github.com/tauri-apps/tauri/commit/bb061509fb674bef86ecbc1de3aa8f3e367a9907) refactor(core): statically link vcruntime, closes [#4122](https://www.github.com/tauri-apps/tauri/pull/4122) ([#4227](https://www.github.com/tauri-apps/tauri/pull/4227)) on 2022-05-27
## \[1.0.0-rc.11]
- Create `dev` cfg alias.
- [9cdcf9b3](https://www.github.com/tauri-apps/tauri/commit/9cdcf9b3a8fa27612b3156c1702a4e776627e869) feat(build): create `dev` alias ([#4212](https://www.github.com/tauri-apps/tauri/pull/4212)) on 2022-05-25
## \[1.0.0-rc.10]
- Delete existing sidecar before copying new one.
- [a737f25c](https://www.github.com/tauri-apps/tauri/commit/a737f25c1078083e0b0f7f338f5c958b86914323) fix(tauri-build): delete existing sidecar file, closes [#4134](https://www.github.com/tauri-apps/tauri/pull/4134) ([#4167](https://www.github.com/tauri-apps/tauri/pull/4167)) on 2022-05-18
## \[1.0.0-rc.9]
- Search `tauri.conf.json > tauri > bundle > icons` for a `.ico` file for the window icon instead of simple default `icons/icon.ico` when `WindowsAttributes::window_icon_path` is not set.
- [bad85a1f](https://www.github.com/tauri-apps/tauri/commit/bad85a1f11da03421401080531275ba201480cd1) feat(build): find .ico in config instead of default `icons/icon.ico` ([#4115](https://www.github.com/tauri-apps/tauri/pull/4115)) on 2022-05-13
## \[1.0.0-rc.8]
- Properly set file version information for the Windows executable.
- [1ca2dd67](https://www.github.com/tauri-apps/tauri/commit/1ca2dd677d50b4c724c55b37060c3ba64b81c54a) fix(tauri-build): properly set executable version info on Windows ([#4045](https://www.github.com/tauri-apps/tauri/pull/4045)) on 2022-05-03
## \[1.0.0-rc.7]
- Rerun build script if `TAURI_CONFIG` environment variable change.
- [7ae9e252](https://www.github.com/tauri-apps/tauri/commit/7ae9e25262376529637cd3b47b1cf84809efaec9) fix(tauri-build): rerun if `TAURI_CONFIG` env var changes on 2022-04-26
## \[1.0.0-rc.6]
- Copy system tray icon resource to the target directory on Linux.
- [f2a30d8b](https://www.github.com/tauri-apps/tauri/commit/f2a30d8bc54fc3ba49e16f69a413eca5f61a9b1f) refactor(core): use ayatana appindicator by default, keep option to use gtk ([#3916](https://www.github.com/tauri-apps/tauri/pull/3916)) on 2022-04-19
## \[1.0.0-rc.5]
- Print error context on the `build` panic.
- [49546c52](https://www.github.com/tauri-apps/tauri/commit/49546c5269080f38d57365788eb2592bff8f6d10) feat(build): print error context ([#3644](https://www.github.com/tauri-apps/tauri/pull/3644)) on 2022-03-09
## \[1.0.0-rc.4]
- Parse window icons at compile time.
- Bumped due to a bump in tauri-codegen.
- [8c935872](https://www.github.com/tauri-apps/tauri/commit/8c9358725a17dcc2acaf4d10c3f654afdff586b0) refactor(core): move `png` and `ico` behind Cargo features ([#3588](https://www.github.com/tauri-apps/tauri/pull/3588)) on 2022-03-05
## \[1.0.0-rc.3]
- Automatically emit `cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET` with the value set on `tauri.conf.json > tauri > bundle > macos > minimumSystemVersion`.
- [4bacea5b](https://www.github.com/tauri-apps/tauri/commit/4bacea5bf48ea5ca6c9bdd10e28e85e67a0c6ef9) feat(core): set `MACOSX_DEPLOYMENT_TARGET` environment variable, closes [#2732](https://www.github.com/tauri-apps/tauri/pull/2732) ([#3496](https://www.github.com/tauri-apps/tauri/pull/3496)) on 2022-02-17
## \[1.0.0-rc.2]
- Rerun if sidecar or resource change.
- [afcc3ec5](https://www.github.com/tauri-apps/tauri/commit/afcc3ec50148074293350aaa26a05812207716be) fix(build): rerun if resource or sidecar change ([#3460](https://www.github.com/tauri-apps/tauri/pull/3460)) on 2022-02-14
## \[1.0.0-rc.1]
- Remove `cargo:rerun-if-changed` check for non-existent file that caused projects to *always* rebuild.
- [65287cd6](https://www.github.com/tauri-apps/tauri/commit/65287cd6148feeba91df86217b261770fed34608) remove non-existent cargo rerun check ([#3412](https://www.github.com/tauri-apps/tauri/pull/3412)) on 2022-02-11
## \[1.0.0-rc.0]
- Allow user to specify windows sdk path in build.rs.
- [59b6ee87](https://www.github.com/tauri-apps/tauri/commit/59b6ee87932d341433032befe3babd897ed8f7d0) fix(tauri-build): allow user to specify win sdk path (fix: [#2871](https://www.github.com/tauri-apps/tauri/pull/2871)) ([#2893](https://www.github.com/tauri-apps/tauri/pull/2893)) on 2021-11-16
- Adds support for using JSON5 format for the `tauri.conf.json` file, along with also supporting the `.json5` extension.
Here is the logic flow that determines if JSON or JSON5 will be used to parse the config:
1. Check if `tauri.conf.json` exists
a. Parse it with `serde_json`
b. Parse it with `json5` if `serde_json` fails
c. Return original `serde_json` error if all above steps failed
2. Check if `tauri.conf.json5` exists
a. Parse it with `json5`
b. Return error if all above steps failed
3. Return error if all above steps failed
- [995de57a](https://www.github.com/tauri-apps/tauri/commit/995de57a76cf51215277673e526d7ec32b86b564) Add seamless support for using JSON5 in the config file ([#47](https://www.github.com/tauri-apps/tauri/pull/47)) on 2022-02-03
- Move the copying of resources and sidecars from `cli.rs` to `tauri-build` so using the Cargo CLI directly processes the files for the application execution in development.
- [5eb72c24](https://www.github.com/tauri-apps/tauri/commit/5eb72c24deddf5a01093bea96b90c0d8806afc3f) refactor: copy resources and sidecars on the Cargo build script ([#3357](https://www.github.com/tauri-apps/tauri/pull/3357)) on 2022-02-08
- The minimum Rust version is now `1.56`.
- [a9dfc015](https://www.github.com/tauri-apps/tauri/commit/a9dfc015505afe91281c2027954ffcc588b1a59c) feat: update to edition 2021 and set minimum rust to 1.56 ([#2789](https://www.github.com/tauri-apps/tauri/pull/2789)) on 2021-10-22
- Validate `tauri` dependency `features` under `Cargo.toml` matching `tauri.conf.json`'s `allowlist`.
- [4de285c3](https://www.github.com/tauri-apps/tauri/commit/4de285c3967d32250d73acdd5d171a6fd332d2b3) feat(core): validate Cargo features matching allowlist \[TRI-023] on 2022-01-09
## \[1.0.0-beta.4]
- Implement `Debug` on public API structs and enums.
- [fa9341ba](https://www.github.com/tauri-apps/tauri/commit/fa9341ba18ba227735341530900714dba0f27291) feat(core): implement `Debug` on public API structs/enums, closes [#2292](https://www.github.com/tauri-apps/tauri/pull/2292) ([#2387](https://www.github.com/tauri-apps/tauri/pull/2387)) on 2021-08-11
## \[1.0.0-beta.3]
- Improve ESM detection with regexes.
- Bumped due to a bump in tauri-codegen.
- [4b0ec018](https://www.github.com/tauri-apps/tauri/commit/4b0ec0188078a8fefd4119fe5e19ebc30191f802) fix(core): improve JS ESM detection ([#2139](https://www.github.com/tauri-apps/tauri/pull/2139)) on 2021-07-02
- Inject invoke key on `script` tags with `type="module"`.
- Bumped due to a bump in tauri-codegen.
- [f03eea9c](https://www.github.com/tauri-apps/tauri/commit/f03eea9c9b964709532afbc4d1dd343b3fd96081) feat(core): inject invoke key on `<script type="module">` ([#2120](https://www.github.com/tauri-apps/tauri/pull/2120)) on 2021-06-29
## \[1.0.0-beta.2]
- Detect ESM scripts and inject the invoke key directly instead of using an IIFE.
- Bumped due to a bump in tauri-codegen.
- [7765c7fa](https://www.github.com/tauri-apps/tauri/commit/7765c7fa281853ddfb26b6b17534df95eaede804) fix(core): invoke key injection on ES module, improve performance ([#2094](https://www.github.com/tauri-apps/tauri/pull/2094)) on 2021-06-27
- Improve invoke key code injection performance time rewriting code at compile time.
- Bumped due to a bump in tauri-codegen.
- [7765c7fa](https://www.github.com/tauri-apps/tauri/commit/7765c7fa281853ddfb26b6b17534df95eaede804) fix(core): invoke key injection on ES module, improve performance ([#2094](https://www.github.com/tauri-apps/tauri/pull/2094)) on 2021-06-27
## \[1.0.0-beta.1]
- Pull Windows resource information (`FileVersion`, `ProductVersion`, `ProductName` and `FileDescription`) from `tauri.conf.json > package` configuration.
- [dc6b0d85](https://www.github.com/tauri-apps/tauri/commit/dc6b0d8522ca9f0962aa7c6fe446743889470b8c) feat(core): set .rc values from tauri.conf.json, closes [#1849](https://www.github.com/tauri-apps/tauri/pull/1849) ([#1951](https://www.github.com/tauri-apps/tauri/pull/1951)) on 2021-06-05
## \[1.0.0-beta.0]
- The `try_build` method now has a `Attributes` argument to allow specifying the window icon path used on Windows.
- [c91105f](https://www.github.com/tauri-apps/tauri/commit/c91105ff965cceb2dfb402004c12799bf3b1c2f6) refactor(build): allow setting window icon path on `try_build` ([#1686](https://www.github.com/tauri-apps/tauri/pull/1686)) on 2021-05-03
## \[1.0.0-beta-rc.1]
- The package info APIs now checks the `package` object on `tauri.conf.json`.
- Bumped due to a bump in tauri-codegen.
- [8fd1baf](https://www.github.com/tauri-apps/tauri/commit/8fd1baf69b14bb81d7be9d31605ed7f02058b392) fix(core): pull package info from tauri.conf.json if set ([#1581](https://www.github.com/tauri-apps/tauri/pull/1581)) on 2021-04-22
- [f575aaa](https://www.github.com/tauri-apps/tauri/commit/f575aaad71f23d44b2f89cf9ee5d84817dc3bb7a) fix: change files not referencing core packages ([#1619](https://www.github.com/tauri-apps/tauri/pull/1619)) on 2021-04-25
## \[1.0.0-beta-rc.0]
- Update all code files to have our license header.
- [bf82136](https://www.github.com/tauri-apps/tauri/commit/bf8213646689175f8a158b956911f3a43e360690) feat(license): SPDX Headers ([#1449](https://www.github.com/tauri-apps/tauri/pull/1449)) on 2021-04-11
- [a6def70](https://www.github.com/tauri-apps/tauri/commit/a6def7066eec19c889b0f14cc1e475bf209a332e) Refactor(tauri): move tauri-api and tauri-updater to tauri ([#1455](https://www.github.com/tauri-apps/tauri/pull/1455)) on 2021-04-11
- [aea6145](https://www.github.com/tauri-apps/tauri/commit/aea614587bddab930d552512b54e18624fbf573e) refactor(repo): add /tooling folder ([#1457](https://www.github.com/tauri-apps/tauri/pull/1457)) on 2021-04-12

View File

@@ -0,0 +1,38 @@
[package]
name = "tauri-build"
version = "1.5.3"
authors = [ "Tauri Programme within The Commons Conservancy" ]
categories = [ "gui", "web-programming" ]
license = "Apache-2.0 OR MIT"
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"
exclude = [ "CHANGELOG.md", "/target" ]
readme = "README.md"
[package.metadata.docs.rs]
all-features = true
rustdoc-args = [ "--cfg", "doc_cfg" ]
[dependencies]
anyhow = "1"
quote = { version = "1", optional = true }
tauri-codegen = { version = "1.4.4", path = "../tauri-codegen", optional = true }
tauri-utils = { version = "1.6.0", path = "../tauri-utils", features = [ "build", "resources" ] }
cargo_toml = "0.15"
serde = "1"
serde_json = "1"
heck = "0.5"
json-patch = "1.2"
tauri-winres = "0.1"
semver = "1"
walkdir = "2"
dirs-next = "2"
[features]
codegen = [ "tauri-codegen", "quote" ]
isolation = [ "tauri-codegen/isolation", "tauri-utils/isolation" ]
config-json5 = [ "tauri-utils/config-json5" ]
config-toml = [ "tauri-utils/config-toml" ]

View File

@@ -1,6 +1,6 @@
# tauri-build
<img align="right" src="https://github.com/tauri-apps/tauri/raw/dev/.github/icon.png" height="128" width="128">
<img align="right" src="https://github.com/tauri-apps/tauri/raw/dev/app-icon.png" height="128" width="128">
[![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)

View File

@@ -1,10 +1,10 @@
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
// 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::{AppConfig, Config, PatternKind};
use tauri_utils::config::{Config, PatternKind, TauriConfig};
#[derive(Debug, Default, PartialEq, Eq)]
struct Diff {
@@ -34,7 +34,7 @@ pub fn check(config: &Config, manifest: &mut Manifest) -> Result<()> {
alias: None,
kind: DependencyKind::Build,
all_cli_managed_features: Some(vec!["isolation"]),
expected_features: match config.app.security.pattern {
expected_features: match config.tauri.pattern {
PatternKind::Isolation { .. } => vec!["isolation".to_string()],
_ => vec![],
},
@@ -43,17 +43,11 @@ pub fn check(config: &Config, manifest: &mut Manifest) -> Result<()> {
name: "tauri".into(),
alias: None,
kind: DependencyKind::Normal,
all_cli_managed_features: Some(
AppConfig::all_features()
.into_iter()
.filter(|f| f != &"tray-icon")
.collect(),
),
all_cli_managed_features: Some(TauriConfig::all_features()),
expected_features: config
.app
.tauri
.features()
.into_iter()
.filter(|f| f != &"tray-icon")
.map(|f| f.to_string())
.collect::<Vec<String>>(),
},
@@ -65,7 +59,7 @@ pub fn check(config: &Config, manifest: &mut Manifest) -> Result<()> {
if deps.is_empty() {
if let Some(alias) = &metadata.alias {
deps = find_dependency(manifest, alias, metadata.kind);
name.clone_from(alias);
name = alias.clone();
}
}
@@ -211,7 +205,7 @@ mod tests {
},
),
] {
assert_eq!(crate::manifest::features_diff(&current, &expected), result);
assert_eq!(super::features_diff(&current, &expected), result);
}
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
@@ -7,27 +7,27 @@ use std::{
env::var,
fs::{create_dir_all, File},
io::{BufWriter, Write},
path::{Path, PathBuf},
path::PathBuf,
};
use tauri_codegen::{context_codegen, ContextData};
use tauri_utils::config::FrontendDist;
use tauri_utils::config::{AppUrl, WindowUrl};
// TODO docs
/// A builder for generating a Tauri application context during compile time.
#[cfg_attr(docsrs, doc(cfg(feature = "codegen")))]
#[cfg_attr(doc_cfg, doc(cfg(feature = "codegen")))]
#[derive(Debug)]
pub struct CodegenContext {
dev: bool,
config_path: PathBuf,
out_file: PathBuf,
capabilities: Option<Vec<PathBuf>>,
}
impl Default for CodegenContext {
fn default() -> Self {
Self {
dev: false,
config_path: PathBuf::from("tauri.conf.json"),
out_file: PathBuf::from("tauri-build-context.rs"),
capabilities: None,
}
}
}
@@ -66,13 +66,11 @@ impl CodegenContext {
self
}
/// Adds a capability file to the generated context.
/// Run the codegen in a `dev` context, meaning that Tauri is using a dev server or local file for development purposes,
/// usually with the `tauri dev` CLI command.
#[must_use]
pub fn capability<P: AsRef<Path>>(mut self, path: P) -> Self {
self
.capabilities
.get_or_insert_with(Default::default)
.push(path.as_ref().to_path_buf());
pub fn dev(mut self) -> Self {
self.dev = true;
self
}
@@ -80,18 +78,33 @@ impl CodegenContext {
///
/// Unless you are doing something special with this builder, you don't need to do anything with
/// the returned output path.
pub(crate) fn try_build(self) -> Result<PathBuf> {
///
/// # Panics
///
/// If any parts of the codegen fail, this will panic with the related error message. This is
/// typically desirable when running inside a build script; see [`Self::try_build`] for no panics.
pub fn build(self) -> PathBuf {
match self.try_build() {
Ok(out) => out,
Err(error) => panic!("Error found during Codegen::build: {error}"),
}
}
/// Non-panicking [`Self::build`]
pub fn try_build(self) -> Result<PathBuf> {
let (config, config_parent) = tauri_codegen::get_config(&self.config_path)?;
// rerun if changed
match &config.build.frontend_dist {
Some(FrontendDist::Directory(p)) => {
let dist_path = config_parent.join(p);
if dist_path.exists() {
println!("cargo:rerun-if-changed={}", dist_path.display());
}
let app_url = if self.dev {
&config.build.dev_path
} else {
&config.build.dist_dir
};
match app_url {
AppUrl::Url(WindowUrl::App(p)) => {
println!("cargo:rerun-if-changed={}", config_parent.join(p).display());
}
Some(FrontendDist::Files(files)) => {
AppUrl::Files(files) => {
for path in files {
println!(
"cargo:rerun-if-changed={}",
@@ -101,13 +114,13 @@ impl CodegenContext {
}
_ => (),
}
for icon in &config.bundle.icon {
for icon in &config.tauri.bundle.icon {
println!(
"cargo:rerun-if-changed={}",
config_parent.join(icon).display()
);
}
if let Some(tray_icon) = config.app.tray_icon.as_ref().map(|t| &t.icon_path) {
if let Some(tray_icon) = config.tauri.system_tray.as_ref().map(|t| &t.icon_path) {
println!(
"cargo:rerun-if-changed={}",
config_parent.join(tray_icon).display()
@@ -115,23 +128,18 @@ impl CodegenContext {
}
#[cfg(target_os = "macos")]
{
let info_plist_path = config_parent.join("Info.plist");
if info_plist_path.exists() {
println!("cargo:rerun-if-changed={}", info_plist_path.display());
}
}
println!(
"cargo:rerun-if-changed={}",
config_parent.join("Info.plist").display()
);
let code = context_codegen(ContextData {
dev: crate::is_dev(),
dev: self.dev,
config,
config_parent,
// it's very hard to have a build script for unit tests, so assume this is always called from
// outside the tauri crate, making the ::tauri root valid.
root: quote::quote!(::tauri),
capabilities: self.capabilities,
assets: None,
test: false,
})?;
// get the full output file path

View File

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

View File

@@ -1,43 +1,30 @@
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
//! This applies the macros at build-time in order to rig some special features needed by `cargo`.
#![doc(
html_logo_url = "https://github.com/tauri-apps/tauri/raw/dev/.github/icon.png",
html_favicon_url = "https://github.com/tauri-apps/tauri/raw/dev/.github/icon.png"
)]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![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 std::{
collections::HashMap,
env, fs,
path::{Path, PathBuf},
};
use std::path::{Path, PathBuf};
mod acl;
mod allowlist;
#[cfg(feature = "codegen")]
mod codegen;
mod manifest;
mod mobile;
mod static_vcruntime;
#[cfg(feature = "codegen")]
#[cfg_attr(docsrs, doc(cfg(feature = "codegen")))]
#[cfg_attr(doc_cfg, doc(cfg(feature = "codegen")))]
pub use codegen::context::CodegenContext;
pub use acl::{AppManifest, DefaultPermissionRule, InlinedPlugin};
fn copy_file(from: impl AsRef<Path>, to: impl AsRef<Path>) -> Result<()> {
let from = from.as_ref();
let to = to.as_ref();
@@ -48,8 +35,8 @@ fn copy_file(from: impl AsRef<Path>, to: impl AsRef<Path>) -> Result<()> {
return Err(anyhow::anyhow!("{:?} is not a file", from));
}
let dest_dir = to.parent().expect("No data in parent");
fs::create_dir_all(dest_dir)?;
fs::copy(from, to)?;
std::fs::create_dir_all(dest_dir)?;
std::fs::copy(from, to)?;
Ok(())
}
@@ -68,7 +55,7 @@ fn copy_binaries(
.to_string_lossy()
.replace(&format!("-{target_triple}"), "");
if package_name == Some(&file_name) {
if package_name.map_or(false, |n| n == &file_name) {
return Err(anyhow::anyhow!(
"Cannot define a sidecar with the same name as the Cargo package name `{}`. Please change the sidecar name in the filesystem and the Tauri configuration.",
file_name
@@ -77,7 +64,7 @@ fn copy_binaries(
let dest = path.join(file_name);
if dest.exists() {
fs::remove_file(&dest).unwrap();
std::fs::remove_file(&dest).unwrap();
}
copy_file(&src, &dest)?;
}
@@ -86,18 +73,10 @@ fn copy_binaries(
/// Copies resources to a path.
fn copy_resources(resources: ResourcePaths<'_>, path: &Path) -> Result<()> {
let path = path.canonicalize()?;
for resource in resources.iter() {
let resource = resource?;
println!("cargo:rerun-if-changed={}", resource.path().display());
// avoid copying the resource if target is the same as source
let src = resource.path().canonicalize()?;
let target = path.join(resource.target());
if src != target {
copy_file(src, target)?;
}
copy_file(resource.path(), path.join(resource.target()))?;
}
Ok(())
}
@@ -132,16 +111,16 @@ fn copy_dir(from: &Path, to: &Path) -> Result<()> {
let rel_path = entry.path().strip_prefix(from)?;
let dest_path = to.join(rel_path);
if entry.file_type().is_symlink() {
let target = fs::read_link(entry.path())?;
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() {
fs::create_dir(dest_path)?;
std::fs::create_dir(dest_path)?;
} else {
fs::copy(entry.path(), dest_path)?;
std::fs::copy(entry.path(), dest_path)?;
}
}
Ok(())
@@ -149,7 +128,7 @@ fn copy_dir(from: &Path, to: &Path) -> Result<()> {
// 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_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))?;
@@ -161,8 +140,12 @@ fn copy_framework_from(src_dir: &Path, framework: &str, dest_dir: &Path) -> Resu
// Copies the macOS application bundle frameworks to the target folder
fn copy_frameworks(dest_dir: &Path, frameworks: &[String]) -> Result<()> {
fs::create_dir_all(dest_dir)
.with_context(|| format!("Failed to create frameworks output directory at {dest_dir:?}"))?;
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);
@@ -187,7 +170,7 @@ fn copy_frameworks(dest_dir: &Path, frameworks: &[String]) -> Result<()> {
framework
));
}
if let Some(home_dir) = dirs::home_dir() {
if let Some(home_dir) = dirs_next::home_dir() {
if copy_framework_from(&home_dir.join("Library/Frameworks/"), framework, dest_dir)? {
continue;
}
@@ -205,10 +188,18 @@ fn copy_frameworks(dest_dir: &Path, frameworks: &[String]) -> Result<()> {
Ok(())
}
// checks if the given Cargo feature is enabled.
fn has_feature(feature: &str) -> bool {
// when a feature is enabled, Cargo sets the `CARGO_FEATURE_<name` env var to 1
// https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-build-scripts
std::env::var(format!("CARGO_FEATURE_{}", AsShoutySnakeCase(feature)))
.map(|x| x == "1")
.unwrap_or(false)
}
// creates a cfg alias if `has_feature` is true.
// `alias` must be a snake case string.
fn cfg_alias(alias: &str, has_feature: bool) {
println!("cargo:rustc-check-cfg=cfg({alias})");
if has_feature {
println!("cargo:rustc-cfg={alias}");
}
@@ -216,14 +207,25 @@ fn cfg_alias(alias: &str, has_feature: bool) {
/// Attributes used on Windows.
#[allow(dead_code)]
#[derive(Debug)]
#[derive(Debug, Default)]
pub struct WindowsAttributes {
window_icon_path: Option<PathBuf>,
/// The path to the sdk location.
///
/// For the GNU toolkit this has to be the path where MinGW put windres.exe and ar.exe.
/// This could be something like: "C:\Program Files\mingw-w64\x86_64-5.3.0-win32-seh-rt_v4-rev0\mingw64\bin"
///
/// For MSVC the Windows SDK has to be installed. It comes with the resource compiler rc.exe.
/// This should be set to the root directory of the Windows SDK, e.g., "C:\Program Files (x86)\Windows Kits\10" or,
/// if multiple 10 versions are installed, set it directly to the correct bin directory "C:\Program Files (x86)\Windows Kits\10\bin\10.0.14393.0\x64"
///
/// If it is left unset, it will look up a path in the registry, i.e. HKLM\SOFTWARE\Microsoft\Windows Kits\Installed Roots
sdk_dir: Option<PathBuf>,
/// A string containing an [application manifest] to be included with the application on Windows.
///
/// Defaults to:
/// ```text
#[doc = include_str!("windows-app-manifest.xml")]
#[doc = include_str!("window-app-manifest.xml")]
/// ```
///
/// ## Warning
@@ -248,28 +250,10 @@ pub struct WindowsAttributes {
app_manifest: Option<String>,
}
impl Default for WindowsAttributes {
fn default() -> Self {
Self::new()
}
}
impl WindowsAttributes {
/// Creates the default attribute set.
pub fn new() -> Self {
Self {
window_icon_path: Default::default(),
app_manifest: Some(include_str!("windows-app-manifest.xml").into()),
}
}
/// Creates the default attriute set wihtou the default app manifest.
#[must_use]
pub fn new_without_app_manifest() -> Self {
Self {
app_manifest: None,
window_icon_path: Default::default(),
}
Self::default()
}
/// Sets the icon to use on the window. Currently only used on Windows.
@@ -282,11 +266,19 @@ impl WindowsAttributes {
self
}
/// Sets the sdk dir for windows. Currently only used on Windows. This must be a valid UTF-8
/// path. Defaults to whatever the `winres` crate determines is best.
#[must_use]
pub fn sdk_dir<P: AsRef<Path>>(mut self, sdk_dir: P) -> Self {
self.sdk_dir = Some(sdk_dir.as_ref().into());
self
}
/// Sets the [application manifest] to be included with the application on Windows.
///
/// Defaults to:
/// ```text
#[doc = include_str!("windows-app-manifest.xml")]
#[doc = include_str!("window-app-manifest.xml")]
/// ```
///
/// ## Warning
@@ -310,7 +302,7 @@ impl WindowsAttributes {
/// # Example
///
/// The following manifest will brand the exe as requesting administrator privileges.
/// Thus, every time it is executed, a Windows UAC dialog will appear.
/// Thus, everytime it is executed, a Windows UAC dialog will appear.
///
/// ```rust,no_run
/// let mut windows = tauri_build::WindowsAttributes::new();
@@ -345,11 +337,6 @@ impl WindowsAttributes {
pub struct Attributes {
#[allow(dead_code)]
windows_attributes: WindowsAttributes,
capabilities_path_pattern: Option<&'static str>,
#[cfg(feature = "codegen")]
codegen: Option<codegen::context::CodegenContext>,
inlined_plugins: HashMap<&'static str, InlinedPlugin>,
app_manifest: AppManifest,
}
impl Attributes {
@@ -364,81 +351,27 @@ impl Attributes {
self.windows_attributes = windows_attributes;
self
}
/// Set the glob pattern to be used to find the capabilities.
///
/// **Note:** You must emit [rerun-if-changed] instructions for your capabilities directory.
///
/// [rerun-if-changed]: https://doc.rust-lang.org/cargo/reference/build-scripts.html#rerun-if-changed
#[must_use]
pub fn capabilities_path_pattern(mut self, pattern: &'static str) -> Self {
self.capabilities_path_pattern.replace(pattern);
self
}
/// Adds the given plugin to the list of inlined plugins (a plugin that is part of your application).
///
/// See [`InlinedPlugin`] for more information.
pub fn plugin(mut self, name: &'static str, plugin: InlinedPlugin) -> Self {
self.inlined_plugins.insert(name, plugin);
self
}
/// Adds the given list of plugins to the list of inlined plugins (a plugin that is part of your application).
///
/// See [`InlinedPlugin`] for more information.
pub fn plugins<I>(mut self, plugins: I) -> Self
where
I: IntoIterator<Item = (&'static str, InlinedPlugin)>,
{
self.inlined_plugins.extend(plugins);
self
}
/// Sets the application manifest for the Access Control List.
///
/// See [`AppManifest`] for more information.
pub fn app_manifest(mut self, manifest: AppManifest) -> Self {
self.app_manifest = manifest;
self
}
#[cfg(feature = "codegen")]
#[cfg_attr(docsrs, doc(cfg(feature = "codegen")))]
#[must_use]
pub fn codegen(mut self, codegen: codegen::context::CodegenContext) -> Self {
self.codegen.replace(codegen);
self
}
}
pub fn is_dev() -> bool {
env::var("DEP_TAURI_DEV").expect("missing `cargo:dev` instruction, please update tauri to latest")
== "true"
}
/// Run all build time helpers for your Tauri Application.
///
/// To provide extra configuration, such as [`AppManifest::commands`]
/// for fine-grained control over command permissions, see [`try_build`].
/// See [`Attributes`] for the complete list of configuration options.
/// The current helpers include the following:
/// * Generates a Windows Resource file when targeting Windows.
///
/// # Platforms
///
/// [`build()`] should be called inside of `build.rs` regardless of the platform, so **DO NOT** use a [conditional compilation]
/// check that prevents it from running on any of your targets.
/// [`build()`] should be called inside of `build.rs` regardless of the platform:
/// * New helpers may target more platforms in the future.
/// * Platform specific code is handled by the helpers automatically.
/// * A build script is required in order to activate some cargo environmental variables that are
/// used when generating code and embedding assets - so [`build()`] may as well be called.
///
/// Platform specific code is handled by the helpers automatically.
///
/// A build script is required in order to activate some cargo environmental variables that are
/// used when generating code and embedding assets.
/// In short, this is saying don't put the call to [`build()`] behind a `#[cfg(windows)]`.
///
/// # Panics
///
/// If any of the build time helpers fail, they will [`std::panic!`] with the related error message.
/// This is typically desirable when running inside a build script; see [`try_build`] for no panics.
///
/// [conditional compilation]: https://web.mit.edu/rust-lang_v1.25/arch/amd64_ubuntu1404/share/doc/rust/html/book/first-edition/conditional-compilation.html
pub fn build() {
if let Err(error) = try_build(Attributes::default()) {
let error = format!("{error:#}");
@@ -453,70 +386,52 @@ pub fn build() {
}
}
/// Same as [`build()`], but takes an extra configuration argument, and does not panic.
/// Non-panicking [`build()`].
#[allow(unused_variables)]
pub fn try_build(attributes: Attributes) -> Result<()> {
use anyhow::anyhow;
println!("cargo:rerun-if-env-changed=TAURI_CONFIG");
println!("cargo:rerun-if-changed=tauri.conf.json");
#[cfg(feature = "config-json5")]
println!("cargo:rerun-if-changed=tauri.conf.json5");
#[cfg(feature = "config-toml")]
println!("cargo:rerun-if-changed=Tauri.toml");
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap();
let mobile = target_os == "ios" || target_os == "android";
cfg_alias("desktop", !mobile);
cfg_alias("mobile", mobile);
let target_triple = env::var("TARGET").unwrap();
let target = tauri_utils::platform::Target::from_triple(&target_triple);
let (mut config, config_paths) =
tauri_utils::config::parse::read_from(target, &env::current_dir().unwrap())?;
for config_file_path in config_paths {
println!("cargo:rerun-if-changed={}", config_file_path.display());
}
if let Ok(env) = env::var("TAURI_CONFIG") {
let mut config = serde_json::from_value(tauri_utils::config::parse::read_from(
std::env::current_dir().unwrap(),
)?)?;
if let Ok(env) = std::env::var("TAURI_CONFIG") {
let merge_config: serde_json::Value = serde_json::from_str(&env)?;
json_patch::merge(&mut config, &merge_config);
}
let config: Config = serde_json::from_value(config)?;
let s = config.identifier.split('.');
let last = s.clone().count() - 1;
let mut android_package_prefix = String::new();
for (i, w) in s.enumerate() {
if i == last {
println!(
"cargo:rustc-env=TAURI_ANDROID_PACKAGE_NAME_APP_NAME={}",
w.replace('-', "_")
);
} else {
android_package_prefix.push_str(&w.replace(['_', '-'], "_1"));
android_package_prefix.push('_');
}
}
android_package_prefix.pop();
println!("cargo:rustc-env=TAURI_ANDROID_PACKAGE_NAME_PREFIX={android_package_prefix}");
cfg_alias("dev", !has_feature("custom-protocol"));
if let Some(project_dir) = env::var_os("TAURI_ANDROID_PROJECT_PATH").map(PathBuf::from) {
mobile::generate_gradle_files(project_dir, &config)?;
let ws_path = get_workspace_dir()?;
let mut manifest =
Manifest::<cargo_toml::Value>::from_slice_with_metadata(&std::fs::read("Cargo.toml")?)?;
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"))?;
}
cfg_alias("dev", is_dev());
let cargo_toml_path = Path::new("Cargo.toml").canonicalize()?;
let mut manifest = Manifest::<cargo_toml::Value>::from_path_with_metadata(cargo_toml_path)?;
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
manifest::check(&config, &mut manifest)?;
acl::build(&out_dir, target, &attributes)?;
tauri_utils::plugin::save_global_api_scripts_paths(&out_dir, None);
println!("cargo:rustc-env=TAURI_ENV_TARGET_TRIPLE={target_triple}");
// when running codegen in this build script, we need to access the env var directly
env::set_var("TAURI_ENV_TARGET_TRIPLE", &target_triple);
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>
let target_dir = out_dir
.parent()
@@ -526,7 +441,7 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
.parent()
.unwrap();
if let Some(paths) = &config.bundle.external_bin {
if let Some(paths) = &config.tauri.bundle.external_bin {
copy_binaries(
ResourcePaths::new(external_binaries(paths, &target_triple).as_slice(), true),
&target_triple,
@@ -537,15 +452,21 @@ 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.bundle.windows.webview_install_mode {
WebviewInstallMode::FixedRuntime { path } => Some(path),
_ => None,
} {
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());
}
}
@@ -557,10 +478,10 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
}
if target_triple.contains("darwin") {
if let Some(frameworks) = &config.bundle.macos.frameworks {
if let Some(frameworks) = &config.tauri.bundle.macos.frameworks {
if !frameworks.is_empty() {
let frameworks_dir = target_dir.parent().unwrap().join("Frameworks");
let _ = fs::remove_dir_all(&frameworks_dir);
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)?;
@@ -571,24 +492,18 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
}
}
if let Some(version) = &config.bundle.macos.minimum_system_version {
if let Some(version) = &config.tauri.bundle.macos.minimum_system_version {
println!("cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET={version}");
}
}
if target_triple.contains("ios") {
println!(
"cargo:rustc-env=IPHONEOS_DEPLOYMENT_TARGET={}",
config.bundle.ios.minimum_system_version
);
}
if target_triple.contains("windows") {
use semver::Version;
use tauri_winres::{VersionInfo, WindowsResource};
fn find_icon<F: Fn(&&String) -> bool>(config: &Config, predicate: F, default: &str) -> PathBuf {
let icon_path = config
.tauri
.bundle
.icon
.iter()
@@ -603,48 +518,40 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
.window_icon_path
.unwrap_or_else(|| find_icon(&config, |i| i.ends_with(".ico"), "icons/icon.ico"));
let mut res = WindowsResource::new();
if let Some(manifest) = attributes.windows_attributes.app_manifest {
res.set_manifest(&manifest);
}
if let Some(version_str) = &config.version {
if let Ok(v) = Version::parse(version_str) {
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);
}
}
if let Some(product_name) = &config.product_name {
res.set("ProductName", product_name);
}
let company_name = config.bundle.publisher.unwrap_or_else(|| {
config
.identifier
.split('.')
.nth(1)
.unwrap_or(&config.identifier)
.to_string()
});
res.set("CompanyName", &company_name);
let file_description = config
.product_name
.or_else(|| manifest.package.as_ref().map(|p| p.name.clone()))
.or_else(|| std::env::var("CARGO_PKG_NAME").ok());
res.set("FileDescription", &file_description.unwrap());
if let Some(copyright) = &config.bundle.copyright {
res.set("LegalCopyright", copyright);
}
if window_icon_path.exists() {
let mut res = WindowsResource::new();
if let Some(manifest) = attributes.windows_attributes.app_manifest {
res.set_manifest(&manifest);
} else {
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) {
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);
}
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_icon_with_id(&window_icon_path.display().to_string(), "32512");
res.compile().with_context(|| {
format!(
"failed to compile `{}` into a Windows Resource file during tauri-build",
window_icon_path.display()
)
})?;
} else {
return Err(anyhow!(format!(
"`{}` not found; required for generating a Windows Resource file during tauri-build",
@@ -652,24 +559,17 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
)));
}
res.compile().with_context(|| {
format!(
"failed to compile `{}` into a Windows Resource file during tauri-build",
window_icon_path.display()
)
})?;
let target_env = env::var("CARGO_CFG_TARGET_ENV").unwrap();
let target_env = std::env::var("CARGO_CFG_TARGET_ENV").unwrap();
match target_env.as_str() {
"gnu" => {
let target_arch = match env::var("CARGO_CFG_TARGET_ARCH").unwrap().as_str() {
let target_arch = match std::env::var("CARGO_CFG_TARGET_ARCH").unwrap().as_str() {
"x86_64" => Some("x64"),
"x86" => Some("x86"),
"aarch64" => Some("arm64"),
arch => None,
};
if let Some(target_arch) = target_arch {
for entry in fs::read_dir(target_dir.join("build"))? {
for entry in std::fs::read_dir(target_dir.join("build"))? {
let path = entry?.path();
let webview2_loader_path = path
.join("out")
@@ -677,14 +577,14 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
.join("WebView2Loader.dll");
if path.to_string_lossy().contains("webview2-com-sys") && webview2_loader_path.exists()
{
fs::copy(webview2_loader_path, target_dir.join("WebView2Loader.dll"))?;
std::fs::copy(webview2_loader_path, target_dir.join("WebView2Loader.dll"))?;
break;
}
}
}
}
"msvc" => {
if env::var("STATIC_VCRUNTIME").is_ok_and(|v| v == "true") {
if std::env::var("STATIC_VCRUNTIME").map_or(false, |v| v == "true") {
static_vcruntime::build();
}
}
@@ -692,10 +592,25 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
}
}
#[cfg(feature = "codegen")]
if let Some(codegen) = attributes.codegen {
codegen.try_build()?;
}
Ok(())
}
#[derive(serde::Deserialize)]
struct CargoMetadata {
workspace_root: PathBuf,
}
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)?
));
}
Ok(serde_json::from_slice::<CargoMetadata>(&output.stdout)?.workspace_root)
}

View File

@@ -1,8 +1,8 @@
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
// taken from <https://github.com/ChrisDenton/static_vcruntime/>
// taken from https://github.com/ChrisDenton/static_vcruntime/
// we're not using static_vcruntime directly because we want this for debug builds too
use std::{env, fs, io::Write, path::Path};

View File

@@ -1,473 +1,16 @@
# Changelog
## \[2.2.0]
## \[1.4.4]
### Dependencies
- Upgraded to `tauri-utils@2.4.0`
- [`48b12b440`](https://www.github.com/tauri-apps/tauri/commit/48b12b440478937c46fdfef9f9d95194be117020) Update to `tauri-utils@2.4.0`
- Upgraded to `tauri-utils@1.6.0`
## \[2.1.1]
## \[1.4.3]
### Dependencies
- Upgraded to `tauri-utils@2.3.1`
## \[2.1.0]
### New Features
- [`013f8f652`](https://www.github.com/tauri-apps/tauri/commit/013f8f652302f2d49c5ec0a075582033d8b074fb) ([#12890](https://www.github.com/tauri-apps/tauri/pull/12890) by [@Legend-Master](https://www.github.com/tauri-apps/tauri/../../Legend-Master)) Added `build > removeUnusedCommands` to trigger the build scripts and macros to remove unused commands based on the capabilities you defined. Note this won't be accounting for dynamically added ACLs so make sure to check it when using this.
### Dependencies
- Upgraded to `tauri-utils@2.3.0`
## \[2.0.5]
### Dependencies
- Upgraded to `tauri-utils@2.2.0`
## \[2.0.4]
### Dependencies
- Upgraded to `tauri-utils@2.1.1`
## \[2.0.3]
### Dependencies
- Upgraded to `tauri-utils@2.1.0`
## \[2.0.2]
### Dependencies
- Upgraded to `tauri-utils@2.0.2`
## \[2.0.1]
### What's Changed
- [`0ab2b3306`](https://www.github.com/tauri-apps/tauri/commit/0ab2b330644b6419f6cee1d5377bfb5cdda2ccf9) ([#11205](https://www.github.com/tauri-apps/tauri/pull/11205) by [@lucasfernog](https://www.github.com/tauri-apps/tauri/../../lucasfernog)) Downgrade MSRV to 1.77.2 to support Windows 7.
### Dependencies
- Upgraded to `tauri-utils@2.0.1`
## \[2.0.0]
### What's Changed
- [`382ed482b`](https://www.github.com/tauri-apps/tauri/commit/382ed482bd08157c39e62f9a0aaad8802f1092cb) Bump MSRV to 1.78.
- [`637285790`](https://www.github.com/tauri-apps/tauri/commit/6372857905ae9c0aedb7f482ddf6cf9f9836c9f2) Promote to v2 stable!
### Dependencies
- Upgraded to `tauri-utils@2.0.0`
## \[2.0.0-rc.13]
### Bug Fixes
- [`1efa5e718`](https://www.github.com/tauri-apps/tauri/commit/1efa5e7184009537b688a395596c696173ae0231) ([#11099](https://www.github.com/tauri-apps/tauri/pull/11099) by [@lucasfernog](https://www.github.com/tauri-apps/tauri/../../lucasfernog)) Rerun build script if the platform-specific configuration file changes.
### Dependencies
- Upgraded to `tauri-utils@2.0.0-rc.13`
## \[2.0.0-rc.12]
### Dependencies
- Upgraded to `tauri-utils@2.0.0-rc.12`
## \[2.0.0-rc.11]
### Dependencies
- Upgraded to `tauri-utils@2.0.0-rc.11`
## \[2.0.0-rc.10]
### Dependencies
- Upgraded to `tauri-utils@2.0.0-rc.10`
## \[2.0.0-rc.9]
### Dependencies
- Upgraded to `tauri-utils@2.0.0-rc.9`
## \[2.0.0-rc.8]
### What's Changed
- [`27d018343`](https://www.github.com/tauri-apps/tauri/commit/27d01834312ee7953b6ccd5b0a368e7a69b225e9) ([#10844](https://www.github.com/tauri-apps/tauri/pull/10844) by [@lucasfernog](https://www.github.com/tauri-apps/tauri/../../lucasfernog)) Changes how the Info.plist is embedded on macOS development to avoid a clippy warning.
### Dependencies
- Upgraded to `tauri-utils@2.0.0-rc.8`
## \[2.0.0-rc.7]
### Bug Fixes
- [`88bc35732`](https://www.github.com/tauri-apps/tauri/commit/88bc357325ba278527d8cba956e828f5744c8a34) ([#10734](https://www.github.com/tauri-apps/tauri/pull/10734) by [@chippers](https://www.github.com/tauri-apps/tauri/../../chippers)) Generate context in a separate thread to prevent a stack overflow.
### Dependencies
- Upgraded to `tauri-utils@2.0.0-rc.7`
## \[2.0.0-rc.6]
### What's Changed
- [`f4d5241b3`](https://www.github.com/tauri-apps/tauri/commit/f4d5241b377d0f7a1b58100ee19f7843384634ac) ([#10731](https://www.github.com/tauri-apps/tauri/pull/10731) by [@amrbashir](https://www.github.com/tauri-apps/tauri/../../amrbashir)) Update documentation icon path.
### Dependencies
- Upgraded to `tauri-utils@2.0.0-rc.6`
## \[2.0.0-rc.5]
### Dependencies
- Upgraded to `tauri-utils@2.0.0-rc.5`
## \[2.0.0-rc.4]
### Dependencies
- Upgraded to `tauri-utils@2.0.0-rc.4`
## \[2.0.0-rc.3]
### Dependencies
- Upgraded to `tauri-utils@2.0.0-rc.3`
- [`0afee5ed8`](https://www.github.com/tauri-apps/tauri/commit/0afee5ed80265c95c4581e173c4886677cfed593) ([#10436](https://www.github.com/tauri-apps/tauri/pull/10436) by [@nyurik](https://www.github.com/tauri-apps/tauri/../../nyurik)) Updated brotli to v6.
## \[2.0.0-rc.2]
### Dependencies
- Upgraded to `tauri-utils@2.0.0-rc.2`
## \[2.0.0-rc.1]
### Dependencies
- Upgraded to `tauri-utils@2.0.0-rc.1`
## \[2.0.0-rc.0]
### Enhancements
- [`1e0793b68`](https://www.github.com/tauri-apps/tauri/commit/1e0793b6821799829e380c88066b3415cc9006df) ([#10357](https://www.github.com/tauri-apps/tauri/pull/10357)) Enhance `AssetResolver::get` in development mode by reading distDir directly as a fallback to the embedded assets.
### Bug Fixes
- [`24445d71d`](https://www.github.com/tauri-apps/tauri/commit/24445d71de92d526d0ccaecb54f13003ddc6f6b4)([#10432](https://www.github.com/tauri-apps/tauri/pull/10432)) Fixes asset resolving when not using the `compression` feature.
### Dependencies
- Upgraded to `tauri-utils@2.0.0-rc.0`
## \[2.0.0-beta.19]
### Bug Fixes
- [`5d2922985`](https://www.github.com/tauri-apps/tauri/commit/5d2922985801908e4b929a7a0e387806ff02ab89) ([#10268](https://www.github.com/tauri-apps/tauri/pull/10268) by [@lucasfernog](https://www.github.com/tauri-apps/tauri/../../lucasfernog)) Fix icon rewriting always triggering build to rerun due to conflicts between file names.
### What's Changed
- [`4c239729c`](https://www.github.com/tauri-apps/tauri/commit/4c239729c3e1b899ecbc6793c3682848e8de1729) ([#10167](https://www.github.com/tauri-apps/tauri/pull/10167) by [@amrbashir](https://www.github.com/tauri-apps/tauri/../../amrbashir)) Add support for `test = true` in `generate_context!` macro to skip some code generation that could affect some tests, for now it only skips empedding a plist on macOS.
### Dependencies
- Upgraded to `tauri-utils@2.0.0-beta.19`
## \[2.0.0-beta.18]
### New Features
- [`5b769948a`](https://www.github.com/tauri-apps/tauri/commit/5b769948a81cac333f64c870a470ba6525bd5cd3) ([#9959](https://www.github.com/tauri-apps/tauri/pull/9959)) Add `include_image_codegen` function to help embedding instances of `Image` struct at compile-time in rust to be used with window, menu or tray icons.
### Bug Fixes
- [`1f6e478c8`](https://www.github.com/tauri-apps/tauri/commit/1f6e478c842a16219798b9962718e9ddb969c041) ([#9878](https://www.github.com/tauri-apps/tauri/pull/9878)) Fixes Info.plist rewriting always triggering build to rerun.
### Dependencies
- Upgraded to `tauri-utils@2.0.0-beta.18`
## \[2.0.0-beta.17]
### What's Changed
- [`ccc3ea729`](https://www.github.com/tauri-apps/tauri/commit/ccc3ea729de205ef467f737f1feeb5bf02d9cd72)([#9646](https://www.github.com/tauri-apps/tauri/pull/9646)) Use `TAURI_ENV_TARGET_TRIPLE` (which is set by `tauri-build`) to determine the target when reading the config file.
### Dependencies
- Upgraded to `tauri-utils@2.0.0-beta.17`
## \[2.0.0-beta.16]
### Dependencies
- Upgraded to `tauri-utils@2.0.0-beta.16`
## \[2.0.0-beta.15]
### Dependencies
- Upgraded to `tauri-utils@2.0.0-beta.15`
## \[2.0.0-beta.14]
### Dependencies
- Upgraded to `tauri-utils@2.0.0-beta.14`
## \[2.0.0-beta.13]
### Dependencies
- Upgraded to `tauri-utils@2.0.0-beta.13`
## \[2.0.0-beta.12]
### Dependencies
- Upgraded to `tauri-utils@2.0.0-beta.12`
## \[2.0.0-beta.11]
### Dependencies
- Upgraded to `tauri-utils@2.0.0-beta.11`
## \[2.0.0-beta.10]
### New Features
- [`e227fe02f`](https://www.github.com/tauri-apps/tauri/commit/e227fe02f986e145c0731a64693e1c830a9eb5b0)([#9156](https://www.github.com/tauri-apps/tauri/pull/9156)) Allow plugins to define (at compile time) JavaScript that are initialized when `withGlobalTauri` is true.
### Dependencies
- Upgraded to `tauri-utils@2.0.0-beta.10`
## \[2.0.0-beta.9]
### New Features
- [`ba0206d8a`](https://www.github.com/tauri-apps/tauri/commit/ba0206d8a30a9b43ec5090dcaabd1a23baa1420c)([#9141](https://www.github.com/tauri-apps/tauri/pull/9141)) The `Context` codegen now accepts a `assets` input to define a custom `tauri::Assets` implementation.
### Dependencies
- Upgraded to `tauri-utils@2.0.0-beta.9`
## \[2.0.0-beta.8]
### Dependencies
- Upgraded to `tauri-utils@2.0.0-beta.8`
### Breaking Changes
- [`ed48e2b3c`](https://www.github.com/tauri-apps/tauri/commit/ed48e2b3c7fa914e4c9af432c02b8154f872c68a)([#9122](https://www.github.com/tauri-apps/tauri/pull/9122)) Expose `tauri::image` module to export the `JsImage` type and removed the `Image` root re-export.
## \[2.0.0-beta.7]
### Dependencies
- Upgraded to `tauri-utils@2.0.0-beta.7`
### Breaking Changes
- [`d1e77acd8`](https://www.github.com/tauri-apps/tauri/commit/d1e77acd8dfdf554b90b542513a58a2de1ef2360)([#9011](https://www.github.com/tauri-apps/tauri/pull/9011)) Change the generated context code to use the new `Image` type in tauri.
## \[2.0.0-beta.6]
### Dependencies
- Upgraded to `tauri-utils@2.0.0-beta.6`
### Breaking Changes
- [`3657ad82`](https://www.github.com/tauri-apps/tauri/commit/3657ad82f88ce528551d032d521c52eed3f396b4)([#9008](https://www.github.com/tauri-apps/tauri/pull/9008)) Allow defining permissions for the application commands via `tauri_build::Attributes::app_manifest`.
## \[2.0.0-beta.5]
### Enhancements
- [`bc5b5e67`](https://www.github.com/tauri-apps/tauri/commit/bc5b5e671a546512f823f1c157421b4c3311dfc0)([#8984](https://www.github.com/tauri-apps/tauri/pull/8984)) Do not include a CSP tag in the application HTML and rely on the custom protocol response header instead.
### Dependencies
- Upgraded to `tauri-utils@2.0.0-beta.5`
## \[2.0.0-beta.4]
### Dependencies
- Upgraded to `tauri-utils@2.0.0-beta.4`
## \[2.0.0-beta.3]
### Dependencies
- Upgraded to `tauri-utils@2.0.0-beta.3`
## \[2.0.0-beta.2]
### Enhancements
- [`83a68deb`](https://www.github.com/tauri-apps/tauri/commit/83a68deb5676d39cd4728d2e140f6b46d5f787ed)([#8797](https://www.github.com/tauri-apps/tauri/pull/8797)) Added a new configuration option `tauri.conf.json > app > security > capabilities` to reference existing capabilities and inline new ones. If it is empty, all capabilities are still included preserving the current behavior.
- [`8d16a80d`](https://www.github.com/tauri-apps/tauri/commit/8d16a80d2fb2468667e7987d0cc99dbc7e3b9d0a)([#8802](https://www.github.com/tauri-apps/tauri/pull/8802)) The `generate_context` proc macro now accepts a `capabilities` attribute where the value is an array of file paths that can be [conditionally compiled](https://doc.rust-lang.org/reference/conditional-compilation.html). These capabilities are added to the application along the capabilities defined in the Tauri configuration file.
### Dependencies
- Upgraded to `tauri-utils@2.0.0-beta.2`
## \[2.0.0-beta.1]
### Dependencies
- Upgraded to `tauri-utils@2.0.0-beta.1`
## \[2.0.0-beta.0]
### New Features
- [`74a2a603`](https://www.github.com/tauri-apps/tauri/commit/74a2a6036a5e57462f161d728cbd8a6f121028ca)([#8661](https://www.github.com/tauri-apps/tauri/pull/8661)) Implement access control list for IPC usage.
### Dependencies
- Upgraded to `tauri-utils@2.0.0-beta.0`
### Breaking Changes
- [`8de308d1`](https://www.github.com/tauri-apps/tauri/commit/8de308d1bf6a855d7a26af58bd0e744938ba47d8)([#8723](https://www.github.com/tauri-apps/tauri/pull/8723)) Restructured Tauri config per [RFC#5](https://github.com/tauri-apps/rfcs/blob/f3e82a6b0c5390401e855850d47dc7b7d9afd684/texts/0005-tauri-config-restructure.md):
- Moved `package.productName`, `package.version` and `tauri.bundle.identifier` fields to the top-level.
- Removed `package` object.
- Renamed `tauri` object to `app`.
- Moved `tauri.bundle` object to the top-level.
- Renamed `build.distDir` field to `frontendDist`.
- Renamed `build.devPath` field to `devUrl` and will no longer accepts paths, it will only accept URLs.
- Moved `tauri.pattern` to `app.security.pattern`.
- Removed `tauri.bundle.updater` object, and its fields have been moved to the updater plugin under `plugins.updater` object.
- Moved `build.withGlobalTauri` to `app.withGlobalTauri`.
- Moved `tauri.bundle.dmg` object to `bundle.macOS.dmg`.
- Moved `tauri.bundle.deb` object to `bundle.linux.deb`.
- Moved `tauri.bundle.appimage` object to `bundle.linux.appimage`.
- Removed all license fields from each bundle configuration object and instead added `bundle.license` and `bundle.licenseFile`.
- Renamed `AppUrl` to `FrontendDist` and refactored its variants to be more explicit.
## \[2.0.0-alpha.13]
### Dependencies
- Upgraded to `tauri-utils@2.0.0-alpha.13`
## \[2.0.0-alpha.12]
### Dependencies
- Upgraded to `tauri-utils@2.0.0-alpha.12`
## \[2.0.0-alpha.11]
### Dependencies
- Upgraded to `tauri-utils@2.0.0-alpha.11`
## \[2.0.0-alpha.10]
### Enhancements
- [`c6c59cf2`](https://www.github.com/tauri-apps/tauri/commit/c6c59cf2373258b626b00a26f4de4331765dd487) Pull changes from Tauri 1.5 release.
### Dependencies
- Upgraded to `tauri-utils@2.0.0-alpha.10`
## \[2.0.0-alpha.9]
### New Features
- [`880266a7`](https://www.github.com/tauri-apps/tauri/commit/880266a7f697e1fe58d685de3bb6836ce5251e92)([#8031](https://www.github.com/tauri-apps/tauri/pull/8031)) Bump the MSRV to 1.70.
### Dependencies
- Upgraded to `tauri-utils@2.0.0-alpha.9`
### Breaking Changes
- [`ebcc21e4`](https://www.github.com/tauri-apps/tauri/commit/ebcc21e4b95f4e8c27639fb1bca545b432f52d5e)([#8057](https://www.github.com/tauri-apps/tauri/pull/8057)) Renamed the beforeDevCommand, beforeBuildCommand and beforeBundleCommand hooks environment variables from `TAURI_PLATFORM, TAURI_ARCH, TAURI_FAMILY, TAURI_PLATFORM_VERSION, TAURI_PLATFORM_TYPE and TAURI_DEBUG` to `TAURI_ENV_PLATFORM, TAURI_ENV_ARCH, TAURI_ENV_FAMILY, TAURI_ENV_PLATFORM_VERSION, TAURI_ENV_PLATFORM_TYPE and TAURI_ENV_DEBUG` to differentiate the prefix with other CLI environment variables.
## \[2.0.0-alpha.8]
### Enhancements
- [`100d9ede`](https://www.github.com/tauri-apps/tauri/commit/100d9ede35995d9db21d2087dd5606adfafb89a5)([#7802](https://www.github.com/tauri-apps/tauri/pull/7802)) Use `Target` enum from `tauri_utils::platform`.
### Dependencies
- Upgraded to `tauri-utils@2.0.0-alpha.8`
## \[2.0.0-alpha.7]
### Dependencies
- Upgraded to `tauri-utils@2.0.0-alpha.7`
## \[2.0.0-alpha.6]
### Dependencies
- Updated to latest `tauri-utils`
## \[2.0.0-alpha.5]
- [`96639ca2`](https://www.github.com/tauri-apps/tauri/commit/96639ca239c9e4f75142fc07868ac46822111cff)([#6749](https://www.github.com/tauri-apps/tauri/pull/6749)) Moved the `shell` functionality to its own plugin in the plugins-workspace repository.
- [`3188f376`](https://www.github.com/tauri-apps/tauri/commit/3188f3764978c6d1452ee31d5a91469691e95094)([#6883](https://www.github.com/tauri-apps/tauri/pull/6883)) Bump the MSRV to 1.65.
- [`ae102980`](https://www.github.com/tauri-apps/tauri/commit/ae102980fcdde3f55effdc0623ea425b48d07dd1)([#6719](https://www.github.com/tauri-apps/tauri/pull/6719)) Refactor the `Context` conditional fields and only parse the tray icon on desktop.
## \[2.0.0-alpha.4]
- Added `android` configuration object under `tauri > bundle`.
- Bumped due to a bump in tauri-utils.
- [db4c9dc6](https://www.github.com/tauri-apps/tauri/commit/db4c9dc655e07ee2184fe04571f500f7910890cd) feat(core): add option to configure Android's minimum SDK version ([#6651](https://www.github.com/tauri-apps/tauri/pull/6651)) on 2023-04-07
## \[2.0.0-alpha.3]
- Pull changes from Tauri 1.3 release.
- [](https://www.github.com/tauri-apps/tauri/commit/undefined) on undefined
## \[2.0.0-alpha.2]
- Return `bool` in the invoke handler.
- [05dad087](https://www.github.com/tauri-apps/tauri/commit/05dad0876842e2a7334431247d49365cee835d3e) feat: initial work for iOS plugins ([#6205](https://www.github.com/tauri-apps/tauri/pull/6205)) on 2023-02-11
## \[2.0.0-alpha.1]
- Bump the MSRV to 1.64.
- [7eb9aa75](https://www.github.com/tauri-apps/tauri/commit/7eb9aa75cfd6a3176d3f566fdda02d88aa529b0f) Update gtk to 0.16 ([#6155](https://www.github.com/tauri-apps/tauri/pull/6155)) on 2023-01-30
- Added `crate_name` field on `PackageInfo`.
- [630a7f4b](https://www.github.com/tauri-apps/tauri/commit/630a7f4b18cef169bfd48673609306fec434e397) refactor: remove mobile log initialization, ref [#6049](https://www.github.com/tauri-apps/tauri/pull/6049) ([#6081](https://www.github.com/tauri-apps/tauri/pull/6081)) on 2023-01-17
## \[2.0.0-alpha.0]
- Change `devPath` URL to use the local IP address on iOS and Android.
- [6f061504](https://www.github.com/tauri-apps/tauri/commit/6f0615044d09ec58393a7ebca5e45bb175e20db3) feat(cli): add `android dev` and `ios dev` commands ([#4982](https://www.github.com/tauri-apps/tauri/pull/4982)) on 2022-08-20
- First mobile alpha release!
- [fa3a1098](https://www.github.com/tauri-apps/tauri/commit/fa3a10988a03aed1b66fb17d893b1a9adb90f7cd) feat(ci): prepare 2.0.0-alpha.0 ([#5786](https://www.github.com/tauri-apps/tauri/pull/5786)) on 2022-12-08
- Upgraded to `tauri-utils@1.5.4`
## \[1.4.2]

View File

@@ -0,0 +1,43 @@
[package]
name = "tauri-codegen"
version = "1.4.4"
authors = [ "Tauri Programme within The Commons Conservancy" ]
categories = [ "gui", "web-programming" ]
license = "Apache-2.0 OR MIT"
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"
exclude = [ "CHANGELOG.md", "/target" ]
readme = "README.md"
[dependencies]
sha2 = "0.10"
base64 = "0.21"
proc-macro2 = "1"
quote = "1"
serde = { version = "1", features = [ "derive" ] }
serde_json = "1"
tauri-utils = { version = "1.6.0", path = "../tauri-utils", features = [ "build" ] }
thiserror = "1"
walkdir = "2"
brotli = { version = "3", optional = true, default-features = false, features = [ "std" ] }
regex = { version = "1", optional = true }
uuid = { version = "1", features = [ "v4" ] }
semver = "1"
ico = "0.3"
png = "0.17"
json-patch = "1.2"
[target."cfg(target_os = \"macos\")".dependencies]
plist = "1"
time = { version = "0.3", features = [ "parsing", "formatting" ] }
[features]
default = [ "compression" ]
compression = [ "brotli", "tauri-utils/compression" ]
isolation = [ "tauri-utils/isolation" ]
shell-scope = [ "regex" ]
config-json5 = [ "tauri-utils/config-json5" ]
config-toml = [ "tauri-utils/config-toml" ]

View File

@@ -1,12 +1,13 @@
# tauri-codegen
<img align="right" src="https://github.com/tauri-apps/tauri/raw/dev/.github/icon.png" height="128" width="128">
<img align="right" src="https://github.com/tauri-apps/tauri/raw/dev/app-icon.png" height="128" width="128">
[![status](https://img.shields.io/badge/Status-Stable-green.svg)](https://github.com/tauri-apps/tauri)
[![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)
[![website](https://img.shields.io/badge/website-tauri.app-purple.svg)](https://tauri.app)
[![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)
[![support](https://img.shields.io/badge/sponsor-Opencollective-blue.svg)](https://opencollective.com/tauri)
@@ -23,7 +24,7 @@ Tauri apps can have custom menus and have tray-type interfaces. They can be upda
## This module
- Embed, hash, and compress assets, including icons for the app as well as the tray icon.
- Embed, hash, and compress assets, including icons for the app as well as the system-tray.
- Parse `tauri.conf.json` at compile time and generate the Config struct.
To learn more about the details of how all of these pieces fit together, please consult this [ARCHITECTURE.md](https://github.com/tauri-apps/tauri/blob/dev/ARCHITECTURE.md) document.

View File

@@ -0,0 +1,658 @@
// Copyright 2019-2023 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 sha2::{Digest, Sha256};
use tauri_utils::assets::AssetKey;
use tauri_utils::config::{AppUrl, Config, PatternKind, WindowUrl};
use tauri_utils::html::{
inject_nonce_token, parse as parse_html, serialize_node as serialize_html_node,
};
#[cfg(feature = "shell-scope")]
use tauri_utils::config::{ShellAllowedArg, ShellAllowedArgs, ShellAllowlistScope};
use crate::embedded_assets::{AssetOptions, CspHashes, EmbeddedAssets, EmbeddedAssetsError};
/// Necessary data needed by [`context_codegen`] to generate code for a Tauri application context.
pub struct ContextData {
pub dev: bool,
pub config: Config,
pub config_parent: PathBuf,
pub root: TokenStream,
}
fn map_core_assets(
options: &AssetOptions,
target: Target,
) -> impl Fn(&AssetKey, &Path, &mut Vec<u8>, &mut CspHashes) -> Result<(), EmbeddedAssetsError> {
#[cfg(feature = "isolation")]
let pattern = tauri_utils::html::PatternObject::from(&options.pattern);
let csp = options.csp;
let dangerous_disable_asset_csp_modification =
options.dangerous_disable_asset_csp_modification.clone();
move |key, path, input, csp_hashes| {
if path.extension() == Some(OsStr::new("html")) {
#[allow(clippy::collapsible_if)]
if csp {
let mut document = parse_html(String::from_utf8_lossy(input).into_owned());
if target == Target::Linux {
::tauri_utils::html::inject_csp_token(&mut document);
}
inject_nonce_token(&mut document, &dangerous_disable_asset_csp_modification);
if dangerous_disable_asset_csp_modification.can_modify("script-src") {
if let Ok(inline_script_elements) = document.select("script:not(empty)") {
let mut scripts = Vec::new();
for inline_script_el in inline_script_elements {
let script = inline_script_el.as_node().text_contents();
let mut hasher = Sha256::new();
hasher.update(&script);
let hash = hasher.finalize();
scripts.push(format!(
"'sha256-{}'",
base64::engine::general_purpose::STANDARD.encode(hash)
));
}
csp_hashes
.inline_scripts
.entry(key.clone().into())
.or_default()
.append(&mut scripts);
}
}
#[cfg(feature = "isolation")]
if dangerous_disable_asset_csp_modification.can_modify("style-src") {
if let tauri_utils::html::PatternObject::Isolation { .. } = &pattern {
// create the csp for the isolation iframe styling now, to make the runtime less complex
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)
));
}
}
*input = serialize_html_node(&document);
}
}
Ok(())
}
}
#[cfg(feature = "isolation")]
fn map_isolation(
_options: &AssetOptions,
dir: PathBuf,
) -> impl Fn(&AssetKey, &Path, &mut Vec<u8>, &mut CspHashes) -> Result<(), EmbeddedAssetsError> {
move |_key, path, input, _csp_hashes| {
if path.extension() == Some(OsStr::new("html")) {
let mut isolation_html =
tauri_utils::html::parse(String::from_utf8_lossy(input).into_owned());
// this is appended, so no need to reverse order it
tauri_utils::html::inject_codegen_isolation_script(&mut isolation_html);
// temporary workaround for windows not loading assets
tauri_utils::html::inline_isolation(&mut isolation_html, &dir);
*input = isolation_html.to_string().as_bytes().to_vec()
}
Ok(())
}
}
#[derive(PartialEq, Eq, Clone, Copy)]
enum Target {
Linux,
Windows,
Darwin,
Android,
// iOS.
Ios,
}
/// Build a `tauri::Context` for including in application code.
pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsError> {
let ContextData {
dev,
config,
config_parent,
root,
} = data;
let target = if let Ok(target) = std::env::var("TARGET") {
if target.contains("unknown-linux") {
Target::Linux
} else if target.contains("pc-windows") {
Target::Windows
} else if target.contains("apple-darwin") {
Target::Darwin
} else if target.contains("android") {
Target::Android
} else if target.contains("apple-ios") {
Target::Ios
} else {
panic!("unknown codegen target {target}");
}
} else if cfg!(target_os = "linux") {
Target::Linux
} else if cfg!(windows) {
Target::Windows
} else if cfg!(target_os = "macos") {
Target::Darwin
} else if cfg!(target_os = "android") {
Target::Android
} else if cfg!(target_os = "ios") {
Target::Ios
} else {
panic!("unknown codegen target");
};
let mut options = AssetOptions::new(config.tauri.pattern.clone())
.freeze_prototype(config.tauri.security.freeze_prototype)
.dangerous_disable_asset_csp_modification(
config
.tauri
.security
.dangerous_disable_asset_csp_modification
.clone(),
);
let csp = if dev {
config
.tauri
.security
.dev_csp
.as_ref()
.or(config.tauri.security.csp.as_ref())
} else {
config.tauri.security.csp.as_ref()
};
if csp.is_some() {
options = options.with_csp();
}
let app_url = if dev {
&config.build.dev_path
} else {
&config.build.dist_dir
};
let assets = match app_url {
AppUrl::Url(url) => match url {
WindowUrl::External(_) => Default::default(),
WindowUrl::App(path) => {
if path.components().count() == 0 {
panic!(
"The `{}` configuration cannot be empty",
if dev { "devPath" } else { "distDir" }
)
}
let assets_path = config_parent.join(path);
if !assets_path.exists() {
panic!(
"The `{}` configuration is set to `{:?}` but this path doesn't exist",
if dev { "devPath" } else { "distDir" },
path
)
}
EmbeddedAssets::new(assets_path, &options, map_core_assets(&options, target))?
}
_ => unimplemented!(),
},
AppUrl::Files(files) => EmbeddedAssets::new(
files
.iter()
.map(|p| config_parent.join(p))
.collect::<Vec<_>>(),
&options,
map_core_assets(&options, target),
)?,
_ => unimplemented!(),
};
let out_dir = {
let out_dir = std::env::var("OUT_DIR")
.map_err(|_| EmbeddedAssetsError::OutDir)
.map(PathBuf::from)
.and_then(|p| p.canonicalize().map_err(|_| EmbeddedAssetsError::OutDir))?;
// make sure that our output directory is created
std::fs::create_dir_all(&out_dir).map_err(|_| EmbeddedAssetsError::OutDir)?;
out_dir
};
let default_window_icon = {
if target == Target::Windows {
// handle default window icons for Windows targets
let icon_path = find_icon(
&config,
&config_parent,
|i| i.ends_with(".ico"),
"icons/icon.ico",
);
if icon_path.exists() {
ico_icon(&root, &out_dir, icon_path)?
} else {
let icon_path = find_icon(
&config,
&config_parent,
|i| i.ends_with(".png"),
"icons/icon.png",
);
png_icon(&root, &out_dir, icon_path)?
}
} else if target == Target::Linux {
// handle default window icons for Linux targets
let icon_path = find_icon(
&config,
&config_parent,
|i| i.ends_with(".png"),
"icons/icon.png",
);
png_icon(&root, &out_dir, icon_path)?
} else {
quote!(None)
}
};
let app_icon = if target == Target::Darwin && dev {
let mut icon_path = find_icon(
&config,
&config_parent,
|i| i.ends_with(".icns"),
"icons/icon.png",
);
if !icon_path.exists() {
icon_path = find_icon(
&config,
&config_parent,
|i| i.ends_with(".png"),
"icons/icon.png",
);
}
raw_icon(&out_dir, icon_path)?
} else {
quote!(None)
};
let package_name = if let Some(product_name) = &config.package.product_name {
quote!(#product_name.to_string())
} else {
quote!(env!("CARGO_PKG_NAME").to_string())
};
let package_version = if let Some(version) = &config.package.version {
semver::Version::from_str(version)?;
quote!(#version.to_string())
} else {
quote!(env!("CARGO_PKG_VERSION").to_string())
};
let package_info = quote!(
#root::PackageInfo {
name: #package_name,
version: #package_version.parse().unwrap(),
authors: env!("CARGO_PKG_AUTHORS"),
description: env!("CARGO_PKG_DESCRIPTION"),
}
);
let system_tray_icon = if let Some(tray) = &config.tauri.system_tray {
let system_tray_icon_path = config_parent.join(&tray.icon_path);
let ext = system_tray_icon_path.extension();
if ext.map_or(false, |e| e == "ico") {
ico_icon(&root, &out_dir, system_tray_icon_path)?
} else if ext.map_or(false, |e| e == "png") {
png_icon(&root, &out_dir, system_tray_icon_path)?
} else {
quote!(compile_error!(
"The tray icon extension must be either `.ico` or `.png`."
))
}
} else {
quote!(None)
};
#[cfg(target_os = "macos")]
let info_plist = if target == Target::Darwin && dev {
let info_plist_path = config_parent.join("Info.plist");
let mut info_plist = if info_plist_path.exists() {
plist::Value::from_file(&info_plist_path)
.unwrap_or_else(|e| panic!("failed to read plist {}: {}", info_plist_path.display(), e))
} else {
plist::Value::Dictionary(Default::default())
};
if let Some(plist) = info_plist.as_dictionary_mut() {
if let Some(product_name) = &config.package.product_name {
plist.insert("CFBundleName".into(), product_name.clone().into());
}
if let Some(version) = &config.package.version {
plist.insert("CFBundleShortVersionString".into(), version.clone().into());
}
let format =
time::format_description::parse("[year][month][day].[hour][minute][second]").unwrap();
if let Ok(build_number) = time::OffsetDateTime::now_utc().format(&format) {
plist.insert("CFBundleVersion".into(), build_number.into());
}
}
info_plist
.to_file_xml(out_dir.join("Info.plist"))
.expect("failed to write Info.plist");
quote!({
tauri::embed_plist::embed_info_plist!(concat!(std::env!("OUT_DIR"), "/Info.plist"));
})
} else {
quote!(())
};
#[cfg(not(target_os = "macos"))]
let info_plist = quote!(());
let pattern = match &options.pattern {
PatternKind::Brownfield => quote!(#root::Pattern::Brownfield(std::marker::PhantomData)),
#[cfg(not(feature = "isolation"))]
PatternKind::Isolation { dir: _ } => {
quote!(#root::Pattern::Brownfield(std::marker::PhantomData))
}
#[cfg(feature = "isolation")]
PatternKind::Isolation { dir } => {
let dir = config_parent.join(dir);
if !dir.exists() {
panic!("The isolation application path is set to `{dir:?}` but it does not exist")
}
let mut sets_isolation_hook = false;
let key = uuid::Uuid::new_v4().to_string();
let map_isolation = map_isolation(&options, dir.clone());
let assets = EmbeddedAssets::new(dir, &options, |key, path, input, csp_hashes| {
// we check if `__TAURI_ISOLATION_HOOK__` exists in the isolation code
// before modifying the files since we inject our own `__TAURI_ISOLATION_HOOK__` reference in HTML files
if String::from_utf8_lossy(input).contains("__TAURI_ISOLATION_HOOK__") {
sets_isolation_hook = true;
}
map_isolation(key, path, input, csp_hashes)
})?;
if !sets_isolation_hook {
panic!("The isolation application does not contain a file setting the `window.__TAURI_ISOLATION_HOOK__` value.");
}
let schema = options.isolation_schema;
quote!(#root::Pattern::Isolation {
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")),
})
}
};
#[cfg(feature = "shell-scope")]
let shell_scope_config = {
use regex::Regex;
use tauri_utils::config::ShellAllowlistOpen;
let shell_scopes = get_allowed_clis(&root, &config.tauri.allowlist.shell.scope);
let shell_scope_open = match &config.tauri.allowlist.shell.open {
ShellAllowlistOpen::Flag(false) => quote!(::std::option::Option::None),
ShellAllowlistOpen::Flag(true) => {
quote!(::std::option::Option::Some(#root::regex::Regex::new(r#"^((mailto:\w+)|(tel:\w+)|(https?://\w+)).+"#).unwrap()))
}
ShellAllowlistOpen::Validate(regex) => match Regex::new(regex) {
Ok(_) => quote!(::std::option::Option::Some(#root::regex::Regex::new(#regex).unwrap())),
Err(error) => {
let error = error.to_string();
quote!({
compile_error!(#error);
::std::option::Option::Some(#root::regex::Regex::new(#regex).unwrap())
})
}
},
_ => panic!("unknown shell open format, unable to prepare"),
};
quote!(#root::ShellScopeConfig {
open: #shell_scope_open,
scopes: #shell_scopes
})
};
#[cfg(not(feature = "shell-scope"))]
let shell_scope_config = quote!();
Ok(quote!(#root::Context::new(
#config,
::std::sync::Arc::new(#assets),
#default_window_icon,
#app_icon,
#system_tray_icon,
#package_info,
#info_plist,
#pattern,
#shell_scope_config
)))
}
fn ico_icon<P: AsRef<Path>>(
root: &TokenStream,
out_dir: &Path,
path: P,
) -> Result<TokenStream, EmbeddedAssetsError> {
let path = path.as_ref();
let bytes = std::fs::read(path)
.unwrap_or_else(|e| panic!("failed to read icon {}: {}", path.display(), e))
.to_vec();
let icon_dir = ico::IconDir::read(std::io::Cursor::new(bytes))
.unwrap_or_else(|e| panic!("failed to parse icon {}: {}", path.display(), e));
let entry = &icon_dir.entries()[0];
let rgba = entry
.decode()
.unwrap_or_else(|e| panic!("failed to decode icon {}: {}", path.display(), e))
.rgba_data()
.to_vec();
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);
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
}));
Ok(icon)
}
fn raw_icon<P: AsRef<Path>>(out_dir: &Path, path: P) -> Result<TokenStream, EmbeddedAssetsError> {
let path = path.as_ref();
let bytes = std::fs::read(path)
.unwrap_or_else(|e| panic!("failed to read icon {}: {}", path.display(), e))
.to_vec();
let out_path = out_dir.join(path.file_name().unwrap());
write_if_changed(&out_path, &bytes).map_err(|error| EmbeddedAssetsError::AssetWrite {
path: path.to_owned(),
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()
));
Ok(icon)
}
fn png_icon<P: AsRef<Path>>(
root: &TokenStream,
out_dir: &Path,
path: P,
) -> Result<TokenStream, EmbeddedAssetsError> {
let path = path.as_ref();
let bytes = std::fs::read(path)
.unwrap_or_else(|e| panic!("failed to read icon {}: {}", path.display(), e))
.to_vec();
let decoder = png::Decoder::new(std::io::Cursor::new(bytes));
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());
}
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);
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,
}
));
Ok(icon)
}
fn write_if_changed(out_path: &Path, data: &[u8]) -> std::io::Result<()> {
use std::fs::File;
use std::io::Write;
if let Ok(curr) = std::fs::read(out_path) {
if curr == data {
return Ok(());
}
}
let mut out_file = File::create(out_path)?;
out_file.write_all(data)
}
fn find_icon<F: Fn(&&String) -> bool>(
config: &Config,
config_parent: &Path,
predicate: F,
default: &str,
) -> PathBuf {
let icon_path = config
.tauri
.bundle
.icon
.iter()
.find(|i| predicate(i))
.cloned()
.unwrap_or_else(|| default.to_string());
config_parent.join(icon_path)
}
#[cfg(feature = "shell-scope")]
fn get_allowed_clis(root: &TokenStream, scope: &ShellAllowlistScope) -> TokenStream {
let commands = scope
.0
.iter()
.map(|scope| {
let sidecar = &scope.sidecar;
let name = &scope.name;
let name = quote!(#name.into());
let command = scope.command.to_string_lossy();
let command = quote!(::std::path::PathBuf::from(#command));
let args = match &scope.args {
ShellAllowedArgs::Flag(true) => quote!(::std::option::Option::None),
ShellAllowedArgs::Flag(false) => quote!(::std::option::Option::Some(::std::vec![])),
ShellAllowedArgs::List(list) => {
let list = list.iter().map(|arg| match arg {
ShellAllowedArg::Fixed(fixed) => {
quote!(#root::scope::ShellScopeAllowedArg::Fixed(#fixed.into()))
}
ShellAllowedArg::Var { validator } => {
let validator = match regex::Regex::new(validator) {
Ok(regex) => {
let regex = regex.as_str();
quote!(#root::regex::Regex::new(#regex).unwrap())
}
Err(error) => {
let error = error.to_string();
quote!({
compile_error!(#error);
#root::regex::Regex::new(#validator).unwrap()
})
}
};
quote!(#root::scope::ShellScopeAllowedArg::Var { validator: #validator })
}
_ => panic!("unknown shell scope arg, unable to prepare"),
});
quote!(::std::option::Option::Some(::std::vec![#(#list),*]))
}
_ => panic!("unknown shell scope command, unable to prepare"),
};
(
quote!(#name),
quote!(
#root::scope::ShellScopeAllowedCommand {
command: #command,
args: #args,
sidecar: #sidecar,
}
),
)
})
.collect::<Vec<_>>();
if commands.is_empty() {
quote!(::std::collections::HashMap::new())
} else {
let insertions = commands
.iter()
.map(|(name, value)| quote!(hashmap.insert(#name, #value);));
quote!({
let mut hashmap = ::std::collections::HashMap::new();
#(#insertions)*
hashmap
})
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
@@ -8,6 +8,7 @@ use quote::{quote, ToTokens, TokenStreamExt};
use sha2::{Digest, Sha256};
use std::{
collections::HashMap,
fmt::Write,
fs::File,
path::{Path, PathBuf},
};
@@ -47,9 +48,6 @@ pub enum EmbeddedAssetsError {
#[error("invalid prefix {prefix} used while including path {path}")]
PrefixInvalid { prefix: PathBuf, path: PathBuf },
#[error("invalid extension `{extension}` used for image {path}, must be `ico` or `png`")]
InvalidImageExtension { extension: PathBuf, path: PathBuf },
#[error("failed to walk directory {path} because {error}")]
Walkdir {
path: PathBuf,
@@ -63,8 +61,6 @@ pub enum EmbeddedAssetsError {
Version(#[from] semver::Error),
}
pub type EmbeddedAssetsResult<T> = Result<T, EmbeddedAssetsError>;
/// Represent a directory of assets that are compressed and embedded.
///
/// This is the compile time generation of [`tauri_utils::assets::Assets`] from a directory. Assets
@@ -340,7 +336,19 @@ impl EmbeddedAssets {
std::fs::create_dir_all(&out_dir).map_err(|_| EmbeddedAssetsError::OutDir)?;
// get a hash of the input - allows for caching existing files
let hash = crate::checksum(&input).map_err(EmbeddedAssetsError::Hex)?;
let hash = {
let mut hasher = crate::vendor::blake3_reference::Hasher::default();
hasher.update(&input);
let mut bytes = [0u8; 32];
hasher.finalize(&mut bytes);
let mut hex = String::with_capacity(2 * bytes.len());
for b in bytes {
write!(hex, "{b:02x}").map_err(EmbeddedAssetsError::Hex)?;
}
hex
};
// use the content hash to determine filename, keep extensions that exist
let out_path = if let Some(ext) = path.extension().and_then(|e| e.to_str()) {
@@ -425,20 +433,9 @@ impl ToTokens for EmbeddedAssets {
// we expect phf related items to be in path when generating the path code
tokens.append_all(quote! {{
#[allow(unused_imports)]
#[allow(unused)]
use ::tauri::utils::assets::{CspHash, EmbeddedAssets, phf, phf::phf_map};
EmbeddedAssets::new(phf_map! { #assets }, &[#global_hashes], phf_map! { #html_hashes })
}});
}
}
pub(crate) fn ensure_out_dir() -> EmbeddedAssetsResult<PathBuf> {
let out_dir = std::env::var("OUT_DIR")
.map_err(|_| EmbeddedAssetsError::OutDir)
.map(PathBuf::from)
.and_then(|p| p.canonicalize().map_err(|_| EmbeddedAssetsError::OutDir))?;
// make sure that our output directory is created
std::fs::create_dir_all(&out_dir).map_err(|_| EmbeddedAssetsError::OutDir)?;
Ok(out_dir)
}

View File

@@ -1,31 +1,16 @@
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
//! - Embed, hash, and compress assets, including icons for the app as well as the tray icon.
//! - Parse `tauri.conf.json` at compile time and generate the Config struct.
#![doc(
html_logo_url = "https://github.com/tauri-apps/tauri/raw/dev/.github/icon.png",
html_favicon_url = "https://github.com/tauri-apps/tauri/raw/dev/.github/icon.png"
)]
pub use self::context::{context_codegen, ContextData};
use crate::embedded_assets::{ensure_out_dir, EmbeddedAssetsError};
use proc_macro2::TokenStream;
use quote::{quote, ToTokens, TokenStreamExt};
use std::{
borrow::Cow,
fmt::{self, Write},
path::{Path, PathBuf},
};
pub use tauri_utils::config::{parse::ConfigError, Config};
use tauri_utils::platform::Target;
use tauri_utils::write_if_changed;
mod context;
pub mod embedded_assets;
pub mod image;
#[doc(hidden)]
pub mod vendor;
@@ -68,26 +53,19 @@ pub fn get_config(path: &Path) -> Result<(Config, PathBuf), CodegenConfigError>
.map(ToOwned::to_owned)
.ok_or_else(|| CodegenConfigError::Parent(path.into_owned()))?;
let target = std::env::var("TAURI_ENV_TARGET_TRIPLE")
.as_deref()
.map(Target::from_triple)
.unwrap_or_else(|_| Target::current());
// in the future we may want to find a way to not need the TAURI_CONFIG env var so that
// it is impossible for the content of two separate configs to get mixed up. The chances are
// already unlikely unless the developer goes out of their way to run the cli on a different
// project than the target crate.
let mut config =
serde_json::from_value(tauri_utils::config::parse::read_from(target, &parent)?.0)?;
let mut config = serde_json::from_value(tauri_utils::config::parse::read_from(parent.clone())?)?;
if let Ok(env) = std::env::var("TAURI_CONFIG") {
let merge_config: serde_json::Value =
serde_json::from_str(&env).map_err(CodegenConfigError::FormatInline)?;
json_patch::merge(&mut config, &merge_config);
}
// Set working directory to where `tauri.config.json` is, so that relative paths in it are parsed correctly.
let old_cwd = std::env::current_dir().map_err(CodegenConfigError::CurrentDir)?;
// Set working directory to where `tauri.config.json` is, so that relative paths in it are parsed correctly.
std::env::set_current_dir(parent.clone()).map_err(CodegenConfigError::CurrentDir)?;
let config = serde_json::from_value(config)?;
@@ -97,54 +75,3 @@ pub fn get_config(path: &Path) -> Result<(Config, PathBuf), CodegenConfigError>
Ok((config, parent))
}
/// Create a blake3 checksum of the passed bytes.
fn checksum(bytes: &[u8]) -> Result<String, fmt::Error> {
let mut hasher = vendor::blake3_reference::Hasher::default();
hasher.update(bytes);
let mut bytes = [0u8; 32];
hasher.finalize(&mut bytes);
let mut hex = String::with_capacity(2 * bytes.len());
for b in bytes {
write!(hex, "{b:02x}")?;
}
Ok(hex)
}
/// Cache the data to `$OUT_DIR`, only if it does not already exist.
///
/// Due to using a checksum as the filename, an existing file should be the exact same content
/// as the data being checked.
struct Cached {
checksum: String,
}
impl TryFrom<String> for Cached {
type Error = EmbeddedAssetsError;
fn try_from(value: String) -> Result<Self, Self::Error> {
Self::try_from(Vec::from(value))
}
}
impl TryFrom<Vec<u8>> for Cached {
type Error = EmbeddedAssetsError;
fn try_from(content: Vec<u8>) -> Result<Self, Self::Error> {
let checksum = checksum(content.as_ref()).map_err(EmbeddedAssetsError::Hex)?;
let path = ensure_out_dir()?.join(&checksum);
write_if_changed(&path, &content)
.map(|_| Self { checksum })
.map_err(|error| EmbeddedAssetsError::AssetWrite { path, error })
}
}
impl ToTokens for Cached {
fn to_tokens(&self, tokens: &mut TokenStream) {
let path = &self.checksum;
tokens.append_all(quote!(::std::concat!(::std::env!("OUT_DIR"), "/", #path)))
}
}

View File

@@ -1,9 +1,8 @@
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
//! This is a lightly modified version of the BLAKE3 reference implementation.
//!
//! The changes applied are to remove unused item warnings due to using it
//! vendored along with some minor clippy suggestions. No logic changes. I
//! suggest diffing against the original to find all the changes.

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