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

Add deprecation warnings for package-internal APIs #315

Merged
merged 2 commits into from
Oct 17, 2024

Conversation

rebello95
Copy link
Collaborator

This PR adds deprecation warnings to APIs that are considered package-internal but cannot yet be marked as package instead of public until we adopt Swift 6 (see #310). We can't make these APIs currently deprecated since that will introduce deprecation warnings where they're used within the library, but we can at least add future deprecation warnings which will show up in the IDE as shown below:

Screenshot 2024-10-16 at 11 27 45 AM

The goal of doing this is to help enable us to tag a 1.0 before adopting Swift 6 so we can mark those APIs as package afterwards and reasonably consider it a non-breaking change.

@rebello95 rebello95 requested review from jhump and eseay October 16, 2024 06:03
@@ -25,6 +25,11 @@ extension ConnectError {
/// passed in the headers block for gRPC-Web.
///
/// - returns: A tuple containing the gRPC status code and an optional error.
@available(
swift,
deprecated: 100.0,
Copy link
Member

Choose a reason for hiding this comment

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

This could be misleading. Is it dangerous to use 1.1 instead? If we end up needing a minor release before we're actually ready to use Swift 6 package visibility, could we just bump this out to 1.2? Would that cause havoc?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This refers to the version of Swift that this will be deprecated in - it's just an arbitrarily high number which doesn't show up in the warning message. Unfortunately, we cannot specify which version of the package something will be deprecated in as part of this macro

Copy link
Member

Choose a reason for hiding this comment

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

Oh. So why not set it to 6?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tested this out, but it triggers warnings if a consuming project upgrades their Package.swift to use Swift 6, which we don't want:

Screenshot 2024-10-19 at 8 42 01 AM

Copy link
Member

@jhump jhump left a comment

Choose a reason for hiding this comment

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

Per separate chat, let's also rename these to start with an underscore -- yet another convention to indicate the symbol is private and that users should avoid it. That way we should be comfortable that a future release that makes them inaccessible will not break anyone.

Otherwise, LGTM.

Signed-off-by: Michael Rebello <[email protected]>
@rebello95
Copy link
Collaborator Author

Per separate chat, let's also rename these to start with an underscore -- yet another convention to indicate the symbol is private and that users should avoid it. That way we should be comfortable that a future release that makes them inaccessible will not break anyone.

Updated to prefix with underscores 👍🏽

@rebello95 rebello95 merged commit 9bed141 into main Oct 17, 2024
15 checks passed
@rebello95 rebello95 deleted the deprecation-warnings-package branch October 17, 2024 06:29
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