Skip to content

Commit

Permalink
Added Swift Package Manager support
Browse files Browse the repository at this point in the history
  • Loading branch information
Cornelius Horstmann authored and brototyp committed Nov 6, 2019
1 parent 8bb44e1 commit 77b1d87
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ Doc/
Pods
/Podfile.lock
Carthage/
/.build
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions MatomoTracker/Application.swift
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
17 changes: 17 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -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]
)
7 changes: 7 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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'
Expand Down

0 comments on commit 77b1d87

Please sign in to comment.