Skip to content

Commit

Permalink
Add test case for testDocCPluginForBinaryDependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle-Ye committed Sep 29, 2024
1 parent ea70c4c commit 68c6b28
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// swift-tools-version: 6.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "DemoKit",
products: [
.library(name: "DemoKit", targets: ["DemoKit"]),
],
dependencies: [
.package(url: "https://github.com/swiftlang/swift-docc-plugin", from: "1.0.0"),
],
targets: [
.binaryTarget(
name: "MMKV",
url: "https://github.com/Kyle-Ye/MMKV/releases/download/v1.3.5-binary/MMKV.xcframework.zip",
checksum: "181709ac82514e7f243b338e2ac221c203741837e7f51e1922582d3f132d5b78"
),
.target(
name: "DemoKit",
dependencies: ["MMKV"]
),
]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import MMKV

public struct Demo {
public static func greeting() {
let _ = MMKV()
print("Hello")
}
}
10 changes: 10 additions & 0 deletions Tests/BuildTests/PluginsBuildPlanTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,14 @@ final class PluginsBuildPlanTests: XCTestCase {
)
}
}

#if canImport(Darwin) // xcframework support is only supported on Darwin platform
func testDocCPluginForBinaryDependency() async throws {
try await fixture(name: "Miscellaneous/Plugins/DocCForBinaryDependency") { fixturePath in
// Before we add -F support, this call will throw since the command will abort with a non-zero exit code
let (stdout, _) = try await executeSwiftPackage(fixturePath, extraArgs: ["generate-documentation", "--target", "DemoKit"])
XCTAssertTrue(localFileSystem.exists(fixturePath.appending(RelativePath(".build/plugins/Swift-DocC/outputs/DemoKit.doccarchive/documentation/demokit/demo/greeting()/index.html"))))
}
}
#endif
}

0 comments on commit 68c6b28

Please sign in to comment.