From ff9af1bae53ef4b7a419c8ae7a1a0b8f8e7e0667 Mon Sep 17 00:00:00 2001 From: Karl Tarbe Date: Thu, 21 Aug 2025 20:17:09 +0300 Subject: [PATCH] Disable DocC plugin by default --- Package.resolved | 20 +------------------- Package.swift | 17 ++++++++++++++++- README.md | 4 ++-- 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/Package.resolved b/Package.resolved index 740ae13b..3e153878 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "dbabab7072a43035502b47866f915f3b5063c184698a44bbb53c9e887acd9cfc", + "originHash" : "3b554910bbc76ac563097effe5ba38eb7a8f36f6260a82637bbbb208737f4735", "pins" : [ { "identity" : "swift-algorithms", @@ -37,24 +37,6 @@ "version" : "3.15.1" } }, - { - "identity" : "swift-docc-plugin", - "kind" : "remoteSourceControl", - "location" : "https://github.com/swiftlang/swift-docc-plugin", - "state" : { - "revision" : "3e4f133a77e644a5812911a0513aeb7288b07d06", - "version" : "1.4.5" - } - }, - { - "identity" : "swift-docc-symbolkit", - "kind" : "remoteSourceControl", - "location" : "https://github.com/swiftlang/swift-docc-symbolkit", - "state" : { - "revision" : "b45d1f2ed151d057b54504d653e0da5552844e34", - "version" : "1.0.0" - } - }, { "identity" : "swift-log", "kind" : "remoteSourceControl", diff --git a/Package.swift b/Package.swift index 6ddcb389..af6b28a4 100644 --- a/Package.swift +++ b/Package.swift @@ -64,7 +64,6 @@ let package = Package( .package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"), .package(url: "https://github.com/apple/swift-numerics", from: "1.0.0"), .package(url: "https://github.com/apple/swift-protobuf", from: "1.31.1"), // Keep version in sync with README - .package(url: "https://github.com/swiftlang/swift-docc-plugin", from: "1.1.0"), ], targets: [ // Targets are the basic building blocks of a package, defining a module or a test suite. @@ -300,6 +299,22 @@ if enableBenchmarking { ] } +// MARK: - DoCC plugin + +var enableDocCPlugin: Bool { + let benchmarkFlags = "SWIFT_HOMOMORPHIC_ENCRYPTION_ENABLE_DOCCPLUGIN" + if let flag = ProcessInfo.processInfo.environment[benchmarkFlags], flag == "1" { + return true + } + return false +} + +if enableDocCPlugin { + package.dependencies += [ + .package(url: "https://github.com/swiftlang/swift-docc-plugin", from: "1.1.0"), + ] +} + // Set the minimum macOS version for the package #if canImport(Darwin) package.platforms = [ diff --git a/README.md b/README.md index b8b6e246..623e7605 100644 --- a/README.md +++ b/README.md @@ -246,9 +246,9 @@ The documentation can be built from Xcode via `Product -> Build Documentation`. ## Command line The documentation can be built from command line by running ```sh -swift package generate-documentation +SWIFT_HOMOMORPHIC_ENCRYPTION_ENABLE_DOCCPLUGIN=1 swift package generate-documentation ``` and previewed by running ```sh -swift package --disable-sandbox preview-documentation --target HomomorphicEncryption +SWIFT_HOMOMORPHIC_ENCRYPTION_ENABLE_DOCCPLUGIN=1 swift package --disable-sandbox preview-documentation --target HomomorphicEncryption ```