dejan2609 opened a new pull request, #20566:
URL: https://github.com/apache/kafka/pull/20566

   Prologue:  #19513
   
   **This POC tries to explain why a new `:distribution`  submodule is required 
 for Gradle 8 -->> 9 upgrade**
   
   The thing is that Gradle 9 is very strict when it comes to a submodule 
boundaries: 
https://docs.gradle.org/9.1.0/userguide/viewing_debugging_dependencies.html#sub:resolving-unsafe-configuration-resolution-errors
   
   Root cause (see this commit:): `:core` module `releaseTarGz` task is not 
able to directly access other submodules `runtimeClasspath` configuration:
   ```
   from(project(':trogdor').configurations.runtimeClasspath) { into("libs/") }
   ```
   
   And that is why I tried to bypass that with: 
   ```
     def  submodulesToIncludeInDistribution = ['tools', 'trogdor', 'shell', 
'api', 'runtime', 'transforms',
                                                 'json', 'file', 
'basic-auth-extension', 'mirror', 'mirror-client',
                                                 'streams', 'streams-scala', 
'test-utils', 'examples', 'tools-api']
                                                   
     def shouldModuleResolveRuntimeClasspath = 
(submodulesToIncludeInDistribution.contains(project.name))
   
       if (shouldModuleResolveRuntimeClasspath) {
           configurations.create('resolvedRuntimeClasspath') {
               extendsFrom(configurations.runtimeClasspath)
               canBeResolved = true
           }
       } 
   ...
     tasks.create(name: "releaseTarGz", dependsOn: 
configurations.archives.artifacts, type: Tar) {
         ...
         from(project(':trogdor').configurations.resolvedRuntimeClasspath) { 
into("libs/") }
         ...
   }
   ```
   but the build still fails :x: when we leave `releaseTarGz` in `:core`
   ___
   Why build works in  #19513 ? Because in addition to the changes above 
configuration for `:distribution` is extended:
   
   ```
     configurations {
       includeIntoDistribution
     }
   
     dependencies {
       ...
       includeIntoDistribution project(path: ':trogdor', configuration: 
'resolvedRuntimeClasspath')
       ...
     }
   
     tasks.create(name: "releaseTarGz", dependsOn: 
project(':core').configurations.archives.artifacts, type: Tar) {
       ...
       from(configurations.includeIntoDistribution) { into("libs/") }
       ...
     }
   ```
   
   
   
   
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to