Search in sources :

Example 1 with XcodeScriptDescriptionArg

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();
}
Also used : XcodeScriptDescriptionArg(com.facebook.buck.apple.XcodeScriptDescriptionArg) PBXShellScriptBuildPhase(com.facebook.buck.apple.xcode.xcodeproj.PBXShellScriptBuildPhase) XcodePostbuildScriptDescription(com.facebook.buck.apple.XcodePostbuildScriptDescription) ImmutableList(com.google.common.collect.ImmutableList) XcodePrebuildScriptDescription(com.facebook.buck.apple.XcodePrebuildScriptDescription) IosReactNativeLibraryDescription(com.facebook.buck.js.IosReactNativeLibraryDescription)

Aggregations

XcodePostbuildScriptDescription (com.facebook.buck.apple.XcodePostbuildScriptDescription)1 XcodePrebuildScriptDescription (com.facebook.buck.apple.XcodePrebuildScriptDescription)1 XcodeScriptDescriptionArg (com.facebook.buck.apple.XcodeScriptDescriptionArg)1 PBXShellScriptBuildPhase (com.facebook.buck.apple.xcode.xcodeproj.PBXShellScriptBuildPhase)1 IosReactNativeLibraryDescription (com.facebook.buck.js.IosReactNativeLibraryDescription)1 ImmutableList (com.google.common.collect.ImmutableList)1