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
|
# Cross-compilation support for armv7
|
||||||
[target.armv7-unknown-linux-gnueabihf]
|
[target.armv7-unknown-linux-gnueabihf]
|
||||||
linker = "arm-linux-gnueabihf-gcc"
|
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
|
dprint fmt
|
||||||
|
|
||||||
generate-sqlx-cache:
|
generate-sqlx-cache:
|
||||||
./regenerate_sqlx_cache.sh
|
./dev-scripts/regenerate_sqlx_cache.sh
|
||||||
|
|
||||||
# Run eslint for the GUI frontend
|
# Run eslint for the GUI frontend
|
||||||
check_gui_eslint:
|
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() {
|
fn main() {
|
||||||
let is_github_actions: bool = std::env::var("GITHUB_ACTIONS").is_ok();
|
let is_github_actions: bool = std::env::var("GITHUB_ACTIONS").is_ok();
|
||||||
let is_docker_build: bool = std::env::var("DOCKER_BUILD").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")
|
.expect("current directory to be accessible")
|
||||||
.join(MONERO_DEPENDS_DIR);
|
.join(MONERO_DEPENDS_DIR);
|
||||||
|
|
||||||
let out_dir = std::env::var("OUT_DIR").expect("OUT_DIR to be set");
|
// Use stable location in target/debug/monero-depends to avoid rebuilding deps unnecessarily
|
||||||
let out_dir = Path::new(&out_dir);
|
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) =
|
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
|
// Build with the monero library all dependencies required
|
||||||
let mut config = Config::new(MONERO_CPP_DIR);
|
let mut config = Config::new(MONERO_CPP_DIR);
|
||||||
|
|
|
||||||
|
|
@ -315,7 +315,7 @@ impl WalletHandle {
|
||||||
network: monero::Network,
|
network: monero::Network,
|
||||||
background_sync: bool,
|
background_sync: bool,
|
||||||
) -> anyhow::Result<Self> {
|
) -> anyhow::Result<Self> {
|
||||||
let password = password.into();
|
let password: Option<String> = password.into();
|
||||||
|
|
||||||
Self::open_with(path.clone(), daemon.clone(), move |manager| {
|
Self::open_with(path.clone(), daemon.clone(), move |manager| {
|
||||||
manager.open_or_create_wallet(
|
manager.open_or_create_wallet(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue