From 2e4d3c5b31622b04d8ce091bf7a8532437938c6e Mon Sep 17 00:00:00 2001 From: QuietMisdreavus Date: Sun, 26 Mar 2023 09:55:03 -0600 Subject: [PATCH] enable Doxygen support by default (#519) rdar://107002535 --- .../SwiftDocC/Model/DocumentationNode.swift | 5 +---- Sources/SwiftDocC/Utility/FeatureFlags.swift | 1 + .../ConvertAction+CommandInitialization.swift | 1 - .../ArgumentParsing/Subcommands/Convert.swift | 3 ++- .../Semantics/SymbolTests.swift | 4 +--- .../ConvertSubcommandTests.swift | 21 ------------------- 6 files changed, 5 insertions(+), 30 deletions(-) diff --git a/Sources/SwiftDocC/Model/DocumentationNode.swift b/Sources/SwiftDocC/Model/DocumentationNode.swift index c11095b417..a788105d95 100644 --- a/Sources/SwiftDocC/Model/DocumentationNode.swift +++ b/Sources/SwiftDocC/Model/DocumentationNode.swift @@ -438,10 +438,7 @@ public struct DocumentationNode { } else if let symbol = documentedSymbol, let docComment = symbol.docComment { let docCommentString = docComment.lines.map { $0.text }.joined(separator: "\n") - var documentOptions: ParseOptions = [.parseBlockDirectives, .parseSymbolLinks] - if FeatureFlags.current.isExperimentalDoxygenSupportEnabled { - documentOptions.insert(.parseMinimalDoxygen) - } + let documentOptions: ParseOptions = [.parseBlockDirectives, .parseSymbolLinks, .parseMinimalDoxygen] let docCommentMarkup = Document(parsing: docCommentString, options: documentOptions) let docCommentDirectives = docCommentMarkup.children.compactMap({ $0 as? BlockDirective }) diff --git a/Sources/SwiftDocC/Utility/FeatureFlags.swift b/Sources/SwiftDocC/Utility/FeatureFlags.swift index 734690db5f..ed6fe38bb7 100644 --- a/Sources/SwiftDocC/Utility/FeatureFlags.swift +++ b/Sources/SwiftDocC/Utility/FeatureFlags.swift @@ -32,6 +32,7 @@ public struct FeatureFlags: Codable { public var isExperimentalDeviceFrameSupportEnabled = false /// Whether or not experimental support for parsing Doxygen commands is enabled. + @available(*, deprecated, message: "Doxygen support is now enabled by default.") public var isExperimentalDoxygenSupportEnabled = false /// Creates a set of feature flags with the given values. diff --git a/Sources/SwiftDocCUtilities/ArgumentParsing/ActionExtensions/ConvertAction+CommandInitialization.swift b/Sources/SwiftDocCUtilities/ArgumentParsing/ActionExtensions/ConvertAction+CommandInitialization.swift index 33f1ffa840..b870a203b4 100644 --- a/Sources/SwiftDocCUtilities/ArgumentParsing/ActionExtensions/ConvertAction+CommandInitialization.swift +++ b/Sources/SwiftDocCUtilities/ArgumentParsing/ActionExtensions/ConvertAction+CommandInitialization.swift @@ -21,7 +21,6 @@ extension ConvertAction { let outOfProcessResolver: OutOfProcessReferenceResolver? FeatureFlags.current.isExperimentalDeviceFrameSupportEnabled = convert.enableExperimentalDeviceFrameSupport - FeatureFlags.current.isExperimentalDoxygenSupportEnabled = convert.experimentalParseDoxygenCommands // If the user-provided a URL for an external link resolver, attempt to // initialize an `OutOfProcessReferenceResolver` with the provided URL. diff --git a/Sources/SwiftDocCUtilities/ArgumentParsing/Subcommands/Convert.swift b/Sources/SwiftDocCUtilities/ArgumentParsing/Subcommands/Convert.swift index db0fd8eb76..d5bdf04d51 100644 --- a/Sources/SwiftDocCUtilities/ArgumentParsing/Subcommands/Convert.swift +++ b/Sources/SwiftDocCUtilities/ArgumentParsing/Subcommands/Convert.swift @@ -169,8 +169,9 @@ extension Docc { /// A user-provided value that is true if experimental Doxygen support should be enabled. /// - /// Defaults to false. + /// > Important: This flag is deprecated now that the feature is enabled by default, and will be removed in a future release. @Flag(help: .hidden) + @available(*, deprecated, message: "Doxygen support is now enabled by default.") public var experimentalParseDoxygenCommands = false // MARK: - Info.plist fallbacks diff --git a/Tests/SwiftDocCTests/Semantics/SymbolTests.swift b/Tests/SwiftDocCTests/Semantics/SymbolTests.swift index 62172b0edb..f6fcbd7b25 100644 --- a/Tests/SwiftDocCTests/Semantics/SymbolTests.swift +++ b/Tests/SwiftDocCTests/Semantics/SymbolTests.swift @@ -514,9 +514,7 @@ class SymbolTests: XCTestCase { XCTAssertEqual(problems.count, 0) } - func testParseDoxygenWithFeatureFlag() throws { - enableFeatureFlag(\.isExperimentalDoxygenSupportEnabled) - + func testParseDoxygen() throws { let deckKitSymbolGraph = Bundle.module.url( forResource: "DeckKit-Objective-C", withExtension: "symbols.json", diff --git a/Tests/SwiftDocCUtilitiesTests/ArgumentParsing/ConvertSubcommandTests.swift b/Tests/SwiftDocCUtilitiesTests/ArgumentParsing/ConvertSubcommandTests.swift index 40af0b1be8..429f44f447 100644 --- a/Tests/SwiftDocCUtilitiesTests/ArgumentParsing/ConvertSubcommandTests.swift +++ b/Tests/SwiftDocCUtilitiesTests/ArgumentParsing/ConvertSubcommandTests.swift @@ -390,27 +390,6 @@ class ConvertSubcommandTests: XCTestCase { XCTAssertTrue(commandWithFlag.enableExperimentalDeviceFrameSupport) XCTAssertTrue(FeatureFlags.current.isExperimentalDeviceFrameSupportEnabled) } - - func testExperimentalParseDoxygenFlag() throws { - let originalFeatureFlagsState = FeatureFlags.current - - defer { - FeatureFlags.current = originalFeatureFlagsState - } - - let commandWithoutFlag = try Docc.Convert.parse([testBundleURL.path]) - let _ = try ConvertAction(fromConvertCommand: commandWithoutFlag) - XCTAssertFalse(commandWithoutFlag.experimentalParseDoxygenCommands) - XCTAssertFalse(FeatureFlags.current.isExperimentalDoxygenSupportEnabled) - - let commandWithFlag = try Docc.Convert.parse([ - "--experimental-parse-doxygen-commands", - testBundleURL.path, - ]) - let _ = try ConvertAction(fromConvertCommand: commandWithFlag) - XCTAssertTrue(commandWithFlag.experimentalParseDoxygenCommands) - XCTAssertTrue(FeatureFlags.current.isExperimentalDoxygenSupportEnabled) - } func testTransformForStaticHostingFlagWithoutHTMLTemplate() throws { unsetenv(TemplateOption.environmentVariableKey)