Commit 6146474d authored by Stefan van den Oord's avatar Stefan van den Oord

Updated cocoa pods, quick and nimble

parent cd77344d
......@@ -13,11 +13,11 @@ pod 'OpenSSL-for-iOS', '~> 1.0.2.d.0'
pod 'NetUtils', '~> 1.0'
target 'PulseTests' do
pod 'Quick', '~> 0.6.0'
pod 'Nimble', '2.0.0-rc.3'
pod 'Quick', '~> 0.6'
pod 'Nimble', '~> 3.0'
end
target 'PulseIntegrationTests' do
pod 'Quick', '~> 0.6.0'
pod 'Nimble', '2.0.0-rc.3'
pod 'Quick', '~> 0.6'
pod 'Nimble', '~> 3.0'
end
......@@ -4,9 +4,9 @@ PODS:
- IGDigest (1.1.2)
- lz4 (128)
- NetUtils (1.3.2)
- Nimble (2.0.0-rc.3)
- Nimble (3.0.0)
- OpenSSL-for-iOS (1.0.2.d.1)
- Quick (0.6.0)
- Quick (0.8.0)
- SwiftBytes (0.2.0)
DEPENDENCIES:
......@@ -15,9 +15,9 @@ DEPENDENCIES:
- IGDigest (~> 1.1.0)
- lz4 (~> 128)
- NetUtils (~> 1.0)
- Nimble (= 2.0.0-rc.3)
- Nimble (~> 3.0)
- OpenSSL-for-iOS (~> 1.0.2.d.0)
- Quick (~> 0.6.0)
- Quick (~> 0.6)
- SwiftBytes (~> 0.2.0)
SPEC CHECKSUMS:
......@@ -26,9 +26,9 @@ SPEC CHECKSUMS:
IGDigest: 066753c10f3f1b593b00037b9ee93dc96b9e7762
lz4: 5e066195ca751d552becaa026f8fe213ff738adf
NetUtils: 0e2985b5cbd56824b9304a26aea4784f0927f23c
Nimble: 9dff98ee195ffe7351d3b2fb01d3a1420fd97948
Nimble: 4c353d43735b38b545cbb4cb91504588eb5de926
OpenSSL-for-iOS: d7a30add88a1969b052135adbe48452af231ed32
Quick: 563686dbcf0ae0f9f7401ac9cd2d786ee1b7f3d7
Quick: 563d0f6ec5f72e394645adb377708639b7dd38ab
SwiftBytes: a700beb32d020abedd3fc3bb4f0e3b5444cb18b6
COCOAPODS: 0.38.2
COCOAPODS: 0.39.0
......@@ -4,9 +4,9 @@ PODS:
- IGDigest (1.1.2)
- lz4 (128)
- NetUtils (1.3.2)
- Nimble (2.0.0-rc.3)
- Nimble (3.0.0)
- OpenSSL-for-iOS (1.0.2.d.1)
- Quick (0.6.0)
- Quick (0.8.0)
- SwiftBytes (0.2.0)
DEPENDENCIES:
......@@ -15,9 +15,9 @@ DEPENDENCIES:
- IGDigest (~> 1.1.0)
- lz4 (~> 128)
- NetUtils (~> 1.0)
- Nimble (= 2.0.0-rc.3)
- Nimble (~> 3.0)
- OpenSSL-for-iOS (~> 1.0.2.d.0)
- Quick (~> 0.6.0)
- Quick (~> 0.6)
- SwiftBytes (~> 0.2.0)
SPEC CHECKSUMS:
......@@ -26,9 +26,9 @@ SPEC CHECKSUMS:
IGDigest: 066753c10f3f1b593b00037b9ee93dc96b9e7762
lz4: 5e066195ca751d552becaa026f8fe213ff738adf
NetUtils: 0e2985b5cbd56824b9304a26aea4784f0927f23c
Nimble: 9dff98ee195ffe7351d3b2fb01d3a1420fd97948
Nimble: 4c353d43735b38b545cbb4cb91504588eb5de926
OpenSSL-for-iOS: d7a30add88a1969b052135adbe48452af231ed32
Quick: 563686dbcf0ae0f9f7401ac9cd2d786ee1b7f3d7
Quick: 563d0f6ec5f72e394645adb377708639b7dd38ab
SwiftBytes: a700beb32d020abedd3fc3bb4f0e3b5444cb18b6
COCOAPODS: 0.38.2
COCOAPODS: 0.39.0
......@@ -8,5 +8,10 @@ public protocol AssertionHandler {
/// Global backing interface for assertions that Nimble creates.
/// Defaults to a private test handler that passes through to XCTest.
///
/// If XCTest is not available, you must assign your own assertion handler
/// before using any matchers, otherwise Nimble will abort the program.
///
/// @see AssertionHandler
public var NimbleAssertionHandler: AssertionHandler = NimbleXCTestHandler()
public var NimbleAssertionHandler: AssertionHandler = { () -> AssertionHandler in
return isXCTestAvailable() ? NimbleXCTestHandler() : NimbleXCTestUnavailableHandler()
}()
......@@ -26,3 +26,15 @@ public class NimbleShortXCTestHandler: AssertionHandler {
}
}
}
/// Fallback handler in case XCTest is unavailable. This assertion handler will abort
/// the program if it is invoked.
class NimbleXCTestUnavailableHandler : AssertionHandler {
func assert(assertion: Bool, message: FailureMessage, location: SourceLocation) {
fatalError("XCTest is not available and no custom assertion handler was configured. Aborting.")
}
}
func isXCTestAvailable() -> Bool {
return NSClassFromString("XCTestCase") != nil
}
......@@ -38,13 +38,6 @@ internal class NMBWait: NSObject {
/// Wait asynchronously until the done closure is called.
///
/// This will advance the run loop.
public func waitUntil(timeout timeout: NSTimeInterval, file: String = __FILE__, line: UInt = __LINE__, action: (() -> Void) -> Void) -> Void {
public func waitUntil(timeout timeout: NSTimeInterval = 1, file: String = __FILE__, line: UInt = __LINE__, action: (() -> Void) -> Void) -> Void {
NMBWait.until(timeout: timeout, file: file, line: line, action: action)
}
/// Wait asynchronously until the done closure is called.
///
/// This will advance the run loop.
public func waitUntil(file: String = __FILE__, line: UInt = __LINE__, action: (() -> Void) -> Void) -> Void {
NMBWait.until(timeout: 1, file: file, line: line, action: action)
}
\ No newline at end of file
import Foundation
/// A Nimble matcher that succeeds when the actual CollectionType's count equals
/// the expected value
public func haveCount<T: CollectionType>(expectedValue: T.Index.Distance) -> NonNilMatcherFunc<T> {
return NonNilMatcherFunc { actualExpression, failureMessage in
if let actualValue = try actualExpression.evaluate() {
failureMessage.postfixMessage = "have \(actualValue) with count \(expectedValue)"
let result = expectedValue == actualValue.count
failureMessage.actualValue = "\(actualValue.count)"
return result
} else {
return false
}
}
}
/// A Nimble matcher that succeeds when the actual collection's count equals
/// the expected value
public func haveCount(expectedValue: Int) -> MatcherFunc<NMBCollection> {
return MatcherFunc { actualExpression, failureMessage in
if let actualValue = try actualExpression.evaluate() {
failureMessage.postfixMessage = "have \(actualValue) with count \(expectedValue)"
let result = expectedValue == actualValue.count
failureMessage.actualValue = "\(actualValue.count)"
return result
} else {
return false
}
}
}
extension NMBObjCMatcher {
public class func haveCountMatcher(expected: NSNumber) -> NMBObjCMatcher {
return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in
let location = actualExpression.location
let actualValue = try! actualExpression.evaluate()
if let value = actualValue as? NMBCollection {
let expr = Expression(expression: ({ value as NMBCollection}), location: location)
return try! haveCount(expected.integerValue).matches(expr, failureMessage: failureMessage)
} else if let actualValue = actualValue {
failureMessage.postfixMessage = "get type of NSArray, NSSet, NSDictionary, or NSHashTable"
failureMessage.actualValue = "\(NSStringFromClass(actualValue.dynamicType))"
}
return false
}
}
}
......@@ -21,13 +21,14 @@ extension NSArray : NMBContainer {}
extension NSSet : NMBContainer {}
extension NSHashTable : NMBContainer {}
/// Protocol for types that support only beEmpty()
/// Protocol for types that support only beEmpty(), haveCount() matchers
@objc public protocol NMBCollection {
var count: Int { get }
}
extension NSSet : NMBCollection {}
extension NSDictionary : NMBCollection {}
extension NSHashTable : NMBCollection {}
extension NSMapTable : NMBCollection {}
/// Protocol for types that support beginWith(), endWith(), beEmpty() matchers
@objc public protocol NMBOrderedCollection : NMBCollection {
......
#import <Foundation/Foundation.h>
#import <Nimble/NMBExceptionCapture.h>
#import <Nimble/DSL.h>
#import "NMBExceptionCapture.h"
#import "DSL.h"
FOUNDATION_EXPORT double NimbleVersionNumber;
FOUNDATION_EXPORT const unsigned char NimbleVersionString[];
FOUNDATION_EXPORT const unsigned char NimbleVersionString[];
\ No newline at end of file
......@@ -48,13 +48,13 @@ public class NMBExpectation : NSObject {
self.expectValue.to(ObjCMatcherWrapper(matcher: matcher))
})
}
public var toWithDescription: (NMBMatcher, String) -> Void {
return ({ matcher, description in
self.expectValue.to(ObjCMatcherWrapper(matcher: matcher), description: description)
})
}
public var toNot: (NMBMatcher) -> Void {
return ({ matcher in
self.expectValue.toNot(
......@@ -62,7 +62,7 @@ public class NMBExpectation : NSObject {
)
})
}
public var toNotWithDescription: (NMBMatcher, String) -> Void {
return ({ matcher, description in
self.expectValue.toNot(
......@@ -70,7 +70,7 @@ public class NMBExpectation : NSObject {
)
})
}
public var notTo: (NMBMatcher) -> Void { return toNot }
public var notToWithDescription: (NMBMatcher, String) -> Void { return toNotWithDescription }
......@@ -84,7 +84,7 @@ public class NMBExpectation : NSObject {
)
})
}
public var toEventuallyWithDescription: (NMBMatcher, String) -> Void {
return ({ matcher, description in
self.expectValue.toEventually(
......@@ -94,7 +94,7 @@ public class NMBExpectation : NSObject {
)
})
}
public var toEventuallyNot: (NMBMatcher) -> Void {
return ({ matcher in
self.expectValue.toEventuallyNot(
......@@ -104,7 +104,7 @@ public class NMBExpectation : NSObject {
)
})
}
public var toEventuallyNotWithDescription: (NMBMatcher, String) -> Void {
return ({ matcher, description in
self.expectValue.toEventuallyNot(
......@@ -114,9 +114,9 @@ public class NMBExpectation : NSObject {
)
})
}
public var toNotEventually: (NMBMatcher) -> Void { return toEventuallyNot }
public var toNotEventuallyWithDescription: (NMBMatcher, String) -> Void { return toEventuallyNotWithDescription }
public class func failWithMessage(message: String, file: String, line: UInt) {
......
......@@ -2,6 +2,7 @@ import Foundation
public typealias MatcherBlock = (actualExpression: Expression<NSObject>, failureMessage: FailureMessage) -> Bool
public typealias FullMatcherBlock = (actualExpression: Expression<NSObject>, failureMessage: FailureMessage, shouldNotMatch: Bool) -> Bool
public class NMBObjCMatcher : NSObject, NMBMatcher {
let _match: MatcherBlock
let _doesNotMatch: MatcherBlock
......
......@@ -21,6 +21,10 @@ NIMBLE_EXPORT id<NMBMatcher> NMB_equal(id expectedValue);
NIMBLE_SHORT(id<NMBMatcher> equal(id expectedValue),
NMB_equal(expectedValue));
NIMBLE_EXPORT id<NMBMatcher> NMB_haveCount(id expectedValue);
NIMBLE_SHORT(id<NMBMatcher> haveCount(id expectedValue),
NMB_haveCount(expectedValue));
NIMBLE_EXPORT NMBObjCBeCloseToMatcher *NMB_beCloseTo(NSNumber *expectedValue);
NIMBLE_SHORT(NMBObjCBeCloseToMatcher *beCloseTo(id expectedValue),
NMB_beCloseTo(expectedValue));
......@@ -109,6 +113,8 @@ NIMBLE_SHORT(id<NMBMatcher> allPass(id matcher),
typedef void (^NMBWaitUntilTimeoutBlock)(NSTimeInterval timeout, void (^action)(void (^)(void)));
typedef void (^NMBWaitUntilBlock)(void (^action)(void (^)(void)));
NIMBLE_EXPORT void NMB_failWithMessage(NSString *msg, NSString *file, NSUInteger line);
NIMBLE_EXPORT NMBWaitUntilTimeoutBlock NMB_waitUntilTimeoutBuilder(NSString *file, NSUInteger line);
NIMBLE_EXPORT NMBWaitUntilBlock NMB_waitUntilBuilder(NSString *file, NSUInteger line);
......
......@@ -113,6 +113,10 @@ NIMBLE_EXPORT id<NMBMatcher> NMB_equal(id expectedValue) {
return [NMBObjCMatcher equalMatcher:expectedValue];
}
NIMBLE_EXPORT id<NMBMatcher> NMB_haveCount(id expectedValue) {
return [NMBObjCMatcher haveCountMatcher:expectedValue];
}
NIMBLE_EXPORT id<NMBMatcher> NMB_match(id expectedValue) {
return [NMBObjCMatcher matchMatcher:expectedValue];
}
......
......@@ -19,9 +19,11 @@ expect(ocean.isClean).toEventually(beTruthy())
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
- [Some Background: Expressing Outcomes Using Assertions in XCTest](#some-background-expressing-outcomes-using-assertions-in-xctest)
- [Nimble: Expectations Using `expect(...).to`](#nimble-expectations-using-expectto)
- [Custom Failure Messages](#custom-failure-messages)
- [Type Checking](#type-checking)
- [Operator Overloads](#operator-overloads)
- [Lazily Computed Values](#lazily-computed-values)
......@@ -35,10 +37,12 @@ expect(ocean.isClean).toEventually(beTruthy())
- [Comparisons](#comparisons)
- [Types/Classes](#typesclasses)
- [Truthiness](#truthiness)
- [Swift Error Handling](#swift-error-handling)
- [Exceptions](#exceptions)
- [Collection Membership](#collection-membership)
- [Strings](#strings)
- [Checking if all elements of a collection pass a condition](#checking-if-all-elements-of-a-collection-pass-a-condition)
- [Verify collection count](#verify-collection-count)
- [Writing Your Own Matchers](#writing-your-own-matchers)
- [Lazy Evaluation](#lazy-evaluation)
- [Type Checking via Swift Generics](#type-checking-via-swift-generics)
......@@ -48,6 +52,7 @@ expect(ocean.isClean).toEventually(beTruthy())
- [Installing Nimble](#installing-nimble)
- [Installing Nimble as a Submodule](#installing-nimble-as-a-submodule)
- [Installing Nimble via CocoaPods](#installing-nimble-via-cocoapods)
- [Using Nimble without XCTest](#using-nimble-without-xctest)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
......@@ -470,10 +475,6 @@ expect(actual).to(beIdenticalTo(expected));
expect(actual).toNot(beIdenticalTo(expected));
```
> `beIdenticalTo` only supports Objective-C objects: subclasses
of `NSObject`, or Swift objects bridged to Objective-C with the
`@objc` prefix.
## Comparisons
```swift
......@@ -855,6 +856,28 @@ For Swift the actual value has to be a SequenceType, e.g. an array, a set or a c
For Objective-C the actual value has to be a NSFastEnumeration, e.g. NSArray and NSSet, of NSObjects and only the variant which
uses another matcher is available here.
## Verify collection count
```swift
// passes if actual collection's count is equal to expected
expect(actual).to(haveCount(expected))
// passes if actual collection's count is not equal to expected
expect(actual).notTo(haveCount(expected))
```
```objc
// passes if actual collection's count is equal to expected
expect(actual).to(haveCount(expected))
// passes if actual collection's count is not equal to expected
expect(actual).notTo(haveCount(expected))
```
For Swift the actual value must be a `CollectionType` such as array, dictionary or set.
For Objective-C the actual value has to be one of the following classes `NSArray`, `NSDictionary`, `NSSet`, `NSHashTable` or one of their subclasses.
# Writing Your Own Matchers
In Nimble, matchers are Swift functions that take an expected
......@@ -1100,12 +1123,47 @@ source 'https://github.com/CocoaPods/Specs.git'
target 'YOUR_APP_NAME_HERE_Tests', :exclusive => true do
use_frameworks!
# If you're using Swift 2.0 (Xcode 7), use this:
pod 'Nimble', '2.0.0-rc.2'
pod 'Nimble', '~> 2.0.0'
# If you're using Swift 1.2 (Xcode 6), use this:
pod 'Nimble', '~> 1.0.0'
# Otherwise, use this commented out line for Swift 1.1 (Xcode 6.2):
# pod 'Nimble', '~> 0.3.0'
end
```
Finally run `pod install`.
## Using Nimble without XCTest
Nimble is integrated with XCTest to allow it work well when used in Xcode test
bundles, however it can also be used in a standalone app. After installing
Nimble using one of the above methods, there are two additional steps required
to make this work.
1. Create a custom assertion handler and assign an instance of it to the
global `NimbleAssertionHandler` variable. For example:
```swift
class MyAssertionHandler : AssertionHandler {
func assert(assertion: Bool, message: FailureMessage, location: SourceLocation) {
if (!assertion) {
print("Expectation failed: \(message.stringValue)")
}
}
}
```
```swift
// Somewhere before you use any assertions
NimbleAssertionHandler = MyAssertionHandler()
```
2. Add a post-build action to fix an issue with the Swift XCTest support
library being unnecessarily copied into your app
* Edit your scheme in Xcode, and navigate to Build -> Post-actions
* Click the "+" icon and select "New Run Script Action"
* Open the "Provide build settings from" dropdown and select your target
* Enter the following script contents:
```
rm "${SWIFT_STDLIB_TOOL_DESTINATION_DIR}/libswiftXCTest.dylib"
```
You can now use Nimble assertions in your code and handle failures as you see
fit.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -6,8 +6,6 @@ FOUNDATION_EXPORT double QuickVersionNumber;
//! Project version string for Quick.
FOUNDATION_EXPORT const unsigned char QuickVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <Quick/PublicHeader.h>
#import <Quick/QuickSpec.h>
#import <Quick/QCKDSL.h>
#import <Quick/QuickConfiguration.h>
#import "QuickSpec.h"
#import "QCKDSL.h"
#import "QuickConfiguration.h"
......@@ -45,6 +45,7 @@ const void * const QCKExampleKey = &QCKExampleKey;
@"Here's the original exception: '%@', reason: '%@', userInfo: '%@'",
exception.name, exception.reason, exception.userInfo];
}
[self testInvocations];
}
/**
......
......@@ -44,8 +44,8 @@ use_frameworks!
def testing_pods
# If you're using Xcode 7 / Swift 2
pod 'Quick', '~> 0.5.0'
pod 'Nimble', '2.0.0-rc.2'
pod 'Quick', '~> 0.6.0'
pod 'Nimble', '2.0.0-rc.3'
# If you're using Xcode 6 / Swift 1.2
pod 'Quick', '~> 0.3.0'
......
#include "Base32.xcconfig"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Base32" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/OpenSSL-for-iOS" "${PODS_ROOT}/Headers/Public/OpenSSL-for-iOS/openssl"
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES
\ No newline at end of file
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Base32" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/OpenSSL-for-iOS"
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES
\ No newline at end of file
#include "CocoaAsyncSocket.xcconfig"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/CocoaAsyncSocket" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/OpenSSL-for-iOS" "${PODS_ROOT}/Headers/Public/OpenSSL-for-iOS/openssl"
OTHER_LDFLAGS = ${COCOAASYNCSOCKET_OTHER_LDFLAGS}
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES
\ No newline at end of file
COCOAASYNCSOCKET_OTHER_LDFLAGS = -framework "CFNetwork" -framework "Security"
\ No newline at end of file
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/CocoaAsyncSocket" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/OpenSSL-for-iOS"
OTHER_LDFLAGS = -framework "CFNetwork" -framework "Security"
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES
\ No newline at end of file
#include "IGDigest.xcconfig"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/IGDigest" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/OpenSSL-for-iOS" "${PODS_ROOT}/Headers/Public/OpenSSL-for-iOS/openssl"
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES
\ No newline at end of file
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/IGDigest" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/OpenSSL-for-iOS"
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES
\ No newline at end of file
#include "NetUtils.xcconfig"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/NetUtils" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/OpenSSL-for-iOS" "${PODS_ROOT}/Headers/Public/OpenSSL-for-iOS/openssl"
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES
SWIFT_INCLUDE_PATHS[sdk=iphoneos*] = ${NETUTILS_SWIFT_INCLUDE_PATHS}
SWIFT_INCLUDE_PATHS[sdk=iphonesimulator*] = ${NETUTILS_SWIFT_INCLUDE_PATHS}
SWIFT_INCLUDE_PATHS[sdk=macosx*] = ${NETUTILS_SWIFT_INCLUDE_PATHS}
\ No newline at end of file
NETUTILS_SWIFT_INCLUDE_PATHS[sdk=iphoneos*] = $(SRCROOT)/NetUtils/ifaddrs/iphoneos
NETUTILS_SWIFT_INCLUDE_PATHS[sdk=iphonesimulator*] = $(SRCROOT)/NetUtils/ifaddrs/iphonesimulator
NETUTILS_SWIFT_INCLUDE_PATHS[sdk=macosx*] = $(SRCROOT)/NetUtils/ifaddrs/macosx
\ No newline at end of file
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/NetUtils" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/OpenSSL-for-iOS"
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES
SWIFT_INCLUDE_PATHS[sdk=iphoneos*] = $(SRCROOT)/NetUtils/ifaddrs/iphoneos
SWIFT_INCLUDE_PATHS[sdk=iphonesimulator*] = $(SRCROOT)/NetUtils/ifaddrs/iphonesimulator
SWIFT_INCLUDE_PATHS[sdk=macosx*] = $(SRCROOT)/NetUtils/ifaddrs/macosx
\ No newline at end of file
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.0.0-rc.3</string>
<string>3.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
......
#include "Nimble.xcconfig"
ENABLE_BITCODE = ${NIMBLE_ENABLE_BITCODE}
FRAMEWORK_SEARCH_PATHS = ${NIMBLE_FRAMEWORK_SEARCH_PATHS}
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Nimble" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/OpenSSL-for-iOS" "${PODS_ROOT}/Headers/Public/OpenSSL-for-iOS/openssl"
OTHER_LDFLAGS = ${NIMBLE_OTHER_LDFLAGS}
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES
\ No newline at end of file
NIMBLE_ENABLE_BITCODE = NO
NIMBLE_FRAMEWORK_SEARCH_PATHS = $(inherited) "$(SDKROOT)/Developer/Library/Frameworks" "$(PLATFORM_DIR)/Developer/Library/Frameworks"
NIMBLE_OTHER_LDFLAGS = -framework "XCTest"
\ No newline at end of file
ENABLE_BITCODE = NO
FRAMEWORK_SEARCH_PATHS = $(inherited) $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Nimble" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/OpenSSL-for-iOS"
OTHER_LDFLAGS = -weak-lswiftXCTest -weak_framework "XCTest"
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
PODS_ROOT = ${SRCROOT}
SKIP_INSTALL = YES
\ No newline at end of file
......@@ -10,8 +10,10 @@ install_framework()
{
if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
local source="${BUILT_PRODUCTS_DIR}/$1"
else
elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
elif [ -r "$1" ]; then
local source="$1"
fi
local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
......@@ -25,19 +27,31 @@ install_framework()
echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
local basename
basename="$(basename -s .framework "$1")"
binary="${destination}/${basename}.framework/${basename}"
if ! [ -r "$binary" ]; then
binary="${destination}/${basename}"
fi
# Strip invalid architectures so "fat" simulator / device frameworks work on device
if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
strip_invalid_archs "$binary"
fi
# Resign the code if required by the build settings to avoid unstable apps
code_sign_if_enabled "${destination}/$(basename "$1")"
# Embed linked Swift runtime libraries
local basename
basename="$(basename "$1" | sed -E s/\\..+// && exit ${PIPESTATUS[0]})"
local swift_runtime_libs
swift_runtime_libs=$(xcrun otool -LX "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/${basename}.framework/${basename}" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
for lib in $swift_runtime_libs; do
echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
code_sign_if_enabled "${destination}/${lib}"
done
# Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
local swift_runtime_libs
swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
for lib in $swift_runtime_libs; do
echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
code_sign_if_enabled "${destination}/${lib}"
done
fi
}
# Signs a framework with the provided identity
......@@ -50,24 +64,42 @@ code_sign_if_enabled() {
fi
}
# Strip invalid architectures
strip_invalid_archs() {
binary="$1"
# Get architectures for current file
archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
stripped=""
for arch in $archs; do
if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then
# Strip non-valid architectures in-place
lipo -remove "$arch" -output "$binary" "$binary" || exit 1
stripped="$stripped $arch"
fi
done
if [[ "$stripped" ]]; then
echo "Stripped $binary of architectures:$stripped"
fi
}
if [[ "$CONFIGURATION" == "Debug" ]]; then
install_framework 'Pods-PulseIntegrationTests/Base32.framework'
install_framework 'Pods-PulseIntegrationTests/CocoaAsyncSocket.framework'
install_framework 'Pods-PulseIntegrationTests/IGDigest.framework'
install_framework 'Pods-PulseIntegrationTests/NetUtils.framework'
install_framework 'Pods-PulseIntegrationTests/SwiftBytes.framework'
install_framework 'Pods-PulseIntegrationTests/lz4.framework'
install_framework 'Pods-PulseIntegrationTests/Nimble.framework'
install_framework 'Pods-PulseIntegrationTests/Quick.framework'
install_framework "Pods-PulseIntegrationTests/Base32.framework"
install_framework "Pods-PulseIntegrationTests/CocoaAsyncSocket.framework"
install_framework "Pods-PulseIntegrationTests/IGDigest.framework"
install_framework "Pods-PulseIntegrationTests/NetUtils.framework"
install_framework "Pods-PulseIntegrationTests/SwiftBytes.framework"
install_framework "Pods-PulseIntegrationTests/lz4.framework"
install_framework "Pods-PulseIntegrationTests/Nimble.framework"
install_framework "Pods-PulseIntegrationTests/Quick.framework"
fi
if [[ "$CONFIGURATION" == "Release" ]]; then
install_framework 'Pods-PulseIntegrationTests/Base32.framework'
install_framework 'Pods-PulseIntegrationTests/CocoaAsyncSocket.framework'
install_framework 'Pods-PulseIntegrationTests/IGDigest.framework'
install_framework 'Pods-PulseIntegrationTests/NetUtils.framework'
install_framework 'Pods-PulseIntegrationTests/SwiftBytes.framework'
install_framework 'Pods-PulseIntegrationTests/lz4.framework'
install_framework 'Pods-PulseIntegrationTests/Nimble.framework'
install_framework 'Pods-PulseIntegrationTests/Quick.framework'
install_framework "Pods-PulseIntegrationTests/Base32.framework"
install_framework "Pods-PulseIntegrationTests/CocoaAsyncSocket.framework"
install_framework "Pods-PulseIntegrationTests/IGDigest.framework"
install_framework "Pods-PulseIntegrationTests/NetUtils.framework"
install_framework "Pods-PulseIntegrationTests/SwiftBytes.framework"
install_framework "Pods-PulseIntegrationTests/lz4.framework"
install_framework "Pods-PulseIntegrationTests/Nimble.framework"
install_framework "Pods-PulseIntegrationTests/Quick.framework"
fi
......@@ -60,7 +60,7 @@ install_resource()
mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
if [[ "${ACTION}" == "install" ]]; then
if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"