MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / source_key

Function source_key

crates/os-runtime/build.rs:58–83  ·  view source on GitHub ↗
(rel: &Path)

Source from the content-addressed store, hash-verified

56 if path.extension().and_then(|ext| ext.to_str()) != Some("hll") {
57 continue;
58 }
59 let rel = path.strip_prefix(manifest_dir).expect("source under crate");
60 let key = source_key(rel);
61 let rel = rel.to_string_lossy().replace('\\', "/");
62 out.push(Source { key, rel, path });
63 }
64}
65
66fn source_key(rel: &Path) -> String {
67 let components: Vec<String> = rel
68 .components()
69 .map(|component| component.as_os_str().to_string_lossy().into_owned())
70 .collect();
71 let stem = rel
72 .file_stem()
73 .and_then(|stem| stem.to_str())
74 .expect("hll stem");
75
76 if components == ["stdlib", "hosted", "console.hll"] {
77 "console_hosted".to_owned()
78 } else if components == ["stdlib", "hosted", "cstr.hll"] {
79 "cstr_hosted".to_owned()
80 } else if components == ["stdlib", "hosted", "heap_source.hll"] {
81 "heap_source_hosted".to_owned()
82 } else if components == ["stdlib", "hosted", "runtime.hll"] {
83 "runtime_hosted".to_owned()
84 } else if components == ["stdlib", "hosted", "sys.hll"] {
85 "sys_hosted".to_owned()
86 } else if components == ["kernel", "core", "entry.hll"] {

Callers 1

collect_sourcesFunction · 0.85

Calls 1

collectMethod · 0.80

Tested by

no test coverage detected