use of com.facebook.buck.apple.xcode.xcodeproj.PBXAggregateTarget in project buck by facebook.
the class ProjectGenerator method generateBuildWithBuckTarget.
private void generateBuildWithBuckTarget(TargetNode<?, ?> targetNode) {
final BuildTarget buildTarget = targetNode.getBuildTarget();
String buckTargetProductName = getXcodeTargetName(buildTarget) + BUILD_WITH_BUCK_POSTFIX;
PBXAggregateTarget buildWithBuckTarget = new PBXAggregateTarget(buckTargetProductName);
buildWithBuckTarget.setProductName(buckTargetProductName);
PBXShellScriptBuildPhase buildShellScriptBuildPhase = new PBXShellScriptBuildPhase();
buildShellScriptBuildPhase.setShellScript(getBuildWithBuckShellScript(targetNode));
buildWithBuckTarget.getBuildPhases().add(buildShellScriptBuildPhase);
// Only add a shell script for fixing UUIDs if it is an AppleBundle
if (targetNode.getDescription() instanceof AppleBundleDescription) {
PBXShellScriptBuildPhase codesignPhase = new PBXShellScriptBuildPhase();
codesignPhase.setShellScript(getCodesignShellScript(targetNode));
buildWithBuckTarget.getBuildPhases().add(codesignPhase);
}
TargetNode<CxxLibraryDescription.Arg, ?> node = getAppleNativeNode(targetGraph, targetNode).get();
ImmutableMap<String, ImmutableMap<String, String>> configs = getXcodeBuildConfigurationsForTargetNode(node, ImmutableMap.of()).get();
XCConfigurationList configurationList = new XCConfigurationList();
PBXGroup group = project.getMainGroup().getOrCreateDescendantGroupByPath(StreamSupport.stream(buildTarget.getBasePath().spliterator(), false).map(Object::toString).collect(MoreCollectors.toImmutableList())).getOrCreateChildGroupByName(getXcodeTargetName(buildTarget));
for (String configurationName : configs.keySet()) {
XCBuildConfiguration configuration = configurationList.getBuildConfigurationsByName().getUnchecked(configurationName);
configuration.setBaseConfigurationReference(getConfigurationFileReference(group, getConfigurationNameToXcconfigPath(buildTarget).apply(configurationName)));
NSDictionary inlineSettings = new NSDictionary();
inlineSettings.put("HEADER_SEARCH_PATHS", "");
inlineSettings.put("LIBRARY_SEARCH_PATHS", "");
inlineSettings.put("FRAMEWORK_SEARCH_PATHS", "");
configuration.setBuildSettings(inlineSettings);
}
buildWithBuckTarget.setBuildConfigurationList(configurationList);
project.getTargets().add(buildWithBuckTarget);
targetNodeToGeneratedProjectTargetBuilder.put(targetNode, buildWithBuckTarget);
}
Aggregations