-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compute beta platform information for non-symbol documentation #959
Commits on Jun 27, 2024
-
Use VersionTriplet for
@Available
directiveChanges: - `@Available` directive now parses `introduced` field as a `VersionTriplet` - `.stringRepresentation(precisionUpToNonsignificant:)` has been moved to `VersionTriplet` - Modifies tests so that they compile given the above changes The availability directive supports an "introduced" field, which accepted any string. This commit modifies it to only accept strings which can be converted into a VersionTriplet, the type which DocC uses internally for representing version information. This is useful to be able to compare the availability from the `@Availability` directive with the platform metadata which DocC's context contains, for purposes such as determining whether a platform has been configured as being in beta. The `.stringRepresentation(precisionUpToNonsignificant:)` functionality has been moved to `VersionTriplet`, which is a non-breaking change as this was internal API. This is because we don't always have a `SymbolGraph.SemanticVersion` as the starting type, for example when using the `@Available` directive.
Configuration menu - View commit details
-
Copy full SHA for 8d82441 - Browse repository at this point
Copy the full SHA 8d82441View commit details -
Compute platform beta status when using
@Available
Changes: - Sets `AvailabilityRenderItem.isBeta` when `AvailabilityRenderItem.init?(_ :current:)` is called - Makes `AvailabilityRenderItem.isBeta`, `AvailabilityRenderItem. introduced` and `AvailabilityRenderItem.name` into `let` properties as they are integral to availability rendering. Unifies the behavior in `AvailabilityRenderItem` so that we always compute whether a platform is in beta, regardless of whether the availability information comes from the symbol graph or comes from the `@Available` directive. This fixes an issue where sample code articles defined with `@Available` directives would never display a beta badge regardless of whether the platform was configured to be a beta platform. Additionally, makes `isBeta` a `let` property to avoid any future bugs, as the code will now no longer compile unless this property is set in an initializer. Resolves rdar://129355087.
Configuration menu - View commit details
-
Copy full SHA for 4361d8d - Browse repository at this point
Copy the full SHA 4361d8dView commit details -
Adds documentation for new
@Available
behaviorDocuments the format which is expected for the "introduced" field of the `@Available` directive.
Configuration menu - View commit details
-
Copy full SHA for 7b5d185 - Browse repository at this point
Copy the full SHA 7b5d185View commit details -
Remove the source-breaking change to
Metadata.Availability
Reintroduces `Metadata.Availability.introduced` as a `String` to avoid any API breaking changes. Deprecates this field, in preparation for removal in a future release. Values for this field are derived from `Metadata.Availability.introducedVersion`. `Metadata.Availability.introducedVersion` is now driving argument `introduced` of the directive.
Configuration menu - View commit details
-
Copy full SHA for 568318e - Browse repository at this point
Copy the full SHA 568318eView commit details -
Add unit tests for new
@Available
behaviour- Adds unit tests for verifying that the `introduced` field is parsed with the correct formatting rules. - Fixes a bug where a leading or trailing full stop would be considered a valid format. - Updates FIXMEs to contain the most up-to-date information - Refactors MetadataAvailabilityTests slightly Resolves rdar://129355087.
Configuration menu - View commit details
-
Copy full SHA for 7e7a54e - Browse repository at this point
Copy the full SHA 7e7a54eView commit details -
Add unit tests to PlatformAvailabilityTests for beta availability
- Adds tests to verify that availability defined only in articles is correctly detected as beta depending on configuration. Resolves rdar://129355087.
Configuration menu - View commit details
-
Copy full SHA for 568e286 - Browse repository at this point
Copy the full SHA 568e286View commit details -
Add diagnostic explanation for non-convertible directive arguments
When a directive argument is not convertible to a complex type (such as VersionTriplet), it is complicated for the author to know what the valid format is. Added a field `expectedFormat` in various places which can be used to specify a string which will describe what the expected format is. The changes are all non-breaking because they are either additive or they modify internal API. Added a custom expected format for `VersionTriplet` to improve the diagnostic information. Resolves rdar://129355087.
Configuration menu - View commit details
-
Copy full SHA for f5f320b - Browse repository at this point
Copy the full SHA f5f320bView commit details
Commits on Jun 28, 2024
-
Revert change to make
isBeta
alet
propertyThis is a source-breaking change, so removing it.
Configuration menu - View commit details
-
Copy full SHA for 5858ded - Browse repository at this point
Copy the full SHA 5858dedView commit details -
Use if-expression to declare variables
Assignments can be written succinctly using an if-expression as of Swift 5.9 (https://github.com/swiftlang/swift-evolution/blob/main/proposals/0380-if-switch-expressions.md)
Configuration menu - View commit details
-
Copy full SHA for 8da7bff - Browse repository at this point
Copy the full SHA 8da7bffView commit details -
Make assertions in PlatformAvailabilityTests clearer
Makes the test assertions clearer by rephrasing the logic. These assertions are tricky to read because `isBeta` can be one of three values: true, false and nil.
Configuration menu - View commit details
-
Copy full SHA for d26b467 - Browse repository at this point
Copy the full SHA d26b467View commit details -
Make
AvailabilityRenderItem.isBeta(introduced:current:)
privateThe function is only used in this file, and not needed anywhere else. We can leave it private.
Configuration menu - View commit details
-
Copy full SHA for 89eb015 - Browse repository at this point
Copy the full SHA 89eb015View commit details -
Revert "Remove the source-breaking change to
Metadata.Availability
"This reverts commit 568318e.
Configuration menu - View commit details
-
Copy full SHA for d67cc9f - Browse repository at this point
Copy the full SHA d67cc9fView commit details -
Uses `SemanticVersion` type rather than `VersionTriplet`. We have 4 types in DocC to represent a semantic version, and want to converge towards using only SemanticVersion: swiftlang#970
Configuration menu - View commit details
-
Copy full SHA for 7efe5c1 - Browse repository at this point
Copy the full SHA 7efe5c1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8223994 - Browse repository at this point
Copy the full SHA 8223994View commit details -
Merge "deprecated" parameter changes with SemanticVersion changes
Unifies the "deprecated" parameter behavior with the new "introduced" parameter behaviour, by making both of them be a `SemanticVersion` type.
Configuration menu - View commit details
-
Copy full SHA for 7d729c0 - Browse repository at this point
Copy the full SHA 7d729c0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 98f9308 - Browse repository at this point
Copy the full SHA 98f9308View commit details -
Update
@Available
documentationUpdates to mention that the `deprecated` argument is also meant to be a semantic version.
Configuration menu - View commit details
-
Copy full SHA for 1bfe9b4 - Browse repository at this point
Copy the full SHA 1bfe9b4View commit details