On Sun, 16 Nov 2025 11:14:10 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 with a new target base due to a 
> merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains seven additional 
> commits since the last revision:
> 
>  - Merge branch 'master' of https://github.com/openjdk/jfx into 
> 833146-mvn-publish
>  - remove print
>  - Use projects directly
>  - Further reduce coupling between main build.gradle and maven-publish.gradle
>  - Move MAVEN_GROUP_ID and fail() over to maven-publish.gradle
>  - Copyright header
>  - 8333146: Move maven publication logic from build.gradle

Could you please verify this observations: 
1. With this change the jar files are generated without class files i.e. sdk is 
not built. Use command :
`gradle -PMAVEN_PUBLISH=true publishToMavenLocal`. 
Note that default task `sdk` is not specified in the command.
The command completes in just a few seconds (~20 seconds), whereas the `sdk` 
task can take a few minutes
Attaching the screenshot, please observe that size of jar files are just a few 
100 bytes. They should be in KBs.

<img width="410" height="386" alt="Screenshot 2025-11-18 at 14 34 01" 
src="https://github.com/user-attachments/assets/78420dff-8de6-41b8-8bdd-32dc5dd122b1";
 />

<br><br>
2. If `sdk` task is added to the above command as : `gradle 
-PMAVEN_PUBLISH=true publishToMavenLocal sdk`
then the build fails with below error:


> Task :base:buildModuleMac FAILED

[Incubating] Problems report is available at: 
build/reports/problems/problems-report.html

FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':base:buildModuleMac' (type 
'Copy').
  - Gradle detected a problem with the following location: 
'modules/javafx.base/build/module-classes'.
    
    Reason: Task ':base:modularPublicationJarMac' uses this output of task 
':base:buildModuleMac' without declaring an explicit or implicit dependency. 
This can lead to incorrect results being produced, depending on what order the 
tasks are executed.
    
    Possible solutions:
      1. Declare task ':base:buildModuleMac' as an input of 
':base:modularPublicationJarMac'.
      2. Declare an explicit dependency on ':base:buildModuleMac' from 
':base:modularPublicationJarMac' using Task#dependsOn.
      3. Declare an explicit dependency on ':base:buildModuleMac' from 
':base:modularPublicationJarMac' using Task#mustRunAfter.
    
    For more information, please refer to 
https://docs.gradle.org/9.2.0/userguide/validation_problems.html#implicit_dependency
 in the Gradle documentation.

* Try:
> Declare task ':base:buildModuleMac' as an input of 
> ':base:modularPublicationJarMac'
> Declare an explicit dependency on ':base:buildModuleMac' from 
> ':base:modularPublicationJarMac' using Task#dependsOn
> Declare an explicit dependency on ':base:buildModuleMac' from 
> ':base:modularPublicationJarMac' using Task#mustRunAfter
> Run with --scan to generate a Build Scan (powered by Develocity).

Deprecated Gradle features were used in this build, making it incompatible with 
Gradle 10.

You can use '--warning-mode all' to show the individual deprecation warnings 
and determine if they come from your own scripts or plugins.

For more on this, please refer to 
https://docs.gradle.org/9.2.0/userguide/command_line_interface.html#sec:command_line_warnings
 in the Gradle documentation.

BUILD FAILED in 1m 15s

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

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

Reply via email to