Skip to content

Commit

Permalink
Work around gradle issue and optionally include graalvm project
Browse files Browse the repository at this point in the history
JAVA-5637
  • Loading branch information
rozza committed Oct 2, 2024
1 parent 8681337 commit 511a63a
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .evergreen/run-graalvm-native-image-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ echo "The Gradle version is"
./gradlew --version

echo "Building and running the GraalVM native image app"
./gradlew -PjavaVersion=${JAVA_VERSION} -Dorg.mongodb.test.uri=${MONGODB_URI} :graalvm-native-image-app:nativeRun
./gradlew -PincludeGraalvm -PjavaVersion=${JAVA_VERSION} -Dorg.mongodb.test.uri=${MONGODB_URI} :graalvm-native-image-app:nativeRun
2 changes: 2 additions & 0 deletions graalvm-native-image-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* limitations under the License.
*/

// Note requires a Gradle project flag `-PincludeGraalvm` (see settings.gradle).

plugins {
id 'application'
id 'org.graalvm.buildtools.native' version '0.9.23'
Expand Down
6 changes: 4 additions & 2 deletions graalvm-native-image-app/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@ you can specify the connection string used by the `:graalvm-native-image-app:run
Gradle tasks, as well as by the built native application by passing the CLI argument
`-Dorg.mongodb.test.uri="<your connection string>"` to `gradlew` or `NativeImageApp` respectively:

For gradle to include this project in the build you *must* include a project flag: `-PincludeGraalvm`

```bash
./gradlew ... -Dorg.mongodb.test.uri="<your connection string>"
./gradlew ... -PincludeGraalvm -Dorg.mongodb.test.uri="<your connection string>"
```

```bash
./graalvm-native-image-app/build/native/nativeCompile/NativeImageApp -Dorg.mongodb.test.uri="<your connection string>"
./graalvm-native-image-app/build/native/nativeCompile/NativeImageApp -PincludeGraalvm -Dorg.mongodb.test.uri="<your connection string>"
```
2 changes: 1 addition & 1 deletion gradle/javaToolchain.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ allprojects {
options.encoding = "UTF-8"
options.release.set(17)
}
} else if (project == project(':graalvm-native-image-app')) {
} else if (project.name == 'graalvm-native-image-app') {
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.release.set(DEFAULT_JDK_VERSION)
Expand Down
5 changes: 3 additions & 2 deletions gradle/javadoc.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ import static org.gradle.util.CollectionUtils.single
*/


def projectsThatDoNotPublishJavaDocs = project(":util").allprojects + project(":driver-benchmarks") + project("driver-workload-executor") + project("driver-lambda") + project(":graalvm-native-image-app")
def javaMainProjects = subprojects - projectsThatDoNotPublishJavaDocs
def projectNamesThatDoNotPublishJavaDocs =["driver-benchmarks", "driver-lambda", "driver-workload-executor", "graalvm-native-image-app", "util",
"spock", "taglets"]
def javaMainProjects = subprojects.findAll { !projectNamesThatDoNotPublishJavaDocs.contains(it.name) }

task docs {
dependsOn javaMainProjects.collect { it.tasks.withType(Javadoc) + it.tasks.withType(ScalaDoc) }
Expand Down
6 changes: 4 additions & 2 deletions gradle/publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ ext {
}
}

def projectsNotPublishedToMaven = project(":util").allprojects + project(":driver-benchmarks") + project("driver-workload-executor") + project("driver-lambda") + project(":graalvm-native-image-app")
def publishedProjects = subprojects - projectsNotPublishedToMaven

def projectNamesNotToBePublished = ["driver-benchmarks", "driver-lambda", "driver-workload-executor", "graalvm-native-image-app", "util",
"spock", "taglets"]
def publishedProjects = subprojects.findAll { !projectNamesNotToBePublished.contains(it.name) }
def scalaProjects = publishedProjects.findAll { it.name.contains('scala') }
def javaProjects = publishedProjects - scalaProjects
def projectsWithManifest = publishedProjects.findAll {it.name != 'driver-legacy' }
Expand Down
5 changes: 4 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,7 @@ include ':driver-scala'
include ':mongodb-crypt'
include 'util:spock'
include 'util:taglets'
include ':graalvm-native-image-app'

if(hasProperty("includeGraalvm")) {
include ':graalvm-native-image-app'
}

0 comments on commit 511a63a

Please sign in to comment.