Skip to content

Conversation

ktoso
Copy link
Collaborator

@ktoso ktoso commented Nov 10, 2020

Hey @MrLotU, thanks in advance for considering this PR. It would help us in some use cases we'd like to use this library 👍

Motivation and Context

In some environments it is better to avoid pulling in "dependencies" if we don't really use them.
There can be situations in which CoreGraphics is not available yet one would still like to use this library.

The conformance is not super crucial to ship with SwiftPrometheus, if someone wants to they can conform GCFloat to ConvertibleNumberType manually.

Description

Remote the not strictly necessary CoreGraphics usage.

@ktoso ktoso requested a review from MrLotU November 10, 2020 03:00
@MrLotU
Copy link
Collaborator

MrLotU commented Nov 10, 2020

Hi @ktoso. Thanks for the PR. I agree with your point and think this would be a decent change. However, it would result in a breaking change since the CGFloatValue that's removed is a public property.

Instead, I would propose to put both the import of CoreGraphics and the CGFloatValue inside a canImport statement to make sure CoreGraphics is available. This should then not cause any breaking changes for platforms that do have CoreGraphics, while fixing issues for platforms that don't.

@ktoso
Copy link
Collaborator Author

ktoso commented Nov 10, 2020

That sounds good, let me confirm that'll definitely work and I'll adjust the PR 👍

@MrLotU MrLotU changed the title -remove CoreGraphics Remove CoreGraphics Nov 10, 2020
@ktoso
Copy link
Collaborator Author

ktoso commented Nov 11, 2020

I dug into this a bit and canImport does not seem solve in the case we're looking into.

I really would strongly push for not depending on not-server stuff in libraries like this which are really mostly going to be used in servers. The small inconvenience for someone to manually conform a CG... type if they really really need a metric using those types is relatively small, compared to blocking some use cases from using the library.

Since the lib is -alpha removals are all fair game still. Think we can get this in?

@MrLotU
Copy link
Collaborator

MrLotU commented Nov 11, 2020

For sure agreed there. Making use of canImport would've been a best case scenario here, but should, IMO, not be a blocker to move forward with this PR anyways, since we're still in Alpha land.

Thanks for the PR, I'm going to look into the CI failures today and merge, tag & release after.

@MrLotU MrLotU added this to the 1.0.0 milestone Nov 11, 2020
Copy link
Collaborator

@MrLotU MrLotU left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks! 👍

@MrLotU MrLotU merged commit 970bd31 into swift-server:master Nov 11, 2020
@ktoso ktoso deleted the wip-remove-CoreGraphics branch November 11, 2020 09:22
@ktoso
Copy link
Collaborator Author

ktoso commented Nov 11, 2020

Thank you very much for merge and quick release 🙏

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