diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/HPLibRTMP.podspec b/HPLibRTMP.podspec index 6e0de9c..f9392b0 100644 --- a/HPLibRTMP.podspec +++ b/HPLibRTMP.podspec @@ -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 diff --git a/HPLibRTMP/Assets/.gitkeep b/HPLibRTMP/Assets/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/HPLibRTMP/Classes/.gitkeep b/HPLibRTMP/Classes/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..494ffb1 --- /dev/null +++ b/Package.swift @@ -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"]), + ] +) diff --git a/HPLibRTMP/Classes/HPRTMP.h b/Sources/HPLibRTMP/HPRTMP.h similarity index 100% rename from HPLibRTMP/Classes/HPRTMP.h rename to Sources/HPLibRTMP/HPRTMP.h diff --git a/HPLibRTMP/Classes/HPRTMP.m b/Sources/HPLibRTMP/HPRTMP.m similarity index 100% rename from HPLibRTMP/Classes/HPRTMP.m rename to Sources/HPLibRTMP/HPRTMP.m diff --git a/Tests/HPLibRTMPTests/HPLibRTMPTests.swift b/Tests/HPLibRTMPTests/HPLibRTMPTests.swift new file mode 100644 index 0000000..c31e1eb --- /dev/null +++ b/Tests/HPLibRTMPTests/HPLibRTMPTests.swift @@ -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 + } +}