Skip to content

Commit d8e7991

Browse files
committed
Revert "chore(manifest) impl hash for build manifest"
This reverts commit 67ebbac. Hashing is done per file (raw), and not per build_manifest struct due to Blake3 not supporting it.
1 parent b04f1a6 commit d8e7991

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

src/build/mod.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ mod sources;
44

55
use anyhow::{Context, Result, bail};
66
use std::{
7-
collections::BTreeMap,
7+
collections::HashMap,
88
fs,
99
path::{Path, PathBuf},
1010
process::Command,
@@ -18,7 +18,7 @@ use crate::{
1818
use hash::calc_build_hash;
1919
use sources::get_sources;
2020

21-
#[derive(serde::Deserialize, serde::Serialize, Clone, Hash)]
21+
#[derive(serde::Deserialize, serde::Serialize, Clone)]
2222
struct BuildManifest {
2323
/// ID of this package, the main alias
2424
id: String,
@@ -46,11 +46,10 @@ struct BuildManifest {
4646
/// Useful for SDKs.
4747
sdks: Option<Vec<String>>,
4848
/// RUNTIME environment variables
49-
/// This is a `BTreeMap` due to `HashMap` not having the `hash` trait.
50-
env: Option<BTreeMap<String, String>>,
49+
env: Option<HashMap<String, String>>,
5150
}
5251

53-
#[derive(serde::Deserialize, serde::Serialize, Clone, Hash)]
52+
#[derive(serde::Deserialize, serde::Serialize, Clone)]
5453
struct Source {
5554
/// Should either be git, tar or local
5655
kind: String,
@@ -199,7 +198,7 @@ fn include_all(
199198
build_dir: &Path,
200199
repo_path: &Path,
201200
chunk_store_path: &Path,
202-
envs: &mut BTreeMap<String, String>,
201+
envs: &mut HashMap<String, String>,
203202
) -> Result<()> {
204203
for dependency in packages {
205204
let result = include(
@@ -224,7 +223,7 @@ fn include(
224223
path_to_include_at: &Path,
225224
repo_path: &Path,
226225
chunk_store_path: &Path,
227-
) -> Result<BTreeMap<String, String>> {
226+
) -> Result<HashMap<String, String>> {
228227
let dependency_build_manifest_path = search_path.join(dependency);
229228
let dependency_build_manifest: BuildManifest =
230229
serde_yaml::from_str(&fs::read_to_string(dependency_build_manifest_path)?)?;

src/repo/types.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::{collections::BTreeMap, path::PathBuf};
1+
use std::{collections::HashMap, path::PathBuf};
22

33
use crate::chunks::{Chunk, HashKind};
44

@@ -20,13 +20,13 @@ pub struct PackageManifest {
2020
pub chunks: Vec<Chunk>,
2121
pub commands: Vec<PathBuf>,
2222
/// Runtime environment variables
23-
pub env: Option<BTreeMap<String, String>>,
23+
pub env: Option<HashMap<String, String>>,
2424
#[serde(default = "build_hash_default")]
2525
pub build_hash: String,
2626
}
2727

2828
/// All of these are user visible, and should carry no actual weight.
29-
#[derive(serde::Deserialize, serde::Serialize, Debug, Clone, PartialEq, Eq, Hash)]
29+
#[derive(serde::Deserialize, serde::Serialize, Debug, Clone, PartialEq, Eq)]
3030
pub struct Metadata {
3131
pub title: Option<String>,
3232
pub description: Option<String>,

src/run/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ pub mod quicklaunch;
22

33
use anyhow::{Context, Result, bail};
44
use std::{
5-
collections::BTreeMap,
5+
collections::HashMap,
66
ffi::OsStr,
77
path::{Path, PathBuf},
88
process::{Command, ExitStatus},
@@ -44,7 +44,7 @@ pub fn start<S: AsRef<OsStr>>(
4444
let entrypoint = entrypoint.to_string_lossy();
4545
let entrypoint: &str = entrypoint.trim_start_matches('/');
4646

47-
let mut envs: BTreeMap<String, String> = package_manifest.env.unwrap_or_default();
47+
let mut envs: HashMap<String, String> = package_manifest.env.unwrap_or_default();
4848

4949
// I hate I have to do this.
5050
let keys_to_update: Vec<String> = envs

0 commit comments

Comments
 (0)