mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-08 04:56:43 +00:00
Merge pull request #712 from betrusted-io/dabao-console-default
make dabao-console a default app for the dabao target
This commit is contained in:
commit
05c9828106
2 changed files with 39 additions and 1 deletions
|
|
@ -461,6 +461,36 @@ impl Builder {
|
|||
self
|
||||
}
|
||||
|
||||
/// Searches through the services and apps name spaces and removes duplicates
|
||||
pub fn deduplicate_processes(&mut self) {
|
||||
let mut pid_names = Vec::<String>::new();
|
||||
let mut dup_indices = Vec::<(usize, usize)>::new();
|
||||
{
|
||||
// ensure the borrows that compose name_spaces go out of scope after searching for duplicates
|
||||
let name_spaces = [&self.services, &self.apps];
|
||||
for (ns, name_space) in name_spaces.iter().enumerate() {
|
||||
for (i, service) in name_space.iter().enumerate() {
|
||||
if let Some(name) = &service.name() {
|
||||
if pid_names.contains(&name) {
|
||||
dup_indices.push((ns, i));
|
||||
} else {
|
||||
pid_names.push(name.to_owned());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if dup_indices.len() > 0 {
|
||||
println!("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
|
||||
for (dupe_ns, dupe_i) in dup_indices {
|
||||
let removed =
|
||||
if dupe_ns == 0 { self.services.remove(dupe_i) } else { self.apps.remove(dupe_i) };
|
||||
println!("WARNING: Found duplicate package name, removing later instances of {:?}", removed);
|
||||
}
|
||||
println!("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
|
||||
}
|
||||
}
|
||||
|
||||
/// add a feature to be passed on to services
|
||||
pub fn add_feature(&mut self, feature: &str) -> &mut Builder {
|
||||
self.features.push(feature.into());
|
||||
|
|
|
|||
|
|
@ -787,7 +787,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
// minimal set of services for app development on a dabao. Need to save space for the app itself!
|
||||
let bao_rram_pkgs =
|
||||
["xous-ticktimer", "xous-log", "xous-names", "usb-bao1x", "bao1x-hal-service"].to_vec();
|
||||
let bao_app_pkgs: Vec<&'static str> = [].to_vec();
|
||||
let bao_app_pkgs: Vec<&'static str> = ["dabao-console"].to_vec();
|
||||
|
||||
builder.add_loader_feature("debug-print");
|
||||
builder.add_kernel_feature("v2p");
|
||||
|
|
@ -833,6 +833,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
// clean up any duplicates - this is an artifact of wanting to include dabao-console
|
||||
// as a "default app" to make behavior more intuitive for beginners trying out dabao,
|
||||
// but also wanting to list it in the UI as an app so that developers are /aware/ of
|
||||
// dabao-console as an app they can modify. Simply hiding it by sticking it in the services
|
||||
// directory makes in hard to discover. Maybe this will be changed to handle it entirely
|
||||
// at the UI layer but anyways - this avoids accidental duplicate processes which is a good thing
|
||||
// in general.
|
||||
builder.deduplicate_processes();
|
||||
builder.build()?;
|
||||
|
||||
// the intent of this call is to check that crates we are sourcing from crates.io
|
||||
|
|
|
|||
Loading…
Reference in a new issue