Skip to content

Commit 263f3c7

Browse files
authored
Merge pull request #146 from Comcast/add-spm-support
Mamba 2.0 SPM Support
2 parents 7f7870c + 6de0a80 commit 263f3c7

File tree

69 files changed

+554
-315
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+554
-315
lines changed

Package.swift

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// swift-tools-version:5.3
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
//
4+
// Package.swift
5+
// mamba
6+
//
7+
// Copyright © 2020 Comcast Cable Communications Management, LLC
8+
// Licensed under the Apache License, Version 2.0 (the "License");
9+
// you may not use this file except in compliance with the License.
10+
// You may obtain a copy of the License at
11+
//
12+
// http://www.apache.org/licenses/LICENSE-2.0
13+
//
14+
// Unless required by applicable law or agreed to in writing, software
15+
// distributed under the License is distributed on an "AS IS" BASIS,
16+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
// See the License for the specific language governing permissions and
18+
// limitations under the License.
19+
//
20+
21+
import PackageDescription
22+
23+
let package = Package(
24+
name: "mamba",
25+
products: [
26+
.library(
27+
name: "mamba",
28+
targets: ["mamba"]
29+
)
30+
],
31+
targets: [
32+
.target(
33+
name: "mamba",
34+
dependencies: [.target(name: "HLSObjectiveC")],
35+
path: "mambaSharedFramework",
36+
exclude: [
37+
"HLS ObjectiveC",
38+
"PlaylistParserError",
39+
"mamba.h"
40+
],
41+
resources: [
42+
.process("Resources")
43+
]
44+
),
45+
.target(
46+
name: "PlaylistParserError",
47+
path: "mambaSharedFramework/PlaylistParserError"
48+
),
49+
.target(
50+
name: "HLSObjectiveC",
51+
dependencies: ["PlaylistParserError"],
52+
path: "mambaSharedFramework/HLS ObjectiveC",
53+
exclude: [
54+
"PrototypeRapidParseArray.include",
55+
"RapidParser_LookingForEForEXTINFState_ParseArray.include",
56+
"RapidParser_LookingForEForEXTState_ParseArray.include",
57+
"RapidParser_LookingForHashForEXTINFState_ParseArray.include",
58+
"RapidParser_LookingForHashForEXTState_ParseArray.include",
59+
"RapidParser_LookingForIForEXTINFState_ParseArray.include",
60+
"RapidParser_LookingForNewlineForEXTINFState_ParseArray.include",
61+
"RapidParser_LookingForNewLineForEXTState_ParseArray.include",
62+
"RapidParser_LookingForNewLineForHashState_ParseArray.include",
63+
"RapidParser_LookingForNForEXTINFState_ParseArray.include",
64+
"RapidParser_LookingForTForEXTINFState_ParseArray.include",
65+
"RapidParser_LookingForXForEXTINFState_ParseArray.include",
66+
"RapidParser_LookingForXForEXTState_ParseArray.include",
67+
"RapidParser_ScanningState_ParseArray.include",
68+
]
69+
)
70+
]
71+
)

mamba.xcodeproj/project.pbxproj

Lines changed: 386 additions & 300 deletions
Large diffs are not rendered by default.

mambaSharedFramework/FrameworkInfo.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,22 @@ public enum FrameworkInfo {
2525
/// returns the version of the mamba framework
2626
public static var version: String {
2727

28+
/// When exporting a framework on SPM, there is no way to access the info dictionary, so the version should be provided differently
29+
#if SWIFT_PACKAGE
30+
guard let versionFilePathUrl = Bundle.module.url(forResource: "version", withExtension: "txt"),
31+
let version = try? String(contentsOf: versionFilePathUrl, encoding: .utf8)
32+
.trimmingCharacters(in: .whitespacesAndNewlines)
33+
else {
34+
assertionFailure("Unable to find version string in framework bundle")
35+
return "Error: Unable to find version string in framework bundle"
36+
}
37+
#else
2838
let bundle = Bundle(for: PlaylistParser.self)
29-
3039
guard let version = bundle.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String else {
3140
assertionFailure("Unable to find version string in framework bundle")
3241
return "Error: Unable to find version string in framework bundle"
3342
}
43+
#endif
3444

3545
return version
3646
}

mambaSharedFramework/Rapid Parser/MambaStringRef/MambaStringRefFactory.h renamed to mambaSharedFramework/HLS ObjectiveC/MambaStringRefFactory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// limitations under the License.
1818
//
1919

20-
#import <mamba/mamba.h>
20+
#import "MambaStringRef.h"
2121

2222
@interface MambaStringRefFactory : MambaStringRef
2323

mambaSharedFramework/Rapid Parser/MambaStringRef/MambaStringRef_ConcreteNSData.h renamed to mambaSharedFramework/HLS ObjectiveC/MambaStringRef_ConcreteNSData.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// limitations under the License.
1818
//
1919

20-
#import <mamba/mamba.h>
20+
#import "MambaStringRef.h"
2121

2222
@interface MambaStringRef_ConcreteNSData : MambaStringRef
2323

mambaSharedFramework/Rapid Parser/MambaStringRef/MambaStringRef_ConcreteNSString.h renamed to mambaSharedFramework/HLS ObjectiveC/MambaStringRef_ConcreteNSString.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// limitations under the License.
1818
//
1919

20-
#import <mamba/mamba.h>
20+
#import "MambaStringRef.h"
2121

2222
@interface MambaStringRef_ConcreteNSString : MambaStringRef
2323

0 commit comments

Comments
 (0)