mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-11-28 03:47:37 +03:00
parent
276a0362de
commit
630a7f4b18
6
.changes/package-info-crate-name.md
Normal file
6
.changes/package-info-crate-name.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
"tauri-utils": patch
|
||||
"tauri-codegen": patch
|
||||
---
|
||||
|
||||
Added `crate_name` field on `PackageInfo`.
|
7
.changes/remove-mobile-log.md
Normal file
7
.changes/remove-mobile-log.md
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
"tauri": patch
|
||||
"tauri-macros": patch
|
||||
"tauri-build": patch
|
||||
---
|
||||
|
||||
Removed mobile logging initialization, which will be handled by `tauri-plugin-log`.
|
@ -221,20 +221,14 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
|
||||
|
||||
let s = config.tauri.bundle.identifier.split('.');
|
||||
let last = s.clone().count() - 1;
|
||||
let mut domain = String::new();
|
||||
let mut android_package_prefix = String::new();
|
||||
for (i, w) in s.enumerate() {
|
||||
if i != last {
|
||||
domain.push_str(w);
|
||||
domain.push('.');
|
||||
|
||||
android_package_prefix.push_str(w);
|
||||
android_package_prefix.push('_');
|
||||
}
|
||||
}
|
||||
domain.pop();
|
||||
android_package_prefix.pop();
|
||||
println!("cargo:rustc-env=TAURI_MOBILE_DOMAIN={domain}");
|
||||
println!("cargo:rustc-env=TAURI_ANDROID_PACKAGE_PREFIX={android_package_prefix}");
|
||||
|
||||
cfg_alias("dev", !has_feature("custom-protocol"));
|
||||
|
@ -303,6 +303,7 @@ pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsE
|
||||
version: #package_version.parse().unwrap(),
|
||||
authors: env!("CARGO_PKG_AUTHORS"),
|
||||
description: env!("CARGO_PKG_DESCRIPTION"),
|
||||
crate_name: env!("CARGO_PKG_NAME"),
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -40,8 +40,6 @@ pub fn entry_point(_attributes: TokenStream, item: TokenStream) -> TokenStream {
|
||||
&mut error,
|
||||
&function,
|
||||
);
|
||||
let domain_str = var("TAURI_MOBILE_DOMAIN").unwrap();
|
||||
let app_name_str = var("CARGO_PKG_NAME").unwrap();
|
||||
|
||||
if let Some(e) = error {
|
||||
quote!(#e).into()
|
||||
@ -61,10 +59,9 @@ pub fn entry_point(_attributes: TokenStream, item: TokenStream) -> TokenStream {
|
||||
|
||||
fn _start_app() {
|
||||
#[cfg(target_os = "ios")]
|
||||
::tauri::init_logging(&format!("{}.{}", #domain_str, #app_name_str));
|
||||
::tauri::log_stdout();
|
||||
#[cfg(target_os = "android")]
|
||||
{
|
||||
::tauri::init_logging(#app_name_str);
|
||||
use ::tauri::paste;
|
||||
::tauri::wry_android_binding!(#domain, #app_name, _start_app, ::tauri::wry);
|
||||
}
|
||||
|
@ -34,6 +34,8 @@ pub struct PackageInfo {
|
||||
pub authors: &'static str,
|
||||
/// The crate description.
|
||||
pub description: &'static str,
|
||||
/// The crate name.
|
||||
pub crate_name: &'static str,
|
||||
}
|
||||
|
||||
impl PackageInfo {
|
||||
|
@ -110,11 +110,9 @@ win7-notifications = { version = "0.3.1", optional = true }
|
||||
|
||||
[target."cfg(target_os = \"android\")".dependencies]
|
||||
paste = "1.0"
|
||||
android_logger = "0.9"
|
||||
log = "0.4"
|
||||
|
||||
[target."cfg(target_os = \"ios\")".dependencies]
|
||||
oslog = "0.2"
|
||||
log = "0.4"
|
||||
libc = "0.2"
|
||||
|
||||
|
@ -278,19 +278,9 @@ pub use self::runtime::ClipboardManager;
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "global-shortcut")))]
|
||||
pub use self::runtime::GlobalShortcutManager;
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
#[doc(hidden)]
|
||||
pub fn init_logging(tag: &str) {
|
||||
android_logger::init_once(
|
||||
android_logger::Config::default()
|
||||
.with_min_level(log::Level::Trace)
|
||||
.with_tag(tag),
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(target_os = "ios")]
|
||||
#[doc(hidden)]
|
||||
pub fn init_logging(subsystem: &str) {
|
||||
pub fn log_stdout() {
|
||||
use std::{
|
||||
ffi::CString,
|
||||
fs::File,
|
||||
@ -323,11 +313,6 @@ pub fn init_logging(subsystem: &str) {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
oslog::OsLogger::new(subsystem)
|
||||
.level_filter(log::LevelFilter::Trace)
|
||||
.init()
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
/// Updater events.
|
||||
|
@ -74,6 +74,7 @@ pub fn mock_context<A: Assets>(assets: A) -> crate::Context<A> {
|
||||
version: "0.1.0".parse().unwrap(),
|
||||
authors: "Tauri",
|
||||
description: "Tauri test",
|
||||
crate_name: "test",
|
||||
},
|
||||
_info_plist: (),
|
||||
pattern: Pattern::Brownfield(std::marker::PhantomData),
|
||||
|
55
examples/api/src-tauri/Cargo.lock
generated
55
examples/api/src-tauri/Cargo.lock
generated
@ -67,24 +67,6 @@ dependencies = [
|
||||
"alloc-no-stdlib",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "android_log-sys"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85965b6739a430150bdd138e2374a98af0c3ee0d030b3bb7fc3bddff58d0102e"
|
||||
|
||||
[[package]]
|
||||
name = "android_logger"
|
||||
version = "0.9.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2ec2333c185d826313162cee39d3fcc6a84ba08114a839bebf53b961e7e75773"
|
||||
dependencies = [
|
||||
"android_log-sys",
|
||||
"env_logger",
|
||||
"lazy_static",
|
||||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.66"
|
||||
@ -95,6 +77,7 @@ checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6"
|
||||
name = "api"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tauri",
|
||||
@ -610,19 +593,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",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dbus"
|
||||
version = "0.9.6"
|
||||
@ -720,16 +690,6 @@ dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "env_logger"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
|
||||
dependencies = [
|
||||
"log",
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "1.8.0"
|
||||
@ -1935,17 +1895,6 @@ version = "6.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3baf96e39c5359d2eb0dd6ccb42c62b91d9678aa68160d261b9e0ccbf9e9dea9"
|
||||
|
||||
[[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"
|
||||
@ -2953,7 +2902,6 @@ dependencies = [
|
||||
name = "tauri"
|
||||
version = "2.0.0-alpha.2"
|
||||
dependencies = [
|
||||
"android_logger",
|
||||
"anyhow",
|
||||
"attohttpc",
|
||||
"base64",
|
||||
@ -2982,7 +2930,6 @@ dependencies = [
|
||||
"open",
|
||||
"os_info",
|
||||
"os_pipe",
|
||||
"oslog",
|
||||
"paste",
|
||||
"percent-encoding",
|
||||
"png",
|
||||
|
@ -16,6 +16,7 @@ tauri-build = { path = "../../../core/tauri-build", features = ["codegen", "isol
|
||||
serde_json = "1.0"
|
||||
serde = { version = "1.0", features = [ "derive" ] }
|
||||
tiny_http = "0.11"
|
||||
log = "0.4"
|
||||
|
||||
[dependencies.tauri]
|
||||
path = "../../../core/tauri"
|
||||
|
@ -14,7 +14,7 @@ pub struct RequestBody {
|
||||
|
||||
#[command]
|
||||
pub fn log_operation(event: String, payload: Option<String>) {
|
||||
println!("{} {:?}", event, payload);
|
||||
log::info!("{} {:?}", event, payload);
|
||||
}
|
||||
|
||||
#[command]
|
||||
|
Loading…
Reference in New Issue
Block a user