On Fri, 14 Nov 2025 07:02:13 GMT, Jendrik Johannes <[email protected]> wrote:

>> Note for reviewers: Some testing was done in a follow-up PR, so worth 
>> checking as well: https://github.com/openjdk/jfx/pull/2144
>> 
>> ---
>> 
>> This PR splits the maven publishing logic into an own file, 
>> `maven-publish.gradle`, that is next to the root `build.gradle`.
>> 
>> The `build.gradle` will apply the `maven-publish.gradle`. The 
>> `maven-publish.gradle` will then configure the Maven related properties and 
>> register all modules for publication.
>> 
>> This way, we decoupled the logic that much, the only things we need to do:
>> - apply from `maven-publish.gradle`
>> - Call `configureMavenPublication` later in the build chain.
>> 
>> To better understand the context, this is the commit where the whole Maven 
>> Publishing logic was introduced. I moved all of that logic out of the main 
>> `build.gradle`: 5a18677f
>> 
>> This will reduce the size by ~170 lines for the `build.gradle`.
>> 
>> Tested with:
>> - `./gradlew -PMAVEN_PUBLISH=true -PMAVEN_VERSION=custom publishToMavenLocal`
>> - `./gradlew -PMAVEN_PUBLISH=true publishToMavenLocal`
>> - `./gradlew -PMAVEN_PUBLISH=true -PMILESTONE_FCS=true publishToMavenLocal`
>> 
>> Everything still works:
>> -> Example: javafx.base from the local .m2 repository
>> <img width="1051" height="388" alt="image" 
>> src="https://github.com/user-attachments/assets/66ccd007-ff2c-4309-982a-1e8123e9f52a";
>>  />
>> 
>> I think this is a good step and an easy way to split out functionality 
>> without blowing things up. We might want to do that for other parts as well.
>> 
>> Note: I also fixed the deprecated `buildDir`, the deprecated `project.task` 
>> method and 2 warnings where it seems like he might not be able to infer the 
>> type (changing `def` to the actual type). 
>> -> The file is completely green, no warnings or deprecations.
>> Note2: I did a small improvement to the `addMavenPublication` method. It is 
>> now more 'typesafe', e.g. projects must be passed in directly, not as 
>> String. If a project does not exist, the build will fail with an exception.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Thanks for the ping. I have to rework my PR anyway. There is no need to pay 
> special attention to it. Any change that makes the publishing setup clearer 
> is good IMO. I think this PR is a good step forward.  
> 
> (I didn't get back to the topic yet on the my PR, because it is more work as 
> I initially expected. What is complicating things me there is how 
> conceptually get the setup right with the Jars for different platform built 
> on different machines. I have to set aside some mote time for it.)

@jjohannes, @koppor told me you are the Gradle Expert to ask for feedback😄.
If you have a bit time, could you review this PR? :)

- I was mostly wondering if this is the right location for the new 
`maven-publish.gradle`, or should/can we move it to `buildSrc`?
- And if my idea with `isAllTaskRequested` seems fine, or if there is a better 
way?

I saw that in https://github.com/openjdk/jfx/pull/1232 you made some publishing 
improvements and used `apply plugin: 'java-library'` instead, but this PR is 
only about extracting the existing publishing logic for now.

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1970#issuecomment-4881540550

Reply via email to