use of com.facebook.buck.apple.xcode.xcodeproj.SourceTreePath in project buck by facebook.
the class NewNativeTargetProjectMutator method addFrameworksBuildPhase.
private void addFrameworksBuildPhase(PBXProject project, PBXNativeTarget target) {
if (frameworks.isEmpty() && archives.isEmpty()) {
return;
}
PBXGroup sharedFrameworksGroup = project.getMainGroup().getOrCreateChildGroupByName("Frameworks");
PBXFrameworksBuildPhase frameworksBuildPhase = new PBXFrameworksBuildPhase();
target.getBuildPhases().add(frameworksBuildPhase);
for (FrameworkPath framework : frameworks) {
SourceTreePath sourceTreePath;
if (framework.getSourceTreePath().isPresent()) {
sourceTreePath = framework.getSourceTreePath().get();
} else if (framework.getSourcePath().isPresent()) {
sourceTreePath = new SourceTreePath(PBXReference.SourceTree.SOURCE_ROOT, pathRelativizer.outputPathToSourcePath(framework.getSourcePath().get()), Optional.empty());
} else {
throw new RuntimeException();
}
PBXFileReference fileReference = sharedFrameworksGroup.getOrCreateFileReferenceBySourceTreePath(sourceTreePath);
frameworksBuildPhase.getFiles().add(new PBXBuildFile(fileReference));
}
for (PBXFileReference archive : archives) {
frameworksBuildPhase.getFiles().add(new PBXBuildFile(archive));
}
}
Aggregations