Skip to content

Commit

Permalink
enable Doxygen support by default (#519)
Browse files Browse the repository at this point in the history
rdar://107002535
  • Loading branch information
QuietMisdreavus authored Mar 26, 2023
1 parent 8fdb396 commit 2e4d3c5
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 30 deletions.
5 changes: 1 addition & 4 deletions Sources/SwiftDocC/Model/DocumentationNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down
1 change: 1 addition & 0 deletions Sources/SwiftDocC/Utility/FeatureFlags.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions Tests/SwiftDocCTests/Semantics/SymbolTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2e4d3c5

Please sign in to comment.