Skip to content

Commit 4c483f8

Browse files
committed
added "sh build.sh build_listkit_xcode_spm_integration"
1 parent 4ef0cc7 commit 4c483f8

File tree

11 files changed

+73
-57
lines changed

11 files changed

+73
-57
lines changed

.github/workflows/ci-pull-requests-only.yml

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,3 @@ jobs:
2525
- name: Run build script
2626
run: ./build.sh ${{ matrix.mode }}
2727

28-
SPM:
29-
name: Build from SPM manifest
30-
runs-on: macOS-latest
31-
env:
32-
DEVELOPER_DIR: /Applications/Xcode_12.1.1.app/Contents/Developer
33-
strategy:
34-
matrix:
35-
destination: ["platform=iOS Simulator,name=iPhone 12 Pro", "platform=macOS,variant=Mac Catalyst", "platform=tvOS Simulator,name=Apple TV 4k"]
36-
scheme: ["AsyncDisplayKit", "AsyncDisplayKitIGListKit"]
37-
steps:
38-
- name: Checkout
39-
uses: actions/checkout@v2
40-
41-
# Starting from Xcode 11 `xcodebuild` supports SwiftPM packages out of the box
42-
# to test that we have valid swift package we need to remove existing *.xcodeproj/xcworkspace
43-
# `xcodebuild` will invoke Package.swift.
44-
- name: spm's xcodebuild - ${{ matrix.destination }}
45-
run: |
46-
set -o pipefail
47-
rm -rf AsyncDisplayKit.xcodeproj/
48-
rm -rf AsyncDisplayKit.xcworkspace/
49-
xcodebuild clean build -scheme "${{ matrix.scheme }}" -destination "${{ matrix.destination }}"
50-

.github/workflows/ci.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
name: Build from SPM manifest
3939
runs-on: macOS-latest
4040
env:
41-
DEVELOPER_DIR: /Applications/Xcode_12.1.1.app/Contents/Developer
41+
DEVELOPER_DIR: /Applications/Xcode_12.2.app/Contents/Developer
4242
strategy:
4343
matrix:
4444
destination: ["platform=iOS Simulator,name=iPhone 12 Pro", "platform=macOS,variant=Mac Catalyst", "platform=tvOS Simulator,name=Apple TV 4k"]
@@ -56,3 +56,15 @@ jobs:
5656
rm -rf AsyncDisplayKit.xcodeproj/
5757
rm -rf AsyncDisplayKit.xcworkspace/
5858
xcodebuild clean build -scheme "${{ matrix.scheme }}" -destination "${{ matrix.destination }}"
59+
60+
Xcode-SPM-Integration:
61+
name: Build example project to verify Xcode's SPM integration
62+
runs-on: macOS-latest
63+
env:
64+
DEVELOPER_DIR: /Applications/Xcode_12.2.app/Contents/Developer
65+
steps:
66+
- name: Checkout
67+
uses: actions/checkout@v2
68+
69+
- name: Check xcode's spm integration
70+
run: ./build.sh build_listkit_xcode_spm_integration

Source/AsyncDisplayKit+IGListKitMethods.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#import <UIKit/UIKit.h>
1616
#import "ASBaseDefines.h"
1717

18-
#if __has_include("IGListKit.h")
18+
#if !__has_include(<IGListKit/IGListKit.h>)
1919
#import "IGListKit.h"
2020
#else
2121
#import <IGListKit/IGListKit.h>

Source/Details/ASPINRemoteImageDownloader.mm

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,37 +16,36 @@
1616
#import "ASThread.h"
1717
#import "ASImageContainerProtocolCategories.h"
1818

19-
#if !SWIFT_PACKAGE
20-
21-
#if __has_include (<PINRemoteImage/PINGIFAnimatedImage.h>)
19+
#if __has_include(<PINRemoteImage/PINGIFAnimatedImage.h>) || __has_include("PINGIFAnimatedImage.h")
2220
#define PIN_ANIMATED_AVAILABLE 1
23-
#import <PINRemoteImage/PINCachedAnimatedImage.h>
24-
#import <PINRemoteImage/PINAlternateRepresentationProvider.h>
21+
#if __has_include(<PINRemoteImage/PINGIFAnimatedImage.h>)
22+
#import <PINRemoteImage/PINCachedAnimatedImage.h>
23+
#import <PINRemoteImage/PINAlternateRepresentationProvider.h>
2524
#else
26-
#define PIN_ANIMATED_AVAILABLE 0
25+
#import "PINCachedAnimatedImage.h"
26+
#import "PINAlternateRepresentationProvider.h"
2727
#endif
28+
#else
29+
#define PIN_ANIMATED_AVAILABLE 0
30+
#endif
2831

