Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added SPM support #1928

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .github/workflows/ci-pull-requests-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ jobs:
uses: actions/checkout@v2
- name: Run build script
run: ./build.sh ${{ matrix.mode }}

36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,39 @@ jobs:
uses: actions/checkout@v2
- name: Run build script
run: ./build.sh ${{ matrix.mode }}

SPM:
name: Build from SPM manifest
runs-on: macOS-latest
env:
DEVELOPER_DIR: /Applications/Xcode_12.4.app/Contents/Developer
strategy:
matrix:
destination: ["platform=iOS Simulator,name=iPhone 12 Pro", "platform=macOS,variant=Mac Catalyst", "platform=tvOS Simulator,name=Apple TV 4k"]
scheme: ["AsyncDisplayKitIGListKit"]
steps:
- name: Checkout
uses: actions/checkout@v2

# Starting from Xcode 11 `xcodebuild` supports SwiftPM packages out of the box
# to test that we have valid swift package we need to remove existing *.xcodeproj/xcworkspace
# `xcodebuild` will invoke Package.swift.
- name: spm's xcodebuild - ${{ matrix.destination }}
run: |
set -o pipefail
rm -rf AsyncDisplayKit.xcodeproj/
rm -rf AsyncDisplayKit.xcworkspace/
swift scripts/generate_spm_sources_layout.swift
xcodebuild clean build -scheme "${{ matrix.scheme }}" -destination "${{ matrix.destination }}"

Xcode-SPM-Integration:
name: Build example project to verify Xcode's SPM integration
runs-on: macOS-latest
env:
DEVELOPER_DIR: /Applications/Xcode_12.4.app/Contents/Developer
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Check xcode's spm integration
run: ./build.sh build_listkit_xcode_spm_integration
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,8 @@ playground.xcworkspace
# Carthage
Carthage/Checkouts
Carthage/Build

#SPM
.swiftpm/
.build/
Package.resolved
4 changes: 2 additions & 2 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "pinterest/PINRemoteImage" "3.0.0-beta.14"
github "pinterest/PINCache" "3.0.1-beta.7"
github "pinterest/PINRemoteImage" "3.0.1"
Copy link

@stareque-atlassian stareque-atlassian Mar 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PINRemoteImage needs to be updated to point to master (or atleast wait for next release), to include PINRemoteImage bugfixes related to SPM. And this should also transitively updated PINCache and PINOperation

github "pinterest/PINCache" "3.0.1"
77 changes: 77 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let headersSearchPath: [CSetting] = [.headerSearchPath("."),
.headerSearchPath("Base"),
.headerSearchPath("Debug"),
.headerSearchPath("Details"),
.headerSearchPath("Details/Transactions"),
.headerSearchPath("Layout"),
.headerSearchPath("Private"),
.headerSearchPath("Private/Layout"),
.headerSearchPath("TextExperiment/Component"),
.headerSearchPath("TextExperiment/String"),
.headerSearchPath("TextExperiment/Utility"),
.headerSearchPath("TextKit"),
.headerSearchPath("tvOS"),]

let sharedDefines: [CSetting] = [
// Disable "old" textnode by default for SPM
.define("AS_ENABLE_TEXTNODE", to: "0"),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this disabled?
It seems to be enabled in ASAvailability.h does this not cause a mismatch between the Project version and the SPM version?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for mention that, I guess the main reason was - I need that to be a default since ASTextNode2 is a future I just enabled it by default :)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.define("AS_ENABLE_TEXTNODE", to: "0"),
.define("AS_ENABLE_TEXTNODE", to: "1"),

This option leads undefined symbol: _OBJC_CLASS_$_ ASTEXTNODE2- error when using ASTextNode2. If you can check, or if someone else meets this error, try changing it from 0 to 1.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This option makes usage of ASTextNode2 a default. So in your code, you should reference it just like ASTextNode


// PINRemoteImage always available for Texture
.define("AS_PIN_REMOTE_IMAGE", to: "1"),

// always disabled
.define("IG_LIST_COLLECTION_VIEW", to: "0"),]

func IGListKit(enabled: Bool) -> [CSetting] {
let state: String = enabled ? "1" : "0"
return [
.define("AS_IG_LIST_KIT", to: state),
.define("AS_IG_LIST_DIFF_KIT", to: state),
]
}


