Skip to content
Open
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
14 changes: 7 additions & 7 deletions assets/asset-tauri/template/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ name = "tauri_lib"
crate-type = ["staticlib", "cdylib", "rlib"]

[build-dependencies]
tauri-build = { version = "2", features = [] }
tauri-build = { version = "2.1.1", features = [] }

[dependencies]
tauri = { version = "2", features = [] }
tauri-cli = "2.4.1"
tauri = { version = "2.1.1", features = [] }
tauri-cli = "2.1.1"

serde = { version = "1", features = ["derive"] }
serde_json = "1"
Expand All @@ -33,8 +33,8 @@ futures-util = "0.3"
anyhow = "1.0"
dirs = "5.0"

tauri-plugin-shell = "2"
tauri-plugin-fs = "2"
tauri-plugin-opener = "2"
tauri-plugin-devtools = "2.0.0"
tauri-plugin-shell = "2.2.1"
tauri-plugin-fs = "2.2.1"
tauri-plugin-opener = "2.2.6"
tauri-plugin-devtools = "2"
tauri-plugin-localhost = "2"
5 changes: 4 additions & 1 deletion assets/asset-tauri/template/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@
],
"security": {
"csp": null
},
"mobile": {
"target": "all"
}
},
"bundle": {
"active": true,
"targets": "all",
"targets": ["desktop", "mobile"],
"icon": [
"icons/32x32.png",
"icons/128x128.png",
Expand Down
49 changes: 49 additions & 0 deletions examples/tauri-mobile-pipeline/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Tauri Mobile + Desktop Pipeline

Builds the **same** sample web app into both a **desktop** bundle and an
**Android** build using the Pipelab Tauri plugin. One Tauri project, two
targets — the example canvas contains a desktop (`platform: linux`) package
block and a mobile (`platform: android`) package block that both consume the
same `html-export` input folder.

## What it does

1. `tauri:scaffold` — creates a fresh Tauri project (web frontend + `src-tauri`).
2. `tauri:package` — writes a mobile-ready `tauri.conf.json` (enables all bundle
targets) and runs the platform build:
- Desktop: `cargo tauri build` (target selected via `platform`/`arch`).
- Android: `cargo tauri android init` then `cargo tauri android build --target aarch64 --apk`
- iOS: `cargo tauri ios init` then `cargo tauri ios build --target aarch64`

The `platform` and `arch` action inputs select the target. `platform` accepts
`win32` / `linux` / `darwin` (desktop) as well as `android` / `ios` (mobile),
and `arch` accepts `x64` / `arm64` / `ia32` / `armv7l` / `universal` / ...

## Prerequisites

Builds are delegated to the official Tauri CLI, which requires the native
toolchains:

- **Desktop** — the host's system webview libraries (e.g. `webkit2gtk-4.1`,
`gtk+-3.0`, `librsvg-2.0` on Linux). See
https://tauri.app/start/prerequisites/#linux
- **Android** — Android SDK + NDK, `ANDROID_HOME` set, and the SDK packages
`platform-tools`, `build-tools`, plus a platform/NDK matching your `rustup`
targets (`aarch64-linux-android`, ...). The Pipelab plugin **self-heals** this
on first run (it reuses an existing SDK or downloads one into the shared cache
folder and adds the Rust target). See
https://tauri.app/start/prerequisites/#android
- **iOS** — macOS with Xcode and the iOS SDK. See
https://tauri.app/start/prerequisites/#ios

## Run

```bash
pnpm --filter @pipelab/cli start -- \
run examples/tauri-mobile-pipeline/pipeline.json \
--user-data /tmp/pl-userdata
```

On a host that only has the Rust + desktop toolchain, the Android block will
still succeed (the plugin provisions the SDK into the shared cache); the desktop
block additionally needs the webview system libraries installed.
30 changes: 30 additions & 0 deletions examples/tauri-mobile-pipeline/html-export/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
<title>Pipelab · Mobile Demo</title>
<style>
:root { color-scheme: dark; }
body {
margin: 0;
min-height: 100vh;
display: grid;
place-items: center;
font-family: system-ui, sans-serif;
background: #0f1115;
color: #e6e6e6;
}
main { text-align: center; padding: 24px; }
h1 { font-size: 1.6rem; }
p { opacity: 0.7; }
</style>
</head>
<body>
<main>
<h1>Pipelab 📱</h1>
<p>This static web app is packaged into a native Android/iOS build by the
<code>@pipelab/plugin-tauri</code> “Package app with configuration” node.</p>
</main>
</body>
</html>
98 changes: 98 additions & 0 deletions examples/tauri-mobile-pipeline/pipeline.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"version": "3.0.0",
"name": "Mobile + Desktop Tauri Package",
"description": "Packages the SAME sample web app into both a desktop bundle (Linux) and an Android build using @pipelab/plugin-tauri, demonstrating one Tauri project targeting mobile and desktop.",
"variables": [],
"canvas": {
"blocks": [
{
"uid": "tauri-package-desktop",
"type": "action",
"origin": { "nodeId": "tauri:package:v2", "pluginId": "tauri" },
"params": {
"arch": { "editor": "simple", "value": "\"x64\"" },
"platform": { "editor": "simple", "value": "\"linux\"" },
"input-folder": {
"editor": "simple",
"value": "\"/workspaces/pipelab/examples/tauri-mobile-pipeline/html-export\""
},
"name": { "editor": "simple", "value": "\"Pipelab Mobile\"" },
"appBundleId": { "editor": "simple", "value": "\"app.pipelab.mobile\"" },
"appCopyright": { "editor": "simple", "value": "\"Copyright © 2024 Pipelab\"" },
"appVersion": { "editor": "simple", "value": "\"1.0.0\"" },
"icon": { "editor": "simple", "value": "\"\"" },
"author": { "editor": "simple", "value": "\"Pipelab\"" },
"description": { "editor": "simple", "value": "\"A Pipelab mobile demo app\"" },
"appCategoryType": {
"editor": "simple",
"value": "\"public.app-category.developer-tools\""
},
"width": { "editor": "simple", "value": 400 },
"height": { "editor": "simple", "value": 800 },
"fullscreen": { "editor": "simple", "value": false },
"frame": { "editor": "simple", "value": true },
"transparent": { "editor": "simple", "value": false },
"toolbar": { "editor": "simple", "value": true },
"alwaysOnTop": { "editor": "simple", "value": false },
"tauriVersion": { "editor": "simple", "value": "\"\"" },
"enableExtraLogging": { "editor": "simple", "value": false },
"openDevtoolsOnStart": { "editor": "simple", "value": false },
"websocketApi": { "editor": "simple", "value": "[]" },
"ignore": { "editor": "editor", "value": "[\n]" },
"enableSteamSupport": { "editor": "simple", "value": false },
"steamGameId": { "editor": "simple", "value": 480 },
"enableDiscordSupport": { "editor": "simple", "value": false },
"discordAppId": { "editor": "simple", "value": "\"\"" }
}
},
{
"uid": "tauri-package-mobile",
"type": "action",
"origin": { "nodeId": "tauri:package:v2", "pluginId": "tauri" },
"params": {
"arch": { "editor": "simple", "value": "\"arm64\"" },
"platform": { "editor": "simple", "value": "\"android\"" },
"input-folder": {
"editor": "simple",
"value": "\"/workspaces/pipelab/examples/tauri-mobile-pipeline/html-export\""
},
"name": { "editor": "simple", "value": "\"Pipelab Mobile\"" },
"appBundleId": { "editor": "simple", "value": "\"app.pipelab.mobile\"" },
"appCopyright": { "editor": "simple", "value": "\"Copyright © 2024 Pipelab\"" },
"appVersion": { "editor": "simple", "value": "\"1.0.0\"" },
"icon": { "editor": "simple", "value": "\"\"" },
"author": { "editor": "simple", "value": "\"Pipelab\"" },
"description": { "editor": "simple", "value": "\"A Pipelab mobile demo app\"" },
"appCategoryType": {
"editor": "simple",
"value": "\"public.app-category.developer-tools\""
},
"width": { "editor": "simple", "value": 400 },
"height": { "editor": "simple", "value": 800 },
"fullscreen": { "editor": "simple", "value": false },
"frame": { "editor": "simple", "value": true },
"transparent": { "editor": "simple", "value": false },
"toolbar": { "editor": "simple", "value": true },
"alwaysOnTop": { "editor": "simple", "value": false },
"tauriVersion": { "editor": "simple", "value": "\"\"" },
"enableExtraLogging": { "editor": "simple", "value": false },
"openDevtoolsOnStart": { "editor": "simple", "value": false },
"websocketApi": { "editor": "simple", "value": "[]" },
"ignore": { "editor": "editor", "value": "[\n]" },
"enableSteamSupport": { "editor": "simple", "value": false },
"steamGameId": { "editor": "simple", "value": 480 },
"enableDiscordSupport": { "editor": "simple", "value": false },
"discordAppId": { "editor": "simple", "value": "\"\"" }
}
}
],
"triggers": [
{
"type": "event",
"origin": { "pluginId": "system", "nodeId": "manual" },
"uid": "manual-start",
"params": {}
}
]
}
}
6 changes: 5 additions & 1 deletion packages/core-node/src/utils/remote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,11 @@ export async function fetchPipelabAsset(
versionOrRange: string,
options: FetchOptions,
): Promise<string> {
if (isDev && projectRoot) {
// Prefer the local monorepo asset when it exists (dev workflow). This avoids
// pulling a published template that may pin Tauri crate versions inconsistently
// with what the local scaffold expects. `PIPELAB_FORCE_NPM` can still force the
// published package (used by CI/prod).
if (projectRoot && process.env.PIPELAB_FORCE_NPM !== "true") {
const assetId = packageName.replace("@pipelab/asset-", "");
const localPath = join(projectRoot, "assets", `asset-${assetId}`);
if (existsSync(localPath)) return localPath;
Expand Down
9 changes: 9 additions & 0 deletions plugins/plugin-core/src/desktop-app.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,14 @@ declare namespace DesktopApp {

interface Tauri extends Config {
tauriVersion: string;
/**
* Optional Tauri `app.mobile` configuration (e.g. android/ios specific overrides).
* Only used when packaging for the `android` or `ios` platforms.
*/
mobile?: {
target?: "all" | "android" | "ios";
android?: Record<string, unknown>;
ios?: Record<string, unknown>;
};
}
}
7 changes: 7 additions & 0 deletions plugins/plugin-tauri/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ import {
import { configureRunner, props } from "./configure";
import { packageV2Runner } from "./package";

export {
ensureAndroidEnvironment,
findAndroidApk,
resolveMobileCliTarget,
resolveMobileOutputTriple,
} from "./tauri";

export default createNodeDefinition({
nodes: [
// make and package
Expand Down
Loading
Loading