Skip to content

Commit

Permalink
fix: use $CARGO_MANIFEST_DIR to fully specify include_dir paths in ta…
Browse files Browse the repository at this point in the history
…uri-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>
  • Loading branch information
scottpledger authored Apr 1, 2024
1 parent 5bd47b4 commit 6703b7c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changes/cli-include-dir-cargo-manifest-dir.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri-cli": patch:enhance
---

Use `$CARGO_MANIFEST_DIR` when including templates at build-time.
2 changes: 1 addition & 1 deletion tooling/cli/src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion tooling/cli/src/mobile/android/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion tooling/cli/src/mobile/ios/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tooling/cli/src/plugin/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down

0 comments on commit 6703b7c

Please sign in to comment.