mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-19 04:26:39 +00:00
Not add project_type if the manifest is in workspace root
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
3b95191f7e
commit
6cf28751c6
@ -107,6 +107,17 @@ fn create_osdk_manifest(cargo_metadata: &serde_json::Value, type_: &ProjectType)
|
|||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if is_in_virtual_workspace(cargo_metadata) {
|
||||||
|
// If the project is created in a workspace,
|
||||||
|
// the project type should be neither a project nor a library.
|
||||||
|
// FIXME: This is only a temporary fix to remove the project type,
|
||||||
|
// we may decide the actual type in the future.
|
||||||
|
let contents = contents.lines().skip(2).collect::<Vec<_>>().join("\n");
|
||||||
|
fs::write(osdk_manifest_path, contents).unwrap();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
fs::write(osdk_manifest_path, contents).unwrap();
|
fs::write(osdk_manifest_path, contents).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,3 +232,17 @@ fn check_rust_toolchain(toolchain: &toml::Table) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn is_in_virtual_workspace(cargo_metadata: &serde_json::Value) -> bool {
|
||||||
|
let cargo_manifeset_path = {
|
||||||
|
let workspace_root = get_workspace_root(cargo_metadata);
|
||||||
|
PathBuf::from(workspace_root).join("Cargo.toml")
|
||||||
|
};
|
||||||
|
|
||||||
|
let cargo_manifest = {
|
||||||
|
let content = fs::read_to_string(cargo_manifeset_path).unwrap();
|
||||||
|
toml::Table::from_str(&content).unwrap()
|
||||||
|
};
|
||||||
|
|
||||||
|
!cargo_manifest.contains_key("package")
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user