Skip to content

Commit

Permalink
feat: build docs.rs documentation for Android
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed Oct 11, 2023
1 parent 8902fe9 commit f85a3f7
Show file tree
Hide file tree
Showing 24 changed files with 113 additions and 25 deletions.
34 changes: 34 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions plugins/app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description = "APIs to read application metadata and change app visibility on ma
edition = { workspace = true }
authors = { workspace = true }
license = { workspace = true }
rust-version = { workspace = true }

[package.metadata.docs.rs]
features = [ "tauri/dox" ]
Expand Down
8 changes: 8 additions & 0 deletions plugins/barcode-scanner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ description = "Scan QR codes, EAN-13 and other kinds of barcodes on Android and
edition = { workspace = true }
authors = { workspace = true }
license = { workspace = true }
rust-version = { workspace = true }
links = "tauri-plugin-barcode-scanner"

[package.metadata.docs.rs]
features = [ "dox" ]
targets = [ "x86_64-linux-android" ]

[build-dependencies]
tauri-build = { workspace = true }

Expand All @@ -16,3 +21,6 @@ serde_json = { workspace = true }
tauri = { workspace = true }
log = { workspace = true }
thiserror = { workspace = true }

[features]
dox = [ "tauri/dox" ]
7 changes: 4 additions & 3 deletions plugins/barcode-scanner/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

use std::process::exit;

fn main() {
if let Err(error) = tauri_build::mobile::PluginBuilder::new()
.android_path("android")
.ios_path("ios")
.run()
{
println!("{error:#}");
exit(1);
// when building documentation for Android the plugin build result is irrelevant to the crate itself
if !(cfg!(feature = "dox") && std::env::var("TARGET").unwrap().contains("android")) {
std::process::exit(1);
}
}
}
1 change: 1 addition & 0 deletions plugins/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description = "Parse arguments from your Tauri application's command line interf
edition = { workspace = true }
authors = { workspace = true }
license = { workspace = true }
rust-version = { workspace = true }

[package.metadata.docs.rs]
features = [ "tauri/dox" ]
Expand Down
10 changes: 9 additions & 1 deletion plugins/clipboard-manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ description = "Read and write to the system clipboard."
edition = { workspace = true }
authors = { workspace = true }
license = { workspace = true }
rust-version = { workspace = true }
links = "tauri-plugin-clipboard-manager"

[package.metadata.docs.rs]
features = [ "tauri/dox" ]
features = [ "dox" ]
targets = [
"x86_64-unknown-linux-gnu",
"x86_64-linux-android"
]

[build-dependencies]
tauri-build = { workspace = true }
Expand All @@ -22,3 +27,6 @@ thiserror = { workspace = true }

