Skip to content

Commit 0482dc3

Browse files
lorixxfacebook-github-bot
authored andcommitted
SPM number10 - fix the internal build
Summary: Follow up with the PR: Instagram#1487 and to resolve some of the internal build failure. = Facebook = This is to follow up with the PR diff: D30428297 to fix the internal BUCK build error. Differential Revision: D30437725 fbshipit-source-id: 8eb6a48a614a857806ee0ab3152707e9b4fd147a
1 parent 99e5675 commit 0482dc3

14 files changed

+103
-30
lines changed

Source/IGListDiffKit/IGListBatchUpdateData.mm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@
1313

1414
#import <unordered_map>
1515

16+
#if !__has_include(<IGListDiffKit/IGListDiffKit.h>)
1617
#import "IGListAssert.h"
18+
#else
19+
#import <IGListDiffKit/IGListAssert.h>
20+
#endif
21+
1722
#import "IGListCompatibility.h"
1823

1924
// Plucks the given move from available moves and turns it into a delete + insert

Source/IGListDiffKit/Internal/IGListIndexSetResultInternal.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77

88
#import <Foundation/Foundation.h>
99

10+
#if !__has_include(<IGListDiffKit/IGListDiffKit.h>)
1011
#import "IGListIndexSetResult.h"
12+
#else
13+
#import <IGListDiffKit/IGListIndexSetResult.h>
14+
#endif
1115

1216
NS_ASSUME_NONNULL_BEGIN
1317

Source/IGListKit/IGListAdapter.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77

88
#import "IGListAdapterInternal.h"
99

10+
#if !__has_include(<IGListDiffKit/IGListDiffKit.h>)
1011
#import "IGListAssert.h"
12+
#else
13+
#import <IGListDiffKit/IGListAssert.h>
14+
#endif
1115
#import "IGListAdapterUpdater.h"
1216
#import "IGListSupplementaryViewSource.h"
1317

Source/IGListKit/IGListAdapterDataSource.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77

88
#import <UIKit/UIKit.h>
99

10+
#if !__has_include(<IGListDiffKit/IGListDiffKit.h>)
1011
#import "IGListDiffable.h"
12+
#else
13+
#import <IGListDiffKit/IGListDiffable.h>
14+
#endif
15+
1116

1217
@class IGListAdapter;
1318
@class IGListSectionController;

Source/IGListKit/IGListBindingSectionController.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77

88
#import <Foundation/Foundation.h>
99

10+
#if !__has_include(<IGListDiffKit/IGListDiffKit.h>)
1011
#import "IGListMacros.h"
12+
#else
13+
#import <IGListDiffKit/IGListMacros.h>
14+
#endif
15+
1116
#import "IGListBindingSectionControllerDataSource.h"
1217
#import "IGListBindingSectionControllerSelectionDelegate.h"
1318
#import "IGListSectionController.h"

Source/IGListKit/IGListBindingSectionController.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77

88
#import "IGListBindingSectionController.h"
99

10+
#if !__has_include(<IGListDiffKit/IGListDiffKit.h>)
1011
#import "IGListAssert.h"
12+
#else
13+
#import <IGListDiffKit/IGListAssert.h>
14+
#endif
1115
#import "IGListBindable.h"
1216

1317
#import "IGListArrayUtilsInternal.h"

Source/IGListKit/IGListCollectionViewLayout.mm

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010

1111
#import <vector>
1212

13+
#if !__has_include(<IGListDiffKit/IGListDiffKit.h>)
1314
#import "IGListAssert.h"
15+
#else
16+
#import <IGListDiffKit/IGListAssert.h>
17+
#endif
1418
#import "IGListCollectionViewDelegateLayout.h"
1519

