fix: use $CARGO_MANIFEST_DIR to fully specify include_dir paths in tauri-cli (#9310)

* Allow tauri-cli to work with Bazel.

Signed-off-by: Scott Pledger <scottpledger2005@gmail.com>

* change file

---------

Signed-off-by: Scott Pledger <scottpledger2005@gmail.com>
This commit is contained in:
scottpledger 2024-04-01 08:43:52 -06:00 committed by GitHub
parent 5bd47b4467
commit 6703b7cbca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 9 additions and 4 deletions

View File

@ -0,0 +1,5 @@
---
"tauri-cli": patch:enhance
---
Use `$CARGO_MANIFEST_DIR` when including templates at build-time.

View File

@ -22,7 +22,7 @@ use clap::Parser;
use handlebars::{to_json, Handlebars};
use include_dir::{include_dir, Dir};
const TEMPLATE_DIR: Dir<'_> = include_dir!("templates/app");
const TEMPLATE_DIR: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/templates/app");
const TAURI_CONF_TEMPLATE: &str = include_str!("../templates/tauri.conf.json");
#[derive(Debug, Parser)]

View File

@ -27,7 +27,7 @@ use std::{
path::{Path, PathBuf},
};
const TEMPLATE_DIR: Dir<'_> = include_dir!("templates/mobile/android");
const TEMPLATE_DIR: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/templates/mobile/android");
pub fn gen(
config: &Config,

View File

@ -22,7 +22,7 @@ use std::{
path::{Component, PathBuf},
};
const TEMPLATE_DIR: Dir<'_> = include_dir!("templates/mobile/ios");
const TEMPLATE_DIR: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/templates/mobile/ios");
// unprefixed app_root seems pretty dangerous!!
// TODO: figure out what cargo-mobile meant by that

View File

@ -20,7 +20,7 @@ use std::{
path::{Component, Path, PathBuf},
};
pub const TEMPLATE_DIR: Dir<'_> = include_dir!("templates/plugin");
pub const TEMPLATE_DIR: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/templates/plugin");
#[derive(Debug, Parser)]
#[clap(about = "Initialize a Tauri plugin project on an existing directory")]