Skip to content

Formally deprecate the old diagnostics.json digest file #1163

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

Merged

Conversation

d-ronnqvist
Copy link
Contributor

Bug/issue #, if applicable: rdar://145729962

Summary

This formally deprecates the old "diagnostics.json" digest file that DocC writes when passed the --emit-digest flag.

This file has superseded by the --diagnostics-file, --diagnostics-output-path <diagnostics-file> file since March 2023 (by #494).

With these changes, the deprecated "diagnostics.json" digest file will contain an additional warning that this file is deprecated and will be removed. However, if there are no warnings or errors, the file won't include this deprecation warning to avoid interfering with older systems who read this file as an indication that the build has warnings or not.

Dependencies

None.

Testing

Build any documentation that produces at least one warning and pass the --emit-digest flag.

Inspect the "diagnostics.json" file inside the documentation output. There should be a warning that this file is deprecated and will be removed.

Checklist

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

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

Comment on lines 68 to 72
package protocol _DeprecatedConsumeProblemsAccess {
func _consume(problems: [Problem]) throws
}

package struct _Deprecated<Consumer: ConvertOutputConsumer>: _DeprecatedConsumeProblemsAccess {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because ConvertOutputConsumer is a public protocol I had to get a bit creative to be able to still call its deprecated API without introducing deprecation warnings in the DocC code.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice work avoiding the warning!

However, it's hard to follow exactly how this code avoids the warning - specifically, why the use of the _DeprecatedConsumeProblemsAccess protocol allows the call site to avoid a warning since _consume in the protocol is not actually deprecated. Since all the call sites have to both use the special _Deprecated structure and cast to the protocol this explanation would be important.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added code comments to explain how this avoids the deprecation warning in 6f89894

@@ -21,7 +21,6 @@ class TestRenderNodeOutputConsumer: ConvertOutputConsumer {
}
}

func consume(problems: [Problem]) throws { }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This tests that conforming types can omit implementing the deprecated method.

@d-ronnqvist d-ronnqvist force-pushed the deprecate-old-diagnostics-digest-file branch from 67ee22a to 15ac29e Compare February 27, 2025 16:56
Copy link
Contributor

@patshaughnessy patshaughnessy left a comment

Choose a reason for hiding this comment

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

Looks good 👍

Comment on lines 68 to 72
package protocol _DeprecatedConsumeProblemsAccess {
func _consume(problems: [Problem]) throws
}

package struct _Deprecated<Consumer: ConvertOutputConsumer>: _DeprecatedConsumeProblemsAccess {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice work avoiding the warning!

However, it's hard to follow exactly how this code avoids the warning - specifically, why the use of the _DeprecatedConsumeProblemsAccess protocol allows the call site to avoid a warning since _consume in the protocol is not actually deprecated. Since all the call sites have to both use the special _Deprecated structure and cast to the protocol this explanation would be important.

@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

1 similar comment
@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

@d-ronnqvist d-ronnqvist force-pushed the deprecate-old-diagnostics-digest-file branch from 3c8590d to dd7db72 Compare April 23, 2025 16:01
@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

@d-ronnqvist d-ronnqvist merged commit 8fc6667 into swiftlang:main Apr 23, 2025
2 checks passed
@d-ronnqvist d-ronnqvist deleted the deprecate-old-diagnostics-digest-file branch April 23, 2025 16:06
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.

2 participants