Search in sources :

Example 1 with CopyFilePhaseDestinationSpec

use of com.facebook.buck.apple.xcode.xcodeproj.CopyFilePhaseDestinationSpec in project buck by facebook.

the class ProjectGenerator method getCopyFilesBuildPhases.

private ImmutableList<PBXBuildPhase> getCopyFilesBuildPhases(Iterable<TargetNode<?, ?>> copiedNodes) {
    // Bucket build rules into bins by their destinations
    ImmutableSetMultimap.Builder<CopyFilePhaseDestinationSpec, TargetNode<?, ?>> ruleByDestinationSpecBuilder = ImmutableSetMultimap.builder();
    for (TargetNode<?, ?> copiedNode : copiedNodes) {
        Optional<CopyFilePhaseDestinationSpec> optionalDestinationSpec = getDestinationSpec(copiedNode);
        if (optionalDestinationSpec.isPresent()) {
            ruleByDestinationSpecBuilder.put(optionalDestinationSpec.get(), copiedNode);
        }
    }
    ImmutableList.Builder<PBXBuildPhase> phases = ImmutableList.builder();
    ImmutableSetMultimap<CopyFilePhaseDestinationSpec, TargetNode<?, ?>> ruleByDestinationSpec = ruleByDestinationSpecBuilder.build();
    // Emit a copy files phase for each destination.
    for (CopyFilePhaseDestinationSpec destinationSpec : ruleByDestinationSpec.keySet()) {
        Iterable<TargetNode<?, ?>> targetNodes = ruleByDestinationSpec.get(destinationSpec);
        phases.add(getSingleCopyFilesBuildPhase(destinationSpec, targetNodes));
    }
    return phases.build();
}
Also used : CopyFilePhaseDestinationSpec(com.facebook.buck.apple.xcode.xcodeproj.CopyFilePhaseDestinationSpec) TargetNode(com.facebook.buck.rules.TargetNode) ImmutableSetMultimap(com.google.common.collect.ImmutableSetMultimap) ImmutableList(com.google.common.collect.ImmutableList) PBXBuildPhase(com.facebook.buck.apple.xcode.xcodeproj.PBXBuildPhase)

Aggregations

CopyFilePhaseDestinationSpec (com.facebook.buck.apple.xcode.xcodeproj.CopyFilePhaseDestinationSpec)1 PBXBuildPhase (com.facebook.buck.apple.xcode.xcodeproj.PBXBuildPhase)1 TargetNode (com.facebook.buck.rules.TargetNode)1 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableSetMultimap (com.google.common.collect.ImmutableSetMultimap)1