let package = Package(
name: "Texture",
platforms: [
.macOS(.v10_15),
.iOS(.v10),
.tvOS(.v10)
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "AsyncDisplayKit",
type: .static,
targets: ["AsyncDisplayKit"]),
.library(
name: "AsyncDisplayKitIGListKit",
type: .static,
targets: ["AsyncDisplayKitIGListKit"]),
],
dependencies: [
.package(url: "https://github.com/pinterest/PINRemoteImage.git", .branch("master")),
.package(url: "https://github.com/3a4oT/IGListKit", .branch("spmNumber10")),
],
targets: [
.target(
name: "AsyncDisplayKit",
dependencies: ["PINRemoteImage"],
path: "spm/Sources/AsyncDisplayKit",
cSettings: headersSearchPath + sharedDefines + IGListKit(enabled: false)
),
.target(
name: "AsyncDisplayKitIGListKit",
dependencies: ["IGListKit", "PINRemoteImage"],
path: "spm/Sources/AsyncDisplayKitIGListKit/AsyncDisplayKit",
cSettings: headersSearchPath + sharedDefines + IGListKit(enabled: true)
),
],
cLanguageStandard: .c11,
cxxLanguageStandard: .cxx11
)
8 changes: 4 additions & 4 deletions Source/ASButtonNode+Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
//

#import <AsyncDisplayKit/ASButtonNode.h>
#import <AsyncDisplayKit/ASTextNode.h>
#import <AsyncDisplayKit/ASImageNode.h>
#import <AsyncDisplayKit/ASStackLayoutDefines.h>
#import "ASButtonNode.h"
#import "ASTextNode.h"
#import "ASImageNode.h"
#import "ASStackLayoutDefines.h"

@interface ASButtonNode () {
NSAttributedString *_normalAttributedTitle;
Expand Down
2 changes: 1 addition & 1 deletion Source/ASButtonNode+Yoga.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

#import <Foundation/Foundation.h>
#import <AsyncDisplayKit/ASButtonNode.h>
#import "ASButtonNode.h"

NS_ASSUME_NONNULL_BEGIN

Expand Down
8 changes: 4 additions & 4 deletions Source/ASButtonNode+Yoga.mm
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
//

#import <AsyncDisplayKit/ASAvailability.h>
#import "ASAvailability.h"
#import "ASButtonNode+Yoga.h"
#import <AsyncDisplayKit/ASButtonNode+Private.h>
#import <AsyncDisplayKit/ASDisplayNodeInternal.h>
#import <AsyncDisplayKit/ASStackLayoutSpecUtilities.h>
#import "ASButtonNode+Private.h"
#import "ASDisplayNodeInternal.h"
#import "ASStackLayoutSpecUtilities.h"

#if YOGA
static void ASButtonNodeResolveHorizontalAlignmentForStyle(ASLayoutElementStyle *style, ASStackLayoutDirection _direction, ASHorizontalAlignment _horizontalAlignment, ASStackLayoutJustifyContent _justifyContent, ASStackLayoutAlignItems _alignItems) {
Expand Down
2 changes: 1 addition & 1 deletion Source/ASButtonNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
//

#import <AsyncDisplayKit/ASControlNode.h>
#import "ASControlNode.h"
#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN
Expand Down
14 changes: 7 additions & 7 deletions Source/ASButtonNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
//

#import <AsyncDisplayKit/ASButtonNode+Private.h>
#import <AsyncDisplayKit/ASButtonNode+Yoga.h>
#import <AsyncDisplayKit/ASStackLayoutSpec.h>
#import <AsyncDisplayKit/ASThread.h>
#import <AsyncDisplayKit/ASDisplayNode+Subclasses.h>
#import <AsyncDisplayKit/ASBackgroundLayoutSpec.h>
#import <AsyncDisplayKit/ASInsetLayoutSpec.h>
#import "ASButtonNode+Private.h"
#import "ASButtonNode+Yoga.h"
#import "ASStackLayoutSpec.h"
#import "ASThread.h"
#import "ASDisplayNode+Subclasses.h"
#import "ASBackgroundLayoutSpec.h"
#import "ASInsetLayoutSpec.h"

@implementation ASButtonNode

Expand Down
2 changes: 1 addition & 1 deletion Source/ASCellNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
//

#import <AsyncDisplayKit/ASDisplayNode.h>
#import "ASDisplayNode.h"

NS_ASSUME_NONNULL_BEGIN

Expand Down
32 changes: 16 additions & 16 deletions Source/ASCellNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
//

#import <AsyncDisplayKit/ASCellNode+Internal.h>

#import <AsyncDisplayKit/ASEqualityHelpers.h>
#import <AsyncDisplayKit/ASInternalHelpers.h>
#import <AsyncDisplayKit/ASDisplayNode+FrameworkPrivate.h>
#import <AsyncDisplayKit/ASCollectionView+Undeprecated.h>
#import <AsyncDisplayKit/ASCollectionElement.h>
#import <AsyncDisplayKit/ASTableView+Undeprecated.h>
#import <AsyncDisplayKit/_ASDisplayView.h>
#import <AsyncDisplayKit/ASDisplayNode+Subclasses.h>
#import <AsyncDisplayKit/ASTextNode.h>
#import <AsyncDisplayKit/ASCollectionNode.h>

#import <AsyncDisplayKit/ASDKViewController.h>
#import <AsyncDisplayKit/ASInsetLayoutSpec.h>
#import <AsyncDisplayKit/ASDisplayNodeInternal.h>
#import "ASCellNode+Internal.h"

#import "ASEqualityHelpers.h"
#import "ASInternalHelpers.h"
#import "ASDisplayNode+FrameworkPrivate.h"
#import "ASCollectionView+Undeprecated.h"
#import "ASCollectionElement.h"
#import "ASTableView+Undeprecated.h"
#import "_ASDisplayView.h"
#import "ASDisplayNode+Subclasses.h"
#import "ASTextNode.h"
#import "ASCollectionNode.h"

#import "ASDKViewController.h"
#import "ASInsetLayoutSpec.h"
#import "ASDisplayNodeInternal.h"

#pragma mark -
#pragma mark ASCellNode
Expand Down
2 changes: 1 addition & 1 deletion Source/ASCollectionNode+Beta.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
//

#import <AsyncDisplayKit/ASCollectionNode.h>
#import "ASCollectionNode.h"

@protocol ASCollectionViewLayoutFacilitatorProtocol, ASCollectionLayoutDelegate, ASBatchFetchingDelegate;
@class ASElementMap;
Expand Down
10 changes: 5 additions & 5 deletions Source/ASCollectionNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
//

#import <UIKit/UICollectionView.h>
#import <AsyncDisplayKit/ASDisplayNode.h>
#import <AsyncDisplayKit/ASRangeControllerUpdateRangeProtocol+Beta.h>
#import <AsyncDisplayKit/ASCollectionView.h>
#import <AsyncDisplayKit/ASBlockTypes.h>
#import <AsyncDisplayKit/ASRangeManagingNode.h>
#import "ASDisplayNode.h"
#import "ASRangeControllerUpdateRangeProtocol+Beta.h"
#import "ASCollectionView.h"
#import "ASBlockTypes.h"
#import "ASRangeManagingNode.h"

@protocol ASCollectionViewLayoutFacilitatorProtocol;
@protocol ASCollectionDelegate;
Expand Down
36 changes: 18 additions & 18 deletions Source/ASCollectionNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
//

#import <AsyncDisplayKit/ASCollectionNode.h>
#import <AsyncDisplayKit/ASCollectionNode+Beta.h>

#import <AsyncDisplayKit/ASCollectionElement.h>
#import <AsyncDisplayKit/ASElementMap.h>
#import <AsyncDisplayKit/ASCollectionInternal.h>
#import <AsyncDisplayKit/ASCollectionLayout.h>
#import <AsyncDisplayKit/ASCollectionViewLayoutFacilitatorProtocol.h>
#import <AsyncDisplayKit/ASDisplayNode+Beta.h>
#import <AsyncDisplayKit/ASDisplayNode+Subclasses.h>
#import <AsyncDisplayKit/ASDisplayNode+FrameworkPrivate.h>
#import <AsyncDisplayKit/ASCellNode+Internal.h>
#import <AsyncDisplayKit/_ASHierarchyChangeSet.h>
#import <AsyncDisplayKit/ASSectionContext.h>
#import <AsyncDisplayKit/ASCollectionView+Undeprecated.h>
#import <AsyncDisplayKit/ASThread.h>
#import <AsyncDisplayKit/ASRangeController.h>
#import <AsyncDisplayKit/ASAbstractLayoutController+FrameworkPrivate.h>
#import "ASCollectionNode.h"
#import "ASCollectionNode+Beta.h"

#import "ASCollectionElement.h"
#import "ASElementMap.h"
#import "ASCollectionInternal.h"
#import "ASCollectionLayout.h"
#import "ASCollectionViewLayoutFacilitatorProtocol.h"
#import "ASDisplayNode+Beta.h"
#import "ASDisplayNode+Subclasses.h"
#import "ASDisplayNode+FrameworkPrivate.h"
#import "ASCellNode+Internal.h"
#import "_ASHierarchyChangeSet.h"
#import "ASSectionContext.h"
#import "ASCollectionView+Undeprecated.h"
#import "ASThread.h"
#import "ASRangeController.h"
#import "ASAbstractLayoutController+FrameworkPrivate.h"

#pragma mark - _ASCollectionPendingState

Expand Down
12 changes: 6 additions & 6 deletions Source/ASCollectionView.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

#import <UIKit/UIKit.h>

#import <AsyncDisplayKit/ASCollectionViewProtocols.h>
#import <AsyncDisplayKit/ASBaseDefines.h>
#import <AsyncDisplayKit/ASBatchContext.h>
#import <AsyncDisplayKit/ASDimension.h>
#import <AsyncDisplayKit/ASLayoutRangeType.h>
#import <AsyncDisplayKit/ASScrollDirection.h>
#import "ASCollectionViewProtocols.h"
#import "ASBaseDefines.h"
#import "ASBatchContext.h"
#import "ASDimension.h"
#import "ASLayoutRangeType.h"
#import "ASScrollDirection.h"

@class ASCellNode;
@class ASCollectionNode;
Expand Down
Loading