Skip to content

Commit

Permalink
Merge branch 'dev' into fix-clear-residual-listeners-#8916
Browse files Browse the repository at this point in the history
  • Loading branch information
canxin121 authored Feb 27, 2024
2 parents ff5c8de + 5a19147 commit e1109ec
Show file tree
Hide file tree
Showing 99 changed files with 1,750 additions and 724 deletions.
12 changes: 12 additions & 0 deletions .changes/cli-acl-subcommands.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
'tauri-cli': 'patch:feat'
'@tauri-apps/cli': 'patch:feat'
---

Add new subcommands for managing permissions and cababilities:

- `tauri permission new`
- `tauri permission add`
- `tauri permission rm`
- `tauri permission ls`
- `tauri capability new`
6 changes: 6 additions & 0 deletions .changes/cli-plugins-migrate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'tauri-cli': 'patch:enhance'
'@tauri-apps/cli': 'patch:enhance'
---

Add plugins to `Cargo.toml` when using `tauri migrate`
7 changes: 7 additions & 0 deletions .changes/csp-header-linux.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"tauri": patch:enhance
"tauri-utils": patch:enhance
"tauri-codegen": patch:enhance
---

Do not include a CSP tag in the application HTML and rely on the custom protocol response header instead.
6 changes: 6 additions & 0 deletions .changes/fix-ios-dev-logs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@tauri-apps/cli": patch:bug
"tauri-cli": patch:bug
---

Fixes process logs not showing on `ios dev`.
5 changes: 5 additions & 0 deletions .changes/fix-mobile-cmd-case.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri": patch:bug
---

Convert the command name to camelCase when executing a mobile plugin command.
8 changes: 8 additions & 0 deletions .changes/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,25 @@
".changes/capabilities-multiwebview.md",
".changes/capabilities-tauri-conf.md",
".changes/capability-context-refactor.md",
".changes/cli-acl-subcommands.md",
".changes/cli-plugin-android-init.md",
".changes/cli-plugins-migrate.md",
".changes/cli-windows-build-tools-detect-utf8.md",
".changes/codegen-capabilities-attribute.md",
".changes/context-runtime-authority.md",
".changes/core-center-window.md",
".changes/core-js-event-anytarget.md",
".changes/core-once-event-return-event-id.md",
".changes/csp-header-linux.md",
".changes/downgrade-minisign.md",
".changes/enhance-resource-dir-resolution.md",
".changes/fix-capability-schema-definitions.md",
".changes/fix-codegen-rerun-if-changed.md",
".changes/fix-config-arg.md",
".changes/fix-invoke-devtools-by-hotkey.md",
".changes/fix-ios-dev-logs.md",
".changes/fix-migrate-updater.md",
".changes/fix-mobile-cmd-case.md",
".changes/fix-mobile-process-spawn.md",
".changes/fix-process-ipc-message-fn.md",
".changes/fix-rewrite-schema.md",
Expand All @@ -40,15 +45,18 @@
".changes/ios-signing-optional.md",
".changes/nsis-dpi-aware.md",
".changes/progress-bar-state-refactor.md",
".changes/re-export-progress-bar-status.md",
".changes/refactor-capabilities-schema.md",
".changes/refactor-capability-remote-option.md",
".changes/remove-app-custom-protocol-feature.md",
".changes/remove-unit-uri.md",
".changes/reparent.md",
".changes/rerun-if-permission-created.md",
".changes/runtime-add-capability.md",
".changes/rwh-06.md",
".changes/schema_str.md",
".changes/tauri-build-codegen-capabilities.md",
".changes/tauri-build-dev-changes.md",
".changes/tauri-close-requested-target-specific.md",
".changes/tauri-error-sync.md",
".changes/tauri-plugin-identifier-alphanumeric.md",
Expand Down
5 changes: 5 additions & 0 deletions .changes/re-export-progress-bar-status.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri': 'patch:bug'
---

Export `ProgressBarStatus`, regression introduced in `2.0.0-beta.4`
8 changes: 8 additions & 0 deletions .changes/remove-app-custom-protocol-feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@tauri-apps/cli": patch:breaking
"tauri-cli": patch:breaking
"tauri": patch:breaking
"tauri-build": patch:breaking
---

The `custom-protocol` Cargo feature is no longer required on your application and is now ignored. To check if running on production, use `#[cfg(not(dev))]` instead of `#[cfg(feature = "custom-protocol")]`.
5 changes: 5 additions & 0 deletions .changes/tauri-build-dev-changes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri-build": patch:breaking
---

Removed `tauri_build::CodegenContext::dev()` and added `tauri_build::dev()`.
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions core/tauri-build/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## \[2.0.0-beta.5]

### Breaking Changes

