Repository navigation
Fix trait conflict that broke the Swift Package Index doc build - #412
Merged
Merged
Conversation
The SPI documentation builder extracts symbol graphs with every package trait enabled. EnableMeterConversionExtensions and EnableMeasurementConversionExtensions were declared mutually exclusive via an #error, so every doc build since the traits landed failed and the hosted archive stayed stale: it contained neither the DocC articles nor the Graph API. The same #error also made `swift build --enable-all-traits` unusable. Make the two traits alternatives rather than complements: a single #if/#elseif block, with EnableMeasurementConversionExtensions winning when both are on. Verified with the default build, each trait alone, EnableGraphAPI and --enable-all-traits. Build the DocC catalog with all traits enabled in check_documentation.py so CI mirrors SPI and catches this class of failure. That surfaced five Graph-trait symbol-link warnings, now fixed. Replace the turf.js-only attribution in the README with the actual sources: turf.js, GEOS, PROJ, Mapbox polylabel and from-scratch implementations. Add the missing mvt-tools guide to the documentation list. Cross-page catalog links used <doc:...>, which GitHub renders as literal text. Prose links now use reference-style definitions pointing at the hosted SPI pages, so they work on both GitHub and Swift Package Index. The Topics lists keep doc: links, because DocC rejects absolute URLs there. Adds a test pinning the trait precedence rule.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The DocC pages on Swift Package Index were never published. The documentation
build was failing, not merely stale — SPI's builder extracts symbol graphs
with every package trait enabled, which hit this in
IntExtensions.swift:Every doc build since the traits landed in #118 failed, so the served archive
predates the DocC catalog: it contains no articles (
gettingstarted,csv,mvttools, … all 404) and no Graph API pages.The same
#erroralso madeswift build --enable-all-traitsunusable.Fix
Traits are alternatives, not complements.
IntExtensions.swiftandDoubleExtensions.swiftnow use one#if … #elseifblock instead of twoindependent blocks plus an
#error.EnableMeasurementConversionExtensionswins when both are on, so enabling everything still compiles.
CI could not have caught this.
scripts/check_documentation.pybuilt withdefault traits only. It now builds and extracts symbol graphs with
--enable-all-traits, mirroring SPI. That surfaced five Graph-trait DocCwarnings, all fixed:
Graph+BetweennessCentrality.swiftarticulationPoints()|articulation pointdoesn't existGraph+Eulerian.swifteulerianity() == .euleriandoesn't existGraph.swiftnodeOnEdge(near:)doesn't existGraph+Contraction.swiftexpandPath(_:)doesn't existGraph+Contraction.swiftresultis missing documentationREADME attribution. The intro and feature list credited every algorithm to
turf.js. They now name the actual sources: turf.js, GEOS, PROJ, Mapbox
polylabel, and implementations written from scratch. The missing
mvt-tools guide is added to the documentation list.
Cross-page links.
<doc:FIT>renders as the literal textdoc:FITonGitHub. Prose links now use reference-style definitions pointing at the hosted
SPI pages, so they work on both GitHub and SPI:
The
## Topicslists inGISTools.mdkeepdoc:links — DocC rejectsabsolute URLs there, and GitHub renders
[Title](doc:Target)as just thetitle, which reads fine on an index page.
Verification
swift build— clean, no warningsswift build --enable-all-traits— now succeeds (failed before)swift test --traits EnableGraphAPI— 3071 tests / 210 suites passswift test --enable-all-traits— 3071 tests passswift test --traits EnableMeterConversionExtensions/…MeasurementConversionExtensions— 2715 tests eachpython3 scripts/check_documentation.py— 0 diagnostics (5 before)main)After merge
SPI re-processes
mainwithin 24 hours, but processes a releaseimmediately. Tag
v3.0.2to publish the docs right away.AI assistance
Developed with AI assistance (DeepSeek V4.1 Flash, via OpenCode).