Skip to content

Commit 46524af

Browse files
committed
Rename extension and tasks
Following conversations, we decided to name: - `graalvmNative` the extension responsible for configuring the GraalVM native tooling - `binaries` the container of _native images_ in this extension. The name `binaries` was preferred over "native images" for multiple reasons: - there's a confusion in the community with the term "image" which is often thought as "Docker images" (or VMs) - the term "binary" is well known in the Gradle ecosystem - a native image can be either an executable or a library, which means that "binary" properly covers both cases - `nativeBuild` becomes `nativeCompile`, to emphatize the fact that it's a _compilation_ phase, and to remove the confusion with the "build" phase in Gradle - similarly `nativeTestBuild` becomes `nativeTestCompile`
1 parent 688db78 commit 46524af

File tree

17 files changed

+69
-69
lines changed

17 files changed

+69
-69
lines changed

common/docs/ANNOUNCEMENT.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ pluginManagement {
4343
```
4444
_(this step will be redundant once this plugin is published to the Gradle Plugin Portal)._
4545

46-
After that, we can configure the image build by using a `jvmNative` configuration block:
46+
After that, we can configure the image build by using a `graalvmNative` configuration block:
4747

4848
```groovy
49-
jvmNative {
50-
images {
49+
graalvmNative {
50+
binaries {
5151
main {
5252
imageName = "my-app"
5353
mainClass = "org.test.Main"
@@ -58,7 +58,7 @@ jvmNative {
5858
}
5959
```
6060

61-
The plugin then adds `jvmNativeCompile` and `nativeRun` tasks that respectively creates a native executable and runs the main class (as one might expect ☺). If the reflection configuration is necessary for the Native Image building, this plugin also provides a simple option that activates the `[native-image-agent](https://www.graalvm.org/reference-manual/native-image/BuildConfiguration/#assisted-configuration-of-native-image-builds)` without any additional user setup. More information (and _Kotlin_ configuration syntax) is available in the [documentation](https://github.com/graalvm/native-build-tools/blob/master/native-gradle-plugin/README.md).
61+
The plugin then adds `nativeCompile` and `nativeRun` tasks that respectively creates a native executable and runs the main class (as one might expect ☺). If the reflection configuration is necessary for the Native Image building, this plugin also provides a simple option that activates the `[native-image-agent](https://www.graalvm.org/reference-manual/native-image/BuildConfiguration/#assisted-configuration-of-native-image-builds)` without any additional user setup. More information (and _Kotlin_ configuration syntax) is available in the [documentation](https://github.com/graalvm/native-build-tools/blob/master/native-gradle-plugin/README.md).
6262

6363
#### Testing in _Gradle_
6464

common/junit-platform-native/gradle/native-image-testing.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ tasks.named("test") {
127127
}
128128
}
129129

130-
tasks.register("jvmNativeTestCompile", Exec) {
130+
tasks.register("nativeTestCompile", Exec) {
131131
dependsOn(test)
132132
inputs.files(test.classpath)
133133
workingDir "${buildDir}"
@@ -141,7 +141,7 @@ tasks.register("jvmNativeTestCompile", Exec) {
141141
}
142142

143143
tasks.register("nativeTest", Exec) {
144-
dependsOn jvmNativeTestCompile
144+
dependsOn nativeTestCompile
145145
workingDir = "${buildDir}"
146146
executable = "${buildDir}/native-image-tests"
147147
}

docs/src/docs/asciidoc/gradle-plugin.adoc

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,12 @@ This plugin works with the `application` plugin and will register a number of ta
131131

132132
The main tasks that you will want to execute are:
133133

134-
- `jvmNativeCompile`, which will trigger the generation of a native executable of your application
134+
- `nativeCompile`, which will trigger the generation of a native executable of your application
135135
- `nativeRun`, which executes the generated native executable
136-
- `jvmNativeTestCompile`, which will build a native image with tests found in the `test` source set
136+
- `nativeTestCompile`, which will build a native image with tests found in the `test` source set
137137
- `nativeTest`, which will <<testing,execute tests>> found in the `test` source set in native mode
138138

139-
Those tasks are configured with reasonable defaults using the `jvmNative` extension `images` container of type link:javadocs/native-gradle-plugin/org/graalvm/buildtools/gradle/dsl/NativeImageOptions.html[NativeImageOptions].
139+
Those tasks are configured with reasonable defaults using the `graalvmNative` extension `binaries` container of type link:javadocs/native-gradle-plugin/org/graalvm/buildtools/gradle/dsl/NativeImageOptions.html[NativeImageOptions].
140140

141141
The main executable is configured by the image named `main`, while the test executable is configured via the image named `test`.
142142

@@ -152,8 +152,8 @@ If you want to use a different toolchain, for example a GraalVM Enterprise Editi
152152
.Selecting the GraalVM toolchain
153153
[role="multi-language-sample"]
154154
```groovy
155-
jvmNative {
156-
images {
155+
graalvmNative {
156+
binaries {
157157
main {
158158
javaLauncher = javaToolchains.launcherFor {
159159
languageVersion = JavaLanguageVersion.of(8)
@@ -166,8 +166,8 @@ jvmNative {
166166

167167
[role="multi-language-sample"]
168168
```kotlin
169-
jvmNative {
170-
images {
169+
graalvmNative {
170+
binaries {
171171
main {
172172
javaLauncher.set(javaToolchains.launcherFor {
173173
languageVersion.set(JavaLanguageVersion.of(8))
@@ -185,8 +185,8 @@ The following configuration options are available for building images:
185185
.NativeImageOption configuration
186186
[role="multi-language-sample"]
187187
```groovy
188-
jvmNative {
189-
images {
188+
graalvmNative {
189+
binaries {
190190
main {
191191
// Main options
192192
imageName = 'application' // The name of the native image, defaults to the project name
@@ -217,8 +217,8 @@ jvmNative {
217217

218218
[role="multi-language-sample"]
219219
```kotlin
220-
jvmNative {
221-
images {
220+
graalvmNative {
221+
binaries {
222222
main {
223223
// Main options
224224
imageName.set("application") // The name of the native image, defaults to the project name
@@ -312,7 +312,7 @@ This should be as easy as appending `-Pagent` to `run` and `nativeBuild`, or `te
312312

313313
```bash
314314
./gradlew -Pagent run # Runs on JVM with native-image-agent.
315-
./gradlew -Pagent jvmNativeCompile # Builds image using configuration acquired by agent.
315+
./gradlew -Pagent nativeCompile # Builds image using configuration acquired by agent.
316316

317317
# For testing
318318
./gradlew -Pagent test # Runs on JVM with native-image-agent.
@@ -345,8 +345,8 @@ nativeBuild {
345345
you need to use:
346346

347347
```groovy
348-
jvmNative {
349-
images {
348+
graalvmNative {
349+
binaries {
350350
main {
351351
verbose = true
352352
}
@@ -365,17 +365,17 @@ nativeTest {
365365
you need to use:
366366

367367
```groovy
368-
jvmNative {
369-
images {
368+
graalvmNative {
369+
binaries {
370370
test {
371371
verbose = true
372372
}
373373
}
374374
}
375375
```
376376

377-
- The `nativeBuild` task has been renamed to `jvmNativeCompile`.
378-
- The `nativeTestBuild` task has been renamed to `jvmNativeTestCompile`.
377+
- The `nativeBuild` task has been renamed to `nativeCompile`.
378+
- The `nativeTestBuild` task has been renamed to `nativeTestCompile`.
379379

380380
Both `nativeBuild` and `nativeTestBuild` task invocations are still supported but deprecated and will be removed in a future release.
381381

native-gradle-plugin/src/functionalTest/groovy/org/graalvm/buildtools/gradle/DeprecatedExtensionFunctionalTest.groovy

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ class DeprecatedExtensionFunctionalTest extends AbstractFunctionalTest {
5757
jvmArgs('hello', 'world')
5858
}
5959
60-
assert jvmNative.images.${replacedWith}.verbose.get() == true
61-
assert jvmNative.images.${replacedWith}.jvmArgs.get() == ['hello', 'world']
60+
assert graalvmNative.binaries.${replacedWith}.verbose.get() == true
61+
assert graalvmNative.binaries.${replacedWith}.jvmArgs.get() == ['hello', 'world']
6262
"""
6363

6464
when:
6565
run 'help'
6666

6767
then:
68-
outputContains "The $extensionName extension is deprecated and will be removed. Please use the 'jvmNative.images.$replacedWith' extension to configure the native image instead."
68+
outputContains "The $extensionName extension is deprecated and will be removed. Please use the 'graalvmNative.binaries.$replacedWith' extension to configure the native image instead."
6969

7070
where:
7171
extensionName | replacedWith
@@ -84,12 +84,12 @@ class DeprecatedExtensionFunctionalTest extends AbstractFunctionalTest {
8484

8585
then:
8686
tasks {
87-
succeeded ':jvmNativeCompile'
87+
succeeded ':nativeCompile'
8888
succeeded ':nativeBuild'
8989
}
9090

9191
and:
92-
outputContains 'Task nativeBuild is deprecated. Use jvmNativeCompile instead.'
92+
outputContains 'Task nativeBuild is deprecated. Use nativeCompile instead.'
9393

9494
where:
9595
version << TESTED_GRADLE_VERSIONS

native-gradle-plugin/src/functionalTest/groovy/org/graalvm/buildtools/gradle/JavaApplicationFunctionalTest.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import org.graalvm.buildtools.gradle.fixtures.AbstractFunctionalTest
4646
class JavaApplicationFunctionalTest extends AbstractFunctionalTest {
4747
def "can build a native image for a simple application"() {
4848
gradleVersion = version
49-
def nativeApp = file("build/native/jvmNativeCompile/java-application")
49+
def nativeApp = file("build/native/nativeCompile/java-application")
5050
debug = true
5151

5252
given:
@@ -59,11 +59,11 @@ class JavaApplicationFunctionalTest extends AbstractFunctionalTest {
5959
""".stripIndent()
6060

6161
when:
62-
run 'jvmNativeCompile'
62+
run 'nativeCompile'
6363

6464
then:
6565
tasks {
66-
succeeded ':jar', ':jvmNativeCompile'
66+
succeeded ':jar', ':nativeCompile'
6767
doesNotContain ':build', ':run'
6868
}
6969

native-gradle-plugin/src/functionalTest/groovy/org/graalvm/buildtools/gradle/JavaApplicationWithResourcesFunctionalTest.groovy

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class JavaApplicationWithResourcesFunctionalTest extends AbstractFunctionalTest
4747
@Unroll("can build an application which uses resources using #pattern on Gradle #version with JUnit Platform #junitVersion")
4848
def "can build an application which uses resources"() {
4949
gradleVersion = version
50-
def nativeApp = file("build/native/jvmNativeCompile/java-application")
50+
def nativeApp = file("build/native/nativeCompile/java-application")
5151
debug = true
5252
given:
5353
withSample("java-application-with-resources")
@@ -60,11 +60,11 @@ class JavaApplicationWithResourcesFunctionalTest extends AbstractFunctionalTest
6060
"""
6161

6262
when:
63-
run 'jvmNativeCompile'
63+
run 'nativeCompile'
6464

6565
then:
6666
tasks {
67-
succeeded ':jar', ':jvmNativeCompile'
67+
succeeded ':jar', ':nativeCompile'
6868
doesNotContain ':build', ':run'
6969
}
7070

@@ -92,8 +92,8 @@ class JavaApplicationWithResourcesFunctionalTest extends AbstractFunctionalTest
9292
junitVersion = System.getProperty('versions.junit')
9393
[version, [pattern, config]] << [TESTED_GRADLE_VERSIONS,
9494
[["explicit resource declaration", """
95-
jvmNative {
96-
images {
95+
graalvmNative {
96+
binaries {
9797
main {
9898
resources {
9999
includedPatterns.add(java.util.regex.Pattern.quote("message.txt"))
@@ -103,8 +103,8 @@ jvmNative {
103103
}
104104
"""],
105105
["detected", """
106-
jvmNative {
107-
images {
106+
graalvmNative {
107+
binaries {
108108
main {
109109
resources {
110110
autodetection {
@@ -119,8 +119,8 @@ jvmNative {
119119
"""
120120
],
121121
["project local detection only", """
122-
jvmNative {
123-
images {
122+
graalvmNative {
123+
binaries {
124124
main {
125125
resources {
126126
autodetection {
@@ -171,8 +171,8 @@ jvmNative {
171171
junitVersion = System.getProperty('versions.junit')
172172
[version, [pattern, config]] << [TESTED_GRADLE_VERSIONS,
173173
[["explicit resource declaration", """
174-
jvmNative {
175-
images {
174+
graalvmNative {
175+
binaries {
176176
test {
177177
resources {
178178
includedPatterns.add(java.util.regex.Pattern.quote("message.txt"))
@@ -183,8 +183,8 @@ jvmNative {
183183
}
184184
"""],
185185
["detected", """
186-
jvmNative {
187-
images {
186+
graalvmNative {
187+
binaries {
188188
test {
189189
resources {
190190
autodetection {

native-gradle-plugin/src/functionalTest/groovy/org/graalvm/buildtools/gradle/JavaApplicationWithTestsFunctionalTest.groovy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,17 @@ class JavaApplicationWithTestsFunctionalTest extends AbstractFunctionalTest {
4949
@Unroll("can execute tests in a native image on Gradle #version with JUnit Platform #junitVersion")
5050
def "can build a native image and run it"() {
5151
gradleVersion = version
52-
def nativeTestsApp = file("build/native/jvmNativeTestCompile/java-application-tests")
52+
def nativeTestsApp = file("build/native/nativeTestCompile/java-application-tests")
5353

5454
given:
5555
withSample("java-application-with-tests")
5656

5757
when:
58-
run 'jvmNativeTestCompile'
58+
run 'nativeTestCompile'
5959

6060
then:
6161
tasks {
62-
succeeded ':testClasses', ':jvmNativeTestCompile'
62+
succeeded ':testClasses', ':nativeTestCompile'
6363
// doesNotContain ':build'
6464
}
6565
outputDoesNotContain "Running in 'test discovery' mode. Note that this is a fallback mode."
@@ -105,7 +105,7 @@ class JavaApplicationWithTestsFunctionalTest extends AbstractFunctionalTest {
105105
then:
106106
tasks {
107107
succeeded ':testClasses',
108-
':jvmNativeTestCompile',
108+
':nativeTestCompile',
109109
':test', // there should probably not be a dependency here
110110
':nativeTest'
111111
doesNotContain ':build'

native-gradle-plugin/src/functionalTest/groovy/org/graalvm/buildtools/gradle/JavaLibraryFunctionalTest.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,18 @@ class JavaLibraryFunctionalTest extends AbstractFunctionalTest {
5757
libExt = ".dylib"
5858
}
5959

60-
def library = file("build/native/jvmNativeCompile/java-library" + libExt)
60+
def library = file("build/native/nativeCompile/java-library" + libExt)
6161
debug = true
6262

6363
given:
6464
withSample("java-library")
6565

6666
when:
67-
run 'jvmNativeCompile'
67+
run 'nativeCompile'
6868

6969
then:
7070
tasks {
71-
succeeded ':jar', ':jvmNativeCompile'
71+
succeeded ':jar', ':nativeCompile'
7272
doesNotContain ':build'
7373
}
7474

native-gradle-plugin/src/functionalTest/groovy/org/graalvm/buildtools/gradle/KotlinApplicationWithTestsFunctionalTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class KotlinApplicationWithTestsFunctionalTest extends AbstractFunctionalTest {
6060
then:
6161
tasks {
6262
succeeded ':compileTestKotlin',
63-
':jvmNativeTestCompile',
63+
':nativeTestCompile',
6464
':test',
6565
':nativeTest'
6666
doesNotContain ':build'

native-gradle-plugin/src/functionalTest/groovy/org/graalvm/buildtools/gradle/MultiProjectJavaApplicationWithTestsFunctionalTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class MultiProjectJavaApplicationWithTestsFunctionalTest extends AbstractFunctio
5959
tasks {
6060
succeeded ':utils:jar',
6161
':core:testClasses',
62-
':core:jvmNativeTestCompile',
62+
':core:nativeTestCompile',
6363
':core:nativeTest'
6464
doesNotContain ':core:build'
6565
}

0 commit comments

Comments
 (0)