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

build: updates to build and test with LTS JDKs #1385

Merged
merged 1 commit into from
Dec 17, 2023
Merged

Conversation

codefromthecrypt
Copy link
Member

@codefromthecrypt codefromthecrypt commented Dec 15, 2023

This updates to build and test with LTS JDKs, using the same project setup as zipkin and zipkin-reporter

  • moves off takari to normal maven wrapper, and updates all plugin versions
  • removes retrolambda which is incompatible with recent JDKs
    • ports java 6 code to java 6 syntax
    • test release profile with JDK 11, which is last to compile java 1.6.
  • adds opens configuration for old spring and grpc integration tests
  • moves off abandoned powermock for mockito
    • bytebuddy no longer supports mocking System, so had to refactor code around currentTime
  • updates GitHub Actions to build on first and last LTS (11, 21)
    • adds javadoc tests to ensure it will build prior to running deploy job

@codefromthecrypt codefromthecrypt force-pushed the update-build branch 2 times, most recently from df0a054 to ca62e4b Compare December 16, 2023 07:24
@codefromthecrypt codefromthecrypt marked this pull request as ready for review December 16, 2023 07:25
This updates to build and test with LTS JDKs, using the same project setup as zipkin and zipkin-reporter

* moves off takari to normal maven wrapper, and updates all plugin versions
* removes retrolambda which is incompatible with recent JDKs
  * ports java 6 code to java 6 syntax
  * test release profile with JDK 11, which is last to compile java 1.6.
* adds opens configuration for old spring and grpc integration tests
* moves off abandoned powermock for mockito
  * bytebuddy no longer supports mocking System, so had to refactor code around currentTime
* updates GitHub Actions to build on first and last LTS (11, 21)
  * adds javadoc tests to ensure it will build prior to running deploy job

Signed-off-by: Adrian Cole <adrian@tetrate.io>
Copy link
Member Author

@codefromthecrypt codefromthecrypt left a comment

Choose a reason for hiding this comment

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

notes

public class RateLimitingSamplerTest {

@Test public void samplesOnlySpecifiedNumber() {
mockStatic(System.class);
Copy link
Member Author

Choose a reason for hiding this comment

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

no longer possible to mock system

@@ -163,12 +167,16 @@ public Clock clock() {
}

static class Jre9 extends Jre7 {
@Override public long currentTimeMicroseconds() {
Copy link
Member Author

Choose a reason for hiding this comment

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

moved the actual (internal) function up so that we can use it and mock access to it easier.

@Test public void produceLinkLocalIp_siteLocal_ipv4() throws Exception {
nicWithAddress(InetAddress.getByAddress("local", new byte[] {(byte) 192, (byte) 168, 0, 1}));
@Test void produceLinkLocalIp_siteLocal_ipv4() throws Exception {
try (MockedStatic<NetworkInterface> mb = mockStatic(NetworkInterface.class)) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Some core classes are mockable, just System is prohibited now.

<profile>
<id>release</id>
<properties>
<!-- grpc-java < 1.15 supports Java 6 https://github.com/grpc/grpc-java/issues/3961 Current versions support Java 7 even though TLS typically implies Java 8+ -->
Copy link
Member Author

Choose a reason for hiding this comment

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

example of building java 1.6 only in a profile, same as zipkin and zipkin-reporter

<systemPropertyVariables>
<java.util.logging.manager>org.apache.logging.log4j.jul.LogManager</java.util.logging.manager>
</systemPropertyVariables>
<!-- Ensure scope leak cause ends up in the console -->
<trimStackTrace>false</trimStackTrace>
<!-- add opens for old grpc to avoid below in JRE 21:
Copy link
Member Author

Choose a reason for hiding this comment

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

example of changing to allow old libraries to run on JRE 21

import org.powermock.modules.junit4.PowerMockRunner;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.junit.jupiter.MockitoExtension;
Copy link
Member Author

Choose a reason for hiding this comment

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

all tests I had to use mockito for static mocking, I ported to jupiter. the next PR will switch the rest.

if: "!contains(github.event.head_commit.message, 'maven-release-plugin')"
strategy:
fail-fast: false # don't fail fast as sometimes failures are operating system specific
matrix: # use latest available versions and be consistent on all workflows!
Copy link
Member Author

Choose a reason for hiding this comment

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

same as zipkin-reporter-java, make sure we can build on JDK 11 as it is what we release on

@codefromthecrypt
Copy link
Member Author

going to merge to get jupiter started, as bumping all this stuff is prereq to re-cutting zipkin-aws and zipkin-gcp

@codefromthecrypt codefromthecrypt merged commit eac0ffa into master Dec 17, 2023
3 checks passed
@codefromthecrypt codefromthecrypt deleted the update-build branch December 17, 2023 00:31
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.

1 participant