Skip to content

New project structure #24

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

Open
wants to merge 4 commits into
base: develop
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ playground.xcworkspace
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
Packages/
.build/
Package.pins

# CocoaPods
#
Expand Down
47 changes: 20 additions & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ env:
matrix:
include:
- script:
- swift build
- swift test
- xcodebuild test -project $MODULE_NAME.xcodeproj -scheme $MODULE_NAME-OSX
- xcodebuild test -project $MODULE_NAME.xcodeproj -scheme $MODULE_NAME-iOS -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6'
- xcodebuild test -project $MODULE_NAME.xcodeproj -scheme $MODULE_NAME-tvOS -sdk appletvsimulator -destination 'platform=tvOS Simulator,name=Apple TV 1080p'
- xcodebuild build -project $MODULE_NAME.xcodeproj -scheme $MODULE_NAME-watchOS -sdk watchsimulator -destination 'platform=watchOS Simulator,name=Apple Watch - 42mm'
#disabled platform specific tests due to https://github.com/travis-ci/travis-ci/issues/7031
- xcodebuild build -project $MODULE_NAME.xcodeproj -scheme $MODULE_NAME-iOS -sdk iphonesimulator #-destination 'platform=iOS Simulator,name=iPhone 7'
- xcodebuild build -project $MODULE_NAME.xcodeproj -scheme $MODULE_NAME-tvOS -sdk appletvsimulator #-destination 'platform=tvOS Simulator,name=Apple TV 1080p'
- xcodebuild build -project $MODULE_NAME.xcodeproj -scheme $MODULE_NAME-watchOS -sdk watchsimulator #-destination 'platform=watchOS Simulator,name=Apple Watch - 42mm'
os: osx
osx_image: xcode7.3
osx_image: xcode8.3
language: objective-c
before_install:
- brew update
Expand All @@ -34,39 +37,29 @@ matrix:
repo: reactive-swift/ExecutionContext
tags: true
- script:
- ./build test
#- ./build clean
#- ./build test -Xcc -fblocks -Xswiftc -Ddispatch
- swift build
- swift test
sudo: required
dist: trusty
language: generic
before_install:
# install original swift distribution
- wget -q -O - https://swift.org/keys/all-keys.asc | gpg --import -
- cd ..
- export SWIFT_VERSION="swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a"
- wget https://swift.org/builds/development/ubuntu1404/$SWIFT_VERSION/$SWIFT_VERSION-ubuntu14.04.tar.gz
- tar xzf $SWIFT_VERSION-ubuntu14.04.tar.gz
- export SWIFT_ROOT_DIR="${PWD}/${SWIFT_VERSION}-ubuntu14.04"
- export PATH="${SWIFT_ROOT_DIR}/usr/bin:${PATH}"
# dispatch build
#- sudo apt-get install clang autoconf libtool pkg-config systemtap-sdt-dev libblocksruntime-dev libkqueue-dev libpthread-workqueue-dev libbsd-dev git make
#- git clone -b experimental/foundation https://github.com/apple/swift-corelibs-libdispatch.git
#- cd swift-corelibs-libdispatch
#- git submodule init
#- git submodule update
#- sh ./autogen.sh
#- ./configure --with-swift-toolchain="${SWIFT_ROOT_DIR}/usr" --prefix="${SWIFT_ROOT_DIR}/usr"
#- make && make install
#- cd ..
- export LINUX_VERSION="ubuntu14.04"
- export SWIFT_VERSION="swift-3.1-release"
- LINUX_VERSION_GLUED=`echo $LINUX_VERSION | perl -n -e'/^(.*?)\.(.*)$/; print "$1$2"'`
- SWIFT_VERSION_UPPER=`echo $SWIFT_VERSION | perl -n -e'/^(.*?)-([\.\d]*?)-(.*)$/; $code = uc $3; print "$1-$2-${code}"'`
- export RELEASE_NAME="$SWIFT_VERSION_UPPER-$LINUX_VERSION"
- wget https://swift.org/builds/$SWIFT_VERSION/$LINUX_VERSION_GLUED/$SWIFT_VERSION_UPPER/$RELEASE_NAME.tar.gz
- tar xzf $RELEASE_NAME.tar.gz
- export PATH="${PWD}/$RELEASE_NAME/usr/bin:${PATH}"
- export LD_LIBRARY_PATH="${PWD}/$RELEASE_NAME/usr/lib/swift/linux/:$LD_LIBRARY_PATH"
# get back home
- cd $MODULE_NAME
# libuv v1
- sudo add-apt-repository ppa:swiftexpress/swiftexpress --yes
- sudo apt-get update
- sudo apt-get install libuv1-dev --force-yes
# get back home
- cd $MODULE_NAME
# get crossroad build script
- wget https://raw.githubusercontent.com/crossroadlabs/utils/master/build
- chmod +x build
notifications:
email: false
49 changes: 31 additions & 18 deletions ExecutionContext.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
65D6379D1C9437BB000F5548 /* RunLoopExecutionContext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RunLoopExecutionContext.swift; sourceTree = "<group>"; };
65D637A41C9437F4000F5548 /* ExecutionContextTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExecutionContextTests.swift; sourceTree = "<group>"; };
65FD8EBF1CD9BC340046D5D6 /* ExecutionContextTenant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExecutionContextTenant.swift; sourceTree = "<group>"; };
9250E0181E91285800A9F4ED /* Package.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = "<group>"; };
92E409101CBC32F2001ED069 /* ExecutionContext.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ExecutionContext.framework; sourceTree = BUILT_PRODUCTS_DIR; };
92E409191CBC32F2001ED069 /* ExecutionContextTests-iOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ExecutionContextTests-iOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
92E4092E1CBC33F9001ED069 /* Boilerplate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Boilerplate.framework; sourceTree = "<group>"; };
Expand Down Expand Up @@ -249,8 +250,9 @@
65D637741C943763000F5548 = {
isa = PBXGroup;
children = (
65D637801C943764000F5548 /* ExecutionContext */,
65D6378C1C943764000F5548 /* ExecutionContextTests */,
9250E0181E91285800A9F4ED /* Package.swift */,
9250E0161E9126EE00A9F4ED /* Sources */,
9250E0171E91283A00A9F4ED /* Tests */,
65D637A61C94383C000F5548 /* Frameworks */,
65D6377F1C943764000F5548 /* Products */,
);
Expand Down Expand Up @@ -291,8 +293,7 @@
65D637A41C9437F4000F5548 /* ExecutionContextTests.swift */,
65D6378F1C943764000F5548 /* Info.plist */,
);
name = ExecutionContextTests;
path = Tests/ExecutionContextTests;
path = ExecutionContextTests;
sourceTree = "<group>";
};
65D637A61C94383C000F5548 /* Frameworks */ = {
Expand All @@ -318,6 +319,22 @@
path = Mac;
sourceTree = "<group>";
};
9250E0161E9126EE00A9F4ED /* Sources */ = {
isa = PBXGroup;
children = (
65D637801C943764000F5548 /* ExecutionContext */,
);
path = Sources;
sourceTree = "<group>";
};
9250E0171E91283A00A9F4ED /* Tests */ = {
isa = PBXGroup;
children = (
65D6378C1C943764000F5548 /* ExecutionContextTests */,
);
path = Tests;
sourceTree = "<group>";
};
92E4092D1CBC33DC001ED069 /* iOS */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -831,7 +848,7 @@
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = ExecutionContext/Info.plist;
INFOPLIST_FILE = Sources/ExecutionContext/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContext;
Expand All @@ -857,7 +874,7 @@
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = ExecutionContext/Info.plist;
INFOPLIST_FILE = Sources/ExecutionContext/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContext;
Expand Down Expand Up @@ -912,11 +929,10 @@
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
INFOPLIST_FILE = ExecutionContext/Info.plist;
INFOPLIST_FILE = Sources/ExecutionContext/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_SWIFT_FLAGS = "-Dnouv";
PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContext;
PRODUCT_NAME = "$(PROJECT_NAME)";
SDKROOT = iphoneos;
Expand All @@ -938,11 +954,10 @@
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
INFOPLIST_FILE = ExecutionContext/Info.plist;
INFOPLIST_FILE = Sources/ExecutionContext/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_SWIFT_FLAGS = "-Dnouv";
PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContext;
PRODUCT_NAME = "$(PROJECT_NAME)";
SDKROOT = iphoneos;
Expand Down Expand Up @@ -1002,10 +1017,10 @@
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/tvOS",
);
INFOPLIST_FILE = ExecutionContext/Info.plist;
INFOPLIST_FILE = Sources/ExecutionContext/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_SWIFT_FLAGS = "-Dnouv";
OTHER_SWIFT_FLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContext;
PRODUCT_NAME = "$(PROJECT_NAME)";
SDKROOT = appletvos;
Expand All @@ -1028,10 +1043,10 @@
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/tvOS",
);
INFOPLIST_FILE = ExecutionContext/Info.plist;
INFOPLIST_FILE = Sources/ExecutionContext/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_SWIFT_FLAGS = "-Dnouv";
OTHER_SWIFT_FLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContext;
PRODUCT_NAME = "$(PROJECT_NAME)";
SDKROOT = appletvos;
Expand Down Expand Up @@ -1091,10 +1106,9 @@
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/watchOS",
);
INFOPLIST_FILE = ExecutionContext/Info.plist;
INFOPLIST_FILE = Sources/ExecutionContext/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_SWIFT_FLAGS = "-Dnouv";
PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContext;
PRODUCT_NAME = "$(PROJECT_NAME)";
SDKROOT = watchos;
Expand All @@ -1118,10 +1132,9 @@
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/watchOS",
);
INFOPLIST_FILE = ExecutionContext/Info.plist;
INFOPLIST_FILE = Sources/ExecutionContext/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_SWIFT_FLAGS = "-Dnouv";
PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.ExecutionContext;
PRODUCT_NAME = "$(PROJECT_NAME)";
SDKROOT = watchos;
Expand Down
4 changes: 1 addition & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ import PackageDescription

