KAFKA-12415: Prepare for Gradle 7.0 and restrict transitive scope for non api dependencies#10203
KAFKA-12415: Prepare for Gradle 7.0 and restrict transitive scope for non api dependencies#10203ijuma merged 28 commits intoapache:trunkfrom
Conversation
There was a problem hiding this comment.
We should also change configurations.testRuntime a few lines above to configurations.testRuntimeClasspath, but this causes a cyclic build error. Fixing this will be required before we move to Gradle 7.0.
There was a problem hiding this comment.
dac7e6b to
78b40f2
Compare
|
|
||
| apply plugin: "com.diffplug.spotless" | ||
| plugins { | ||
| id 'com.diffplug.spotless' version '5.10.2' |
There was a problem hiding this comment.
We have to either include the version literal here or in a properties file. Methods cannot be invoked. Having a separate properties file and the dependencies file didn't seem particularly better than this way.
…es to the publishing task anyway
|
@mjsax @guozhangwang @vvcephei Can one of you review the build changes for the stream modules and check if they all make sense? |
|
@chia7712 Are you ok after the latest changes? |
* apache-github/trunk: (37 commits) KAFKA-10357: Extract setup of changelog from Streams partition assignor (apache#10163) KAFKA-10251: increase timeout for consuming records (apache#10228) KAFKA-12394; Return `TOPIC_AUTHORIZATION_FAILED` in delete topic response if no describe permission (apache#10223) MINOR: Disable transactional/idempotent system tests for Raft quorums (apache#10224) KAFKA-10766: Unit test cases for RocksDBRangeIterator (apache#9717) KAFKA-12289: Adding test cases for prefix scan in InMemoryKeyValueStore (apache#10052) KAFKA-12268: Implement task idling semantics via currentLag API (apache#10137) MINOR: Time and log producer state recovery phases (apache#10241) MINOR: correct the error message of validating uint32 (apache#10193) MINOR: Format the revoking active log output in `StreamsPartitionAssignor` (apache#10242) KAFKA-12323 Follow-up: Refactor the unit test a bit (apache#10205) MINOR: Remove stack trace of the lock exception in a debug log4j (apache#10231) MINOR: Word count should account for extra whitespaces between words (apache#10229) MINOR; Small refactor in `GroupMetadata` (apache#10236) KAFKA-10340: Proactively close producer when cancelling source tasks (apache#10016) KAFKA-12329; kafka-reassign-partitions command should give a better error message when a topic does not exist (apache#10141) KAFKA-12254: Ensure MM2 creates topics with source topic configs (apache#10217) MINOR: fix kafka-metadata-shell.sh (apache#10226) KAFKA-12374: Add missing config sasl.mechanism.controller.protocol (apache#10199) KAFKA-10101: Fix edge cases in Log.recoverLog and LogManager.loadLogs (apache#8812) ...
|
@ijuma, I ran If that should not work, we should also update the README. But if it should work, we may need a bit more work for building an unsigned release archive. FWIW, running |
|
A few more things regarding
I have Gradle 6.8.3 installed. |
* apache-github/trunk: KAFKA-12400: Upgrade jetty to fix CVE-2020-27223 MINOR: Fix null exception in coordinator log (apache#10250) y KAFKA-12375: don't reuse thread.id until a thread has fully shut down (apache#10215) KAFKA-12177: apply log start offset retention before time and size based retention (apache#10216) KAFKA-12369; Implement `ListTransactions` API (apache#10206)
|
Thanks for testing @rhauch!
The readme was wrong when it comes to this since signing was only triggered when
Good catch, I updated the build so that this works with the new plugin.
It seems like the new plugin only includes those when |
|
|
||
| shadowJar { | ||
| baseName = 'kafka-jmh-benchmarks-all' | ||
| classifier = null |
There was a problem hiding this comment.
Those changes rename the shadow jar from kafka-jmh-benchmarks-all.jar to kafka-jmh-benchmarks-all-3.0.0-SNAPSHOT-all.jar. That breaks jmh.sh as the script presumes the name of shadow jar is kafka-jmh-benchmarks-all.jar (https://github.com/apache/kafka/blob/trunk/jmh-benchmarks/jmh.sh#L40)
There was a problem hiding this comment.
Good point, fixed the script and readme.
There was a problem hiding this comment.
Could we remove duplicate "all" from name of shadow jar? kafka-jmh-benchmarks-all-3.0.0-SNAPSHOT-all.jar
| compile libs.jacksonDatabind | ||
| compile libs.jacksonJDK8Datatypes | ||
| compile libs.slf4jApi | ||
| implementation project(':connect:api') |
There was a problem hiding this comment.
I think this is the correct mapping.
By switching to implementation, any external project depending on the connect:json module will have to include an explicit dependency on connect:api. This appears to be have the same effect as what previous branches do with compile on earlier branches, but using implementation seems more correct since the Gradle docs suggest that compile (or compileOnly) are more applicable for shading, which is not our case here.
There was a problem hiding this comment.
Does connect-json expose any connect-api types in its public API?
There was a problem hiding this comment.
The public API is defined in connect:api, and connect:json and connect:transforms are implementations of interfaces defined in (and therefore cannot be used without) connect:api. Within AK, we provide the connect:json and connect:transforms always with the connect:api (and runtime) modules, and therefore using implementation (and compile in earlier branches) seems appropriate.
From a more abstract perspective, one might argue that the connect:json and connect:transforms could declare their use of connect:api as a transitive dependency (e.g., api rather than implementation). It's just that as a practical matter we don't need this, and arguably no other projects would either.
As such, I think it's safer to use implementation, as it's in line with what we were doing earlier.
There was a problem hiding this comment.
To clarify, compile is more like api than implementation. I switched the dependency of connect-api for connect-json and connect-transform to api for now. We can change this in a future PR, if we like, but it seems more consistent with the generally conservative approach we're taking in this PR.
|
@chia7712 I filed https://issues.apache.org/jira/browse/KAFKA-12418 to follow up on the jars that are no longer included in the release tarball. It seems OK to me, but I'll do a bit more due dilligence before the 3.0.0 release. |
|
No test failures, but one of the jobs was killed in the last run: The previous runs confirm that it's a flaky issue unrelated to this PR (there are no test changes here). |
|
|
||
| The above command will fail if you haven't set up the signing key. To bypass signing the artifact, you can run: | ||
|
|
||
| ./gradlew clean releaseTarGz -x signArchives |
There was a problem hiding this comment.
@ijuma the proper way to skip signing is now to run ./gradlew clean releaseTarGz -DskipSigning, is that right? Is there a reason we removed this instruction from the README instead of updating it?
There was a problem hiding this comment.
Signing is skipped by default. Are you seeing something different? There is a table that describes skipSigning:
There was a problem hiding this comment.
Yes, we're suddenly seeing our soak test (an application which deploys from trunk) fail with
./gradlew clean install releaseTarGz
> Configure project :
Building project 'core' with Scala version 2.13.5
Building project 'streams-scala' with Scala version 2.13.5
> Task :connect:signMavenJavaPublication FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':connect:signMavenJavaPublication'.
> Cannot perform signing task ':connect:signMavenJavaPublication' because it has no configured signatory
I personally haven't been able to reproduce this, but both @wcarlson5 and @lct45 have reported running into this issue
There was a problem hiding this comment.
Note that your command has install while the README line I deleted did not (and was wrong). It is still weird that you're seeing this for snapshot builds. I'll work with you all offline to try and figure it out.
There was a problem hiding this comment.
We figured it out, the build was using a non snapshot version. Passing -PskipSigning=true fixed it. Submitted #10307 to make it easier to debug these issues in the future.


Gradle 7.0 is required for Java 16 compatibility and it removes a number of
deprecated APIs. Fix most issues preventing the upgrade to Gradle 7.0.
The remaining ones are more complicated and should be handled
in a separate PR. Details of the changes:
are still published to the Maven Central repository).
compilewithapiorimplementation- note thatimplementationdependencies appear with
runtimescope in the pom file so this is a (positive)change in behavior
implementationtestCompilewithtestImplementationruntimewithruntimeOnlyandtestRuntimewithtestRuntimeOnlyconfigurations.runtimewithconfigurations.runtimeClasspathconfigurations.testRuntimewithconfigurations.testRuntimeClasspath(except forthe usage in the
streamsproject as that causes a cyclic dependency error)java-libraryplugin instead ofjavamaven-publishplugin instead of deprecatedmavenplugin - this changes thecommands used to publish and to install locally, but task aliases for
installanduploadArchiveswere added for backwards compatibility-x signArchivesline from the readme since it was wrong (it was ano-op before and it fails now, however)
artifactsblock with an approach that works with themaven-publishpluginjmh-benchmarkmodule - the shadow jar is pretty large and notparticularly useful (before this PR, we would publish the non shadow jars)
versionwitharchiveVersion,baseNamewitharchiveBaseNameandclassifierwitharchiveClassifierpluginDSL to configure pluginsCommitter Checklist (excluded from commit message)