mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-04-29 12:06:01 +02:00
Merge branch 'next' into feat/camera
This commit is contained in:
Generated
+13
-35
@@ -959,19 +959,6 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dashmap"
|
||||
version = "5.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"hashbrown",
|
||||
"lock_api",
|
||||
"once_cell",
|
||||
"parking_lot_core 0.9.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "der"
|
||||
version = "0.5.1"
|
||||
@@ -2811,17 +2798,6 @@ dependencies = [
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "oslog"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80d2043d1f61d77cb2f4b1f7b7b2295f40507f5f8e9d1c8bf10a1ca5f97a3969"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"dashmap",
|
||||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "overload"
|
||||
version = "0.1.1"
|
||||
@@ -4164,10 +4140,11 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
|
||||
|
||||
[[package]]
|
||||
name = "swift-rs"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/Brendonovich/swift-rs?rev=eb6de914ad57501da5019154d476d45660559999#eb6de914ad57501da5019154d476d45660559999"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "806ff0904302a8a91644422fcfeee4828c3a9dbcfd1757ba495f1a755c2ac873"
|
||||
dependencies = [
|
||||
"base64 0.13.1",
|
||||
"base64 0.21.0",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
@@ -4282,7 +4259,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "tauri"
|
||||
version = "2.0.0-alpha.3"
|
||||
source = "git+https://github.com/tauri-apps/tauri?branch=next#6fca895695e220995802bfbed2486056402ab535"
|
||||
source = "git+https://github.com/tauri-apps/tauri?branch=next#5d94eaa3bc9f1e5cf3e0fa64fba5801d494c2541"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"attohttpc",
|
||||
@@ -4332,7 +4309,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "tauri-build"
|
||||
version = "2.0.0-alpha.1"
|
||||
source = "git+https://github.com/tauri-apps/tauri?branch=next#6fca895695e220995802bfbed2486056402ab535"
|
||||
source = "git+https://github.com/tauri-apps/tauri?branch=next#5d94eaa3bc9f1e5cf3e0fa64fba5801d494c2541"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cargo_toml",
|
||||
@@ -4351,7 +4328,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "tauri-codegen"
|
||||
version = "2.0.0-alpha.1"
|
||||
source = "git+https://github.com/tauri-apps/tauri?branch=next#6fca895695e220995802bfbed2486056402ab535"
|
||||
source = "git+https://github.com/tauri-apps/tauri?branch=next#5d94eaa3bc9f1e5cf3e0fa64fba5801d494c2541"
|
||||
dependencies = [
|
||||
"base64 0.21.0",
|
||||
"brotli",
|
||||
@@ -4376,7 +4353,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "tauri-macros"
|
||||
version = "2.0.0-alpha.1"
|
||||
source = "git+https://github.com/tauri-apps/tauri?branch=next#6fca895695e220995802bfbed2486056402ab535"
|
||||
source = "git+https://github.com/tauri-apps/tauri?branch=next#5d94eaa3bc9f1e5cf3e0fa64fba5801d494c2541"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
@@ -4473,11 +4450,12 @@ dependencies = [
|
||||
"byte-unit",
|
||||
"fern",
|
||||
"log",
|
||||
"oslog",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_repr",
|
||||
"swift-rs",
|
||||
"tauri",
|
||||
"tauri-build",
|
||||
"time 0.3.15",
|
||||
]
|
||||
|
||||
@@ -4617,7 +4595,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "tauri-runtime"
|
||||
version = "0.13.0-alpha.1"
|
||||
source = "git+https://github.com/tauri-apps/tauri?branch=next#6fca895695e220995802bfbed2486056402ab535"
|
||||
source = "git+https://github.com/tauri-apps/tauri?branch=next#5d94eaa3bc9f1e5cf3e0fa64fba5801d494c2541"
|
||||
dependencies = [
|
||||
"gtk",
|
||||
"http",
|
||||
@@ -4638,7 +4616,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "tauri-runtime-wry"
|
||||
version = "0.13.0-alpha.1"
|
||||
source = "git+https://github.com/tauri-apps/tauri?branch=next#6fca895695e220995802bfbed2486056402ab535"
|
||||
source = "git+https://github.com/tauri-apps/tauri?branch=next#5d94eaa3bc9f1e5cf3e0fa64fba5801d494c2541"
|
||||
dependencies = [
|
||||
"cocoa",
|
||||
"gtk",
|
||||
@@ -4658,7 +4636,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "tauri-utils"
|
||||
version = "2.0.0-alpha.1"
|
||||
source = "git+https://github.com/tauri-apps/tauri?branch=next#6fca895695e220995802bfbed2486056402ab535"
|
||||
source = "git+https://github.com/tauri-apps/tauri?branch=next#5d94eaa3bc9f1e5cf3e0fa64fba5801d494c2541"
|
||||
dependencies = [
|
||||
"brotli",
|
||||
"ctor",
|
||||
|
||||
@@ -9,6 +9,9 @@ rust-version.workspace = true
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build.workspace = true
|
||||
|
||||
[dependencies]
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
@@ -23,7 +26,7 @@ fern = "0.6"
|
||||
android_logger = "0.11"
|
||||
|
||||
[target."cfg(target_os = \"ios\")".dependencies]
|
||||
oslog = "0.2"
|
||||
swift-rs = "1.0.1"
|
||||
|
||||
[features]
|
||||
colored = ["fern/colored"]
|
||||
+12
-9
@@ -1,12 +1,15 @@
|
||||
fn alias(alias: &str, has_feature: bool) {
|
||||
if has_feature {
|
||||
println!("cargo:rustc-cfg={alias}");
|
||||
}
|
||||
}
|
||||
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use std::process::exit;
|
||||
|
||||
fn main() {
|
||||
let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap();
|
||||
let mobile = target_os == "ios" || target_os == "android";
|
||||
alias("desktop", !mobile);
|
||||
alias("mobile", mobile);
|
||||
if let Err(error) = tauri_build::mobile::PluginBuilder::new()
|
||||
.ios_path("ios")
|
||||
.run()
|
||||
{
|
||||
println!("{error:#}");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
.DS_Store
|
||||
/.build
|
||||
/Packages
|
||||
/*.xcodeproj
|
||||
xcuserdata/
|
||||
DerivedData/
|
||||
.swiftpm/config/registries.json
|
||||
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
|
||||
.netrc
|
||||
Package.resolved
|
||||
/tauri-api
|
||||
@@ -0,0 +1,31 @@
|
||||
// swift-tools-version:5.7
|
||||
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "tauri-plugin-log",
|
||||
platforms: [
|
||||
.iOS(.v11),
|
||||
],
|
||||
products: [
|
||||
// Products define the executables and libraries a package produces, and make them visible to other packages.
|
||||
.library(
|
||||
name: "tauri-plugin-log",
|
||||
type: .static,
|
||||
targets: ["tauri-plugin-log"]),
|
||||
],
|
||||
dependencies: [
|
||||
.package(name: "Tauri", path: "tauri-api")
|
||||
],
|
||||
targets: [
|
||||
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
|
||||
// Targets can depend on other targets in this package, and on products in packages this package depends on.
|
||||
.target(
|
||||
name: "tauri-plugin-log",
|
||||
dependencies: [
|
||||
.byName(name: "Tauri")
|
||||
],
|
||||
path: "Sources")
|
||||
]
|
||||
)
|
||||
@@ -0,0 +1,3 @@
|
||||
# Log
|
||||
|
||||
Exposes a function log a message using the OSLog API.
|
||||
@@ -0,0 +1,13 @@
|
||||
import UIKit
|
||||
import Tauri
|
||||
import SwiftRs
|
||||
|
||||
@_cdecl("tauri_log")
|
||||
func log(level: Int, message: SRString) {
|
||||
switch level {
|
||||
case 1: Logger.debug(message.toString())
|
||||
case 2: Logger.info(message.toString())
|
||||
case 3: Logger.error(message.toString())
|
||||
default: break
|
||||
}
|
||||
}
|
||||
+15
-21
@@ -22,6 +22,11 @@ use tauri::{
|
||||
|
||||
pub use fern;
|
||||
|
||||
#[cfg(target_os = "ios")]
|
||||
swift_rs::swift!(fn tauri_log(
|
||||
level: u8, message: &swift_rs::SRString
|
||||
));
|
||||
|
||||
const DEFAULT_MAX_FILE_SIZE: u128 = 40000;
|
||||
const DEFAULT_ROTATION_STRATEGY: RotationStrategy = RotationStrategy::KeepOne;
|
||||
const DEFAULT_LOG_TARGETS: [LogTarget; 2] = [LogTarget::Stdout, LogTarget::LogDir];
|
||||
@@ -260,29 +265,18 @@ impl Builder {
|
||||
}
|
||||
#[cfg(target_os = "ios")]
|
||||
LogTarget::Stdout | LogTarget::Stderr => {
|
||||
use std::sync::Mutex;
|
||||
let loggers: Mutex<HashMap<String, oslog::OsLog>> = Default::default();
|
||||
let mut subsystem = String::new();
|
||||
let identifier = &app_handle.config().tauri.bundle.identifier;
|
||||
let s = identifier.split('.');
|
||||
let last = s.clone().count() - 1;
|
||||
for (i, w) in s.enumerate() {
|
||||
if i != last {
|
||||
subsystem.push_str(w);
|
||||
subsystem.push('.');
|
||||
}
|
||||
}
|
||||
subsystem.push_str(&app_handle.package_info().crate_name);
|
||||
|
||||
fern::Output::call(move |record| {
|
||||
let mut loggers = loggers.lock().unwrap();
|
||||
let pair =
|
||||
loggers.entry(record.target().into()).or_insert_with(|| {
|
||||
oslog::OsLog::new(&subsystem, record.target())
|
||||
});
|
||||
|
||||
let message = format!("{}", record.args());
|
||||
(*pair).with_level(record.level().into(), &message);
|
||||
unsafe {
|
||||
tauri_log(
|
||||
match record.level() {
|
||||
log::Level::Trace | log::Level::Debug => 1,
|
||||
log::Level::Info => 2,
|
||||
log::Level::Warn | log::Level::Error => 3,
|
||||
},
|
||||
&message.as_str().into(),
|
||||
);
|
||||
}
|
||||
})
|
||||
}
|
||||
#[cfg(desktop)]
|
||||
|
||||
Reference in New Issue
Block a user