mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-12-17 09:34:16 -05:00
build: Improve caching (#681)
* move regenerate_sqlx_cache.sh to dev-scripts * helix ignore src-tauri/gen * delete old regenerate_sqlx_cache * build monero c++ dependencies in target/debug/monero-depends to avoid rebuilding * add sccache rustc wrapper * install sccache in ci * key cache by target as well * remove sccache
This commit is contained in:
parent
d7ca051c20
commit
55cca0c54f
6 changed files with 30 additions and 5 deletions
|
|
@ -1,3 +1,6 @@
|
|||
[build]
|
||||
target-dir = "target"
|
||||
|
||||
# Cross-compilation support for armv7
|
||||
[target.armv7-unknown-linux-gnueabihf]
|
||||
linker = "arm-linux-gnueabihf-gcc"
|
||||
|
|
|
|||
2
.helix/ignore
Normal file
2
.helix/ignore
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
src-tauri/gen/
|
||||
|
||||
2
justfile
2
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:
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -315,7 +315,7 @@ impl WalletHandle {
|
|||
network: monero::Network,
|
||||
background_sync: bool,
|
||||
) -> anyhow::Result<Self> {
|
||||
let password = password.into();
|
||||
let password: Option<String> = password.into();
|
||||
|
||||
Self::open_with(path.clone(), daemon.clone(), move |manager| {
|
||||
manager.open_or_create_wallet(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue