Skip to content

Commit

Permalink
feat(target): get sdkroots
Browse files Browse the repository at this point in the history
  • Loading branch information
kkharji committed Jun 19, 2022
1 parent ace769e commit 5730d7b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/pbxproj/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,12 @@ fn test_demo1_representation() {
);

assert_eq!(1, project.projects().len());
let root_project = project.root_project();
println!("{:#?}", root_project.targets[0]);

let root_group = project.root_group();
assert_eq!(17, project.files().len());
println!("{:#?}", root_group.children);
// println!("{:#?}", root_group.children);
assert_eq!(3, root_group.children.len());
assert_eq!(None, root_group.name);
assert_eq!(None, root_group.path);
Expand Down
15 changes: 15 additions & 0 deletions src/pbxproj/object/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,21 @@ pub struct PBXTarget<'a> {
pub build_working_directory: Option<&'a String>,
}

impl<'a> PBXTarget<'a> {
/// get target's sdk roots from all build configuration settings
pub fn sdkroots(&self) -> Vec<&String> {
if let Some(ref bclist) = self.build_configuration_list {
bclist
.build_configurations
.iter()
.flat_map(|b| b.build_settings.get_string("SDKROOT"))
.collect::<Vec<&String>>()
} else {
Default::default()
}
}
}

impl<'a> AsPBXObject<'a> for PBXTarget<'a> {
fn as_pbx_object(
id: String,
Expand Down

0 comments on commit 5730d7b

Please sign in to comment.