29-
#if __has_include(<webp/decode.h>)
32+
#if __has_include(<webp/decode.h>) || __has_include("webp/decode.h")
3033
#define PIN_WEBP_AVAILABLE 1
31-
#else
34+
#else
3235
#define PIN_WEBP_AVAILABLE 0
33-
#endif
36+
#endif
3437

38+
#if __has_include(<PINRemoteImage/PINRemoteImage.h>)
3539
#import <PINRemoteImage/PINRemoteImageManager.h>
3640
#import <PINRemoteImage/NSData+ImageDetectors.h>
3741
#import <PINRemoteImage/PINRemoteImageCaching.h>
38-
3942
#else
40-
#define PIN_ANIMATED_AVAILABLE __has_include(<webp/decode.h>) || __has_include("webp/decode.h")
41-
#define PIN_WEBP_AVAILABLE __has_include("PINRemoteImage.h") || __has_include (<PINRemoteImage/PINRemoteImage.h>)
43+
#import "PINRemoteImageManager.h"
44+
#import "NSData+ImageDetectors.h"
45+
#import "PINRemoteImageCaching.h"
46+
#endif
4247

43-
#if __has_include (<PINRemoteImage/PINRemoteImage.h>)
44-
#import <PINRemoteImage/PINRemoteImage.h>
45-
#else
46-
#import "PINRemoteImage.h"
47-
#endif
4848

49-
#endif
5049

5150
static inline PINRemoteImageManagerPriority PINRemoteImageManagerPriorityWithASImageDownloaderPriority(ASImageDownloaderPriority priority) {
5251
switch (priority) {

Source/IGListAdapter+AsyncDisplayKit.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111

1212
#if AS_IG_LIST_KIT
1313

14-
#if __has_include("IGListKit.h")
14+
#if !__has_include(<IGListKit/IGListKit.h>)
1515
#import "IGListKit.h"
1616
#else
17-
#import <IGListKit/IGListKit.h>aa
17+
#import <IGListKit/IGListKit.h>
1818
#endif
1919

2020
NS_ASSUME_NONNULL_BEGIN

Source/Layout/ASLayout+IGListDiffKit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#if AS_IG_LIST_DIFF_KIT
1010
#import "ASLayout.h"
1111

12-
#if __has_include("IGListDiffKit.h")
12+
#if !__has_include(<IGListDiffKit/IGListDiffKit.h>)
1313
#import "IGListDiffKit.h"
1414
#else
1515
#import <IGListDiffKit/IGListDiffKit.h>

Source/Private/ASIGListAdapterBasedDataSource.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#if AS_IG_LIST_KIT
1313

14-
#if __has_include("IGListKit.h")
14+
#if !__has_include(<IGListKit/IGListKit.h>)
1515
#import "IGListKit.h"
1616
#else
1717
#import <IGListKit/IGListKit.h>

build.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ function build_example {
6161
build
6262

6363
cd ../..
64+
else
65+
echo "Seems like there are no Cartfile or Podfile in the ${example}"
66+
echo "Build will be skipped."
6467
fi
6568
}
6669

@@ -104,6 +107,18 @@ tests_listkit)
104107
success="1"
105108
;;
106109

110+
build_listkit_xcode_spm_integration)
111+
echo "Building AsyncDisplayKit+IGListKit via Xcode's Swift Package Manager"
112+
echo "Xcode 12.2+ required"
113+
set -o pipefail && xcodebuild clean \
114+
-project examples/ASIGListKitSPM/Sample.xcodeproj \
115+
-scheme Sample \
116+
-sdk "iphonesimulator" \
117+
-destination "platform=iOS Simulator,name=iPhone 12" \
118+
build
119+
success="1"
120+
;;
121+
107122
examples|all)
108123
echo "Verifying that all AsyncDisplayKit examples compile."
109124
for example in examples/*/; do
@@ -246,8 +261,19 @@ cocoapods-lint-other-subspecs)
246261

247262
carthage|all)
248263
echo "Verifying carthage works."
264+
## carthage workaround to slip spm based project
265+
spm_example_project="examples/ASIGListKitSPM/Sample.xcodeproj"
266+
carthge_example_project_workaround="examples/ASIGListKitSPM/Sample.carthageSkip"
267+
268+
# apply workaround
269+
mv $spm_example_project $carthge_example_project_workaround
249270

271+
# carthage job
250272
set -o pipefail && carthage update && carthage build --no-skip-current
273+
274+
#revert back workaround
275+
mv $carthge_example_project_workaround $spm_example_project
276+
251277
success="1"
252278
;;
253279

examples/ASIGListKitSPM/ASIGListKitSPM.xcodeproj/project.pbxproj renamed to examples/ASIGListKitSPM/Sample.xcodeproj/project.pbxproj

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/* End PBXBuildFile section */
2020

