Skip to content

Commit bf23afc

Browse files
Revert "Create new target for common code (#1331)"
This reverts commit 70a8a0d.
1 parent 5370377 commit bf23afc

File tree

5 files changed

+5
-44
lines changed

5 files changed

+5
-44
lines changed

Package.swift

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ let package = Package(
4343
.target(
4444
name: "SwiftDocC",
4545
dependencies: [
46-
.target(name: "DocCCommon"),
4746
.product(name: "Markdown", package: "swift-markdown"),
4847
.product(name: "SymbolKit", package: "swift-docc-symbolkit"),
4948
.product(name: "CLMDB", package: "swift-lmdb"),
@@ -56,7 +55,6 @@ let package = Package(
5655
name: "SwiftDocCTests",
5756
dependencies: [
5857
.target(name: "SwiftDocC"),
59-
.target(name: "DocCCommon"),
6058
.target(name: "SwiftDocCTestUtilities"),
6159
],
6260
resources: [
@@ -72,7 +70,6 @@ let package = Package(
7270
name: "SwiftDocCUtilities",
7371
dependencies: [
7472
.target(name: "SwiftDocC"),
75-
.target(name: "DocCCommon"),
7673
.product(name: "NIOHTTP1", package: "swift-nio", condition: .when(platforms: [.macOS, .iOS, .linux, .android])),
7774
.product(name: "ArgumentParser", package: "swift-argument-parser")
7875
],
@@ -84,7 +81,6 @@ let package = Package(
8481
dependencies: [
8582
.target(name: "SwiftDocCUtilities"),
8683
.target(name: "SwiftDocC"),
87-
.target(name: "DocCCommon"),
8884
.target(name: "SwiftDocCTestUtilities"),
8985
],
9086
resources: [
@@ -99,7 +95,6 @@ let package = Package(
9995
name: "SwiftDocCTestUtilities",
10096
dependencies: [
10197
.target(name: "SwiftDocC"),
102-
.target(name: "DocCCommon"),
10398
.product(name: "SymbolKit", package: "swift-docc-symbolkit"),
10499
],
105100
swiftSettings: swiftSettings
@@ -114,25 +109,6 @@ let package = Package(
114109
exclude: ["CMakeLists.txt"],
115110
swiftSettings: swiftSettings
116111
),
117-
118-
// A few common types and core functionality that's useable by all other targets.
119-
.target(
120-
name: "DocCCommon",
121-
dependencies: [
122-
// This target shouldn't have any local dependencies so that all other targets can depend on it.
123-
// We can add dependencies on SymbolKit and Markdown here but they're not needed yet.
124-
],
125-
swiftSettings: [.swiftLanguageMode(.v6)]
126-
),
127-
128-
.testTarget(
129-
name: "DocCCommonTests",
130-
dependencies: [
131-
.target(name: "DocCCommon"),
132-
.target(name: "SwiftDocCTestUtilities"),
133-
],
134-
swiftSettings: [.swiftLanguageMode(.v6)]
135-
),
136112

137113
// Test app for SwiftDocCUtilities
138114
.executableTarget(

Sources/DocCCommon/SourceLanguage.swift renamed to Sources/SwiftDocC/Model/SourceLanguage.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
/*
22
This source file is part of the Swift.org open source project
33

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

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

1111
/// A programming language.
12-
public struct SourceLanguage: Hashable, Codable, Comparable, Sendable {
12+
public struct SourceLanguage: Hashable, Codable, Comparable {
1313
/// The display name of the programming language.
1414
public var name: String
1515
/// A globally unique identifier for the language.
@@ -132,7 +132,7 @@ public struct SourceLanguage: Hashable, Codable, Comparable, Sendable {
132132
public static let metal = SourceLanguage(name: "Metal", id: "metal")
133133

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

137137
enum CodingKeys: CodingKey {
138138
case name
@@ -157,9 +157,7 @@ public struct SourceLanguage: Hashable, Codable, Comparable, Sendable {
157157

158158
try container.encode(self.name, forKey: SourceLanguage.CodingKeys.name)
159159
try container.encode(self.id, forKey: SourceLanguage.CodingKeys.id)
160-
if !self.idAliases.isEmpty {
161-
try container.encode(self.idAliases, forKey: SourceLanguage.CodingKeys.idAliases)
162-
}
160+
try container.encodeIfNotEmpty(self.idAliases, forKey: SourceLanguage.CodingKeys.idAliases)
163161
try container.encode(self.linkDisambiguationID, forKey: SourceLanguage.CodingKeys.linkDisambiguationID)
164162
}
165163

Sources/SwiftDocC/Utility/CommonTypeExports.swift

Lines changed: 0 additions & 13 deletions
This file was deleted.
File renamed without changes.

Tests/DocCCommonTests/SourceLanguageTests.swift renamed to Tests/SwiftDocCTests/Model/SourceLanguageTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
See https://swift.org/CONTRIBUTORS.txt for Swift project authors
99
*/
1010

11-
import DocCCommon
11+
@testable import SwiftDocC
1212
import XCTest
1313

1414
class SourceLanguageTests: XCTestCase {

0 commit comments

Comments
 (0)