diff --git a/.cargo/config.toml b/.cargo/config.toml index b8e076e9..ed4a2124 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,3 +1,6 @@ +[build] +target-dir = "target" + # Cross-compilation support for armv7 [target.armv7-unknown-linux-gnueabihf] linker = "arm-linux-gnueabihf-gcc" diff --git a/.helix/ignore b/.helix/ignore new file mode 100644 index 00000000..47f73afa --- /dev/null +++ b/.helix/ignore @@ -0,0 +1,2 @@ +src-tauri/gen/ + diff --git a/regenerate_sqlx_cache.sh b/dev-scripts/regenerate_sqlx_cache.sh similarity index 100% rename from regenerate_sqlx_cache.sh rename to dev-scripts/regenerate_sqlx_cache.sh diff --git a/justfile b/justfile index 84226f20..10279976 100644 --- a/justfile +++ b/justfile @@ -106,7 +106,7 @@ fmt: dprint fmt generate-sqlx-cache: - ./regenerate_sqlx_cache.sh + ./dev-scripts/regenerate_sqlx_cache.sh # Run eslint for the GUI frontend check_gui_eslint: diff --git a/monero-sys/build.rs b/monero-sys/build.rs index 7b6a30c8..78d6a649 100644 --- a/monero-sys/build.rs +++ b/monero-sys/build.rs @@ -77,6 +77,24 @@ const EMBEDDED_PATCHES: &[EmbeddedPatch] = &[ ), ]; +/// Find the workspace target directory from OUT_DIR +/// +/// OUT_DIR is something like: /path/to/workspace/target/debug/build/monero-sys-abc123/out +/// We want to extract: /path/to/workspace/target +fn find_workspace_target_dir() -> std::path::PathBuf { + let out_dir = std::env::var("OUT_DIR").expect("OUT_DIR to be set"); + let out_path = Path::new(&out_dir); + + // Walk up from OUT_DIR to find "target" directory + for ancestor in out_path.ancestors() { + if ancestor.ends_with("target") { + return ancestor.to_path_buf(); + } + } + + panic!("Could not find target directory from OUT_DIR: {}", out_dir); +} + fn main() { let is_github_actions: bool = std::env::var("GITHUB_ACTIONS").is_ok(); let is_docker_build: bool = std::env::var("DOCKER_BUILD").is_ok(); @@ -102,10 +120,12 @@ fn main() { .expect("current directory to be accessible") .join(MONERO_DEPENDS_DIR); - let out_dir = std::env::var("OUT_DIR").expect("OUT_DIR to be set"); - let out_dir = Path::new(&out_dir); + // Use stable location in target/debug/monero-depends to avoid rebuilding deps unnecessarily + let target_dir = find_workspace_target_dir(); + let stable_depends_dir = target_dir.join("debug").join("monero-depends").join(&std::env::var("TARGET").expect("TARGET env var to be present")); + let (contrib_depends_dir, target) = - compile_dependencies(contrib_depends_dir, out_dir.join("depends")); + compile_dependencies(contrib_depends_dir, stable_depends_dir); // Build with the monero library all dependencies required let mut config = Config::new(MONERO_CPP_DIR); diff --git a/monero-sys/src/lib.rs b/monero-sys/src/lib.rs index 4ad1486c..a4c843f1 100644 --- a/monero-sys/src/lib.rs +++ b/monero-sys/src/lib.rs @@ -315,7 +315,7 @@ impl WalletHandle { network: monero::Network, background_sync: bool, ) -> anyhow::Result { - let password = password.into(); + let password: Option = password.into(); Self::open_with(path.clone(), daemon.clone(), move |manager| { manager.open_or_create_wallet(