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

Move the pcap example into Source/Examples/ #1119

Merged
merged 1 commit into from
Feb 1, 2021
Merged

Conversation

glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented Jan 29, 2021

Motivation:

The PCAP example depends on swift-nio-extras. Since grpc-swift now
depends on swift-nio-extras (and we have target based dependency
resolution) the example can live in-source with other examples.

Modifications:

  • Move Examples/PCAPExample to Source/Examples/PCAP.
  • Use swift-argument-parser
  • Make it a target in the GRPC package, rather than its own package.

Result:

Easier to avoid bit-rot.

@glbrntt glbrntt added the semver/none No version bump required. label Jan 29, 2021
@glbrntt glbrntt requested a review from Lukasa January 29, 2021 08:39
Copy link
Collaborator

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

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

Basically looks good to me, one question about the target name.

Package.swift Outdated Show resolved Hide resolved
Motivation:

The PCAP example depends on swift-nio-extras. Since grpc-swift now
depends on swift-nio-extras (and we have target based dependency
resolution) the example can live in-source with other examples.

Modifications:

- Move Examples/PCAPExample to Source/Examples/PacketCapture.
- Make it a target in the GRPC package, rather than its own package.

Result:

Easier to avoid bit-rot.

// Client for the PacketCapture example
.target(
name: "PacketCapture",
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't all targets be GRPC prefixed? Targets need to be unique across the whole binary (so all dependencies' targets must be globally unique)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Isn't that only necessary for targets which are also products?

Copy link
Contributor

Choose a reason for hiding this comment

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

@glbrntt no, there can only be one module of a given name in the whole binary. Some people call it the Utilities module problem.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sure, but we have target specific dependencies right? So this module won't be in the product, because it's an executable target.

Copy link
Contributor

@weissi weissi Jan 29, 2021

Choose a reason for hiding this comment

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

And I think in your particular case it will appear to work (because it's just an example). But I think there's some weird issue when you do swift package edit where then even modules that aren't officially exported at all start to clash (I think we had this with NIOHTTP1Server or something where multiple NIO packages used to define that).

Copy link
Contributor

Choose a reason for hiding this comment

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

@Lukasa I don't think I filed one but this is a long time ago.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@weissi I can't repro that. Plus, I thought the reasoning for the package description API in 5.2 where packages are explicitly named was to avoid this problem?

Copy link
Contributor

Choose a reason for hiding this comment

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

@glbrntt that is possible. Maybe it's just a problem in < 5.2? Tbh I don't fully understand what's going on but it used to break the release tools. But we do test with 5.0 there...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I can totally believe that it didn't work before 5.2. Any objections to leaving the naming as is @weissi?

Copy link
Contributor

Choose a reason for hiding this comment

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

@glbrntt go for it. We can fix that at any time if it causes trouble.

@glbrntt glbrntt merged commit 34c984c into grpc:main Feb 1, 2021
@glbrntt glbrntt deleted the gb-move-pcap branch February 1, 2021 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/none No version bump required.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants