diff --git a/AsyncDisplayKit.podspec b/AsyncDisplayKit.podspec index c6b60eb710..1b688c75ae 100644 --- a/AsyncDisplayKit.podspec +++ b/AsyncDisplayKit.podspec @@ -59,6 +59,7 @@ Pod::Spec.new do |spec| end spec.subspec 'Yoga' do |yoga| + yoga.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) YOGA=1' } yoga.dependency 'Yoga', '1.0.2' yoga.dependency 'AsyncDisplayKit/Core' end diff --git a/AsyncDisplayKit/ASDisplayNode+Beta.h b/AsyncDisplayKit/ASDisplayNode+Beta.h index f465d033a5..e34ed968ed 100644 --- a/AsyncDisplayKit/ASDisplayNode+Beta.h +++ b/AsyncDisplayKit/ASDisplayNode+Beta.h @@ -13,6 +13,10 @@ #import #import +#if YOGA +#import +#endif + NS_ASSUME_NONNULL_BEGIN ASDISPLAYNODE_EXTERN_C_BEGIN diff --git a/AsyncDisplayKit/AsyncDisplayKit-Prefix.pch b/AsyncDisplayKit/AsyncDisplayKit-Prefix.pch index 374bad0162..e545805799 100644 --- a/AsyncDisplayKit/AsyncDisplayKit-Prefix.pch +++ b/AsyncDisplayKit/AsyncDisplayKit-Prefix.pch @@ -22,3 +22,7 @@ #ifndef IG_LIST_KIT #define IG_LIST_KIT __has_include() #endif + +#ifndef YOGA + #define YOGA __has_include() +#endif diff --git a/AsyncDisplayKit/Layout/ASLayoutElement.mm b/AsyncDisplayKit/Layout/ASLayoutElement.mm index d2907b27b4..ea3393db0b 100644 --- a/AsyncDisplayKit/Layout/ASLayoutElement.mm +++ b/AsyncDisplayKit/Layout/ASLayoutElement.mm @@ -19,6 +19,10 @@ #import #import +#if YOGA + #import +#endif + extern void ASLayoutElementPerformBlockOnEveryElement(id element, void(^block)(id element)) { if (element) { diff --git a/Base/ASAvailability.h b/Base/ASAvailability.h index 5f0d0d559a..c8c0bbc977 100644 --- a/Base/ASAvailability.h +++ b/Base/ASAvailability.h @@ -10,6 +10,8 @@ #import +#pragma once + #ifndef kCFCoreFoundationVersionNumber_iOS_9_0 #define kCFCoreFoundationVersionNumber_iOS_9_0 1240.10 #endif @@ -24,18 +26,10 @@ #define AS_TARGET_OS_OSX (!(TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH)) #define AS_TARGET_OS_IOS TARGET_OS_IPHONE -#ifndef YOGA_HEADER_PATH - #define YOGA_HEADER_PATH -#endif - -#ifndef YOGA - #define YOGA __has_include(YOGA_HEADER_PATH) -#endif - // If Yoga is available, make it available anywhere we use ASAvailability. -// This reduces Yoga-specific code in other files. -#if YOGA - #import YOGA_HEADER_PATH +// This reduces Yoga-specific code in other files.// If Yoga is available, make it available anywhere we use ASAvailability. +#if __has_include() +#define YOGA 1 #endif #if AS_TARGET_OS_OSX diff --git a/build.sh b/build.sh index 478386d4c5..0dda011eb2 100755 --- a/build.sh +++ b/build.sh @@ -56,6 +56,11 @@ if [ "$MODE" = "examples" ]; then for example in examples/*/; do echo "Building (examples) $example." + rm -rf ~/ModuleCache + rm -rf ~/Build + rm -rf ~/Info.plist + rm -rf ~/Logs + if [ -f "${example}/Podfile" ]; then echo "Using CocoaPods" if [ -f "${example}/Podfile.lock" ]; then @@ -70,7 +75,7 @@ if [ "$MODE" = "examples" ]; then -sdk "$SDK" \ -destination "$PLATFORM" \ -derivedDataPath ~/ \ - build | xcpretty $FORMATTER + clean build | xcpretty $FORMATTER elif [ -f "${example}/Cartfile" ]; then echo "Using Carthage" local_repo=`pwd`