Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] spm support #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion HPLibRTMP.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ TODO: Add long description of the pod here.
s.ios.deployment_target = '8.0'

s.source_files = 'HPLibRTMP/Classes/**/*'
s.public_header_files = 'HPLibRTMP/Classes/**/*.h'
s.public_header_files = 'Sources/HPLibRTMP/**/*.h'

s.dependency 'pili-librtmp'
end
Empty file removed HPLibRTMP/Assets/.gitkeep
Empty file.
Empty file removed HPLibRTMP/Classes/.gitkeep
Empty file.
21 changes: 21 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// swift-tools-version: 5.6
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "HPLibRTMP",
dependencies: [
.package(url: "https://github.com/pili-engineering/pili-librtmp", from: "1.0.0"),
],
targets: [
.executableTarget(
name: "HPLibRTMP",
dependencies: [
"pili-librtmp"
]),
.testTarget(
name: "HPLibRTMPTests",
dependencies: ["HPLibRTMP"]),
]
)
File renamed without changes.
File renamed without changes.
47 changes: 47 additions & 0 deletions Tests/HPLibRTMPTests/HPLibRTMPTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import XCTest
import class Foundation.Bundle

final class HPLibRTMPTests: XCTestCase {
func testExample() throws {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct
// results.

// Some of the APIs that we use below are available in macOS 10.13 and above.
guard #available(macOS 10.13, *) else {
return
}

// Mac Catalyst won't have `Process`, but it is supported for executables.
#if !targetEnvironment(macCatalyst)

let fooBinary = productsDirectory.appendingPathComponent("HPLibRTMP")

let process = Process()
process.executableURL = fooBinary

let pipe = Pipe()
process.standardOutput = pipe

try process.run()
process.waitUntilExit()

let data = pipe.fileHandleForReading.readDataToEndOfFile()
let output = String(data: data, encoding: .utf8)

XCTAssertEqual(output, "Hello, world!\n")
#endif
}

/// Returns path to the built products directory.
var productsDirectory: URL {
#if os(macOS)
for bundle in Bundle.allBundles where bundle.bundlePath.hasSuffix(".xctest") {
return bundle.bundleURL.deletingLastPathComponent()
}
fatalError("couldn't find the products directory")
#else
return Bundle.main.bundleURL
#endif
}
}