Migrate shadow plugin from com.github.johnrengelman to com.gradleup (fixes #2862)#2945
Migrate shadow plugin from com.github.johnrengelman to com.gradleup (fixes #2862)#2945thejainamjain wants to merge 15 commits into
Conversation
…issue newrelic#2862) - Replace plugin id and dependency coord with com.gradleup.shadow:shadow-gradle-plugin:8.3.0 in buildSrc/build.gradle, instrumentation-build, and newrelic-opentelemetry-agent-extension - Add explicit org.apache.ant:ant:1.10.14 dependency to buildSrc; shadow 8.3.0 no longer bundles/shades Ant internally so ZipEntry/ZipOutputStream are not available transitively - Fix zip imports in DependencyPatcher and Log4j2PluginFileMover from shaded shadow.org.apache.tools.zip.* to unshaded org.apache.tools.zip.* - Add getName() override to both Transformer implementations; shadow 8.3.0 Transformer interface now extends org.gradle.api.Named requiring this method - Upgrade Gradle wrapper 7.5.1 -> 8.3; com.gradleup.shadow requires Gradle 8.3 minimum - Fix Gradle 8 API removals required by the wrapper upgrade: - cache_weave_attributes.gradle.kts: JavaExec.main -> mainClass - infinite-tracing/build.gradle.kts: jacoco.reportsDir removed, xml.isEnabled -> required, html.destination -> html.outputLocation - newrelic-weaver/build.gradle: replace undefined jdk8 property reference with javaToolchains.compilerFor API to resolve JDK 8 path dynamically Pinned shadow at exactly 8.3.0 (not later) because 8.3.4+ broke Java 8 support per upstream reports. Verified Transformer/TransformerContext interfaces unchanged at 8.3.0 so no interface-name migration needed.
|
I've pulled your branch and ran into a blocker. To build the full agent and the resulting artifact, the gradle command is: When attempting to build with your branch, we get the following error: I know getting a build environment setup can be a challenge, especially as it relates to some of the sub-modules that require some closed source compile time jars. If you would like to tackle the above issue and push up to your branch, I'm happy to work through this with you so we can arrive at a successful merge into the agent. I'm also happy to take what you have so far and complete it on our end (with appropriate credit for your contributions). Let us know how you want to proceed. Thanks again for the contribution! |
…teVersionProperties Gradle 8 strict validation catches implicit task dependencies that Gradle 7 allowed silently. compileJava11Java reads Agent.properties produced by generateVersionProperties without declaring it as a dependency, causing failures in parallel builds (./gradlew clean jar --parallel).
|
Hi @jtduffy Made the fix - Happy to make any further adjustments if anything else comes up on your end. Looking forward to getting this merged! |
|
One thing worth noting - when running the full build including tests, |
|
@thejainamjain We're still reviewing the gradle changes and should have some feedback for you tomorrow. |
|
Done @jtduffy |
getBrowserTimingFooter() was deprecated in agent 8.9.0 and subsequently removed from the NewRelic API. The smoke test's purpose is to exercise the full API surface area; the footer calls are no longer part of that surface. getBrowserTimingHeader() already covers the RUM API section.
99f9330 to
08c0e4d
Compare
…e-shadow-plugin-to-gradleup
|
@thejainamjain If you want, please pull in my changes from my working branch to yours. It contains other fixes for some instrumentation modules and other build items. I'm still running regression tests on so I may have more changes/feedback in the next couple of days |
…e-shadow-plugin-to-gradleup
|
@thejainamjain There is one more minor commit I made that you can pull into your branch. For some reason, the verifier was getting an OOM error when running against the |
…e-shadow-plugin-to-gradleup
|
Successful PR test run in #2950 |
|
@thejainamjain Hey one last thing and then the team will do a full review. Can you remove the file |
…m/thejainamjain/newrelic-java-agent into migrate-shadow-plugin-to-gradleup
|
Hey @jtduffy, done! Removed |
|
I will be doing a squash merge on this on Monday June 29th after I return from FTO so I can be around in case issues pop up. |
Closes #2862
What this does
Migrates the shadow Gradle plugin from the deprecated
com.github.johnrengelman.shadowto the GradleUp fork
com.gradleup.shadow, pinned at exactly 8.3.0.Why 8.3.0 specifically
com.gradleup.shadowstarts at 8.3.0; no earlier version exists under this coordinateconfirmed safe for Java 8 builds
Changes beyond a plugin ID swap
This turned out to require more than a string substitution:
Gradle wrapper: 7.5.1 → 8.3
com.gradleup.shadowenforces Gradle 8.3+ at runtime and will not apply on 7.5.1.buildSrc/build.gradleorg.apache.ant:ant:1.10.14— shadow 8.3.0 no longer shades Antinternally; it declares Ant as
runtimescope in its own POM but Gradle does notpull this transitively into
buildSrccompilation, causingZipEntry/ZipOutputStreamto be missing at compile time. Pinned to 1.10.14 to match shadow 8.3.0's own POM.
DependencyPatcher.java+Log4j2PluginFileMover.javashadow.org.apache.tools.zip.*(shaded, now gone) toorg.apache.tools.zip.*(unshaded, confirmed viajavapon shadow 8.3.0 jar)getName()override — shadow 8.3.0'sTransformerinterface now extendsorg.gradle.api.Named, makinggetName()an abstract requirementGradle 8 API fixes (required by the wrapper upgrade)
cache_weave_attributes.gradle.kts:JavaExec.main→mainClassinfinite-tracing/build.gradle.kts:jacoco.reportsDirremoved,xml.isEnabled→
xml.required,html.destination→html.outputLocationnewrelic-weaver/build.gradle: replaced undefinedjdk8property (which Gradle 8no longer resolves leniently on repository containers) with
javaToolchains.compilerForto dynamically resolve the JDK 8 installation path
Verified
./gradlew :buildSrc:build :newrelic-opentelemetry-agent-extension:shadowJarpassesclean with JDK 8 (Zulu 8.94) and Gradle 8.3
TransformerandTransformerContextclass paths unchanged in 8.3.0 — no interfacerename needed (that only happens in shadow 9.0.0)