Skip to content

Commit

Permalink
Merge f499b10 into b4b6243
Browse files Browse the repository at this point in the history
  • Loading branch information
HJianBo committed Dec 9, 2019
2 parents b4b6243 + f499b10 commit 5aef5a6
Show file tree
Hide file tree
Showing 28 changed files with 451 additions and 211 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ Example/Pods
Example/Podfile.lock
Carthage/
Cartfile.resolved
xcenv.sh
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0
5.1
23 changes: 14 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
language: swift
osx_image: xcode10.2
xcode_project: CocoaMQTT.xcodeproj
xcode_scheme: CocoaMQTT
xcode_destination: platform=iOS Simulator,OS=12.2,name=iPhone Xs
xcode_sdk: iphonesimulator12.2
osx_image: xcode11.1

before_install:
- wget https://www.emqx.io/downloads/broker/v3.1.2/emqx-macosx-v3.1.2.zip -O emqx.zip
- unzip emqx.zip
- emqx/bin/emqx start
- wget https://www.emqx.io/downloads/broker/v3.2.7/emqx-macosx-v3.2.7.zip -O emqx.zip
- unzip emqx.zip
- brew install openssl
- emqx/bin/emqx start
- git clone https://github.com/hjianbo/xcode-coveralls --depth=1
- cd xcode-coveralls && git submodule init && git submodule update && cd ..
- xcodebuild -project xcode-coveralls/xcode-coveralls.xcodeproj -scheme xcode-coveralls DSTROOT=/ SYMROOT=build install | xcpretty

before_script:
- carthage update --platform iOS
- carthage update --platform macOS

script:
- set -o pipefail && xcodebuild -project CocoaMQTT.xcodeproj -scheme CocoaMQTT -derivedDataPath . build test

after_success:
- bash coveralls.sh
54 changes: 45 additions & 9 deletions CocoaMQTT.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
8225B547227C312400E4DB51 /* CocoaMQTT.h in Headers */ = {isa = PBXBuildFile; fileRef = 040997711C1B1070006B5A6D /* CocoaMQTT.h */; settings = {ATTRIBUTES = (Public, ); }; };
8225B556227C334700E4DB51 /* CocoaMQTTTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0409971E1C1B0B96006B5A6D /* CocoaMQTTTests.swift */; };
8225B557227C334700E4DB51 /* FrameTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8270C4AA21DA6F6700C5D485 /* FrameTests.swift */; };
8225B571227C3B0200E4DB51 /* CocoaAsyncSocket.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8225B543227C308900E4DB51 /* CocoaAsyncSocket.framework */; };
82519C0722ACC6E100FA0815 /* CocoaMQTTTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82519C0622ACC6E100FA0815 /* CocoaMQTTTypes.swift */; };
82CF1FB022943B2100DF539A /* CocoaMQTTReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82CF1FAF22943B2100DF539A /* CocoaMQTTReader.swift */; };
8D14C7632345CAB5002D959E /* CocoaMQTTDeliverTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D14C7622345CAB5002D959E /* CocoaMQTTDeliverTests.swift */; };
Expand All @@ -36,6 +35,8 @@
8D43DE6222FAFDA700D9A06B /* FramePingReq.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D43DE6122FAFDA700D9A06B /* FramePingReq.swift */; };
8D43DE6422FAFE5F00D9A06B /* FramePingResp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D43DE6322FAFE5F00D9A06B /* FramePingResp.swift */; };
8D43DE6622FAFF2500D9A06B /* FrameDisconnect.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D43DE6522FAFF2500D9A06B /* FrameDisconnect.swift */; };
8D6C0E25239E7B44003094E9 /* CocoaAsyncSocket.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8225B543227C308900E4DB51 /* CocoaAsyncSocket.framework */; };
8D6C0E26239E7B44003094E9 /* CocoaAsyncSocket.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 8225B543227C308900E4DB51 /* CocoaAsyncSocket.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand All @@ -48,6 +49,20 @@
};
/* End PBXContainerItemProxy section */

/* Begin PBXCopyFilesBuildPhase section */
8D6C0E27239E7B44003094E9 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
8D6C0E26239E7B44003094E9 /* CocoaAsyncSocket.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
0409971E1C1B0B96006B5A6D /* CocoaMQTTTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CocoaMQTTTests.swift; sourceTree = "<group>"; };
040997201C1B0B96006B5A6D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
Expand Down Expand Up @@ -89,7 +104,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
8225B571227C3B0200E4DB51 /* CocoaAsyncSocket.framework in Frameworks */,
8D6C0E25239E7B44003094E9 /* CocoaAsyncSocket.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -220,6 +235,8 @@
8225B52E227C2E8700E4DB51 /* Sources */,
8225B52F227C2E8700E4DB51 /* Frameworks */,
8225B530227C2E8700E4DB51 /* Resources */,
8D6C0E27239E7B44003094E9 /* Embed Frameworks */,
8D6C0E28239E90AB003094E9 /* ShellScript */,
);
buildRules = (
);
Expand Down Expand Up @@ -257,7 +274,7 @@
attributes = {
LastSwiftUpdateCheck = 1020;
LastUpgradeCheck = 0930;
ORGANIZATIONNAME = emqtt.io;
ORGANIZATIONNAME = emqx.io;
TargetAttributes = {
8225B531227C2E8700E4DB51 = {
CreatedOnToolsVersion = 10.2.1;
Expand Down Expand Up @@ -321,6 +338,23 @@
shellPath = /bin/sh;
shellScript = "for path in $FRAMEWORK_SEARCH_PATHS\ndo\nif [ -d \"${path}/CocoaAsyncSocket.framework\" ] && [[ $path == *\"Carthage\"* ]]; then\nexport SCRIPT_INPUT_FILE_COUNT=1\nexport SCRIPT_INPUT_FILE_0=\"${path}/CocoaAsyncSocket.framework\"\n/usr/local/bin/carthage copy-frameworks\nbreak\nfi\ndone\n";
};
8D6C0E28239E90AB003094E9 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n\nexport CURRENT_ARCH=\"x86_64\"\nexport | egrep '(BUILT_PRODUCTS_DIR)|(CURRENT_ARCH)|(OBJECT_FILE_DIR_normal)|(SRCROOT)|(OBJROOT)' > xcenv.sh\n\n";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down Expand Up @@ -417,6 +451,8 @@
"FRAMEWORK_SEARCH_PATHS[sdk=watchsimulator*]" = "$(PROJECT_DIR)/Carthage/Build/watchOS";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_GENERATE_TEST_COVERAGE_FILES = YES;
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
Expand All @@ -429,8 +465,8 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MACOSX_DEPLOYMENT_TARGET = 10.12;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = "";
Expand Down Expand Up @@ -485,15 +521,17 @@
"FRAMEWORK_SEARCH_PATHS[sdk=watchos*]" = "$(PROJECT_DIR)/Carthage/Build/watchOS";
"FRAMEWORK_SEARCH_PATHS[sdk=watchsimulator*]" = "$(PROJECT_DIR)/Carthage/Build/watchOS";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_GENERATE_TEST_COVERAGE_FILES = YES;
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MACOSX_DEPLOYMENT_TARGET = 10.12;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = "";
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator";
Expand Down Expand Up @@ -591,7 +629,6 @@
);
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = CocoaMQTTTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.2;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
Expand Down Expand Up @@ -620,7 +657,6 @@
);
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = CocoaMQTTTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.2;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "io.emqx.CocoaMQTT-Tests";
Expand Down
25 changes: 11 additions & 14 deletions CocoaMQTT.xcodeproj/xcshareddata/xcschemes/CocoaMQTT.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,17 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8225B531227C2E8700E4DB51"
BuildableName = "CocoaMQTT.framework"
BlueprintName = "CocoaMQTT"
ReferencedContainer = "container:CocoaMQTT.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -39,17 +49,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8225B531227C2E8700E4DB51"
BuildableName = "CocoaMQTT.framework"
BlueprintName = "CocoaMQTT"
ReferencedContainer = "container:CocoaMQTT.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -70,8 +69,6 @@
ReferencedContainer = "container:CocoaMQTT.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
8 changes: 4 additions & 4 deletions CocoaMQTTTests/CocoaMQTTDeliverTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class CocoaMQTTDeliverTests: XCTestCase {
let caller = Caller()
let deliver = CocoaMQTTDeliver()

var frames = [FramePublish(topic: "t/0", payload: [0x00], qos: .qos0),
let frames = [FramePublish(topic: "t/0", payload: [0x00], qos: .qos0),
FramePublish(topic: "t/1", payload: [0x01], qos: .qos1, msgid: 1),
FramePublish(topic: "t/2", payload: [0x02], qos: .qos2, msgid: 2)]

Expand All @@ -44,7 +44,7 @@ class CocoaMQTTDeliverTests: XCTestCase {
let caller = Caller()
let deliver = CocoaMQTTDeliver()

var frames = [FramePublish(topic: "t/0", payload: [0x00], qos: .qos0),
let frames = [FramePublish(topic: "t/0", payload: [0x00], qos: .qos0),
FramePublish(topic: "t/1", payload: [0x01], qos: .qos1, msgid: 1),
FramePublish(topic: "t/2", payload: [0x02], qos: .qos2, msgid: 2)]

Expand Down Expand Up @@ -104,7 +104,7 @@ class CocoaMQTTDeliverTests: XCTestCase {
XCTAssertEqual(true, deliver.add(frames[2]))
XCTAssertEqual(false, deliver.add(frames[0]))

ms_sleep(1000) // Wait for re-delivering timeout
ms_sleep(1100) // Wait for re-delivering timeout
XCTAssertEqual(caller.frames.count, 2)
assertEqual(caller.frames[0], frames[1])
assertEqual(caller.frames[1], frames[1])
Expand Down Expand Up @@ -158,7 +158,7 @@ class CocoaMQTTDeliverTests: XCTestCase {
}
}

class Caller: CocoaMQTTDeliverProtocol {
private class Caller: CocoaMQTTDeliverProtocol {

var delegateQueue: DispatchQueue

Expand Down
6 changes: 3 additions & 3 deletions CocoaMQTTTests/CocoaMQTTStorageTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class CocoaMQTTStorageTests: XCTestCase {
}

func testStorage() {
var frames = [FramePublish(topic: "t/1", payload: [0x01], qos: .qos1, msgid: 1),
let frames = [FramePublish(topic: "t/1", payload: [0x01], qos: .qos1, msgid: 1),
FramePublish(topic: "t/2", payload: [0x01], qos: .qos1, msgid: 2),
FramePublish(topic: "t/3", payload: [0x01], qos: .qos1, msgid: 3),]

Expand All @@ -36,8 +36,8 @@ class CocoaMQTTStorageTests: XCTestCase {
storage = nil

storage = CocoaMQTTStorage(by: clientId)
var should = [frames[0], frames[2]]
var saved = storage?.readAll()
let should = [frames[0], frames[2]]
let saved = storage?.readAll()
XCTAssertEqual(should.count, saved?.count)
for i in 0 ..< should.count {
assertEqual(should[i], saved?[i])
Expand Down

0 comments on commit 5aef5a6

Please sign in to comment.