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
24 changes: 24 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ let package = Package(
.target(
name: "SwiftDocC",
dependencies: [
.target(name: "DocCCommon"),
.product(name: "Markdown", package: "swift-markdown"),
.product(name: "SymbolKit", package: "swift-docc-symbolkit"),
.product(name: "CLMDB", package: "swift-lmdb"),
Expand All @@ -55,6 +56,7 @@ let package = Package(
name: "SwiftDocCTests",
dependencies: [
.target(name: "SwiftDocC"),
.target(name: "DocCCommon"),
.target(name: "SwiftDocCTestUtilities"),
],
resources: [
Expand All @@ -70,6 +72,7 @@ let package = Package(
name: "SwiftDocCUtilities",
dependencies: [
.target(name: "SwiftDocC"),
.target(name: "DocCCommon"),
.product(name: "NIOHTTP1", package: "swift-nio", condition: .when(platforms: [.macOS, .iOS, .linux, .android])),
.product(name: "ArgumentParser", package: "swift-argument-parser")
],
Expand All @@ -81,6 +84,7 @@ let package = Package(
dependencies: [
.target(name: "SwiftDocCUtilities"),
.target(name: "SwiftDocC"),
.target(name: "DocCCommon"),
.target(name: "SwiftDocCTestUtilities"),
],
resources: [
Expand All @@ -95,6 +99,7 @@ let package = Package(
name: "SwiftDocCTestUtilities",
dependencies: [
.target(name: "SwiftDocC"),
.target(name: "DocCCommon"),
.product(name: "SymbolKit", package: "swift-docc-symbolkit"),
],
swiftSettings: swiftSettings
Expand All @@ -109,6 +114,25 @@ let package = Package(
exclude: ["CMakeLists.txt"],
swiftSettings: swiftSettings
),

// A few common types and core functionality that's useable by all other targets.
.target(
name: "DocCCommon",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to #1345 I added a "DocC" prefix to this target so as to not conflict with any other target in the toolchain.

dependencies: [
// This target shouldn't have any local dependencies so that all other targets can depend on it.
// We can add dependencies on SymbolKit and Markdown here but they're not needed yet.
],
swiftSettings: [.swiftLanguageMode(.v6)]
),

.testTarget(
name: "DocCCommonTests",
dependencies: [
.target(name: "DocCCommon"),
.target(name: "SwiftDocCTestUtilities"),
],
swiftSettings: [.swiftLanguageMode(.v6)]
),

// Test app for SwiftDocCUtilities
.executableTarget(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/*
This source file is part of the Swift.org open source project

Copyright (c) 2021-2023 Apple Inc. and the Swift project authors
Copyright (c) 2021-2025 Apple Inc. and the Swift project authors
Licensed under Apache License v2.0 with Runtime Library Exception

See https://swift.org/LICENSE.txt for license information
See https://swift.org/CONTRIBUTORS.txt for Swift project authors
*/

/// A programming language.
public struct SourceLanguage: Hashable, Codable, Comparable {
public struct SourceLanguage: Hashable, Codable, Comparable, Sendable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you added Sendable conformance here, vs. the previous version in Sources/SwiftDocC/Model/SourceLanguage.swift. Was that intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you can see that that was made in 04a7964 after moving the code. Conforming to Sendable here is necessary for the stricter concurrency checks in the Swift 6 language mode that the same commit enables for this new target.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed the SourceLanguage file that was in SwiftDocC to CommonTypeExports so that git would produce a better diff for these changes.

/// The display name of the programming language.
public var name: String
/// A globally unique identifier for the language.
Expand Down Expand Up @@ -132,7 +132,7 @@ public struct SourceLanguage: Hashable, Codable, Comparable {
public static let metal = SourceLanguage(name: "Metal", id: "metal")

/// The list of programming languages that are known to DocC.
public static var knownLanguages: [SourceLanguage] = [.swift, .objectiveC, .javaScript, .data, .metal]
public static let knownLanguages: [SourceLanguage] = [.swift, .objectiveC, .javaScript, .data, .metal]

enum CodingKeys: CodingKey {
case name
Expand All @@ -157,7 +157,9 @@ public struct SourceLanguage: Hashable, Codable, Comparable {

try container.encode(self.name, forKey: SourceLanguage.CodingKeys.name)
try container.encode(self.id, forKey: SourceLanguage.CodingKeys.id)
try container.encodeIfNotEmpty(self.idAliases, forKey: SourceLanguage.CodingKeys.idAliases)
if !self.idAliases.isEmpty {
try container.encode(self.idAliases, forKey: SourceLanguage.CodingKeys.idAliases)
}
try container.encode(self.linkDisambiguationID, forKey: SourceLanguage.CodingKeys.linkDisambiguationID)
}

Expand Down
13 changes: 13 additions & 0 deletions Sources/SwiftDocC/Utility/CommonTypeExports.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
This source file is part of the Swift.org open source project

Copyright (c) 2025 Apple Inc. and the Swift project authors
Licensed under Apache License v2.0 with Runtime Library Exception

See https://swift.org/LICENSE.txt for license information
See https://swift.org/CONTRIBUTORS.txt for Swift project authors
*/

public import DocCCommon

public typealias SourceLanguage = DocCCommon.SourceLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
See https://swift.org/CONTRIBUTORS.txt for Swift project authors
*/

@testable import SwiftDocC
import DocCCommon
import XCTest

class SourceLanguageTests: XCTestCase {
Expand Down