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

feat: build docs.rs documentation for Android #654

Merged
merged 2 commits into from
Oct 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
4 changes: 0 additions & 4 deletions .github/workflows/lint-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,6 @@ jobs:
if: matrix.package != 'tauri-plugin-sql'
run: cargo clippy --package ${{ matrix.package }} --all-targets -- -D warnings

- name: clippy ${{ matrix.package }} --all-features
if: ${{ !contains(fromJSON('["tauri-plugin-http", "tauri-plugin-upload", "tauri-plugin-updater", "tauri-plugin-websocket", "tauri-plugin-sql"]'), matrix.package) }}
run: cargo clippy --package ${{ matrix.package }} --all-targets --all-features -- -D warnings

- name: clippy ${{ matrix.package }} mysql
if: matrix.package == 'tauri-plugin-sql'
run: cargo clippy --package ${{ matrix.package }} --all-targets --no-default-features --features mysql -- -D warnings
Expand Down
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
Loading