2121
/* Begin PBXFileReference section */
22-
FB32E77B25768F45000C4F42 /* ASIGListKitSPM.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ASIGListKitSPM.app; sourceTree = BUILT_PRODUCTS_DIR; };
22+
FB32E77B25768F45000C4F42 /* Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Sample.app; sourceTree = BUILT_PRODUCTS_DIR; };
2323
FB32E77E25768F45000C4F42 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
2424
FB32E78025768F45000C4F42 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
2525
FB32E78725768F48000C4F42 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
@@ -56,7 +56,7 @@
5656
FB32E77C25768F45000C4F42 /* Products */ = {
5757
isa = PBXGroup;
5858
children = (
59-
FB32E77B25768F45000C4F42 /* ASIGListKitSPM.app */,
59+
FB32E77B25768F45000C4F42 /* Sample.app */,
6060
);
6161
name = Products;
6262
sourceTree = "<group>";
@@ -112,9 +112,9 @@
112112
/* End PBXGroup section */
113113

114114
/* Begin PBXNativeTarget section */
115-
FB32E77A25768F45000C4F42 /* ASIGListKitSPM */ = {
115+
FB32E77A25768F45000C4F42 /* Sample */ = {
116116
isa = PBXNativeTarget;
117-
buildConfigurationList = FB32E78F25768F48000C4F42 /* Build configuration list for PBXNativeTarget "ASIGListKitSPM" */;
117+
buildConfigurationList = FB32E78F25768F48000C4F42 /* Build configuration list for PBXNativeTarget "Sample" */;
118118
buildPhases = (
119119
FB32E77725768F45000C4F42 /* Sources */,
120120
FB32E77825768F45000C4F42 /* Frameworks */,
@@ -124,12 +124,12 @@
124124
);
125125
dependencies = (
126126
);
127-
name = ASIGListKitSPM;
127+
name = Sample;
128128
packageProductDependencies = (
129129
FB3894A52576FC5F0025252E /* AsyncDisplayKitIGListKit */,
130130
);
131131
productName = ASIGListKitSPM;
132-
productReference = FB32E77B25768F45000C4F42 /* ASIGListKitSPM.app */;
132+
productReference = FB32E77B25768F45000C4F42 /* Sample.app */;
133133
productType = "com.apple.product-type.application";
134134
};
135135
/* End PBXNativeTarget section */
@@ -146,7 +146,7 @@
146146
};
147147
};
148148
};
149-
buildConfigurationList = FB32E77625768F45000C4F42 /* Build configuration list for PBXProject "ASIGListKitSPM" */;
149+
buildConfigurationList = FB32E77625768F45000C4F42 /* Build configuration list for PBXProject "Sample" */;
150150
compatibilityVersion = "Xcode 9.3";
151151
developmentRegion = en;
152152
hasScannedForEncodings = 0;
@@ -159,7 +159,7 @@
159159
projectDirPath = "";
160160
projectRoot = "";
161161
targets = (
162-
FB32E77A25768F45000C4F42 /* ASIGListKitSPM */,
162+
FB32E77A25768F45000C4F42 /* Sample */,
163163
);
164164
};
165165
/* End PBXProject section */
@@ -327,6 +327,7 @@
327327
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
328328
CODE_SIGN_STYLE = Automatic;
329329
INFOPLIST_FILE = ASIGListKitSPM/Info.plist;
330+
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
330331
LD_RUNPATH_SEARCH_PATHS = (
331332
"$(inherited)",
332333
"@executable_path/Frameworks",
@@ -345,6 +346,7 @@
345346
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
346347
CODE_SIGN_STYLE = Automatic;
347348
INFOPLIST_FILE = ASIGListKitSPM/Info.plist;
349+
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
348350
LD_RUNPATH_SEARCH_PATHS = (
349351
"$(inherited)",
350352
"@executable_path/Frameworks",
@@ -359,7 +361,7 @@
359361
/* End XCBuildConfiguration section */
360362

361363
/* Begin XCConfigurationList section */
362-
FB32E77625768F45000C4F42 /* Build configuration list for PBXProject "ASIGListKitSPM" */ = {
364+
FB32E77625768F45000C4F42 /* Build configuration list for PBXProject "Sample" */ = {
363365
isa = XCConfigurationList;
364366
buildConfigurations = (
365367
FB32E78D25768F48000C4F42 /* Debug */,
@@ -368,7 +370,7 @@
368370
defaultConfigurationIsVisible = 0;
369371
defaultConfigurationName = Release;
370372
};
371-
FB32E78F25768F48000C4F42 /* Build configuration list for PBXNativeTarget "ASIGListKitSPM" */ = {
373+
FB32E78F25768F48000C4F42 /* Build configuration list for PBXNativeTarget "Sample" */ = {
372374
isa = XCConfigurationList;
373375
buildConfigurations = (
374376
FB32E79025768F48000C4F42 /* Debug */,
File renamed without changes.

0 commit comments

Comments
 (0)