[target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
arboard = "3"

[features]
dox = [ "tauri/dox" ]
7 changes: 4 additions & 3 deletions plugins/clipboard-manager/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

use std::process::exit;

fn main() {
if let Err(error) = tauri_build::mobile::PluginBuilder::new()
.android_path("android")
.ios_path("ios")
.run()
{
println!("{error:#}");
exit(1);
// when building documentation for Android the plugin build result is irrelevant to the crate itself
if !(cfg!(feature = "dox") && std::env::var("TARGET").unwrap().contains("android")) {
std::process::exit(1);
}
}
}
7 changes: 7 additions & 0 deletions plugins/deep-link/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ edition = { workspace = true }
rust-version = { workspace = true }
links = "tauri-plugin-deep-link"

[package.metadata.docs.rs]
features = [ "dox" ]
targets = [ "x86_64-linux-android" ]

[build-dependencies]
serde = { workspace = true }
serde_json = { workspace = true }
Expand All @@ -20,3 +24,6 @@ tauri = { workspace = true }
log = { workspace = true }
thiserror = { workspace = true }
url = "2"

[features]
dox = [ "tauri/dox" ]
6 changes: 3 additions & 3 deletions plugins/deep-link/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

use std::process::exit;

#[path = "src/config.rs"]
mod config;
use config::{AssociatedDomain, Config};
Expand Down Expand Up @@ -37,7 +35,9 @@ fn main() {
.run()
{
println!("{error:#}");
exit(1);
if !(cfg!(feature = "dox") && std::env::var("TARGET").unwrap().contains("android")) {
std::process::exit(1);
}
}

if let Some(config) = tauri_build::config::plugin_config::<Config>("deep-link") {
Expand Down
10 changes: 9 additions & 1 deletion plugins/dialog/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ description = "Native system dialogs for opening and saving files along with mes
edition = { workspace = true }
authors = { workspace = true }
license = { workspace = true }
rust-version = { workspace = true }
links = "tauri-plugin-dialog"

[package.metadata.docs.rs]
features = [ "tauri/dox" ]
features = [ "dox" ]
targets = [
"x86_64-unknown-linux-gnu",
"x86_64-linux-android"
]

[dependencies]
serde = { workspace = true }
Expand All @@ -27,3 +32,6 @@ raw-window-handle = "0.5"

[build-dependencies]
tauri-build = { workspace = true }

[features]
dox = [ "tauri/dox" ]
7 changes: 4 additions & 3 deletions plugins/dialog/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

use std::process::exit;

fn main() {
if let Err(error) = tauri_build::mobile::PluginBuilder::new()
.android_path("android")
.ios_path("ios")
.run()
{
println!("{error:#}");
exit(1);
// when building documentation for Android the plugin build result is irrelevant to the crate itself
if !(cfg!(feature = "dox") && std::env::var("TARGET").unwrap().contains("android")) {
std::process::exit(1);
}
}
}
4 changes: 2 additions & 2 deletions plugins/dialog/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ pub struct MessageDialogBuilder<R: Runtime> {
#[cfg(mobile)]
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct MessageDialogPayload<'a> {
pub(crate) struct MessageDialogPayload<'a> {
title: &'a String,
message: &'a String,
kind: &'a MessageDialogKind,
Expand Down Expand Up @@ -272,7 +272,7 @@ pub struct FileDialogBuilder<R: Runtime> {
#[cfg(mobile)]
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct FileDialogPayload<'a> {
pub(crate) struct FileDialogPayload<'a> {
filters: &'a Vec<Filter>,
multiple: bool,
}
Expand Down
1 change: 1 addition & 0 deletions plugins/global-shortcut/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description = "Register global hotkeys listeners on your Tauri application."
edition = { workspace = true }
authors = { workspace = true }
license = { workspace = true }
rust-version = { workspace = true }

[package.metadata.docs.rs]
features = [ "tauri/dox" ]
Expand Down
1 change: 1 addition & 0 deletions plugins/http/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description = "Access an HTTP client written in Rust."
edition = { workspace = true }
authors = { workspace = true }
license = { workspace = true }
rust-version = { workspace = true }

[package.metadata.docs.rs]
features = [ "tauri/dox" ]
Expand Down
8 changes: 7 additions & 1 deletion plugins/notification/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ description = "Send desktop and mobile notifications on your Tauri application."
edition = { workspace = true }
authors = { workspace = true }
license = { workspace = true }
rust-version = { workspace = true }
links = "tauri-plugin-notification"

[package.metadata.docs.rs]
features = [ "tauri/dox" ]
features = [ "dox" ]
targets = [
"x86_64-unknown-linux-gnu",
"x86_64-linux-android"
]

[build-dependencies]
tauri-build = { workspace = true }
Expand All @@ -32,3 +37,4 @@ win7-notifications = { version = "0.3.1", optional = true }

[features]
windows7-compat = [ "win7-notifications" ]
dox = [ "tauri/dox" ]
7 changes: 4 additions & 3 deletions plugins/notification/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

use std::process::exit;

fn main() {
if let Err(error) = tauri_build::mobile::PluginBuilder::new()
.android_path("android")
.ios_path("ios")
.run()
{
println!("{error:#}");
exit(1);
// when building documentation for Android the plugin build result is irrelevant to the crate itself
if !(cfg!(feature = "dox") && std::env::var("TARGET").unwrap().contains("android")) {
std::process::exit(1);
}
}
}
1 change: 1 addition & 0 deletions plugins/os/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description = "Read information about the operating system."
edition = { workspace = true }
authors = { workspace = true }
license = { workspace = true }
rust-version = { workspace = true }

[package.metadata.docs.rs]
features = [ "tauri/dox" ]
Expand Down
1 change: 1 addition & 0 deletions plugins/process/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description = "Access the current process of your Tauri application."
edition = { workspace = true }
authors = { workspace = true }
license = { workspace = true }
rust-version = { workspace = true }

[package.metadata.docs.rs]
features = [ "tauri/dox" ]
Expand Down
1 change: 1 addition & 0 deletions plugins/shell/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description = "Access the system shell. Allows you to spawn child processes and
edition = { workspace = true }
authors = { workspace = true }
license = { workspace = true }
rust-version = { workspace = true }

[package.metadata.docs.rs]
features = [ "tauri/dox" ]
Expand Down
1 change: 1 addition & 0 deletions plugins/updater/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description = "In-app updates for Tauri applications."
edition = { workspace = true }
authors = { workspace = true }
license = { workspace = true }
rust-version = { workspace = true }

[package.metadata.docs.rs]
features = [ "tauri/dox" ]
Expand Down
2 changes: 1 addition & 1 deletion plugins/updater/src/updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ impl Update {
self.install(bytes)
}

#[cfg(any(target_os = "android", target_os = "ios"))]
#[cfg(mobile)]
fn install_inner(&self, bytes: Vec<u8>) -> Result<()> {
Ok(())
}
Expand Down
1 change: 1 addition & 0 deletions plugins/window/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description = "Interact with the Tauri window."
edition = { workspace = true }
authors = { workspace = true }
license = { workspace = true }
rust-version = { workspace = true }

[package.metadata.docs.rs]
features = [ "tauri/dox" ]
Expand Down
5 changes: 4 additions & 1 deletion shared/template/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license = { workspace = true }
links = "tauri-plugin-{{name}}"

[package.metadata.docs.rs]
features = [ "tauri/dox" ]
features = [ "dox" ]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand All @@ -20,3 +20,6 @@ serde_json = { workspace = true }
tauri = { workspace = true }
log = { workspace = true }
thiserror = { workspace = true }

[features]
dox = [ "tauri/dox" ]
Loading

0 comments on commit f85a3f7

Please sign in to comment.