Skip to content

Commit

Permalink
Merge branch 'develop' into rm-legacy-lair
Browse files Browse the repository at this point in the history
  • Loading branch information
neonphog committed Aug 18, 2022
2 parents 3cad53d + d68051e commit 8e9161e
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 32 deletions.
3 changes: 3 additions & 0 deletions crates/hdi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@
//! <https://github.com/holochain/holochain/blob/develop/crates/test_utils/wasm/wasm_workspace/validate/src/integrity.rs>.
//! Many more validation examples can be browsed in that very workspace.
/// Current HDI rust crate version.
pub const HDI_VERSION: &str = env!("CARGO_PKG_VERSION");

pub use hdk_derive::hdk_entry_defs;
pub use hdk_derive::hdk_entry_helper;
pub use hdk_derive::hdk_extern;
Expand Down
5 changes: 5 additions & 0 deletions crates/hdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,11 @@
//!
//! [`hdk_extern!`]: hdk_derive::hdk_extern
pub use hdi::HDI_VERSION;

/// Current HDK rust crate version.
pub const HDK_VERSION: &str = env!("CARGO_PKG_VERSION");

#[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
const ERAND_INTERNAL: u32 = getrandom::Error::CUSTOM_START + 1;

Expand Down
1 change: 1 addition & 0 deletions crates/holochain/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## Unreleased

- **BREAKING CHANGE** - Removes legacy lair. You must now use lair-keystore >= 0.2.0 with holochain. It is recommended to abandon your previous holochain agents, as there is not a straight forward migration path. To migrate: [dump the old keys](https://github.com/holochain/lair/blob/v0.0.11/crates/lair_keystore/src/bin/lair-keystore/main.rs#L38) -> [write a utility to re-encode them](https://github.com/holochain/lair/tree/hc_seed_bundle-v0.1.2/crates/hc_seed_bundle) -> [then import them to the new lair](https://github.com/holochain/lair/tree/lair_keystore-v0.2.0/crates/lair_keystore#lair-keystore-import-seed---help) -- [\#1518](https://github.com/holochain/holochain/pull/1518)
- New solution for adding `hdi_version_req` field to the output of `--build-info` argument. [\#1523](https://github.com/holochain/holochain/pull/1523)

## 0.0.154

Expand Down
1 change: 1 addition & 0 deletions crates/holochain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ unwrap_to = { version = "0.1.0", optional = false }
arbitrary = { version = "1.0", features = ["derive"] }

[build-dependencies]
hdk = { version = "0.0.146", path = "../hdk"}
serde = { version = "1.0", features = [ "derive" ] }
serde_json = { version = "1.0.51" }
toml = "0.5.6"
Expand Down
43 changes: 11 additions & 32 deletions crates/holochain/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ mod version_info {
#[derive(Serialize, Debug)]
struct BuildInfo {
git_info: Option<GitInfo>,
cargo_pkg_version: String,
hdk_version_req: String,
cargo_pkg_version: &'static str,
hdk_version_req: &'static str,
hdi_version_req: &'static str,

timestamp: DateTime<Utc>,
hostname: String,
Expand Down Expand Up @@ -67,30 +68,6 @@ mod version_info {
}
}

fn hdk_version_req() -> String {
use std::str::FromStr;
use toml::Value;

let manifest_path =
std::path::PathBuf::from_str(option_env!("CARGO_MANIFEST_DIR").unwrap_or("."))
.unwrap()
.join("Cargo.toml");
let manifest = std::fs::read_to_string(&manifest_path)
.unwrap_or_else(|e| panic!("reading {:?}: {}", &manifest_path, e));

let manifest_toml = Value::from_str(&manifest).expect("parsing manifest");

let table = manifest_toml.as_table().unwrap();
let hdk_dep = &table["dependencies"]["hdk"];

match hdk_dep {
Value::Table(hdk) => hdk["version"].to_string(),
Value::String(hdk_version) => hdk_version.to_string(),
other => panic!("unexpected hdk_dep {:?}", other),
}
.replace('"', "")
}

impl BuildInfo {
fn retrieve() -> Self {
let rustc_version = Command::new(option_env!("RUSTC").unwrap_or("rustc"))
Expand All @@ -105,9 +82,10 @@ mod version_info {
.to_string();

BuildInfo {
cargo_pkg_version: std::env::var("CARGO_PKG_VERSION").unwrap_or_default(),
cargo_pkg_version: env!("CARGO_PKG_VERSION"),
git_info: GitInfo::maybe_retrieve(),
hdk_version_req: hdk_version_req(),
hdk_version_req: hdk::HDK_VERSION,
hdi_version_req: hdk::HDI_VERSION,

timestamp: SystemTime::now().into(),
hostname,
Expand All @@ -131,10 +109,11 @@ mod version_info {
/// This will be used populate the VERSION_INFO environment variable,
/// which will be displayed as JSON when `holochain --version-info` is called.
pub(crate) fn populate_env() {
println!(
"cargo:rustc-env=BUILD_INFO={}",
BuildInfo::retrieve().as_json_string()
);
let json = BuildInfo::retrieve().as_json_string();
println!("cargo:rustc-env=BUILD_INFO={}", json);

// incase you want to debug the output:
//println!("cargo:warning={}", json);
}
}

Expand Down
9 changes: 9 additions & 0 deletions crates/holochain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
// We have a lot of usages of type aliases to `&String`, which clippy objects to.
#![allow(clippy::ptr_arg)]

#[cfg(feature = "hdk")]
pub use hdk::HDI_VERSION;

#[cfg(feature = "hdk")]
pub use hdk::HDK_VERSION;

/// Current Holochain Conductor rust crate version.
pub const HOLOCHAIN_VERSION: &str = env!("CARGO_PKG_VERSION");

pub mod conductor;
#[allow(missing_docs)]
pub mod core;
Expand Down

0 comments on commit 8e9161e

Please sign in to comment.