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
26 changes: 25 additions & 1 deletion scripts/build_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def validate_sources(config):
)
disallowed_for_archive = (
"targets", "docc_catalog", "path", "repo", "ref",
"preflight", "add_docc_plugin", "extra_flags",
"preflight", "add_docc_plugin", "extra_flags", "env",
)
for field in disallowed_for_archive:
if field in entry:
Expand Down Expand Up @@ -233,6 +233,23 @@ def validate_sources(config):
if "preflight" in entry and not entry["preflight"]:
errors.append(f"{label} has 'preflight' but it is empty")

if "env" in entry:
env_val = entry["env"]
if not isinstance(env_val, dict):
errors.append(
f"{label} 'env' must be an object mapping names to values "
f"(got {type(env_val).__name__})"
)
else:
for key, value in env_val.items():
if not isinstance(key, str) or not key:
errors.append(f"{label} 'env' has non-string or empty key")
if not isinstance(value, (str, int, float, bool)):
errors.append(
f"{label} 'env[{key}]' must be a string, number, or bool "
f"(got {type(value).__name__})"
)

return errors


Expand Down Expand Up @@ -600,6 +617,13 @@ def build_source(source, root_dir, workspace, common_dir, temp_archive_dir, docc
else:
raise RuntimeError(f"unknown type '{source_type}'")

source_env = source.get("env")
if source_env:
env = env.copy()
for key, value in source_env.items():
env[key] = str(value)
print(f"Source env overrides: {', '.join(sorted(source_env))}")

preflight = source.get("preflight", "")
if preflight:
print(f"Running preflight: {preflight}")
Expand Down
6 changes: 6 additions & 0 deletions scripts/navigation.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@
{ "source": "server-guides", "path": "/documentation/serverguides" },
{ "source": "swift-server-todos-tutorial", "path": "/tutorials/getting-started-swift-server" }
]
},
{
"title": "Interoperability",
"modules": [
{ "source": "swift-java", "path": "/documentation/swiftjavadocumentation", "title": "Swift and Java" }
]
}
],
"hidden": [
Expand Down
10 changes: 10 additions & 0 deletions scripts/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@
"repo": "https://github.com/swiftlang/swiftly.git",
"ref": "main",
"targets": ["SwiftlyDocs"]
},
{
"id": "swift-java",
"type": "git",
"repo": "https://github.com/swiftlang/swift-java.git",
"ref": "main",
"targets": ["SwiftJavaDocumentation"],
"env": {
"SWIFTJAVA_DOCC_PLUGIN_INSTALL": "1"
}
}
]
}