From c63d9654afa317df967359c96c5109527ab3570b Mon Sep 17 00:00:00 2001 From: Thibaut Lorrain Date: Tue, 19 Jul 2022 12:15:54 +0200 Subject: [PATCH 1/2] Use package name instead of runnable id for dir on target This means means multiple runnables from the same package (ie integration tests) will live in the same directory on the target device and this directory will be stable and will not contain a build hash. This is way better for disk usage especially when lots for tests resources need to be copied (as those will not be duplicated on the target device). This should also improve the first execution time on ssh devices when there are multiple integration tests in the package as the resources will need to only be copied once then rsync will do some magic --- cargo-dinghy/src/main.rs | 1 + dinghy-lib/src/device.rs | 4 ++-- dinghy-lib/src/lib.rs | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cargo-dinghy/src/main.rs b/cargo-dinghy/src/main.rs index df987ce2..4b7f44dd 100644 --- a/cargo-dinghy/src/main.rs +++ b/cargo-dinghy/src/main.rs @@ -120,6 +120,7 @@ fn run_command(cli: DinghyCli) -> Result<()> { dynamic_libraries: vec![], runnable: Runnable { id: exe_id, + package_name: std::env::var("CARGO_PKG_NAME")?, exe: PathBuf::from(exe).canonicalize()?, // cargo launches the runner inside the dir of the crate source: PathBuf::from(".").canonicalize()?, diff --git a/dinghy-lib/src/device.rs b/dinghy-lib/src/device.rs index 48204497..e377418f 100644 --- a/dinghy-lib/src/device.rs +++ b/dinghy-lib/src/device.rs @@ -32,8 +32,8 @@ pub fn make_remote_app_with_name( let root_dir = build.target_path.join("dinghy"); let bundle_path = match bundle_name { - Some(name) => root_dir.join(&build.runnable.id).join(name), - None => root_dir.join(&build.runnable.id), + Some(name) => root_dir.join(&build.runnable.package_name).join(name), + None => root_dir.join(&build.runnable.package_name), }; let bundle_libs_path = root_dir.join("overlay"); let bundle_target_path = &bundle_path; diff --git a/dinghy-lib/src/lib.rs b/dinghy-lib/src/lib.rs index 7f1440c5..c5418562 100644 --- a/dinghy-lib/src/lib.rs +++ b/dinghy-lib/src/lib.rs @@ -291,6 +291,7 @@ impl BuildBundle { #[derive(Clone, Debug, Default)] pub struct Runnable { pub id: String, + pub package_name: String, pub exe: path::PathBuf, pub source: path::PathBuf, } From e21c2a1d22f4747133f43b5ad0ba9f64cc268840 Mon Sep 17 00:00:00 2001 From: Thibaut Lorrain Date: Wed, 20 Jul 2022 10:57:31 +0200 Subject: [PATCH 2/2] copy file time metadata for single file resources --- dinghy-lib/src/project.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dinghy-lib/src/project.rs b/dinghy-lib/src/project.rs index 9a14b798..21ad3a56 100644 --- a/dinghy-lib/src/project.rs +++ b/dinghy-lib/src/project.rs @@ -97,7 +97,7 @@ impl Project { if metadata.is_dir() { rec_copy(file, dst, td.copy_git_ignored)?; } else { - fs::copy(file, dst)?; + copy_and_sync_file(file, dst)?; } } else { log::warn!(