From 2b918436e0e4961ae4345fad2345cb2a1707d8e3 Mon Sep 17 00:00:00 2001 From: Ignacio Bonafonte Date: Thu, 11 Jun 2020 17:12:54 +0200 Subject: [PATCH 1/3] Add support for Swift Package Manager (static and dynamic library) Add installation instructions for SwiftPM and Carthage --- Package.swift | 17 +++++++++++++++++ README.md | 19 ++++++++++++++++++- opentracing.podspec | 2 +- 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 Package.swift diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..043e2a5 --- /dev/null +++ b/Package.swift @@ -0,0 +1,17 @@ +// 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: "Opentracing", + products: [ + .library( name: "Opentracing", type: .dynamic, targets: ["Opentracing"]), + .library( name: "libOpentracing", type: .static, targets: ["Opentracing"]), + ], + dependencies: [ + ], + targets: [ + .target( name: "Opentracing", dependencies: [], path: "Pod/Classes") + ] +) diff --git a/README.md b/README.md index f74916c..3ea8874 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Gitter chat](http://img.shields.io/badge/gitter-join%20chat%20%E2%86%92-brightgreen.svg)](https://gitter.im/opentracing/public) [![Version](https://img.shields.io/cocoapods/v/opentracing.svg?style=flat)](http://cocoapods.org/pods/opentracing) [![License](https://img.shields.io/cocoapods/l/opentracing.svg?style=flat)](http://cocoapods.org/pods/opentracing) [![Platform](https://img.shields.io/cocoapods/p/opentracing.svg?style=flat)](http://cocoapods.org/pods/opentracing) +[![Gitter chat](http://img.shields.io/badge/gitter-join%20chat%20%E2%86%92-brightgreen.svg)](https://gitter.im/opentracing/public) [![Version](https://img.shields.io/cocoapods/v/opentracing.svg?style=flat)](http://cocoapods.org/pods/opentracing) [![License](https://img.shields.io/cocoapods/l/opentracing.svg?style=flat)](http://cocoapods.org/pods/opentracing) [![Platform](https://img.shields.io/cocoapods/p/opentracing.svg?style=flat)](http://cocoapods.org/pods/opentracing) [![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![SwiftPM compatible](https://img.shields.io/badge/SwiftPM-compatible-brightgreen.svg)](https://swift.org/package-manager/) # OpenTracing API for Objective-C @@ -17,3 +17,20 @@ Use [CocoaPods](https://guides.cocoapods.org/using/getting-started.html)! ```ruby pod "opentracing" ``` + +## Installation (Carthage) + +Use [Carthage](https://github.com/Carthage/Carthage#quick-start)! + +```ruby +github "opentracing/opentracing-objc" +``` + +## Installation (SwiftPM) + + ```swift + dependencies: [ + .package(url: "https://github.com/opentracing/opentracing-objc", from: "0.5.2") + ] + ``` + diff --git a/opentracing.podspec b/opentracing.podspec index a1f31a6..572399e 100644 --- a/opentracing.podspec +++ b/opentracing.podspec @@ -1,7 +1,7 @@ # GENERATED FILE: DO NOT EDIT DIRECTLY Pod::Spec.new do |s| s.name = "opentracing" - s.version = "0.5.1" + s.version = "0.5.2" s.summary = "The OpenTracing API for Objective-C" s.description = <<-DESC From 5c3e527934f9186448c00284ca2aa91e5517dfe9 Mon Sep 17 00:00:00 2001 From: Ignacio Bonafonte Date: Fri, 12 Jun 2020 17:11:08 +0200 Subject: [PATCH 2/3] Create a header file that SPM will use for publishing classes --- Package.swift | 7 ++++++- Pod/SPMHeaders/opentracing.h | 26 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 Pod/SPMHeaders/opentracing.h diff --git a/Package.swift b/Package.swift index 043e2a5..1fb1156 100644 --- a/Package.swift +++ b/Package.swift @@ -12,6 +12,11 @@ let package = Package( dependencies: [ ], targets: [ - .target( name: "Opentracing", dependencies: [], path: "Pod/Classes") + .target( name: "Opentracing", + dependencies: [], + path: "Pod", + sources:["Classes"], + publicHeadersPath: "SPMHeaders") ] ) + diff --git a/Pod/SPMHeaders/opentracing.h b/Pod/SPMHeaders/opentracing.h new file mode 100644 index 0000000..ef08fbf --- /dev/null +++ b/Pod/SPMHeaders/opentracing.h @@ -0,0 +1,26 @@ +// +// OpenTracing.h +// OpenTracing +// +// Created by Ignacio Bonafonte on 07/05/2019. +// Copyright © 2019 OpenTracing. All rights reserved. +// + +#import + +//! Project version number for OpenTracing. +FOUNDATION_EXPORT double OpenTracingVersionNumber; + +//! Project version string for OpenTracing. +FOUNDATION_EXPORT const unsigned char OpenTracingVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + +#import <./../Classes/OTTracer.h> +#import <./../Classes/OTSpanContext.h> +#import <./../Classes/OTSpan.h> +#import <./../Classes/OTNoop.h> +#import <./../Classes/OTGlobal.h> +#import <./../Classes/OTReference.h> +#import <./../Classes/OTVersion.h> + From c3a60aa19668e48f647c2e9d9ce7e364f69bc496 Mon Sep 17 00:00:00 2001 From: Ignacio Bonafonte Date: Mon, 15 Jun 2020 16:28:23 +0200 Subject: [PATCH 3/3] Add Swift Name for protocol inheriting (it fails when implementing from swift without it) --- Pod/Classes/OTTracer.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Pod/Classes/OTTracer.h b/Pod/Classes/OTTracer.h index e24aee9..e65cf7c 100644 --- a/Pod/Classes/OTTracer.h +++ b/Pod/Classes/OTTracer.h @@ -179,7 +179,7 @@ FOUNDATION_EXPORT NSInteger OTSpanContextCorruptedCode; * @see OTUsupportedFormatCode * @see OTInvalidCarrierCode */ -- (BOOL)inject:(id)spanContext format:(NSString*)format carrier:(id)carrier error:(NSError* __autoreleasing *)outError; +- (BOOL)inject:(id)spanContext format:(NSString*)format carrier:(id)carrier error:(NSError* __autoreleasing *)outError NS_SWIFT_NAME(inject(spanContext:format:carrier:)); /** * @see OTTracer#extractWithFormat:carrier:error: @@ -221,7 +221,7 @@ FOUNDATION_EXPORT NSInteger OTSpanContextCorruptedCode; * @see OTSpanContextCorruptedCode * @see OTTracer#startSpan:references:tags:startTime: */ -- (nullable id)extractWithFormat:(NSString*)format carrier:(id)carrier error:(NSError* __autoreleasing *)outError; +- (nullable id)extractWithFormat:(NSString*)format carrier:(id)carrier error:(NSError* __autoreleasing *)outError NS_SWIFT_NAME(extractWithFormat(format:carrier:)); @end