Best way to ensure that Java 10 is used in Gradle

I’m building using the Gradle 4.8 java plugin & Java 10.

I want to specify & ensure that Java 10 is expected / used / targeted / etc.

Will the Gradle java plugin add a releaseCompatibility setting anytime soon?

Is it best to use the first, the second, or both of the following (or is it better to do something else)?:

1:

java {
    sourceCompatibility = VERSION_1_10
    targetCompatibility = VERSION_1_10
}

2:

tasks.withType<JavaCompile> {
    val compilerArgs = options.compilerArgs
    compilerArgs += "--release"
    compilerArgs += "10"
}