diff --git a/.gitignore b/.gitignore index 6f8bb33..745353b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ # .DS_Store build/ +.build/ *.pbxuser !default.pbxuser *.mode1v3 diff --git a/.travis.yml b/.travis.yml index 04ba88e..0f6c444 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,9 @@ before_script: - export LANG=en_US.UTF-8 script: - xcodebuild $ACTION -project Polyline.xcodeproj -scheme "$SCHEME" -destination "$DESTINATION" ONLY_ACTIVE_ARCH=NO + - swift build && swift test env: - SCHEME=Polyline ACTION=test DESTINATION='platform=iOS Simulator,name=iPhone 7,OS=10.1' ONLY_ACTIVE_ARCH=NO - SCHEME=PolylineMac ACTION=test DESTINATION='platform=OS X' - - SCHEME=PolylineTV ACTION=test DESTINATION='platform=tvOS Simulator,name=Apple TV 1080p,OS=10.1' + - SCHEME=PolylineTV ACTION=test DESTINATION='platform=tvOS Simulator,name=Apple TV 1080p,OS=11.0' - SCHEME=PolylineWatch ACTION=build DESTINATION='platform=watchOS Simulator,name=Apple Watch Series 2 - 42mm,OS=3.1' diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..aa88a69 --- /dev/null +++ b/Package.swift @@ -0,0 +1,28 @@ +// swift-tools-version:4.0 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "Polyline", + products: [ + // Products define the executables and libraries produced by a package, and make them visible to other packages. + .library( + name: "Polyline", + targets: ["Polyline"]), + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + // .package(url: /* package url */, from: "1.0.0"), + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages which this package depends on. + .target( + name: "Polyline", + dependencies: []), + .testTarget( + name: "PolylineTests", + dependencies: ["Polyline"]), + ] +) diff --git a/Polyline.podspec b/Polyline.podspec index 618cec8..5ec5df1 100644 --- a/Polyline.podspec +++ b/Polyline.podspec @@ -82,7 +82,7 @@ Pod::Spec.new do |s| # Not including the public_header_files will make all headers public. # - s.source_files = "Polyline" + s.source_files = "Sources/Polyline" # s.public_header_files = "Classes/**/*.h" diff --git a/Polyline.xcodeproj/project.pbxproj b/Polyline.xcodeproj/project.pbxproj index 642080c..81fe408 100644 --- a/Polyline.xcodeproj/project.pbxproj +++ b/Polyline.xcodeproj/project.pbxproj @@ -133,10 +133,10 @@ 207F63F419B5DF7E005261FA = { isa = PBXGroup; children = ( + 35A28A5720E284B20030D1D9 /* Tests */, + 35A28A5420E283D10030D1D9 /* Sources */, 207F641C19B5EDC3005261FA /* README.md */, 207F641819B5E05A005261FA /* LICENSE.txt */, - 207F640019B5DF7E005261FA /* Polyline */, - 207F640A19B5DF7E005261FA /* PolylineTests */, 207F63FF19B5DF7E005261FA /* Products */, ); sourceTree = ""; @@ -155,42 +155,58 @@ name = Products; sourceTree = ""; }; - 207F640019B5DF7E005261FA /* Polyline */ = { + 207F640A19B5DF7E005261FA /* PolylineTests */ = { isa = PBXGroup; children = ( - 207F640319B5DF7E005261FA /* Polyline.h */, - 207F641A19B5E10C005261FA /* Polyline.swift */, - 207F640119B5DF7E005261FA /* Supporting Files */, + 207F640D19B5DF7E005261FA /* PolylineTests.swift */, + 28DD887D1AA1280C001CC005 /* FunctionalPolylineTests.swift */, + 207F640B19B5DF7E005261FA /* Supporting Files */, ); - path = Polyline; + path = PolylineTests; sourceTree = ""; }; - 207F640119B5DF7E005261FA /* Supporting Files */ = { + 207F640B19B5DF7E005261FA /* Supporting Files */ = { isa = PBXGroup; children = ( - 207F640219B5DF7E005261FA /* Info.plist */, + 207F640C19B5DF7E005261FA /* Info.plist */, ); name = "Supporting Files"; sourceTree = ""; }; - 207F640A19B5DF7E005261FA /* PolylineTests */ = { + 35A28A5420E283D10030D1D9 /* Sources */ = { isa = PBXGroup; children = ( - 207F640D19B5DF7E005261FA /* PolylineTests.swift */, - 28DD887D1AA1280C001CC005 /* FunctionalPolylineTests.swift */, - 207F640B19B5DF7E005261FA /* Supporting Files */, + 35A28A5520E283EA0030D1D9 /* Polyline */, ); - path = PolylineTests; + path = Sources; sourceTree = ""; }; - 207F640B19B5DF7E005261FA /* Supporting Files */ = { + 35A28A5520E283EA0030D1D9 /* Polyline */ = { isa = PBXGroup; children = ( - 207F640C19B5DF7E005261FA /* Info.plist */, + 207F640319B5DF7E005261FA /* Polyline.h */, + 207F641A19B5E10C005261FA /* Polyline.swift */, + 35A28A5620E283F90030D1D9 /* Supporting Files */, + ); + path = Polyline; + sourceTree = ""; + }; + 35A28A5620E283F90030D1D9 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 207F640219B5DF7E005261FA /* Info.plist */, ); name = "Supporting Files"; sourceTree = ""; }; + 35A28A5720E284B20030D1D9 /* Tests */ = { + isa = PBXGroup; + children = ( + 207F640A19B5DF7E005261FA /* PolylineTests */, + ); + path = Tests; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -663,7 +679,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = Polyline/Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Sources/Polyline/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.ramoapps.$(PRODUCT_NAME:rfc1034identifier)"; @@ -684,7 +700,7 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = Polyline/Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Sources/Polyline/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.ramoapps.$(PRODUCT_NAME:rfc1034identifier)"; @@ -702,7 +718,7 @@ "DEBUG=1", "$(inherited)", ); - INFOPLIST_FILE = PolylineTests/Info.plist; + INFOPLIST_FILE = Tests/PolylineTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.ramoapps.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -713,7 +729,7 @@ 207F641619B5DF7E005261FA /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - INFOPLIST_FILE = PolylineTests/Info.plist; + INFOPLIST_FILE = Tests/PolylineTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.ramoapps.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -734,7 +750,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; FRAMEWORK_VERSION = A; GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "$(SRCROOT)/Polyline/Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Sources/Polyline/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.ramoapps.Polyline; @@ -759,7 +775,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; FRAMEWORK_VERSION = A; GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "$(SRCROOT)/Polyline/Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Sources/Polyline/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.ramoapps.Polyline; @@ -778,7 +794,7 @@ COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = dwarf; GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = PolylineTests/Info.plist; + INFOPLIST_FILE = Tests/PolylineTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.ramoapps.PolylineTests; PRODUCT_NAME = PolylineTests; @@ -796,7 +812,7 @@ COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = PolylineTests/Info.plist; + INFOPLIST_FILE = Tests/PolylineTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.ramoapps.PolylineTests; PRODUCT_NAME = PolylineTests; @@ -816,7 +832,7 @@ DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = Polyline/Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Sources/Polyline/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.ramoapps.Polyline; @@ -841,7 +857,7 @@ DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = Polyline/Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Sources/Polyline/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.ramoapps.Polyline; @@ -860,7 +876,7 @@ CLANG_ANALYZER_NONNULL = YES; DEBUG_INFORMATION_FORMAT = dwarf; GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = PolylineTests/Info.plist; + INFOPLIST_FILE = Tests/PolylineTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.ramoapps.PolylineTests; PRODUCT_NAME = PolylineTests; @@ -877,7 +893,7 @@ COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = PolylineTests/Info.plist; + INFOPLIST_FILE = Tests/PolylineTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.ramoapps.PolylineTests; PRODUCT_NAME = PolylineTests; @@ -899,7 +915,7 @@ DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = Polyline/Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Sources/Polyline/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.ramoapps.Polyline; @@ -925,7 +941,7 @@ DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = Polyline/Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Sources/Polyline/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.ramoapps.Polyline; diff --git a/README.md b/README.md index 121155b..d0fff4b 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,13 @@ You can integrate Polyline in your `Cartfile` like this: github "raphaelmor/Polyline" ~> 4.0 ``` +### Swift Package Manager +You can integrate Polyline using the [Swift Package Manager](https://swift.org/package-manager/), add the following package to the `dependencies` in your Package.swift file: + +```swift +.Package(url: "https://github.com/raphaelmor/Polyline.git", .upToNextMinor(from: "4.0")) +``` + ### Manual - Drag Polyline.swift inside your project tree. diff --git a/Polyline/Info.plist b/Sources/Polyline/Info.plist similarity index 100% rename from Polyline/Info.plist rename to Sources/Polyline/Info.plist diff --git a/Polyline/Polyline.h b/Sources/Polyline/Polyline.h similarity index 100% rename from Polyline/Polyline.h rename to Sources/Polyline/Polyline.h diff --git a/Polyline/Polyline.swift b/Sources/Polyline/Polyline.swift similarity index 100% rename from Polyline/Polyline.swift rename to Sources/Polyline/Polyline.swift diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift new file mode 100644 index 0000000..27f254e --- /dev/null +++ b/Tests/LinuxMain.swift @@ -0,0 +1,7 @@ +import XCTest + +import PolylineTests + +var tests = [XCTestCaseEntry]() +tests += PolylineTests.allTests() +XCTMain(tests) \ No newline at end of file diff --git a/PolylineTests/FunctionalPolylineTests.swift b/Tests/PolylineTests/FunctionalPolylineTests.swift similarity index 100% rename from PolylineTests/FunctionalPolylineTests.swift rename to Tests/PolylineTests/FunctionalPolylineTests.swift diff --git a/PolylineTests/Info.plist b/Tests/PolylineTests/Info.plist similarity index 100% rename from PolylineTests/Info.plist rename to Tests/PolylineTests/Info.plist diff --git a/PolylineTests/PolylineTests.swift b/Tests/PolylineTests/PolylineTests.swift similarity index 100% rename from PolylineTests/PolylineTests.swift rename to Tests/PolylineTests/PolylineTests.swift diff --git a/Tests/PolylineTests/XCTestManifests.swift b/Tests/PolylineTests/XCTestManifests.swift new file mode 100644 index 0000000..09a46f4 --- /dev/null +++ b/Tests/PolylineTests/XCTestManifests.swift @@ -0,0 +1,9 @@ +import XCTest + +#if !os(macOS) +public func allTests() -> [XCTestCaseEntry] { + return [ + testCase(PolylineTests.allTests), + ] +} +#endif \ No newline at end of file