From 1c0c5e304ccc2e6430f1ca0e0f2b1e58fd397158 Mon Sep 17 00:00:00 2001 From: Daiderd Jordan Date: Fri, 24 Apr 2020 21:27:33 +0200 Subject: [PATCH 1/2] init cargo workspace Enables splittig up the code a bit more, and hopefully helps keep the compilation time down. --- ofborg/Cargo.lock => Cargo.lock | 0 Cargo.toml | 11 +++++++++++ ofborg/Cargo.toml | 7 ------- 3 files changed, 11 insertions(+), 7 deletions(-) rename ofborg/Cargo.lock => Cargo.lock (100%) create mode 100644 Cargo.toml diff --git a/ofborg/Cargo.lock b/Cargo.lock similarity index 100% rename from ofborg/Cargo.lock rename to Cargo.lock diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..46a6e0a --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,11 @@ +[workspace] +members = [ + "ofborg" +] + +[profile.release] +debug = true + +[patch.crates-io] +#hubcaps = { path = "../hubcaps" } +#amq-proto = { path = "rust-amq-proto" } diff --git a/ofborg/Cargo.toml b/ofborg/Cargo.toml index e106079..4a49573 100644 --- a/ofborg/Cargo.toml +++ b/ofborg/Cargo.toml @@ -28,10 +28,3 @@ nom = "4.0.0-beta3" sys-info = "0.5.6" chrono = "0.4.6" separator = "0.4.1" - -[profile.release] -debug = true - -[patch.crates-io] -#hubcaps = { path = "../hubcaps" } -#amq-proto = { path = "rust-amq-proto" } From 7ccb4943a1d03a39bc7eb02041520916ab5860fa Mon Sep 17 00:00:00 2001 From: Daiderd Jordan Date: Fri, 24 Apr 2020 22:07:59 +0200 Subject: [PATCH 2/2] move simple-build to a separate project This is mostly intended as an example and since this is only useful for testing it should be relatively safe. --- Cargo.lock | 8 ++++++++ Cargo.toml | 3 ++- ofborg-simple-build/Cargo.toml | 10 ++++++++++ .../src/main.rs | 12 ++++++++---- 4 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 ofborg-simple-build/Cargo.toml rename ofborg/src/bin/simple-build.rs => ofborg-simple-build/src/main.rs (87%) diff --git a/Cargo.lock b/Cargo.lock index f56a83a..9fa85a7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -461,6 +461,14 @@ dependencies = [ "uuid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "ofborg-simple-build" +version = "0.1.0" +dependencies = [ + "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "ofborg 0.1.8", +] + [[package]] name = "openssl" version = "0.9.24" diff --git a/Cargo.toml b/Cargo.toml index 46a6e0a..b2c02f7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,7 @@ [workspace] members = [ - "ofborg" + "ofborg", + "ofborg-simple-build" ] [profile.release] diff --git a/ofborg-simple-build/Cargo.toml b/ofborg-simple-build/Cargo.toml new file mode 100644 index 0000000..b1bb6b6 --- /dev/null +++ b/ofborg-simple-build/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "ofborg-simple-build" +version = "0.1.0" +authors = ["Daiderd Jordan "] +edition = "2018" + +[dependencies] +ofborg = { path = "../ofborg" } + +log = "0.3.8" diff --git a/ofborg/src/bin/simple-build.rs b/ofborg-simple-build/src/main.rs similarity index 87% rename from ofborg/src/bin/simple-build.rs rename to ofborg-simple-build/src/main.rs index 8415c24..6583c77 100644 --- a/ofborg/src/bin/simple-build.rs +++ b/ofborg-simple-build/src/main.rs @@ -1,18 +1,22 @@ -use ofborg::config; -use ofborg::nix; +#[macro_use] +extern crate log; use std::env; use std::fs::File; use std::io::Read; use std::path::Path; -fn main() { - let cfg = config::load(env::args().nth(1).unwrap().as_ref()); +use ofborg::config; +use ofborg::nix; +fn main() { ofborg::setup_log(); + log::info!("Loading config..."); + let cfg = config::load(env::args().nth(1).unwrap().as_ref()); let nix = cfg.nix(); + log::info!("Running build..."); match nix.safely_build_attrs( &Path::new("./"), nix::File::DefaultNixpkgs,