From 77b1d87a944fc6658b69037fc182b5e7baf6ecfb Mon Sep 17 00:00:00 2001 From: Cornelius Horstmann Date: Sun, 15 Oct 2017 17:05:46 +0200 Subject: [PATCH] Added Swift Package Manager support --- .gitignore | 1 + CHANGELOG.md | 1 + MatomoTracker/Application.swift | 4 ++++ Package.swift | 17 +++++++++++++++++ Rakefile | 7 +++++++ 5 files changed, 30 insertions(+) create mode 100644 Package.swift diff --git a/.gitignore b/.gitignore index 5c33a5a5..b8bb903c 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ Doc/ Pods /Podfile.lock Carthage/ +/.build diff --git a/CHANGELOG.md b/CHANGELOG.md index 334c2f7d..f910b8a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +* **feature** Added support for the Swift Package Manager. [#312](https://github.com/matomo-org/matomo-sdk-ios/pull/312) * **bugfix** Fixed an issue with `WKWebView` on iOS not returning a user agent string [#322](https://github.com/matomo-org/matomo-sdk-ios/issues/322) ## 7.0.3 diff --git a/MatomoTracker/Application.swift b/MatomoTracker/Application.swift index b9883639..20c02344 100644 --- a/MatomoTracker/Application.swift +++ b/MatomoTracker/Application.swift @@ -1,3 +1,7 @@ +#if SWIFT_PACKAGE +import Foundation +#endif + public struct Application { /// Creates an returns a new application object representing the current application public static func makeCurrentApplication() -> Application { diff --git a/Package.swift b/Package.swift new file mode 100644 index 00000000..3c1b6f2d --- /dev/null +++ b/Package.swift @@ -0,0 +1,17 @@ +// swift-tools-version:5.0 +// +// MatomoTracker +// + +import PackageDescription + +let package = Package( + name: "MatomoTracker", + products: [ + .library(name: "MatomoTracker", targets: ["MatomoTracker"]) + ], + targets: [ + .target(name: "MatomoTracker", dependencies: [], path: "MatomoTracker"), + ], + swiftLanguageVersions: [.v5] +) diff --git a/Rakefile b/Rakefile index dcd0cfdd..a442ad09 100644 --- a/Rakefile +++ b/Rakefile @@ -42,6 +42,12 @@ namespace :package_manager do sh("carthage build --no-skip-current") rescue nil package_manager_failed('Carthage integration') unless $?.success? end + + desc 'Builds the project with the Swift Package Manager' + task spm: :prepare do + sh("swift build") rescue nil + package_manager_failed('Swift Package Manager') unless $?.success? + end end @@ -56,6 +62,7 @@ end desc 'Check the integration of MatomoTracker with package managers' task :build_with_package_manager do Rake::Task['package_manager:carthage'].invoke + Rake::Task['package_manager:spm'].invoke end task default: 'test'