Skip to content

Commit 9ad3f2b

Browse files
authored
Remove SwiftDocCUtilities (the command line actions library) as a product (#1052)
* Remove `SwiftDocCUtilities` as a package product. * Remove duplicated initializer
1 parent a8e145d commit 9ad3f2b

File tree

3 files changed

+7
-106
lines changed

3 files changed

+7
-106
lines changed

Package.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ let package = Package(
2727
name: "SwiftDocC",
2828
targets: ["SwiftDocC"]
2929
),
30-
.library(
31-
name: "SwiftDocCUtilities",
32-
targets: ["SwiftDocCUtilities"]
33-
),
3430
.executable(
3531
name: "docc",
3632
targets: ["docc"]

Sources/SwiftDocCUtilities/Action/Actions/Convert/ConvertAction.swift

Lines changed: 2 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public struct ConvertAction: Action, RecreatingContext {
103103
/// - sourceRepository: The source repository where the documentation's sources are hosted.
104104
/// - temporaryDirectory: The location where the convert action should write temporary files while converting the documentation.
105105
/// - dependencies: A list of URLs to already built documentation archives that this documentation depends on.
106-
init(
106+
package init(
107107
documentationBundleURL: URL?,
108108
outOfProcessResolver: OutOfProcessReferenceResolver?,
109109
analyze: Bool,
@@ -132,8 +132,7 @@ public struct ConvertAction: Action, RecreatingContext {
132132
hostingBasePath: String? = nil,
133133
sourceRepository: SourceRepository? = nil,
134134
dependencies: [URL] = []
135-
) throws
136-
{
135+
) throws {
137136
self.rootURL = documentationBundleURL
138137
self.outOfProcessResolver = outOfProcessResolver
139138
self.analyze = analyze
@@ -245,100 +244,6 @@ public struct ConvertAction: Action, RecreatingContext {
245244
experimentalModifyCatalogWithGeneratedCuration: experimentalModifyCatalogWithGeneratedCuration
246245
)
247246
}
248-
249-
/// Initializes the action with the given validated options, creates or uses the given action workspace & context.
250-
///
251-
/// - Parameters:
252-
/// - documentationBundleURL: The root of the documentation catalog to convert.
253-
/// - outOfProcessResolver: An out-of-process resolver that
254-
/// - analyze: `true` if the convert action should override the provided `diagnosticLevel` with `.information`, otherwise `false`.
255-
/// - targetDirectory: The location where the convert action will write the built documentation output.
256-
/// - htmlTemplateDirectory: The location of the HTML template to use as a base for the built documentation output.
257-
/// - emitDigest: Whether the conversion should create metadata files, such as linkable entities information.
258-
/// - currentPlatforms: The current version and beta information for platforms that may be encountered while processing symbol graph files.
259-
/// - buildIndex: Whether or not the convert action should emit an LMDB representation of the navigator index.
260-
///
261-
/// A JSON representation is built and emitted regardless of this value.
262-
/// - workspace: A provided documentation workspace. Creates a new empty workspace if value is `nil`
263-
/// - context: A provided documentation context. Creates a new empty context in the workspace if value is `nil`
264-
/// - dataProvider: A data provider to use when registering bundles
265-
/// - documentationCoverageOptions: Indicates whether or not to generate coverage output and at what level.
266-
/// - bundleDiscoveryOptions: Options to configure how the converter discovers documentation bundles.
267-
/// - diagnosticLevel: The level above which diagnostics will be filtered out. This filter level is inclusive, i.e. if a level of `DiagnosticSeverity.information` is specified, diagnostics with a severity up to and including `.information` will be printed.
268-
/// - diagnosticEngine: The engine that will collect and emit diagnostics during this action.
269-
/// - formatConsoleOutputForTools: `true` if the convert action should write diagnostics to the console in a format suitable for parsing by an IDE or other tool, otherwise `false`.
270-
/// - inheritDocs: `true` if the convert action should retain the original documentation content for inherited symbols, otherwise `false`.
271-
/// - experimentalEnableCustomTemplates: `true` if the convert action should enable support for custom "header.html" and "footer.html" template files, otherwise `false`.
272-
/// - experimentalModifyCatalogWithGeneratedCuration: `true` if the convert action should write documentation extension files containing markdown representations of DocC's automatic curation into the `documentationBundleURL`, otherwise `false`.
273-
/// - transformForStaticHosting: `true` if the convert action should process the build documentation archive so that it supports a static hosting environment, otherwise `false`.
274-
/// - allowArbitraryCatalogDirectories: `true` if the convert action should consider the root location as a documentation bundle if it doesn't discover another bundle, otherwise `false`.
275-
/// - hostingBasePath: The base path where the built documentation archive will be hosted at.
276-
/// - sourceRepository: The source repository where the documentation's sources are hosted.
277-
/// - temporaryDirectory: The location where the convert action should write temporary files while converting the documentation.
278-
/// - dependencies: A list of URLs to already built documentation archives that this documentation depends on.
279-
public init(
280-
documentationBundleURL: URL,
281-
outOfProcessResolver: OutOfProcessReferenceResolver?,
282-
analyze: Bool,
283-
targetDirectory: URL,
284-
htmlTemplateDirectory: URL?,
285-
emitDigest: Bool,
286-
currentPlatforms: [String : PlatformVersion]?,
287-
buildIndex: Bool = false,
288-
workspace: DocumentationWorkspace = DocumentationWorkspace(),
289-
context: DocumentationContext? = nil,
290-
dataProvider: DocumentationWorkspaceDataProvider? = nil,
291-
documentationCoverageOptions: DocumentationCoverageOptions = .noCoverage,
292-
bundleDiscoveryOptions: BundleDiscoveryOptions = .init(),
293-
diagnosticLevel: String? = nil,
294-
diagnosticEngine: DiagnosticEngine? = nil,
295-
formatConsoleOutputForTools: Bool = false,
296-
inheritDocs: Bool = false,
297-
experimentalEnableCustomTemplates: Bool = false,
298-
experimentalModifyCatalogWithGeneratedCuration: Bool = false,
299-
transformForStaticHosting: Bool,
300-
allowArbitraryCatalogDirectories: Bool = false,
301-
hostingBasePath: String?,
302-
sourceRepository: SourceRepository? = nil,
303-
temporaryDirectory: URL,
304-
dependencies: [URL] = []
305-
) throws {
306-
// Note: This public initializer exists separately from the above internal one
307-
// because the FileManagerProtocol type we use to enable mocking in tests
308-
// is internal to this framework.
309-
//
310-
// This public initializer just recalls the internal initializer
311-
// but defaults to `FileManager.default`.
312-
313-
try self.init(
314-
documentationBundleURL: documentationBundleURL,
315-
outOfProcessResolver: outOfProcessResolver,
316-
analyze: analyze,
317-
targetDirectory: targetDirectory,
318-
htmlTemplateDirectory: htmlTemplateDirectory,
319-
emitDigest: emitDigest,
320-
currentPlatforms: currentPlatforms,
321-
buildIndex: buildIndex,
322-
workspace: workspace,
323-
context: context,
324-
dataProvider: dataProvider,
325-
fileManager: FileManager.default,
326-
temporaryDirectory: temporaryDirectory,
327-
documentationCoverageOptions: documentationCoverageOptions,
328-
bundleDiscoveryOptions: bundleDiscoveryOptions,
329-
diagnosticLevel: diagnosticLevel,
330-
diagnosticEngine: diagnosticEngine,
331-
formatConsoleOutputForTools: formatConsoleOutputForTools,
332-
inheritDocs: inheritDocs,
333-
experimentalEnableCustomTemplates: experimentalEnableCustomTemplates,
334-
experimentalModifyCatalogWithGeneratedCuration: experimentalModifyCatalogWithGeneratedCuration,
335-
transformForStaticHosting: transformForStaticHosting,
336-
allowArbitraryCatalogDirectories: allowArbitraryCatalogDirectories,
337-
hostingBasePath: hostingBasePath,
338-
sourceRepository: sourceRepository,
339-
dependencies: dependencies
340-
)
341-
}
342247

343248
/// `true` if the convert action is cancelled.
344249
private let isCancelled = Synchronized<Bool>(false)

Tests/SwiftDocCUtilitiesTests/ConvertActionStaticHostableTests.swift

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

4-
Copyright (c) 2021 Apple Inc. and the Swift project authors
4+
Copyright (c) 2021-2024 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
@@ -29,7 +29,7 @@ class ConvertActionStaticHostableTests: StaticHostingBaseTests {
2929
let templateFolder = Folder.testHTMLTemplateDirectory
3030
try templateFolder.write(to: testTemplateURL)
3131

32-
let basePath = "test/folder"
32+
let basePath = "test/folder"
3333
let indexHTML = Folder.testHTMLTemplate(basePath: "test/folder")
3434

3535
var action = try ConvertAction(
@@ -40,9 +40,9 @@ class ConvertActionStaticHostableTests: StaticHostingBaseTests {
4040
htmlTemplateDirectory: testTemplateURL,
4141
emitDigest: false,
4242
currentPlatforms: nil,
43+
temporaryDirectory: try createTemporaryDirectory(),
4344
transformForStaticHosting: true,
44-
hostingBasePath: basePath,
45-
temporaryDirectory: try createTemporaryDirectory()
45+
hostingBasePath: basePath
4646
)
4747
_ = try action.perform(logHandle: .none)
4848

@@ -51,7 +51,7 @@ class ConvertActionStaticHostableTests: StaticHostingBaseTests {
5151
expectedContent += templateFolder.content.filter { $0 is Folder }.map{ $0.name }
5252

5353
let output = try fileManager.contentsOfDirectory(atPath: targetBundleURL.path)
54-
XCTAssertEqual(Set(output), Set(expectedContent), "Unexpect output")
54+
XCTAssertEqual(Set(output), Set(expectedContent), "Unexpected output")
5555

5656
for item in output {
5757

0 commit comments

Comments
 (0)