- [`b9e6a018`](https://www.github.com/tauri-apps/tauri/commit/b9e6a01879d9233040f3d3fab11c59e70563da7e)([#8937](https://www.github.com/tauri-apps/tauri/pull/8937)) The `custom-protocol` Cargo feature is no longer required on your application and is now ignored. To check if running on production, use `#[cfg(not(dev))]` instead of `#[cfg(feature = "custom-protocol")]`.
- [`b9e6a018`](https://www.github.com/tauri-apps/tauri/commit/b9e6a01879d9233040f3d3fab11c59e70563da7e)([#8937](https://www.github.com/tauri-apps/tauri/pull/8937)) Removed `tauri_build::CodegenContext::dev()` and added `tauri_build::dev()`.


### Dependencies

- Upgraded to `[email protected]`
- Upgraded to `[email protected]`

## \[2.0.0-beta.4]

### Enhancements
Expand Down
6 changes: 3 additions & 3 deletions core/tauri-build/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tauri-build"
version = "2.0.0-beta.4"
version = "2.0.0-beta.5"
description = "build time code to pair with https://crates.io/crates/tauri"
exclude = [ "CHANGELOG.md", "/target" ]
readme = "README.md"
Expand Down Expand Up @@ -28,8 +28,8 @@ rustdoc-args = [ "--cfg", "docsrs" ]
[dependencies]
anyhow = "1"
quote = { version = "1", optional = true }
tauri-codegen = { version = "2.0.0-beta.4", path = "../tauri-codegen", optional = true }
tauri-utils = { version = "2.0.0-beta.4", path = "../tauri-utils", features = [ "build", "resources" ] }
tauri-codegen = { version = "2.0.0-beta.5", path = "../tauri-codegen", optional = true }
tauri-utils = { version = "2.0.0-beta.5", path = "../tauri-utils", features = [ "build", "resources" ] }
cargo_toml = "0.17"
serde = "1"
serde_json = "1"
Expand Down
12 changes: 1 addition & 11 deletions core/tauri-build/src/codegen/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use tauri_utils::config::FrontendDist;
#[cfg_attr(docsrs, doc(cfg(feature = "codegen")))]
#[derive(Debug)]
pub struct CodegenContext {
dev: bool,
config_path: PathBuf,
out_file: PathBuf,
capabilities: Option<Vec<PathBuf>>,
Expand All @@ -26,7 +25,6 @@ pub struct CodegenContext {
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,
Expand Down Expand Up @@ -68,14 +66,6 @@ impl CodegenContext {
self
}

/// 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 dev(mut self) -> Self {
self.dev = true;
self
}

/// Adds a capability file to the generated context.
#[must_use]
pub fn capability<P: AsRef<Path>>(mut self, path: P) -> Self {
Expand Down Expand Up @@ -131,7 +121,7 @@ impl CodegenContext {
);

let code = context_codegen(ContextData {
dev: self.dev,
dev: crate::dev(),
config,
config_parent,
// it's very hard to have a build script for unit tests, so assume this is always called from
Expand Down
18 changes: 7 additions & 11 deletions core/tauri-build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use anyhow::Context;
pub use anyhow::Result;
use cargo_toml::Manifest;
use heck::AsShoutySnakeCase;

use tauri_utils::{
acl::build::parse_capabilities,
Expand Down Expand Up @@ -207,15 +206,6 @@ 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) {
Expand Down Expand Up @@ -419,6 +409,12 @@ impl Attributes {
}
}

pub fn dev() -> bool {
std::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.
///
/// The current helpers include the following:
Expand Down Expand Up @@ -499,7 +495,7 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
mobile::generate_gradle_files(project_dir)?;
}

cfg_alias("dev", !has_feature("custom-protocol"));
cfg_alias("dev", dev());

let ws_path = get_workspace_dir()?;
let mut manifest =
Expand Down
10 changes: 10 additions & 0 deletions core/tauri-codegen/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## \[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 `[email protected]`

## \[2.0.0-beta.4]

### Dependencies
Expand Down
4 changes: 2 additions & 2 deletions core/tauri-codegen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tauri-codegen"
version = "2.0.0-beta.4"
version = "2.0.0-beta.5"
description = "code generation meant to be consumed inside of `tauri` through `tauri-build` or `tauri-macros`"
exclude = [ "CHANGELOG.md", "/target" ]
readme = "README.md"
Expand All @@ -20,7 +20,7 @@ quote = "1"
syn = "2"
serde = { version = "1", features = [ "derive" ] }
serde_json = "1"
tauri-utils = { version = "2.0.0-beta.4", path = "../tauri-utils", features = [ "build" ] }
tauri-utils = { version = "2.0.0-beta.5", path = "../tauri-utils", features = [ "build" ] }
thiserror = "1"
walkdir = "2"
brotli = { version = "3", optional = true, default-features = false, features = [ "std" ] }
Expand Down
9 changes: 2 additions & 7 deletions core/tauri-codegen/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ pub struct ContextData {

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);
Expand All @@ -53,10 +52,6 @@ fn map_core_assets(
if csp {
let document = parse_html(String::from_utf8_lossy(input).into_owned());

if target == Target::Linux {
::tauri_utils::html::inject_csp_token(&document);
}

inject_nonce_token(&document, &dangerous_disable_asset_csp_modification);

if dangerous_disable_asset_csp_modification.can_modify("script-src") {
Expand Down Expand Up @@ -176,15 +171,15 @@ pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsE
path
)
}
EmbeddedAssets::new(assets_path, &options, map_core_assets(&options, target))?
EmbeddedAssets::new(assets_path, &options, map_core_assets(&options))?
}
FrontendDist::Files(files) => EmbeddedAssets::new(
files
.iter()
.map(|p| config_parent.join(p))
.collect::<Vec<_>>(),
&options,
map_core_assets(&options, target),
map_core_assets(&options),
)?,
_ => unimplemented!(),
},
Expand Down
7 changes: 7 additions & 0 deletions core/tauri-macros/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## \[2.0.0-beta.5]

### Dependencies

- Upgraded to `[email protected]`
- Upgraded to `[email protected]`

## \[2.0.0-beta.4]

### Dependencies
Expand Down
Loading

0 comments on commit e1109ec

Please sign in to comment.