use of com.facebook.buck.apple.xcode.xcodeproj.PBXReference in project bazel by bazelbuild.
the class PbxReferencesGrouper method dirOfContainingPbxGroup.
/**
* The directory of the PBXGroup that will contain the given reference. For most references, this
* is just the actual parent directory. For {@code PBXVariantGroup}s, whose children are not
* guaranteed to be in any common directory except the client root, this returns the deepest
* common container of each child in the group.
*/
private Path dirOfContainingPbxGroup(PBXReference reference) {
if (reference instanceof PBXVariantGroup) {
PBXVariantGroup variantGroup = (PBXVariantGroup) reference;
Path path = Paths.get(variantGroup.getChildren().get(0).getPath());
for (PBXReference child : variantGroup.getChildren()) {
path = deepestCommonContainer(path, path(child.getPath()));
}
return path;
} else {
return parent(path(reference.getPath()));
}
}
use of com.facebook.buck.apple.xcode.xcodeproj.PBXReference in project buck by facebook.
the class ProjectGeneratorTest method testProjectStructureWithInfoPlist.
@Test
public void testProjectStructureWithInfoPlist() throws IOException {
BuildTarget libraryTarget = BuildTarget.builder(rootPath, "//foo", "lib").build();
BuildTarget bundleTarget = BuildTarget.builder(rootPath, "//foo", "bundle").build();
TargetNode<?, ?> libraryNode = AppleLibraryBuilder.createBuilder(libraryTarget).setExportedHeaders(ImmutableSortedSet.of(new FakeSourcePath("foo.h"))).build();
TargetNode<?, ?> bundleNode = AppleBundleBuilder.createBuilder(bundleTarget).setBinary(libraryTarget).setExtension(Either.ofLeft(AppleBundleExtension.FRAMEWORK)).setInfoPlist(new FakeSourcePath(("Info.plist"))).build();
ProjectGenerator projectGenerator = createProjectGeneratorForCombinedProject(ImmutableSet.of(libraryNode, bundleNode));
projectGenerator.createXcodeProjects();
PBXProject project = projectGenerator.getGeneratedProject();
PBXGroup bundleGroup = project.getMainGroup().getOrCreateChildGroupByName(bundleTarget.getFullyQualifiedName());
PBXGroup sourcesGroup = bundleGroup.getOrCreateChildGroupByName("Sources");
assertThat(bundleGroup.getChildren(), hasSize(2));
Iterable<String> childNames = Iterables.transform(sourcesGroup.getChildren(), PBXReference::getName);
assertThat(childNames, hasItem("Info.plist"));
}
Aggregations