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

Allow jnr-unixsocket version to be overridden or excluded by downstream dependenencies #182

Merged
merged 4 commits into from
Jan 10, 2022

Conversation

vickenty
Copy link
Contributor

@vickenty vickenty commented Jan 4, 2022

With refactor from fb4cd25 the amount of changes necessary to make jnr-unixsocket optional at runtime is fairly small, and we don't need to rely on reflection at all.

Rest of the PR is adding tests for this scenario. UDS-related tests are adjusted to skip if UDS is not available at runtime; but everything else should run as before. A new maven profile is added that drops jnr-unixsocket from classpath only when running tests. This would be similar to how things are for our library if downstream excludes jnr-unixsocket dependency.

Latest jnr-unixsocket version, 0.38.15, appears to be backwards compatible, and can be used in-place of 0.36 which we depend on currently. To help users that want to use later version, run the test suite against a newer version as well.

Lastly, this adds two new CI jobs to run the above.

Shuffle the code in the builder so that we don't load unix socket support
classes unless the client is configured to use unix sockets. Use reflection
in the client to test if the address is a UnixSocketAddress.

This allows the client code to function at runtime in UDP mode without having
jnr-unixsocket artifacts on the classpath.
Skip UDS tests if jnr-unixsocket classes are not available at runtime.
Add new profiles to test two additional configurations related to jnr-unixsocket:
- with jnr-unixsocket not available at runtime
- with newer version of jnr-unixsocket (either compile or runtime)
Add two new jobs that simulate different configurations at runtime:
- no jnr-unixsocket package available at all;
- latest version is supplied instead of the one we depend on;

Compilation is done using the default version in all jobs.
@vickenty
Copy link
Contributor Author

vickenty commented Jan 4, 2022

Windows failure is caused by an unrelated concurrent modification issue, which will be fixed by #183

Copy link
Member

@truthbk truthbk left a comment

Choose a reason for hiding this comment

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

Code looks good to me, but can you please triple-check jnr-unixsocket version v0.38.15 is java7 compatible?

<dependency>
<groupId>com.github.jnr</groupId>
<artifactId>jnr-unixsocket</artifactId>
<version>0.38.15</version>
Copy link
Member

Choose a reason for hiding this comment

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

I believe this version is not java7 compatible and per: eed7a1c, it appears to be the case. Let's check.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It isn't, and we still depend on 0.36. This bit is in a profile that is only activated for testing. The idea is to validate the library using both 0.36 and 0.38.15, so we can provide a bit of assurance for users that don't need Java 7 compatibility and would like a later version.

Copy link
Member

Choose a reason for hiding this comment

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

Gotcha!

Copy link
Member

@truthbk truthbk left a comment

Choose a reason for hiding this comment

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

📦

<dependency>
<groupId>com.github.jnr</groupId>
<artifactId>jnr-unixsocket</artifactId>
<version>0.38.15</version>
Copy link
Member

Choose a reason for hiding this comment

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

Gotcha!

@vickenty vickenty merged commit c8cac43 into master Jan 10, 2022
@vickenty vickenty deleted the vickenty/jnr-opt branch January 10, 2022 15:30
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