Skip to content
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

Beta tag heuristic should use >= when comparing platform version information #994

Merged

Conversation

patshaughnessy
Copy link
Contributor

rdar://132024975

Summary

Today DocC Render displays a beta badge for symbols that were introduced in the current version of a platform, if the platform's availability was set as beta in the DocC compiler command line invocation.

This change updates this heuristic to consider symbols that were introduced in the current - or future - version of a beta platform. This gives DocC a bit more flexibility to handle symbol data that might describe future versions of a platform, and to handle platforms that might have two versions in beta at the same time.

Dependencies

None.

Testing

Steps:

  1. Build some API reference documentation containing at least one symbol with availability information. For example, a symbol might have this availability:
 "availability": [
    {
      "domain": "myPlatform",
      "introduced": {
        "major": 3,
        "minor": 0,
        "patch": 0
      }
    }
  ]
  1. Declare this platform ("myPlatform") is beta using a DocC command line argument: --platform name=myPlatform,version=3.0.0,beta=true
  2. View the symbol’s documentation page, and validate DocC marks it as beta; for example: myPlatform 3.0+ Beta
  3. Now change the CLI argument and pass in an earlier version of the beta platform, for example: --platform name=myPlatform,version=1.0.0,beta=true
  4. Recompile the documentation, and validate the symbol is still shown as beta: myPlatform 3.0+ Beta, even though the symbol was introduced in a later version of the beta platform.

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • [ x] Added tests
  • [x ] Ran the ./bin/test script and it succeeded
  • [ ] Updated documentation if necessary

@patshaughnessy
Copy link
Contributor Author

@swift-ci Please test

Copy link
Contributor

@QuietMisdreavus QuietMisdreavus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, thanks!

@sofiaromorales
Copy link
Contributor

Minor: Specify the beta behaviour in the platform CLI help line (https://github.com/swiftlang/swift-docc/blob/main/Sources/SwiftDocCUtilities/ArgumentParsing/Subcommands/Convert.swift#L148), to something like this:

...
Optionally, the platform information can include a 'beta={true|false}' component.
If no beta information is provided, the platform is considered not in beta.
If the platform is set to beta, any symbol introduced in a version equal to or greater than the specified semantic version will be marked as beta.

@sofiaromorales
Copy link
Contributor

@swift-ci please test

1 similar comment
@patshaughnessy
Copy link
Contributor Author

@swift-ci please test

Sources/SwiftDocC/Model/Rendering/SemanticVersion.swift Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this?

@patshaughnessy
Copy link
Contributor Author

@swift-ci please test

@patshaughnessy patshaughnessy merged commit 320410f into swiftlang:main Jul 26, 2024
2 checks passed
@patshaughnessy patshaughnessy deleted the r132024975-beta-tag-heuristic branch July 26, 2024 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants