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
3 changes: 2 additions & 1 deletion .github/workflows/build_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ jobs:
name: Build combined documentation
runs-on: ubuntu-latest
container:
image: swiftlang/swift:nightly-main-jammy
# image: swiftlang/swift:nightly-main-jammy
image: swift:6.3
steps:
- uses: actions/checkout@v6

Expand Down
14 changes: 11 additions & 3 deletions scripts/build_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ def parse_args():
default=None,
help="Build only a specific source by id",
)
parser.add_argument(
"--extra-hosting-prefix",
default=None,
metavar="PREFIX",
help="Prepend a path segment to the hosting base path (e.g. 'docs' → 'docs/main'). "
"Does not affect the output directory name or landing page title.",
)
return parser.parse_args()


Expand Down Expand Up @@ -503,7 +510,6 @@ def fetch_archive(source, workspace):
print(f"Found {docc_archive_name} at {archive_path}")
return archive_path


def find_docc_catalog_for_target(source_dir, target, swift_cmd):
"""Discover the .docc catalog directory for a Swift package target.

Expand Down Expand Up @@ -877,7 +883,7 @@ def inject_custom_templates_into_stubs(archive_path, common_dir):
return patched


def _finalize_combined_archive(all_archives, output_dir, version, docc_cmd, prior_failed, common_dir=None, navigation=None):
def _finalize_combined_archive(all_archives, output_dir, version, docc_cmd, prior_failed, common_dir=None, navigation=None, hosting_base_path=None):
"""Merge per-source archives and apply the static-hosting transform.

Returns (succeeded_steps, failed_steps): names that should be added to
Expand Down Expand Up @@ -928,7 +934,7 @@ def _finalize_combined_archive(all_archives, output_dir, version, docc_cmd, prio
return ["combined-merge"], ["navigator-curation"]

try:
transform_static_hosting(combined_output, version, docc_cmd)
transform_static_hosting(combined_output, hosting_base_path or version, docc_cmd)
except subprocess.CalledProcessError:
print("Error: docc process-archive transform-for-static-hosting failed")
curated = ["combined-merge"]
Expand Down Expand Up @@ -1053,6 +1059,7 @@ def main():
print("No navigation.json found — combined navigator will not be curated.")

version = config["version"]
hosting_base_path = f"{args.extra_hosting_prefix}/{version}" if args.extra_hosting_prefix else version
sources = config["sources"]

# Ensure consistent, pretty-printed DocC JSON output
Expand Down Expand Up @@ -1135,6 +1142,7 @@ def attempt_build(index, source, fatal=(), recoverable=()):
s_steps, f_steps = _finalize_combined_archive(
all_archives, output_dir, version, tools.docc, failed,
common_dir=common_dir, navigation=navigation,
hosting_base_path=hosting_base_path,
)
succeeded.extend(s_steps)
failed.extend(f_steps)
Expand Down
13 changes: 4 additions & 9 deletions scripts/navigation.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
"version": 1,
"groups": [
{
"title": "The Swift Language",
"title": "Essential Libraries",
"modules": [
{ "source": "swift-stdlib", "path": "/documentation/swift" },
{ "source": "swift-book", "path": "/documentation/the-swift-programming-language" },
{ "source": "swift-stdlib", "path": "/documentation/swift" },
{ "source": "swift-migration-guide", "path": "/documentation/migrationguide" },
{ "source": "compiler-diagnostics", "path": "/documentation/diagnostics" }
{ "source": "compiler-diagnostics", "path": "/documentation/diagnostics" },
{ "source": "swift-testing", "path": "/documentation/testing" }
]
},
{
Expand All @@ -18,12 +19,6 @@
{ "source": "swiftpm", "path": "/documentation/packageplugin" }
]
},
{
"title": "Testing",
"modules": [
{ "source": "swift-testing", "path": "/documentation/testing" }
]
},
{
"title": "Server-Side Swift",
"modules": [
Expand Down
2 changes: 1 addition & 1 deletion scripts/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"id": "swift-testing",
"type": "git",
"repo": "https://github.com/swiftlang/swift-testing.git",
"ref": "main",
"ref": "release/6.3",
"targets": ["Testing"],
"add_docc_plugin": true
},
Expand Down
Loading