use of com.facebook.buck.apple.XcodeScriptDescriptionArg in project buck by facebook.
the class NewNativeTargetProjectMutator method createScriptsForTargetNodes.
private ImmutableList<PBXShellScriptBuildPhase> createScriptsForTargetNodes(Iterable<TargetNode<?, ?>> nodes) throws IllegalStateException {
ImmutableList.Builder<PBXShellScriptBuildPhase> builder = ImmutableList.builder();
for (TargetNode<?, ?> node : nodes) {
PBXShellScriptBuildPhase shellScriptBuildPhase = new PBXShellScriptBuildPhase();
boolean nodeIsPrebuildScript = node.getDescription() instanceof XcodePrebuildScriptDescription;
boolean nodeIsPostbuildScript = node.getDescription() instanceof XcodePostbuildScriptDescription;
if (nodeIsPrebuildScript || nodeIsPostbuildScript) {
XcodeScriptDescriptionArg arg = (XcodeScriptDescriptionArg) node.getConstructorArg();
shellScriptBuildPhase.getInputPaths().addAll(FluentIterable.from(arg.srcs).transform(sourcePathResolver).transform(pathRelativizer::outputDirToRootRelative).transform(Object::toString).toSet());
shellScriptBuildPhase.getOutputPaths().addAll(arg.outputs);
shellScriptBuildPhase.setShellScript(arg.cmd);
} else if (node.getDescription() instanceof IosReactNativeLibraryDescription) {
shellScriptBuildPhase.setShellScript(generateXcodeShellScript(node));
} else {
// unreachable
throw new IllegalStateException("Invalid rule type for shell script build phase");
}
builder.add(shellScriptBuildPhase);
}
return builder.build();
}
Aggregations