Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Sources/SWBCore/Settings/BuiltinMacros.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,9 @@ public final class BuiltinMacros {
public static let SDKDB_TO_SYMGRAPH_EXEC = BuiltinMacros.declarePathMacro("SDKDB_TO_SYMGRAPH_EXEC")
public static let CLANG_EXTRACT_API_EXEC = BuiltinMacros.declareStringMacro("CLANG_EXTRACT_API_EXEC")
public static let DOCC_ARCHIVE_PATH = BuiltinMacros.declareStringMacro("DOCC_ARCHIVE_PATH")
public static let DOCC_PRETTY_PRINT = BuiltinMacros.declareBooleanMacro("DOCC_PRETTY_PRINT")
public static let DOCC_EXTRACT_SPI_DOCUMENTATION = BuiltinMacros.declareBooleanMacro("DOCC_EXTRACT_SPI_DOCUMENTATION")
public static let DOCC_SKIP_SYNTHESIZED_MEMBERS = BuiltinMacros.declareBooleanMacro("DOCC_SKIP_SYNTHESIZED_MEMBERS")
public static let DOCC_EXTRACT_EXTENSION_SYMBOLS = BuiltinMacros.declareBooleanMacro("DOCC_EXTRACT_EXTENSION_SYMBOLS")
public static let DOCC_EXTRACT_SWIFT_INFO_FOR_OBJC_SYMBOLS = BuiltinMacros.declareBooleanMacro("DOCC_EXTRACT_SWIFT_INFO_FOR_OBJC_SYMBOLS")
public static let DOCC_EXTRACT_OBJC_INFO_FOR_SWIFT_SYMBOLS = BuiltinMacros.declareBooleanMacro("DOCC_EXTRACT_OBJC_INFO_FOR_SWIFT_SYMBOLS")
Expand Down Expand Up @@ -1646,6 +1648,8 @@ public final class BuiltinMacros {
DISABLE_TEST_HOST_PLATFORM_PROCESSING,
DISABLE_XCFRAMEWORK_SIGNATURE_VALIDATION,
DOCC_ARCHIVE_PATH,
DOCC_PRETTY_PRINT,
DOCC_SKIP_SYNTHESIZED_MEMBERS,
DOCC_EXTRACT_SPI_DOCUMENTATION,
DOCC_EXTRACT_EXTENSION_SYMBOLS,
DOCC_EXTRACT_SWIFT_INFO_FOR_OBJC_SYMBOLS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,21 @@ final public class DocumentationCompilerSpec: GenericCompilerSpec, SpecIdentifie
) -> [String] {
var additionalFlags = [String]()

// Check if pretty print is requested
if cbc.scope.evaluate(BuiltinMacros.DOCC_PRETTY_PRINT) && swiftCompilerInfo.toolFeatures.has(.emitExtensionBlockSymbols) {
additionalFlags.append("-symbol-graph-pretty-print")
}

// Check if extension symbol documentation is requested
if cbc.scope.evaluate(BuiltinMacros.DOCC_EXTRACT_EXTENSION_SYMBOLS) && swiftCompilerInfo.toolFeatures.has(.emitExtensionBlockSymbols) {
additionalFlags.append("-emit-extension-block-symbols")
}

// Check if synthesized members should be skipped
if cbc.scope.evaluate(BuiltinMacros.DOCC_SKIP_SYNTHESIZED_MEMBERS) && swiftCompilerInfo.toolFeatures.has(.emitExtensionBlockSymbols) {
additionalFlags.append("-symbol-graph-skip-synthesized-members")
}

switch DocumentationType(from: cbc) {
case .executable:
// When building executable types (like applications and command-line tools), include
Expand Down
14 changes: 14 additions & 0 deletions Sources/SWBUniversalPlatform/Specs/Documentation.xcspec
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,20 @@
DefaultValue = NO;
},

// If the Swift compiler / Swift symbol graph extractor should pretty print the symbol graph.
{
Name = DOCC_PRETTY_PRINT;
Type = bool;
DefaultValue = NO;
},

// If the Swift compiler / Swift symbol graph extractor should skip synthesized members.
{
Name = DOCC_SKIP_SYNTHESIZED_MEMBERS;
Type = bool;
DefaultValue = NO;
},

{
Name = DOCC_EXTRACT_SWIFT_INFO_FOR_OBJC_SYMBOLS;
Type = bool;
Expand Down