Search in sources :

Example 1 with GroupedSource

use of com.facebook.buck.apple.GroupedSource in project buck by facebook.

the class NewNativeTargetProjectMutator method traverseGroupsTreeAndHandleSources.

private void traverseGroupsTreeAndHandleSources(final PBXGroup sourcesGroup, final PBXSourcesBuildPhase sourcesBuildPhase, Iterable<GroupedSource> groupedSources) {
    GroupedSource.Visitor visitor = new GroupedSource.Visitor() {

        @Override
        public void visitSourceWithFlags(SourceWithFlags sourceWithFlags) {
            addSourcePathToSourcesBuildPhase(sourceWithFlags, sourcesGroup, sourcesBuildPhase);
        }

        @Override
        public void visitPublicHeader(SourcePath publicHeader) {
            addSourcePathToHeadersBuildPhase(publicHeader, sourcesGroup, HeaderVisibility.PUBLIC);
        }

        @Override
        public void visitPrivateHeader(SourcePath privateHeader) {
            addSourcePathToHeadersBuildPhase(privateHeader, sourcesGroup, HeaderVisibility.PRIVATE);
        }

        @Override
        public void visitSourceGroup(String sourceGroupName, Path sourceGroupPathRelativeToTarget, List<GroupedSource> sourceGroup) {
            PBXGroup newSourceGroup = sourcesGroup.getOrCreateChildGroupByName(sourceGroupName);
            newSourceGroup.setSourceTree(PBXReference.SourceTree.SOURCE_ROOT);
            newSourceGroup.setPath(sourceGroupPathRelativeToTarget.toString());
            // Sources groups stay in the order in which they're in the GroupedSource.
            newSourceGroup.setSortPolicy(PBXGroup.SortPolicy.UNSORTED);
            traverseGroupsTreeAndHandleSources(newSourceGroup, sourcesBuildPhase, sourceGroup);
        }
    };
    for (GroupedSource groupedSource : groupedSources) {
        groupedSource.visit(visitor);
    }
}
Also used : SourcePath(com.facebook.buck.rules.SourcePath) SourceTreePath(com.facebook.buck.apple.xcode.xcodeproj.SourceTreePath) Path(java.nio.file.Path) FrameworkPath(com.facebook.buck.rules.coercer.FrameworkPath) SourcePath(com.facebook.buck.rules.SourcePath) GroupedSource(com.facebook.buck.apple.GroupedSource) PBXGroup(com.facebook.buck.apple.xcode.xcodeproj.PBXGroup) List(java.util.List) ImmutableList(com.google.common.collect.ImmutableList) NSString(com.dd.plist.NSString) SourceWithFlags(com.facebook.buck.rules.SourceWithFlags)

Aggregations

NSString (com.dd.plist.NSString)1 GroupedSource (com.facebook.buck.apple.GroupedSource)1 PBXGroup (com.facebook.buck.apple.xcode.xcodeproj.PBXGroup)1 SourceTreePath (com.facebook.buck.apple.xcode.xcodeproj.SourceTreePath)1 SourcePath (com.facebook.buck.rules.SourcePath)1 SourceWithFlags (com.facebook.buck.rules.SourceWithFlags)1 FrameworkPath (com.facebook.buck.rules.coercer.FrameworkPath)1 ImmutableList (com.google.common.collect.ImmutableList)1 Path (java.nio.file.Path)1 List (java.util.List)1