Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove v1 references on documentation and benchmark #7258

Merged
merged 2 commits into from
Jun 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/tauri/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2084,7 +2084,7 @@ impl<R: Runtime> Window<R> {
///
/// This listener only receives events that are triggered using the
/// [`trigger`](Window#method.trigger) and [`emit_and_trigger`](Window#method.emit_and_trigger) methods or
/// the `appWindow.emit` function from the @tauri-apps/api `window` module.
/// the `emit` function from the window plugin (`@tauri-apps/plugin-window` package).
///
/// # Examples
/// ```
Expand Down
2 changes: 1 addition & 1 deletion tooling/api/docs/js-api.json

Large diffs are not rendered by default.

16 changes: 4 additions & 12 deletions tooling/api/src/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,21 +125,13 @@ export function mockIPC(
* mockWindows("main", "second", "third");
*
* mockIPC((cmd, args) => {
* if (cmd === "tauri") {
* if (
* args?.__tauriModule === "Window" &&
* args?.message?.cmd === "manage" &&
* args?.message?.data?.cmd?.type === "close"
* ) {
* console.log('closing window!');
* }
* if (cmd === "plugin:event|emit") {
* console.log('emit event', args?.event, args?.payload);
* }
* });
*
* const { getCurrent } = await import("@tauri-apps/api/window");
*
* const win = getCurrent();
* await win.close(); // this will cause the mocked IPC handler to log to the console.
* const { emit } = await import("@tauri-apps/api/event");
* await emit('loaded'); // this will cause the mocked IPC handler to log to the console.
* ```
*
* @param current Label of window this JavaScript context is running in.
Expand Down
4 changes: 2 additions & 2 deletions tooling/api/typedoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"entryPoints": [
"src/event.ts",
"src/mocks.ts",
"src/tauri.ts",
"src/window.ts"
"src/path.ts",
"src/tauri.ts"
],
"githubPages": false,
"readme": "none",
Expand Down
6 changes: 5 additions & 1 deletion tooling/bench/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ pub struct StraceOutput {

pub fn get_target() -> &'static str {
#[cfg(target_os = "macos")]
return "x86_64-apple-darwin";
return if cfg!(target_arch = "aarch64") {
"aarch64-apple-darwin"
} else {
"x86_64-apple-darwin"
};
#[cfg(target_os = "linux")]
return "x86_64-unknown-linux-gnu";
#[cfg(target_os = "windows")]
Expand Down
25 changes: 1 addition & 24 deletions tooling/bench/tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,11 @@
members = [
"./*/src-tauri/",
]
resolver = "2"

[profile.release]
panic = "abort"
codegen-units = 1
lto = true
incremental = false
opt-level = "s"

# See https://github.com/rust-lang/cargo/issues/10118#issuecomment-1006000210
# And https://github.com/rust-lang/rust/issues/96486
[profile.release.package.compiler_builtins]
# The compiler-builtins crate cannot reference libcore, and it's own CI will
# verify that this is the case. This requires, however, that the crate is built
# without overflow checks and debug assertions. Forcefully disable debug
# assertions and overflow checks here which should ensure that even if these
# assertions are enabled for libstd we won't enable then for compiler_builtins
# which should ensure we still link everything correctly.
debug-assertions = false
overflow-checks = false

# For compiler-builtins we always use a high number of codegen units.
# The goal here is to place every single intrinsic into its own object
# file to avoid symbol clashes with the system libgcc if possible. Note
# that this number doesn't actually produce this many object files, we
# just don't create more than this number of object files.
#
# It's a bit of a bummer that we have to pass this here, unfortunately.
# Ideally this would be specified through an env var to Cargo so Cargo
# knows how many CGUs are for this specific crate, but for now
# per-crate configuration isn't specifiable in the environment.
codegen-units = 10000
13 changes: 1 addition & 12 deletions tooling/bench/tests/files_transfer/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,7 @@ <h1>Welcome to Tauri!</h1>

<script>
window.addEventListener('DOMContentLoaded', (event) => {
window.__TAURI__
.invoke('tauri', {
__tauriModule: 'Fs',
message: {
cmd: 'readFile',
path: '.tauri_3mb.json',
options: {
// home folder
dir: 11
}
}
})
window.__TAURI__.invoke('read_file')
.then((_data) => {
// success
window.__TAURI__.invoke('app_should_close', { exitCode: 0 })
Expand Down
2 changes: 1 addition & 1 deletion tooling/bench/tests/files_transfer/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ tauri-build = { path = "../../../../../core/tauri-build", features = [ "codegen"
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = [ "derive" ] }
tauri = { path = "../../../../../core/tauri", features = ["fs-read-file"] }
tauri = { path = "../../../../../core/tauri", features = [] }

[features]
custom-protocol = [ "tauri/custom-protocol" ]
17 changes: 15 additions & 2 deletions tooling/bench/tests/files_transfer/src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,27 @@

#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

#[tauri::command]
use std::fs::read;
use tauri::{command, 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<Vec<u8>, 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(contents)
}

fn main() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![app_should_close])
.invoke_handler(tauri::generate_handler![app_should_close, read_file])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
Loading