RFR: gradle buildscript improvements
Athijegannathan Sundararajan
sundar at openjdk.java.net
Wed Apr 27 04:31:07 UTC 2022
On Sat, 16 Apr 2022 21:43:41 GMT, danieljarabek <duke at openjdk.java.net> wrote:
> Some improvements based on suggestions I made in an email [1]. Since then, the buildscript has a evolved quite a bit so some of my suggestions became obsolete or easier. This PR generally implements suggestions 2 and 3 from my email.
>
> Use Gradle incremental builds and up to date checks:
> - The `createJextractImage` and `createRuntimeImageForTest` tasks now use Gradle task input and ouputs to enable up to date checks.
> - The cmake tasks could theoretically also have inputs and outputs added, however cmake has incremental builds already and these tasks are only run when running jtreg and take little time compared to the test suite.
>
> I made a few minor style changes and fixed the comment on the jtreg task.
>
> I would like feedback on one change, which is making the assemble task automatically run the jextractapp task to build a jextract binary. Do you think it is best if the assemble task automatically runs the verify task as well? Or should things just be left as they are and require running verify or jextractapp manually? For some brief insight into Gradle lifecycle tasks for those not familiar: The build task should build and test everything so it depends on assemble and check. The assemble task is responsible for building everything, it depends on jar in a default configuration. The check task is responsible for running tests. For more information see the Gradle docs [2].
>
> [1] - https://mail.openjdk.java.net/pipermail/panama-dev/2022-March/016665.html
> [2] - https://docs.gradle.org/current/userguide/base_plugin.html#sec:base_tasks
build.gradle line 32:
> 30: def quote_jlink_opts = Os.isFamily(Os.FAMILY_WINDOWS)?
> 31: "\\\"--enable-native-access=org.openjdk.jextract\\\"" :
> 32: '"--enable-native-access=org.openjdk.jextract"';
global moved to place of use. looks good.
build.gradle line 40:
> 38:
> 39: compileJava {
> 40: options.release = 18
using property style rather passing option as string. looks fine
build.gradle line 65:
> 63: doFirst {
> 64: delete(jextract_app_dir)
> 65: }
I didn't know about inputs/outputs of Exec task. I just checked that running verify without clean in between does not rebuild (after your change). So looks fine.
build.gradle line 102:
> 100: // build the jextract image when the build or assemble task is run
> 101: assemble.dependsOn(jextractapp)
> 102:
Not sure of this change. Basically what we want is only three targets to use "clean", "verify" and "jtreg"
"verify" is for just create minimal jextract JDK image and run simple 'integration test' on it.
'jtreg' is for really running all tests
Note that we cannot use usual lifecycle of Gradle projects. Out tests are run a separate JDK image containing jextract tool in it - because this is how we expect users to deploy/use.
"verify" creates a minimal jextract image (which won't have compiler and other things needed for jtreg test run and so we create two JRE images) and runs a simple jextract on a simple test.h.
build.gradle line 123:
> 121: doFirst {
> 122: delete(out_dir)
> 123: }
similar inputs/outputs change. looks good.
build.gradle line 172:
> 170: }
> 171:
> 172: // run jtreg tests. Note: needs jtreg_home variable set to point to the jtreg
good catch :) That comment is relic of the past.
-------------
PR: https://git.openjdk.java.net/jextract/pull/25
More information about the jextract-dev
mailing list