On Tue, 18 Nov 2025 11:30:54 GMT, Marius Hanl <[email protected]> wrote:

>> 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.
>
> Marius Hanl has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Use defineProperty and fail method from default build.gradle

I ran the same command `gradle -PMAVEN_PUBLISH=true publishToMavenLocal` with 
the latest changes in the PR and without.

With this PR, for a module a few additional tasks get executed compared to 
without PR.
For example for graphics module, following additional tasks are executed.

> Task :graphics:modularJarStandaloneMac
> Task :graphics:copyNativeFilesStandaloneMac NO-SOURCE
> Task :graphics:copyLibFilesStandaloneMac
> Task :graphics:copyLegalStandaloneMac
> Task :graphics:cleanOpenLegalStandaloneMac
> Task :graphics:copyClassFilesMac
> Task :graphics:copyBinFilesMac NO-SOURCE
> Task :graphics:copyLibFilesMac
> Task :graphics:copySourceFilesMac
> Task :graphics:copyDocFilesMac
> Task :graphics:copyBuildPropertiesMac
> Task :graphics:copyClosedLegalStandaloneMac
> Task :graphics:copyLegalMac


So, the content of build directories differ. With this change there are 2 
additional directories created under build dir: `modular-sdk` and `sdk`

<img width="647" height="415" alt="Screenshot 2025-11-19 at 10 37 10" 
src="https://github.com/user-attachments/assets/3a359065-661c-4ad5-baed-33d80fdc46b4";
 />


I am not sure which is more correct behavior or if it can cause any issue.
Though seems safe, as ideal way would be to do a full build and then publish.
I would like to request @kevinrushforth and @johanvos to please weigh in.

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

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

Reply via email to