let package = Package(
name: "ExecutionContext",
targets: [Target(name: "ExecutionContext")],
dependencies: [
.Package(url: "https://github.com/reactive-swift/RunLoop.git", majorVersion: 0, minor: 2)
],
exclude: ["Carthage"]
]
)
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
//limitations under the License.
//===----------------------------------------------------------------------===//

#if !os(Linux) || dispatch

#if !nodispatch
import Foundation
import Dispatch
import Boilerplate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import Boilerplate
import Glibc
#endif

#if !os(Linux) || dispatch
#if !nodispatch
import Dispatch
#endif

Expand Down
File renamed without changes.
24 changes: 11 additions & 13 deletions Tests/ExecutionContextTests/ExecutionContextTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import XCTest
import Boilerplate
import RunLoop

#if !os(tvOS)
class ExecutionContextTests: XCTestCase {
//Tests does not create static variables. We need initialized main thread
//let mainContext = DefaultExecutionContext.main
Expand Down Expand Up @@ -126,15 +125,15 @@ class ExecutionContextTests: XCTestCase {

func testMain() {
let context:ExecutionContextProtocol = DefaultExecutionContext.main
#if os(Linux)
let runRunLoop = true
#else
//#if os(Linux)
// let runRunLoop = true
//#else
let runRunLoop = false
#endif
//#endif

#if !os(Linux)
//#if !os(Linux)
syncTest(context: context)
#endif
//#endif
asyncTest(context: context, runRunLoop: runRunLoop)
afterTest(context: context, runRunLoop: runRunLoop)
//afterTestAdvanced - no it will not work here
Expand All @@ -151,11 +150,11 @@ class ExecutionContextTests: XCTestCase {

func testCustomOnMain() {
let context = executionContext(executor: main.execute)
#if os(Linux)
let runRunLoop = true
#else
//#if os(Linux)
// let runRunLoop = true
//#else
let runRunLoop = false
#endif
//#endif

// syncTest(context)
asyncTest(context: context, runRunLoop: runRunLoop)
Expand All @@ -174,11 +173,10 @@ class ExecutionContextTests: XCTestCase {
//afterTestAdvanced - no it will not work here
}
}
#endif

#if os(Linux)
extension ExecutionContextTests {
static var allTests : [(String, ExecutionContextTests -> () throws -> Void)] {
static var allTests : [(String, (ExecutionContextTests) -> () throws -> Void)] {
return [
("testSerial", testSerial),
("testParallel", testParallel),
Expand Down
9 changes: 9 additions & 0 deletions Tests/ExecutionContextTests/XCTestManifests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import XCTest

#if os(Linux)
public func allTests() -> [XCTestCaseEntry] {
return [
testCase(ExecutionContextTests.allTests)
]
}
#endif
10 changes: 6 additions & 4 deletions Tests/LinuxMain.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import XCTest

@testable import ExecutionContextTestSuite
import ExecutionContextTests

XCTMain([
testCase(ExecutionContextTests.allTests),
])
var tests = [XCTestCaseEntry]()

tests += ExecutionContextTests.allTests()

XCTMain(tests)