RFR: 8337281: build.gradle assumes all modules are named "javafx.$project"

Kevin Rushforth kcr at openjdk.org
Fri Jul 26 18:20:37 UTC 2024


On Fri, 26 Jul 2024 17:04:17 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

> This PR fixes a bad assumption in a few places in `build.gradle`, which assumes that the module name can be derived from the name of the gradle project name by prepending `"javafx."` to the name rather than using the `moduleName` property of the project. In many of these places, the logic replaces dots with dashes in the name, but it does so by prefixing the project name with `"javafx-"` rather than doing a string replacement. This means that a module with more than one dot will only have the first one replaced.
> 
> I discovered this while working on the following two RFEs, both of which hit this bug:
> 
> [JDK-8309381](https://bugs.openjdk.org/browse/JDK-8309381): Support JavaFX incubator modules
> [JDK-8337280](https://bugs.openjdk.org/browse/JDK-8337280): Include jdk.jsobject module with JavaFX
> 
> Both of them need this bug to be fixed, so I am separating it out into its own issue.
> 
> ### Notes to reviewers
> 
> Most of the problematic logic is in the maven publication method, which is only enabled via `gradle -PMAVEN_PUBLISH=true` (in the absence of any other params, that won't actually try to publish anything, so is safe to use for testing). I left in some print statements for the purpose of testing, that I will remove with the next commit.
> 
> I tested this with the following branch, which is a preliminary prototype of adding jdk.jsobject to the build with the fix from _this_ PR applied: [test-module-name-jsobject](https://github.com/kevinrushforth/jfx/tree/test-module-name-jsobject).

build.gradle line 1799:

> 1797:                         if (!projectDependencies.empty) {
> 1798:                             projectDependencies.each { dep ->
> 1799:                                 def depName = dep.moduleName.replace('.', '-')

I was doing one last check and noticed a bug here. As with the earlier block on line 1716, the `projectDependencies.each` line needs to be replaced with:


    projectDependencies.each { projName ->
        def dep = project.project(":$projName")


since `dep` needs to be a gradle Project not a String.

I'll test it and fix it.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1518#discussion_r1693442715


More information about the openjfx-dev mailing list