From 690d175e90e40e931810c7b4765cf2ae917b30c9 Mon Sep 17 00:00:00 2001 From: "guillem.cordoba" Date: Mon, 20 May 2024 15:39:07 +0200 Subject: [PATCH] Custom go compiler works --- crates/scaffold-tauri-app/src/lib.rs | 24 ++- .../templates/executable-happ/Cargo.toml.hbs | 7 + .../executable-happ/src-tauri/Cargo.toml.hbs | 5 + docs/.vitepress/config.mts | 17 +- docs/documentation/android/developing.md | 23 +++ docs/documentation/android/publishing.md | 171 ++++++++++++++++++ .../{android-setup.md => android/setup.md} | 2 + docs/documentation/faqs.md | 9 +- docs/documentation/getting-to-know-tauri.md | 2 +- docs/documentation/troubleshooting.md | 6 +- examples/executable-happ/Cargo.lock | 53 +++--- examples/executable-happ/Cargo.toml | 8 +- examples/executable-happ/flake.lock | 2 +- examples/executable-happ/package.json | 7 +- examples/executable-happ/src-tauri/Cargo.toml | 4 +- .../src-tauri/gen/android/app/.gitignore | 2 +- .../gen/android/app/build.gradle.kts | 4 +- .../android/app/src/main/AndroidManifest.xml | 2 +- .../{tauri_app => example}/MainActivity.kt | 2 +- .../app/src/main/res/values-night/themes.xml | 2 +- .../app/src/main/res/values/strings.xml | 4 +- .../app/src/main/res/values/themes.xml | 2 +- .../kotlin/BuildTask.kt | 0 .../kotlin/RustPlugin.kt | 0 .../executable-happ/src-tauri/icons/32x32.png | Bin 3129 -> 974 bytes examples/executable-happ/src-tauri/src/lib.rs | 10 +- .../executable-happ/src-tauri/src/main.rs | 2 +- .../executable-happ/src-tauri/tauri.conf.json | 2 +- examples/executable-happ/src/App.svelte | 49 ----- examples/executable-happ/src/lib/Greet.svelte | 22 --- examples/executable-happ/src/main.js | 8 - examples/executable-happ/src/style.css | 102 ----------- examples/executable-happ/src/vite-env.d.ts | 2 - 33 files changed, 304 insertions(+), 251 deletions(-) create mode 100644 crates/scaffold-tauri-app/templates/executable-happ/Cargo.toml.hbs create mode 100644 docs/documentation/android/developing.md create mode 100644 docs/documentation/android/publishing.md rename docs/documentation/{android-setup.md => android/setup.md} (97%) rename examples/executable-happ/src-tauri/gen/android/app/src/main/java/example/{tauri_app => example}/MainActivity.kt (59%) rename examples/executable-happ/src-tauri/gen/android/buildSrc/src/main/java/example/{tauri_app => example}/kotlin/BuildTask.kt (100%) rename examples/executable-happ/src-tauri/gen/android/buildSrc/src/main/java/example/{tauri_app => example}/kotlin/RustPlugin.kt (100%) delete mode 100644 examples/executable-happ/src/App.svelte delete mode 100644 examples/executable-happ/src/lib/Greet.svelte delete mode 100644 examples/executable-happ/src/main.js delete mode 100644 examples/executable-happ/src/style.css delete mode 100644 examples/executable-happ/src/vite-env.d.ts diff --git a/crates/scaffold-tauri-app/src/lib.rs b/crates/scaffold-tauri-app/src/lib.rs index b42c0ecd..cd325114 100644 --- a/crates/scaffold-tauri-app/src/lib.rs +++ b/crates/scaffold-tauri-app/src/lib.rs @@ -142,16 +142,32 @@ pub fn scaffold_tauri_app( let package_json_content = add_npm_script_to_package( &(root_package_json_path.clone(), package_json_content), &String::from("network"), - &format!("BOOTSTRAP_PORT=$(port) SIGNAL_PORT=$(port) INTERNAL_IP=$(internal-ip --ipv4) concurrently -k \"{}\" \"{}\" \"{}\"", package_manager.run_script_command(String::from("local-services"), None ), - package_manager.run_script_command(String::from("start"), Some(ui_package.clone())), - package_manager.run_script_command(String::from("launch"), None) + &format!("{} && BOOTSTRAP_PORT=$(port) SIGNAL_PORT=$(port) INTERNAL_IP=$(internal-ip --ipv4) concurrently -k \"{}\" \"UI_PORT=1420 {}\" \"{}\"", + + package_manager.run_script_command(String::from("build:happ"), None), + package_manager.run_script_command(String::from("local-services"), None ), + package_manager.run_script_command(String::from("start"), Some(ui_package.clone())), + package_manager.run_script_command(String::from("launch"), None) ), )?; let package_json_content = add_npm_script_to_package( &(root_package_json_path.clone(), package_json_content), &String::from("local-services"), - &format!("hc run-local-services --bootstrap-port $BOOTSTRAP_PORT --signal-port $SIGNAL_PORT"), + &format!("hc run-local-services --bootstrap-interface $INTERNAL_IP --bootstrap-port $BOOTSTRAP_PORT --signal-interfaces $INTERNAL_IP --signal-port $SIGNAL_PORT"), )?; + + let package_json_content = add_npm_script_to_package( + &(root_package_json_path.clone(), package_json_content), + &String::from("android:network"), + &format!("{} && BOOTSTRAP_PORT=$(port) SIGNAL_PORT=$(port) INTERNAL_IP=$(internal-ip --ipv4) concurrently -k \"{}\" \"UI_PORT=1420 {}\" \"{}\" \"{}\"", + package_manager.run_script_command(String::from("build:happ"), None), + package_manager.run_script_command(String::from("local-services"), None), + package_manager.run_script_command(String::from("start"), Some(ui_package.clone())), + package_manager.run_script_command(String::from("tauri dev"), None), + package_manager.run_script_command(String::from("tauri android dev"), None), + ), + )?; + let package_json_content = add_npm_script_to_package( &(root_package_json_path.clone(), package_json_content), &String::from("build:zomes"), diff --git a/crates/scaffold-tauri-app/templates/executable-happ/Cargo.toml.hbs b/crates/scaffold-tauri-app/templates/executable-happ/Cargo.toml.hbs new file mode 100644 index 00000000..dea15b42 --- /dev/null +++ b/crates/scaffold-tauri-app/templates/executable-happ/Cargo.toml.hbs @@ -0,0 +1,7 @@ +{{previous_file_content}} + +[patch.crates-io] +# TODO: remove these patches once https://github.com/holochain/tx5/issues/87 is resolved +tx5-go-pion-sys = { git = "https://github.com/guillemcordoba/tx5", branch = "custom-go" } +tx5-go-pion-turn = { git = "https://github.com/guillemcordoba/tx5", branch = "custom-go" } + diff --git a/crates/scaffold-tauri-app/templates/executable-happ/src-tauri/Cargo.toml.hbs b/crates/scaffold-tauri-app/templates/executable-happ/src-tauri/Cargo.toml.hbs index f653b029..cf445d87 100644 --- a/crates/scaffold-tauri-app/templates/executable-happ/src-tauri/Cargo.toml.hbs +++ b/crates/scaffold-tauri-app/templates/executable-happ/src-tauri/Cargo.toml.hbs @@ -29,3 +29,8 @@ url2 = "0.0.6" app_dirs2 = "2.5.5" tempdir = "0.3.7" anyhow = "1" + +[patch.crates-io] +# TODO: remove these patches once https://github.com/holochain/tx5/issues/87 is resolved +tx5-go-pion-sys = { git = "https://github.com/guillemcordoba/tx5", branch = "custom-go" } +tx5-go-pion-turn = { git = "https://github.com/guillemcordoba/tx5", branch = "custom-go" } diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index f82dd57e..3739d9f4 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -33,8 +33,21 @@ export default defineConfig({ link: "/documentation/getting-to-know-tauri", }, { - text: "Setting up Android", - link: "/documentation/android-setup", + text: "Android", + items: [ + { + text: "Setup", + link: "/documentation/android/setup", + }, + { + text: "Developing", + link: "/documentation/android/developing", + }, + { + text: "Publishing", + link: "/documentation/android/publishing", + }, + ], }, ], }, diff --git a/docs/documentation/android/developing.md b/docs/documentation/android/developing.md new file mode 100644 index 00000000..1db6924e --- /dev/null +++ b/docs/documentation/android/developing.md @@ -0,0 +1,23 @@ +## Developing for Android + +While developing a hApp, it's not that useful to just have one agent to test your hApp with. Instead, you usually need a couple of peers to be able to interact with one another. + +The scaffolding setup + +::: code-group +```bash [npm] +npm run android:network +``` + +```bash [yarn] +yarn android:network +``` + +```bash [pnpm] +pnpm android:network +``` +::: + +```bash +adb devices +``` diff --git a/docs/documentation/android/publishing.md b/docs/documentation/android/publishing.md new file mode 100644 index 00000000..8f4d4282 --- /dev/null +++ b/docs/documentation/android/publishing.md @@ -0,0 +1,171 @@ +# Android Setup + +> [!NOTE] +> This guide assumes that you have already gone through either [how to create an executable hApp](./how-to-create-an-executable-happ.md) or [how to create a holochain runtime](./how-to-create-a-holochain-runtime.md). + +1. In the root folder of your repository, run: + +::: code-group +```bash [npm] +npm run tauri android init +``` + +```bash [yarn] +yarn tauri android init +``` + +```bash [pnpm] +pnpm tauri android init +``` +::: + +This should initialize all the necessary android files for your app. + +2. Go in the `src-tauri/gen/android/app/build.gradle.kts` that was generated in the previous step, and set the "usesCleartextTraffic" to true: + +```kotlin +plugins { + id("com.android.application") + id("org.jetbrains.kotlin.android") + id("rust") +} + +android { + compileSdk = 33 + namespace = "com.tauri.tauri_app" + defaultConfig { + manifestPlaceholders["usesCleartextTraffic"] = "false" // [!code --] + manifestPlaceholders["usesCleartextTraffic"] = "true" // [!code ++] + applicationId = "com.tauri.tauri_app" + minSdk = 24 + targetSdk = 33 + versionCode = 1 + versionName = "1.0" + } + + buildTypes { + getByName("debug") { + manifestPlaceholders["usesCleartextTraffic"] = "true" + isDebuggable = true + isJniDebuggable = true + isMinifyEnabled = false + packaging { + jniLibs.keepDebugSymbols.add("*/arm64-v8a/*.so") + jniLibs.keepDebugSymbols.add("*/armeabi-v7a/*.so") + jniLibs.keepDebugSymbols.add("*/x86/*.so") + jniLibs.keepDebugSymbols.add("*/x86_64/*.so") + } + } + getByName("release") { + signingConfig = signingConfigs.getByName("release") + isMinifyEnabled = true + proguardFiles( + *fileTree(".") { include("**/*.pro") } + .plus(getDefaultProguardFile("proguard-android-optimize.txt")) + .toList().toTypedArray() + ) + } + } + kotlinOptions { + jvmTarget = "1.8" + } +} + +rust { + rootDirRel = "../../../" +} + +dependencies { + implementation("androidx.webkit:webkit:1.6.1") + implementation("androidx.appcompat:appcompat:1.6.1") + implementation("com.google.android.material:material:1.8.0") + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test.ext:junit:1.1.4") + androidTestImplementation("androidx.test.espresso:espresso-core:3.5.0") +} + +apply(from = "tauri.build.gradle.kts") +``` + +3. In your Android device, enable the [developer options](https://developer.android.com/studio/debug/dev-options). + +4. After you have enabled the developer options, [enable USB debbuging](https://developer.android.com/studio/debug/dev-options#Enable-debugging). + +5. Connect your Android device to your computer with a USB cable, and confirm in your Android device that you allow USB debugging from this computer. + +6. In the root folder of your repository, run: + +```bash +nix develop .#androidDev +``` + +This is a replacement command for the usual `nix develop`, which includes `Android Studio`, and all the necessary tooling that you need for Android development. Every time you want to test or build for the Android platform, you will need to enter the nix devShell this way and then your command from inside of it. + +> [!WARNING] +> The first time this is run, it will take some time. This is because nix has to download and build all the necessary Android tooling. After the first time, it will be almost instant. + +7. Inside your `androidDev` devShell, run: + +```bash +adb devices +``` + +If all the previous steps were successful, you should see your device in the list of devices. + +8. Verify that everything is working by running the app for android with: + +::: code-group +```bash [npm] +npm run tauri android dev +``` + +```bash [yarn] +yarn tauri android dev +``` + +```bash [pnpm] +pnpm tauri android dev +``` +::: + +--- + +That's it! You have completed the setup for the Android platform. + +## Android Development + +### Developing + +::: code-group +```bash [npm] +npm run tauri android dev +``` + +```bash [yarn] +yarn tauri android dev +``` + +```bash [pnpm] +pnpm tauri android dev +``` +::: + +```bash +adb devices +``` + +### Publishing + +::: code-group +```bash [npm] +npm run tauri android build +``` + +```bash [yarn] +yarn tauri android build +``` + +```bash [pnpm] +pnpm tauri android build +``` +::: diff --git a/docs/documentation/android-setup.md b/docs/documentation/android/setup.md similarity index 97% rename from docs/documentation/android-setup.md rename to docs/documentation/android/setup.md index 87f1698f..a5d6ba92 100644 --- a/docs/documentation/android-setup.md +++ b/docs/documentation/android/setup.md @@ -131,3 +131,5 @@ pnpm tauri android dev --- That's it! You have completed the setup for the Android platform. + +Continue to [Android developing](./developing) to learn how to develop your app while targeting the Android platform. diff --git a/docs/documentation/faqs.md b/docs/documentation/faqs.md index 8786b222..32713a58 100644 --- a/docs/documentation/faqs.md +++ b/docs/documentation/faqs.md @@ -8,9 +8,8 @@ Well, not quite. Let's break it down to the two main mobile platforms: Holochain has experimental support for Android. This means that holochain works as expected on Android, **except for these issues**: -- [Go compiler issue on Android 11 or later](https://github.com/holochain/tx5/issues/87). This means that in these Android versions, the device can't communicate with anyone on the network, so in practicality holochain does not work. -- [Installation of apps takes more than 40 seconds to complete on an average Android device](https://github.com/holochain/holochain/issues/3243). - [Every time the Android app is opened, holochain takes ~10 seconds to boot up, so there is a long loading screen](https://github.com/holochain/holochain/issues/3243). +- [Go compiler issue on Android 11 or later](https://github.com/holochain/tx5/issues/87). `tauri-plugin-holochain` solves this issue by providing a custom go toolchain, which is already included in the `devShells` and scaffolded projects described in throughout this documentation site, so **if you use `tauri-plugin-holochain`, this issue is not present at all**. ### iOS @@ -18,8 +17,8 @@ In development, holochain works as expected in iOS. But Apple prevents JIT compi --- -## Well, okey... Then how does tauri-plugin-holochain help me now? +## Well, okey... Then how does `tauri-plugin-holochain` help me now? -For now, you can build a desktop only executable hApp that your users can download and use. It's ready to be deployed and iterated upon. After the issues with holochain mobile outlined above are resolved, you will be able to upgrade to a new version of the plugin to automatically get mobile support in your hApp. +For now, you can build a desktop executable hApp that your users can download and use, and start experimenting with Android support. After the issues with holochain mobile outlined above are resolved, you will be able to upgrade to a new version of the plugin to automatically get full mobile support in your hApp. -This is the way ourselves in darskoil studio are building hApps right now. We are monitoring the issues at the technical level, and in constant communication with the core holochain development team. At the same time, while they get resolved, we are building the MVP version for our hApps. +This is the way ourselves in darskoil.studio are building hApps right now. We are monitoring the issues at the core holochain infrastructure level, and in constant communication with the core holochain development team to help get them fixed. diff --git a/docs/documentation/getting-to-know-tauri.md b/docs/documentation/getting-to-know-tauri.md index a5c13332..b484130f 100644 --- a/docs/documentation/getting-to-know-tauri.md +++ b/docs/documentation/getting-to-know-tauri.md @@ -97,7 +97,7 @@ After the initial set up and scaffolding, our tauri app can only be built for de ### Android Setup -Continue to the [Android setup](./android-setup). +Continue to the [Android setup](./android/setup). ### iOS Setup diff --git a/docs/documentation/troubleshooting.md b/docs/documentation/troubleshooting.md index e263ce3d..6f2fa7d0 100644 --- a/docs/documentation/troubleshooting.md +++ b/docs/documentation/troubleshooting.md @@ -1,12 +1,12 @@ -### NixOS +## NixOS -#### Connect to devices +### Connect to devices ```bash sudo adb devices ``` -#### Firewall +### Firewall Disable the firewall to get the tauri frontend with: diff --git a/examples/executable-happ/Cargo.lock b/examples/executable-happ/Cargo.lock index a4f76632..53557e6a 100644 --- a/examples/executable-happ/Cargo.lock +++ b/examples/executable-happ/Cargo.lock @@ -2087,6 +2087,24 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "example" +version = "0.0.0" +dependencies = [ + "anyhow", + "app_dirs2", + "holochain_client", + "holochain_types", + "lair_keystore", + "log", + "tauri", + "tauri-build", + "tauri-plugin-holochain", + "tauri-plugin-log", + "tempdir", + "url2", +] + [[package]] name = "fallible-iterator" version = "0.2.0" @@ -8302,24 +8320,6 @@ dependencies = [ "windows 0.56.0", ] -[[package]] -name = "tauri-app" -version = "0.0.0" -dependencies = [ - "anyhow", - "app_dirs2", - "holochain_client", - "holochain_types", - "lair_keystore", - "log", - "tauri", - "tauri-build", - "tauri-plugin-holochain", - "tauri-plugin-log", - "tempdir", - "url2", -] - [[package]] name = "tauri-build" version = "2.0.0-beta.15" @@ -9186,15 +9186,14 @@ dependencies = [ [[package]] name = "tx5-core" version = "0.0.9-alpha" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a45e91402a7c17bda8835acb47c7460dc3880dc067235d324401a7359857a75" dependencies = [ - "app_dirs2", "base64 0.13.1", "once_cell", "rand 0.8.5", "serde", "serde_json", - "sha2", - "tempfile", "tokio", "tracing", "url", @@ -9203,14 +9202,16 @@ dependencies = [ [[package]] name = "tx5-core" version = "0.0.9-alpha" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a45e91402a7c17bda8835acb47c7460dc3880dc067235d324401a7359857a75" +source = "git+https://github.com/guillemcordoba/tx5?branch=custom-go#9e0d775cfe2c166ee58d07b884d20d186c580aaa" dependencies = [ + "app_dirs2", "base64 0.13.1", "once_cell", "rand 0.8.5", "serde", "serde_json", + "sha2", + "tempfile", "tokio", "tracing", "url", @@ -9233,6 +9234,7 @@ dependencies = [ [[package]] name = "tx5-go-pion-sys" version = "0.0.9-alpha" +source = "git+https://github.com/guillemcordoba/tx5?branch=custom-go#9e0d775cfe2c166ee58d07b884d20d186c580aaa" dependencies = [ "Inflector", "base64 0.13.1", @@ -9243,13 +9245,14 @@ dependencies = [ "ouroboros", "sha2", "tracing", - "tx5-core 0.0.9-alpha", + "tx5-core 0.0.9-alpha (git+https://github.com/guillemcordoba/tx5?branch=custom-go)", "zip 0.6.6", ] [[package]] name = "tx5-go-pion-turn" version = "0.0.9-alpha" +source = "git+https://github.com/guillemcordoba/tx5?branch=custom-go#9e0d775cfe2c166ee58d07b884d20d186c580aaa" dependencies = [ "base64 0.13.1", "dirs", @@ -9259,7 +9262,7 @@ dependencies = [ "sha2", "tokio", "tracing", - "tx5-core 0.0.9-alpha", + "tx5-core 0.0.9-alpha (git+https://github.com/guillemcordoba/tx5?branch=custom-go)", "zip 0.6.6", ] diff --git a/examples/executable-happ/Cargo.toml b/examples/executable-happ/Cargo.toml index b7088d22..398f064b 100644 --- a/examples/executable-happ/Cargo.toml +++ b/examples/executable-happ/Cargo.toml @@ -20,9 +20,10 @@ path = "dnas/forum/zomes/coordinator/posts" path = "dnas/forum/zomes/integrity/posts" [patch.crates-io] -# tx5-go-pion-sys = {git ="https://github.com/guillemcordoba/tx5", branch ="main"} -tx5-go-pion-sys = {path ="/home/guillem/projects/holochain/core/tx5/crates/tx5-go-pion-sys"} -tx5-go-pion-turn = {path ="/home/guillem/projects/holochain/core/tx5/crates/tx5-go-pion-turn"} +# TODO: remove these patches once https://github.com/holochain/tx5/issues/87 is resolved +tx5-go-pion-sys = { git = "https://github.com/guillemcordoba/tx5", branch = "custom-go" } +tx5-go-pion-turn = { git = "https://github.com/guillemcordoba/tx5", branch = "custom-go" } + # mr_bundle = {git ="https://github.com/guillemcordoba/holochain", branch ="lair-startup-timing"} # holochain = {git ="https://github.com/guillemcordoba/holochain", branch ="lair-startup-timing"} # holochain_types = {git ="https://github.com/guillemcordoba/holochain", branch ="lair-startup-timing"} @@ -34,4 +35,3 @@ tx5-go-pion-turn = {path ="/home/guillem/projects/holochain/core/tx5/crates/tx5- # holochain_zome_types = {git ="https://github.com/guillemcordoba/holochain", branch ="lair-startup-timing"} # holo_hash= {git ="https://github.com/guillemcordoba/holochain", branch ="lair-startup-timing"} -# holochain_client = {git ="https://github.com/guillemcordoba/holochain-client-rust", branch ="develop"} diff --git a/examples/executable-happ/flake.lock b/examples/executable-happ/flake.lock index 27bc8305..f14643cc 100644 --- a/examples/executable-happ/flake.lock +++ b/examples/executable-happ/flake.lock @@ -1892,7 +1892,7 @@ }, "locked": { "lastModified": 0, - "narHash": "sha256-RTcpEArNSD6GmnYKh/gG0f9rrHj9nPM92kT2KgbXSaM=", + "narHash": "sha256-WyMth1CPaPXFHocTQsQqcwlIANpZCwaIwIBQK5aiUb4=", "path": "../..", "type": "path" }, diff --git a/examples/executable-happ/package.json b/examples/executable-happ/package.json index 0edf8ef4..49be9ff3 100644 --- a/examples/executable-happ/package.json +++ b/examples/executable-happ/package.json @@ -8,12 +8,13 @@ ], "scripts": { "start": "AGENTS=2 npm run network", - "network": "BOOTSTRAP_PORT=$(port) SIGNAL_PORT=$(port) INTERNAL_IP=$(internal-ip --ipv4) concurrently -k \"npm run local-services\" \"UI_PORT=1420 npm start -w ui\" \"npm run launch\"", + "network": "npm run build:happ && BOOTSTRAP_PORT=$(port) SIGNAL_PORT=$(port) INTERNAL_IP=$(internal-ip --ipv4) concurrently -k \"npm run local-services\" \"UI_PORT=1420 npm start -w ui\" \"npm run launch\"", "launch": "concurrently-repeat \"npm run tauri dev\" $AGENTS", - "local-services": "hc run-local-services --bootstrap-port $BOOTSTRAP_PORT --signal-port $SIGNAL_PORT", + "android:network": "BOOTSTRAP_PORT=$(port) SIGNAL_PORT=$(port) INTERNAL_IP=$(internal-ip --ipv4) concurrently -k \"npm run local-services\" \"UI_PORT=1420 npm start -w ui\" \"npm run tauri dev\" \"npm run tauri android dev\"", + "local-services": "hc run-local-services --bootstrap-interface $INTERNAL_IP --bootstrap-port $BOOTSTRAP_PORT --signal-interfaces $INTERNAL_IP --signal-port $SIGNAL_PORT", "build:happ": "npm run build:zomes && hc app pack workdir --recursive", "build:webhapp": "npm run build:zomes && npm run package -w ui && hc web-app pack workdir --recursive", - "build:zomes": "CARGO_TARGET_DIR=target cargo build --release --target wasm32-unknown-unknown --workspace --exclude tauri-app", + "build:zomes": "CARGO_TARGET_DIR=target cargo build --release --target wasm32-unknown-unknown --workspace --exclude example", "dev": "vite", "build": "vite build", "preview": "vite preview", diff --git a/examples/executable-happ/src-tauri/Cargo.toml b/examples/executable-happ/src-tauri/Cargo.toml index f9bc183b..8e464fff 100644 --- a/examples/executable-happ/src-tauri/Cargo.toml +++ b/examples/executable-happ/src-tauri/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "tauri-app" +name = "example" version = "0.0.0" description = "A Tauri App" authors = ["you"] @@ -9,7 +9,7 @@ edition = "2021" rust-version = "1.70" [lib] -name = "tauri_app_lib" +name = "example_lib" crate-type = ["staticlib", "cdylib", "rlib"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/examples/executable-happ/src-tauri/gen/android/app/.gitignore b/examples/executable-happ/src-tauri/gen/android/app/.gitignore index 4f37a87f..bbdafd85 100644 --- a/examples/executable-happ/src-tauri/gen/android/app/.gitignore +++ b/examples/executable-happ/src-tauri/gen/android/app/.gitignore @@ -1,4 +1,4 @@ -/src/main/java/example/tauri_app/generated +/src/main/java/example/example/generated /src/main/jniLibs/**/*.so /src/main/assets/tauri.conf.json /tauri.build.gradle.kts diff --git a/examples/executable-happ/src-tauri/gen/android/app/build.gradle.kts b/examples/executable-happ/src-tauri/gen/android/app/build.gradle.kts index a536db2b..aec7bfef 100644 --- a/examples/executable-happ/src-tauri/gen/android/app/build.gradle.kts +++ b/examples/executable-happ/src-tauri/gen/android/app/build.gradle.kts @@ -6,10 +6,10 @@ plugins { android { compileSdk = 33 - namespace = "example.tauri_app" + namespace = "example.example" defaultConfig { manifestPlaceholders["usesCleartextTraffic"] = "false" - applicationId = "example.tauri_app" + applicationId = "example.example" minSdk = 24 targetSdk = 33 versionCode = 1 diff --git a/examples/executable-happ/src-tauri/gen/android/app/src/main/AndroidManifest.xml b/examples/executable-happ/src-tauri/gen/android/app/src/main/AndroidManifest.xml index 2f3f41bd..952765b1 100644 --- a/examples/executable-happ/src-tauri/gen/android/app/src/main/AndroidManifest.xml +++ b/examples/executable-happ/src-tauri/gen/android/app/src/main/AndroidManifest.xml @@ -4,7 +4,7 @@ - diff --git a/examples/executable-happ/src-tauri/gen/android/app/src/main/res/values/strings.xml b/examples/executable-happ/src-tauri/gen/android/app/src/main/res/values/strings.xml index e6c86719..3e485480 100644 --- a/examples/executable-happ/src-tauri/gen/android/app/src/main/res/values/strings.xml +++ b/examples/executable-happ/src-tauri/gen/android/app/src/main/res/values/strings.xml @@ -1,4 +1,4 @@ - tauri-app - tauri-app + example + example \ No newline at end of file diff --git a/examples/executable-happ/src-tauri/gen/android/app/src/main/res/values/themes.xml b/examples/executable-happ/src-tauri/gen/android/app/src/main/res/values/themes.xml index 222f3a7a..68d198c0 100644 --- a/examples/executable-happ/src-tauri/gen/android/app/src/main/res/values/themes.xml +++ b/examples/executable-happ/src-tauri/gen/android/app/src/main/res/values/themes.xml @@ -1,6 +1,6 @@ - diff --git a/examples/executable-happ/src-tauri/gen/android/buildSrc/src/main/java/example/tauri_app/kotlin/BuildTask.kt b/examples/executable-happ/src-tauri/gen/android/buildSrc/src/main/java/example/example/kotlin/BuildTask.kt similarity index 100% rename from examples/executable-happ/src-tauri/gen/android/buildSrc/src/main/java/example/tauri_app/kotlin/BuildTask.kt rename to examples/executable-happ/src-tauri/gen/android/buildSrc/src/main/java/example/example/kotlin/BuildTask.kt diff --git a/examples/executable-happ/src-tauri/gen/android/buildSrc/src/main/java/example/tauri_app/kotlin/RustPlugin.kt b/examples/executable-happ/src-tauri/gen/android/buildSrc/src/main/java/example/example/kotlin/RustPlugin.kt similarity index 100% rename from examples/executable-happ/src-tauri/gen/android/buildSrc/src/main/java/example/tauri_app/kotlin/RustPlugin.kt rename to examples/executable-happ/src-tauri/gen/android/buildSrc/src/main/java/example/example/kotlin/RustPlugin.kt diff --git a/examples/executable-happ/src-tauri/icons/32x32.png b/examples/executable-happ/src-tauri/icons/32x32.png index b2bb2e7cca55d59d04e9c66014183875b9e32911..a437dd51741e9e56e14b5d6024493cb2abfd5259 100644 GIT binary patch delta 953 zcmV;q14jJ07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rbj##$t6KL#u=IqPlaloWVEppSFi$#DQ}Q=jWcRaXd_2$ zeSauQPZst2SnZ~grNxPZgONTG@&v~cph^(4BC<+(Nr0eYw=c z=#rt+Xh2eLDodUy=R%~CxFe50`oB(fXt7}VJQ6A0Cx&Th?UHKqhRNw`@|Oi3-~V5X%gbhz&&0?} z>AjxjdPR0A@XoSgNimi(bkdTM+zmM=9>fyg1?4EEPTZm=!*Zgcjwd@m@+uj)qku+)T#H3lz2Z|bR|d`1wlmAC81kP!ZOb8g{}sQ z?v!Un)bouqzo&R4C<$)VTAGx9_~V~&T-{@K{t^op-L%5vcDN@K>*{cpC>iL2 z6O-Tc#EhfJPP+1~s-LG@*ia7F6rXz9Ae9J-yLpauXC#!@KNYuBcUxrC-G7s~G8I#2 zjL)Cv$A9sU6vn1-^Yg4+iJ!*R$t8q~Sf%Vz0j=qG~=@S`raW<}QDqiG_<4XI9j9 zGr9>6IITBynb8TALCZAH$S$Y6o$;gRwe+`7#x2Xb9Y%IBYdrkw-lx9) -> std::io::Result { } fn internal_ip() -> String { - if cfg!(mobile) { - std::option_env!("INTERNAL_IP") - .expect("Environment variable INTERNAL_IP was not set") - .to_string() - } else { - String::from("localhost") - } + std::option_env!("INTERNAL_IP") + .expect("Environment variable INTERNAL_IP was not set") + .to_string() } fn bootstrap_url() -> Url2 { diff --git a/examples/executable-happ/src-tauri/src/main.rs b/examples/executable-happ/src-tauri/src/main.rs index 455963ee..aa4b072d 100644 --- a/examples/executable-happ/src-tauri/src/main.rs +++ b/examples/executable-happ/src-tauri/src/main.rs @@ -2,5 +2,5 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] fn main() { - tauri_app_lib::run(); + example_lib::run(); } diff --git a/examples/executable-happ/src-tauri/tauri.conf.json b/examples/executable-happ/src-tauri/tauri.conf.json index ff9ae9d9..18da8852 100644 --- a/examples/executable-happ/src-tauri/tauri.conf.json +++ b/examples/executable-happ/src-tauri/tauri.conf.json @@ -1,5 +1,5 @@ { - "productName": "tauri-app", + "productName": "example", "version": "0.0.0", "identifier": "example", "build": { diff --git a/examples/executable-happ/src/App.svelte b/examples/executable-happ/src/App.svelte deleted file mode 100644 index 42012796..00000000 --- a/examples/executable-happ/src/App.svelte +++ /dev/null @@ -1,49 +0,0 @@ - - -
-

Welcome to Tauri!

- - - -

- Click on the Tauri, Vite, and Svelte logos to learn more. -

- -
- -
- -
- -
{@html response}
-
- -
- - diff --git a/examples/executable-happ/src/lib/Greet.svelte b/examples/executable-happ/src/lib/Greet.svelte deleted file mode 100644 index 4f9be745..00000000 --- a/examples/executable-happ/src/lib/Greet.svelte +++ /dev/null @@ -1,22 +0,0 @@ - - -
-
- - -
-

{greetMsg}

-
- diff --git a/examples/executable-happ/src/main.js b/examples/executable-happ/src/main.js deleted file mode 100644 index 6b4e1a96..00000000 --- a/examples/executable-happ/src/main.js +++ /dev/null @@ -1,8 +0,0 @@ -import "./style.css"; -import App from "./App.svelte"; - -const app = new App({ - target: document.getElementById("app"), -}); - -export default app; diff --git a/examples/executable-happ/src/style.css b/examples/executable-happ/src/style.css deleted file mode 100644 index c0f9e3bc..00000000 --- a/examples/executable-happ/src/style.css +++ /dev/null @@ -1,102 +0,0 @@ -:root { - font-family: Inter, Avenir, Helvetica, Arial, sans-serif; - font-size: 16px; - line-height: 24px; - font-weight: 400; - - color: #0f0f0f; - background-color: #f6f6f6; - - font-synthesis: none; - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - -webkit-text-size-adjust: 100%; -} - -.container { - margin: 0; - padding-top: 10vh; - display: flex; - flex-direction: column; - justify-content: center; - text-align: center; -} - -.logo { - height: 6em; - padding: 1.5em; - will-change: filter; - transition: 0.75s; -} - -.logo.tauri:hover { - filter: drop-shadow(0 0 2em #24c8db); -} - -.row { - display: flex; - justify-content: center; -} - -a { - font-weight: 500; - color: #646cff; - text-decoration: inherit; -} - -a:hover { - color: #535bf2; -} - -h1 { - text-align: center; -} - -input, -button { - border-radius: 8px; - border: 1px solid transparent; - padding: 0.6em 1.2em; - font-size: 1em; - font-weight: 500; - font-family: inherit; - color: #0f0f0f; - background-color: #ffffff; - transition: border-color 0.25s; - box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2); -} - -button { - cursor: pointer; -} - -button:hover { - border-color: #396cd8; -} - -input, -button { - outline: none; -} - -#greet-input { - margin-right: 5px; -} - -@media (prefers-color-scheme: dark) { - :root { - color: #f6f6f6; - background-color: #2f2f2f; - } - - a:hover { - color: #24c8db; - } - - input, - button { - color: #ffffff; - background-color: #0f0f0f98; - } -} diff --git a/examples/executable-happ/src/vite-env.d.ts b/examples/executable-happ/src/vite-env.d.ts deleted file mode 100644 index 4078e747..00000000 --- a/examples/executable-happ/src/vite-env.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -/// -///