1620
#import "UIScrollView+IGListKit.h"
@@ -500,32 +504,32 @@ - (void)_calculateLayoutIfNeeded {
500504
const UIEdgeInsets insets = [delegate collectionView:collectionView layout:self insetForSectionAtIndex:section];
501505
const CGFloat lineSpacing = [delegate collectionView:collectionView layout:self minimumLineSpacingForSectionAtIndex:section];
502506
const CGFloat interitemSpacing = [delegate collectionView:collectionView layout:self minimumInteritemSpacingForSectionAtIndex:section];
503-
507+
504508
const CGSize paddedCollectionViewSize = UIEdgeInsetsInsetRect(contentInsetAdjustedCollectionViewBounds, insets).size;
505509
const UICollectionViewScrollDirection fixedDirection = self.scrollDirection == UICollectionViewScrollDirectionHorizontal ? UICollectionViewScrollDirectionVertical : UICollectionViewScrollDirectionHorizontal;
506510
const CGFloat paddedLengthInFixedDirection = CGSizeGetLengthInDirection(paddedCollectionViewSize, fixedDirection);
507511
const CGFloat headerLengthInScrollDirection = hideHeaderWhenItemsEmpty ? 0 : CGSizeGetLengthInDirection(headerSize, self.scrollDirection);
508512
const CGFloat footerLengthInScrollDirection = hideHeaderWhenItemsEmpty ? 0 : CGSizeGetLengthInDirection(footerSize, self.scrollDirection);
509513
const BOOL headerExists = headerLengthInScrollDirection > 0;
510514
const BOOL footerExists = footerLengthInScrollDirection > 0;
511-
515+
512516
// start the section accounting for the header size
513517
// header length in scroll direction is subtracted from the sectionBounds when calculating the header bounds after items are done
514518
// this bumps the first row of items over enough to make room for the header
515519
itemCoordInScrollDirection += headerLengthInScrollDirection;
516520
nextRowCoordInScrollDirection += headerLengthInScrollDirection;
517-
521+
518522
// add the leading inset in fixed direction in case the section falls on the same row as the previous
519523
// if the section is newlined then the coord in fixed direction is reset
520524
itemCoordInFixedDirection += UIEdgeInsetsLeadingInsetInDirection(insets, fixedDirection);
521-
525+
522526
// the farthest in the fixed direction the frame of an item in this section can go
523527
const CGFloat maxCoordinateInFixedDirection = CGRectGetLengthInDirection(contentInsetAdjustedCollectionViewBounds, fixedDirection) - UIEdgeInsetsTrailingInsetInDirection(insets, fixedDirection);
524-
528+
525529
for (NSInteger item = 0; item < itemCount; item++) {
526530
NSIndexPath *indexPath = [NSIndexPath indexPathForItem:item inSection:section];
527531
const CGSize size = [delegate collectionView:collectionView layout:self sizeForItemAtIndexPath:indexPath];
528-
532+
529533
IGAssert(CGSizeGetLengthInDirection(size, fixedDirection) <= paddedLengthInFixedDirection
530534
|| fabs(CGSizeGetLengthInDirection(size, fixedDirection) - paddedLengthInFixedDirection) < FLT_EPSILON,
531535
@"%@ of item %li in section %li (%.0f pt) must be less than or equal to container (%.0f pt) accounting for section insets %@",
@@ -535,9 +539,9 @@ - (void)_calculateLayoutIfNeeded {
535539
CGSizeGetLengthInDirection(size, fixedDirection),
536540
CGRectGetLengthInDirection(contentInsetAdjustedCollectionViewBounds, fixedDirection),
537541
NSStringFromUIEdgeInsets(insets));
538-
542+
539543
CGFloat itemLengthInFixedDirection = MIN(CGSizeGetLengthInDirection(size, fixedDirection), paddedLengthInFixedDirection);
540-
544+
541545
// if the origin and length in fixed direction of the item busts the size of the container
542546
// or if this is the first item and the header has a non-zero size
543547
// newline to the next row and reset
@@ -547,19 +551,19 @@ - (void)_calculateLayoutIfNeeded {
547551
|| (item == 0 && headerExists)) {
548552
itemCoordInScrollDirection = nextRowCoordInScrollDirection;
549553
itemCoordInFixedDirection = UIEdgeInsetsLeadingInsetInDirection(insets, fixedDirection);
550-
551-
554+
555+
552556
// if newlining, always append line spacing unless its the very first item of the section
553557
if (item > 0) {
554558
itemCoordInScrollDirection += lineSpacing;
555559
}
556560
}
557-
561+
558562
const CGFloat distanceToEdge = paddedLengthInFixedDirection - (itemCoordInFixedDirection + itemLengthInFixedDirection);
559563
if (self.stretchToEdge && distanceToEdge > 0 && distanceToEdge <= epsilon) {
560564
itemLengthInFixedDirection = paddedLengthInFixedDirection - itemCoordInFixedDirection;
561565
}
562-
566+
563567
const CGRect rawFrame = (self.scrollDirection == UICollectionViewScrollDirectionVertical) ?
564568
CGRectMake(itemCoordInFixedDirection,
565569
itemCoordInScrollDirection + insets.top,
@@ -570,23 +574,23 @@ - (void)_calculateLayoutIfNeeded {
570574
size.width,
571575
itemLengthInFixedDirection);
572576
const CGRect frame = IGListRectIntegralScaled(rawFrame);
573-
577+
574578
_sectionData[section].itemBounds[item] = frame;
575-
579+
576580
// track the max size of the row to find the coord of the next row, adjust for leading inset while iterating items
577581
nextRowCoordInScrollDirection = MAX(CGRectGetMaxInDirection(frame, self.scrollDirection) - UIEdgeInsetsLeadingInsetInDirection(insets, self.scrollDirection), nextRowCoordInScrollDirection);
578-
582+
579583
// increase the rolling coord in fixed direction appropriately and add item spacing for all items on the same row
580584
itemCoordInFixedDirection += itemLengthInFixedDirection + interitemSpacing;
581-
585+
582586
// union the rolling section bounds
583587
if (item == 0) {
584588
rollingSectionBounds = frame;
585589
} else {
586590
rollingSectionBounds = CGRectUnion(rollingSectionBounds, frame);
587591
}
588592
}
589-
593+
590594
const CGRect headerBounds = self.scrollDirection == UICollectionViewScrollDirectionVertical ?
591595
CGRectMake(insets.left,
592596
itemsEmpty ? CGRectGetMaxY(rollingSectionBounds) : CGRectGetMinY(rollingSectionBounds) - headerSize.height,
@@ -596,13 +600,13 @@ - (void)_calculateLayoutIfNeeded {
596600
insets.top,
597601
hideHeaderWhenItemsEmpty ? 0 : headerSize.width,
598602
paddedLengthInFixedDirection);
599-
603+
600604
_sectionData[section].headerBounds = headerBounds;
601-
605+
602606
if (itemsEmpty) {
603607
rollingSectionBounds = headerBounds;
604608
}
605-
609+
606610
const CGRect footerBounds = (self.scrollDirection == UICollectionViewScrollDirectionVertical) ?
607611
CGRectMake(insets.left,
608612
CGRectGetMaxY(rollingSectionBounds),
@@ -612,9 +616,9 @@ - (void)_calculateLayoutIfNeeded {
612616
insets.top,
613617
hideHeaderWhenItemsEmpty ? 0 : footerSize.width,
614618
paddedLengthInFixedDirection);
615-
619+
616620
_sectionData[section].footerBounds = footerBounds;
617-
621+
618622
// union the header before setting the bounds of the section
619623
// only do this when the header has a size, otherwise the union stretches to box empty space
620624
if (headerExists) {
@@ -623,28 +627,28 @@ - (void)_calculateLayoutIfNeeded {
623627
if (footerExists) {
624628
rollingSectionBounds = CGRectUnion(rollingSectionBounds, footerBounds);
625629
}
626-
630+
627631
_sectionData[section].bounds = rollingSectionBounds;
628632
_sectionData[section].insets = insets;
629-
633+
630634
// bump the coord for the next section with the right insets
631635
itemCoordInFixedDirection += UIEdgeInsetsTrailingInsetInDirection(insets, fixedDirection);
632-
636+
633637
// find the farthest point in the section and add the trailing inset to find the next row's coord
634638
nextRowCoordInScrollDirection = MAX(nextRowCoordInScrollDirection, CGRectGetMaxInDirection(rollingSectionBounds, self.scrollDirection) + UIEdgeInsetsTrailingInsetInDirection(insets, self.scrollDirection));
635-
639+
636640
// keep track of coordinates for partial invalidation
637641
_sectionData[section].lastItemCoordInScrollDirection = itemCoordInScrollDirection;
638642
_sectionData[section].lastItemCoordInFixedDirection = itemCoordInFixedDirection;
639643
_sectionData[section].lastNextRowCoordInScrollDirection = nextRowCoordInScrollDirection;
640644
}
641-
645+
642646
_minimumInvalidatedSection = NSNotFound;
643647
}
644648

645649
- (NSRange)_rangeOfSectionsInRect:(CGRect)rect {
646650
NSRange result = NSMakeRange(NSNotFound, 0);
647-
651+
648652
const NSInteger sectionCount = _sectionData.size();
649653
for (NSInteger section = 0; section < sectionCount; section++) {
650654
IGListSectionEntry entry = _sectionData[section];
@@ -657,7 +661,7 @@ - (NSRange)_rangeOfSectionsInRect:(CGRect)rect {
657661
}
658662
}
659663
}
660-
664+
661665
return result;
662666
}
663667

Source/IGListKit/IGListKit.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8+
#if !__has_include(<IGListDiffKit/IGListDiffKit.h>)
89
#import "IGListCompatibility.h"
10+
#else
11+
#import <IGListDiffKit/IGListCompatibility.h>
12+
#endif
913

1014
/**
1115
* Project version number for IGListKit.
@@ -52,6 +56,7 @@ FOUNDATION_EXPORT const unsigned char IGListKitVersionString[];
5256

5357
// Shared (iOS, tvOS, macOS compatible):
5458

59+
#if !__has_include(<IGListDiffKit/IGListDiffKit.h>)
5560
#import "IGListAssert.h"
5661
#import "IGListBatchUpdateData.h"
5762
#import "IGListDiff.h"
@@ -63,4 +68,16 @@ FOUNDATION_EXPORT const unsigned char IGListKitVersionString[];
6368
#import "IGListMoveIndexPath.h"
6469
#import "NSNumber+IGListDiffable.h"
6570
#import "NSString+IGListDiffable.h"
66-
71+
#else
72+
#import <IGListDiffKit/IGListAssert.h>
73+
#import <IGListDiffKit/IGListBatchUpdateData.h>
74+
#import <IGListDiffKit/IGListDiff.h>
75+
#import <IGListDiffKit/IGListDiffable.h>
76+
#import <IGListDiffKit/IGListExperiments.h>
77+
#import <IGListDiffKit/IGListIndexPathResult.h>
78+
#import <IGListDiffKit/IGListIndexSetResult.h>
79+
#import <IGListDiffKit/IGListMoveIndex.h>
80+
#import <IGListDiffKit/IGListMoveIndexPath.h>
81+
#import <IGListDiffKit/NSNumber+IGListDiffable.h>
82+
#import <IGListDiffKit/NSString+IGListDiffable.h>
83+
#endif

Source/IGListKit/IGListSingleSectionController.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77

88
#import "IGListSingleSectionController.h"
99

10+
#if !__has_include(<IGListDiffKit/IGListDiffKit.h>)
1011
#import "IGListAssert.h"
12+
#else
13+
#import <IGListDiffKit/IGListAssert.h>
14+
#endif
15+
1116

1217
@interface IGListSingleSectionController ()
1318

Source/IGListKit/Internal/IGListAdapter+UICollectionView.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77

88
#import "IGListAdapter+UICollectionView.h"
99

10+
#if !__has_include(<IGListDiffKit/IGListDiffKit.h>)
1011
#import "IGListAssert.h"
12+
#else
13+
#import <IGListDiffKit/IGListAssert.h>
14+
#endif
1115
#import "IGListAdapterInternal.h"
1216
#import "IGListSectionController.h"
1317
#import "IGListSectionControllerInternal.h"

0 commit comments

Comments
 (0)