diff --git a/bson-kotlin/build.gradle.kts b/bson-kotlin/build.gradle.kts index 45e8c9c0e5d..84b6deabd31 100644 --- a/bson-kotlin/build.gradle.kts +++ b/bson-kotlin/build.gradle.kts @@ -18,12 +18,12 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { id("org.jetbrains.kotlin.jvm") - `java-library` + id("java-library") // Test based plugins - id("com.diffplug.spotless") - id("org.jetbrains.dokka") - id("io.gitlab.arturbosch.detekt") + alias(libs.plugins.spotless) + alias(libs.plugins.dokka) + alias(libs.plugins.detekt) } repositories { @@ -39,13 +39,13 @@ ext.set("pomName", "Bson Kotlin") dependencies { // Align versions of all Kotlin components - implementation(platform("org.jetbrains.kotlin:kotlin-bom")) - implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") + implementation(platform(libs.kotlin.bom)) + implementation(libs.kotlin.stdlib.jdk8) api(project(path = ":bson", configuration = "default")) - implementation("org.jetbrains.kotlin:kotlin-reflect") + implementation(libs.kotlin.reflect) - testImplementation("org.jetbrains.kotlin:kotlin-test-junit") + testImplementation(libs.junit.kotlin) testImplementation(project(path = ":driver-core", configuration = "default")) } diff --git a/bson-kotlinx/build.gradle.kts b/bson-kotlinx/build.gradle.kts index ac0b07f18eb..d2b3e13919b 100644 --- a/bson-kotlinx/build.gradle.kts +++ b/bson-kotlinx/build.gradle.kts @@ -19,12 +19,12 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { id("org.jetbrains.kotlin.jvm") kotlin("plugin.serialization") - `java-library` + id("java-library") // Test based plugins - id("com.diffplug.spotless") - id("org.jetbrains.dokka") - id("io.gitlab.arturbosch.detekt") + alias(libs.plugins.spotless) + alias(libs.plugins.dokka) + alias(libs.plugins.detekt) } repositories { @@ -38,10 +38,6 @@ description = "Bson Kotlinx Codecs" ext.set("pomName", "Bson Kotlinx") -ext.set("kotlinxDatetimeVersion", "0.4.0") - -val kotlinxDatetimeVersion: String by ext - java { registerFeature("dateTimeSupport") { usingSourceSet(sourceSets["main"]) } registerFeature("jsonSupport") { usingSourceSet(sourceSets["main"]) } @@ -49,21 +45,21 @@ java { dependencies { // Align versions of all Kotlin components - implementation(platform("org.jetbrains.kotlin:kotlin-bom")) - implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") + implementation(platform(libs.kotlin.bom)) + implementation(libs.kotlin.stdlib.jdk8) - implementation(platform("org.jetbrains.kotlinx:kotlinx-serialization-bom:1.5.0")) - implementation("org.jetbrains.kotlinx:kotlinx-serialization-core") - "dateTimeSupportImplementation"("org.jetbrains.kotlinx:kotlinx-datetime:$kotlinxDatetimeVersion") - "jsonSupportImplementation"("org.jetbrains.kotlinx:kotlinx-serialization-json") + implementation(platform(libs.kotlinx.serialization)) + implementation(libs.kotlinx.serialization.core) + "dateTimeSupportImplementation"(libs.kotlinx.serialization.datetime) + "jsonSupportImplementation"(libs.kotlinx.serialization.json) api(project(path = ":bson", configuration = "default")) - implementation("org.jetbrains.kotlin:kotlin-reflect") + implementation(libs.kotlin.reflect) - testImplementation("org.jetbrains.kotlin:kotlin-test-junit") testImplementation(project(path = ":driver-core", configuration = "default")) - testImplementation("org.jetbrains.kotlinx:kotlinx-datetime:$kotlinxDatetimeVersion") - testImplementation("org.jetbrains.kotlinx:kotlinx-serialization-json") + testImplementation(libs.junit.kotlin) + testImplementation(libs.kotlinx.serialization.datetime) + testImplementation(libs.kotlinx.serialization.json) } kotlin { explicitApi() } diff --git a/build.gradle b/build.gradle index 26734755984..b89624d4c4a 100644 --- a/build.gradle +++ b/build.gradle @@ -14,33 +14,21 @@ * limitations under the License. */ -apply plugin: 'eclipse' -apply plugin: 'idea' - -buildscript { - repositories { - mavenLocal() - mavenCentral() - maven { url "https://plugins.gradle.org/m2/" } - } - dependencies { - classpath 'com.netflix.nebula:gradle-extra-configurations-plugin:7.0.0' - classpath "com.github.spotbugs.snom:spotbugs-gradle-plugin:6.0.15" - classpath 'biz.aQute.bnd:biz.aQute.bnd.gradle:5.1.2' - - // Scala plugins - classpath "com.adtran:scala-multiversion-plugin:2.0.4" - classpath "com.diffplug.spotless:spotless-plugin-gradle:6.14.0" - - // kotlin plugins - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.10" - classpath "org.jetbrains.kotlin:kotlin-serialization:1.8.10" - classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.8.10" - classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.21.0" - - // Test logging plugin - classpath 'com.adarshr:gradle-test-logger-plugin:2.1.0' - } +plugins { + id("eclipse") + id("idea") + + alias(libs.plugins.bnd) apply false + alias(libs.plugins.detekt) apply false + alias(libs.plugins.dokka) apply false + alias(libs.plugins.download) apply false + alias(libs.plugins.kotlin) apply false + alias(libs.plugins.kotlin.serialization) apply false + alias(libs.plugins.optional) apply false + alias(libs.plugins.scala.multiversion) apply false + alias(libs.plugins.spotbugs) apply false + alias(libs.plugins.spotless) apply false + alias(libs.plugins.test.logger) apply false } ////////////////////////////////////////// @@ -49,17 +37,6 @@ buildscript { ext { configDir = new File(rootDir, 'config') - jnrUnixsocketVersion = '0.38.17' - nettyVersion = '4.1.87.Final' - snappyVersion = '1.1.10.3' - zstdVersion = '1.5.5-3' - awsSdkV2Version = '2.18.9' - awsSdkV1Version = '1.12.337' - projectReactorVersion = '2022.0.0' - junitBomVersion = '5.10.2' - logbackVersion = '1.3.14' - graalSdkVersion = '24.0.0' - reflectionsVersion = '0.9.10' gitVersion = getGitVersion() } @@ -109,27 +86,21 @@ configure(javaProjects) { } configure(scalaProjects) { - apply plugin: 'scala' - apply plugin: 'java-library' - apply plugin: 'idea' + apply plugin: "java-library" + apply plugin: "scala" apply plugin: "com.adtran.scala-multiversion-plugin" apply plugin: "com.diffplug.spotless" group = 'org.mongodb.scala' dependencies { - api ('org.scala-lang:scala-library:%scala-version%') - api ('org.scala-lang:scala-reflect:%scala-version%') - - testImplementation(platform("org.junit:junit-bom:$junitBomVersion")) - testImplementation("org.junit.vintage:junit-vintage-engine") - - testImplementation('org.scalatest:scalatest-flatspec_%%:3.2.9') - testImplementation('org.scalatest:scalatest-shouldmatchers_%%:3.2.9') - testImplementation('org.scalatestplus:junit-4-13_%%:3.2.9.0') - testImplementation('org.scalatestplus:mockito-3-12_%%:3.2.10.0') - testImplementation("ch.qos.logback:logback-classic:$logbackVersion") - testImplementation("org.reflections:reflections:$reflectionsVersion") + api(libs.scala.library) + api(libs.scala.reflect) + + testImplementation(platform(libs.junit.bom)) + testImplementation(libs.bundles.junit.vintage) + testImplementation(libs.bundles.scalatest) + testImplementation(libs.reflections) } test{ @@ -177,12 +148,12 @@ configure(javaMainProjects) { apply plugin: 'java-library' dependencies { - compileOnly 'com.google.code.findbugs:jsr305:1.3.9' - api 'org.slf4j:slf4j-api:1.7.6', optional - testImplementation 'com.google.code.findbugs:jsr305:1.3.9' + compileOnly(libs.findbugs.jsr) + api(libs.slf4j, optional) + testImplementation(libs.findbugs.jsr) // https://issues.apache.org/jira/browse/GROOVY-10194 - testImplementation 'org.codehaus.groovy:groovy-all:3.0.9' + testImplementation(libs.groovy) } /* Compiling */ @@ -251,25 +222,19 @@ configure(javaCodeCheckedProjects) { apply plugin: 'com.adarshr.test-logger' dependencies { - testImplementation(platform("org.junit:junit-bom:$junitBomVersion")) - testImplementation('org.junit.jupiter:junit-jupiter') - testImplementation('org.junit.jupiter:junit-jupiter-params') - testImplementation('org.junit.jupiter:junit-jupiter-engine') - testImplementation('org.junit.vintage:junit-vintage-engine') - - testImplementation platform('org.spockframework:spock-bom:2.1-groovy-3.0') - testImplementation 'org.spockframework:spock-core' - testImplementation 'org.spockframework:spock-junit4' + testImplementation(platform(libs.junit.bom)) + testImplementation(libs.bundles.junit.vintage) + + testImplementation(platform(libs.spock.bom)) + testImplementation(libs.bundles.spock) + if ('8'.equals(findProperty("javaVersion"))) { - testImplementation("org.mockito:mockito-core:4.6.1") - testImplementation("org.mockito:mockito-inline:4.6.1") + testImplementation(libs.bundles.mockito.java8) } else { - testImplementation("org.mockito:mockito-core:5.11.0") + testImplementation(libs.bundles.mockito) } - testImplementation 'cglib:cglib-nodep:2.2.2' - testImplementation 'org.objenesis:objenesis:1.3' - testImplementation 'org.hamcrest:hamcrest-all:1.3' - testImplementation "ch.qos.logback:logback-classic:$logbackVersion" + testImplementation(libs.cglib) + testImplementation(libs.objenesis) testImplementation project(':util:spock') //Adding categories to classpath } diff --git a/driver-benchmarks/build.gradle b/driver-benchmarks/build.gradle index 91d979cff68..b8c5ac0b62b 100644 --- a/driver-benchmarks/build.gradle +++ b/driver-benchmarks/build.gradle @@ -32,7 +32,7 @@ sourceSets { dependencies { api project(':driver-sync') api project(':mongodb-crypt') - implementation "ch.qos.logback:logback-classic:$logbackVersion" + implementation(libs.logback.classic) } javadoc { diff --git a/driver-core/build.gradle b/driver-core/build.gradle index a44f65bbc1b..900015bf79e 100644 --- a/driver-core/build.gradle +++ b/driver-core/build.gradle @@ -16,7 +16,7 @@ plugins { - id 'com.github.gmazzo.buildconfig' version '3.0.3' + alias(libs.plugins.build.config) } archivesBaseName = 'mongodb-driver-core' @@ -33,7 +33,6 @@ configurations { } } -def classifiers = ["linux-x86_64", "linux-aarch_64", "osx-x86_64", "osx-aarch_64", "windows-x86_64"] dependencies { api project(path: ':bson', configuration: 'default') implementation project(path: ':bson-record-codec', configuration: 'default') @@ -41,30 +40,26 @@ dependencies { implementation project(path: ':bson-kotlinx', configuration: 'default'), optional implementation project(path: ':mongodb-crypt', configuration: 'default'), optional - implementation "com.github.jnr:jnr-unixsocket:$jnrUnixsocketVersion", optional - api platform("io.netty:netty-bom:$nettyVersion") - api "io.netty:netty-buffer", optional - api "io.netty:netty-transport", optional - api "io.netty:netty-handler", optional - compileOnly "org.graalvm.sdk:graal-sdk:$graalSdkVersion" + implementation(libs.jnr.unixsocket, optional) + api(platform(libs.netty.bom), optional) + api(libs.bundles.netty, optional) + compileOnly(libs.graal.sdk) - // Optionally depend on both AWS SDK v2 and v1. The driver will use v2 is present, v1 if present, or built-in functionality if - // neither are present - implementation "software.amazon.awssdk:auth:$awsSdkV2Version", optional - implementation "software.amazon.awssdk:sts:$awsSdkV2Version", optional - implementation "com.amazonaws:aws-java-sdk-core:$awsSdkV1Version", optional - implementation "com.amazonaws:aws-java-sdk-sts:$awsSdkV1Version", optional + // Optionally depend on both AWS SDK v2 and v1. + // The driver will use v2 is present, v1 if present, or built-in functionality if neither are present + implementation(libs.bundles.aws.java.sdk.v1, optional) + implementation(libs.bundles.aws.java.sdk.v2, optional) - implementation "org.xerial.snappy:snappy-java:$snappyVersion", optional - implementation "com.github.luben:zstd-jni:$zstdVersion", optional + implementation(libs.snappy.java, optional) + implementation(libs.zstd.jni, optional) testImplementation project(':bson').sourceSets.test.output - testImplementation('org.junit.jupiter:junit-jupiter-api') - testImplementation("org.reflections:reflections:$reflectionsVersion") - testRuntimeOnly "io.netty:netty-tcnative-boringssl-static" + testImplementation(libs.bundles.junit) + testImplementation(libs.reflections) - classifiers.forEach { - testRuntimeOnly "io.netty:netty-tcnative-boringssl-static::$it" + testRuntimeOnly(libs.netty.boringssl) + ["linux-x86_64", "linux-aarch_64", "osx-x86_64", "osx-aarch_64", "windows-x86_64"].each { arch -> + testRuntimeOnly(variantOf(libs.netty.boringssl) { classifier(arch) }) } } diff --git a/driver-kotlin-coroutine/build.gradle.kts b/driver-kotlin-coroutine/build.gradle.kts index 96ac4cc31eb..59ef13952f2 100644 --- a/driver-kotlin-coroutine/build.gradle.kts +++ b/driver-kotlin-coroutine/build.gradle.kts @@ -18,12 +18,12 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { id("org.jetbrains.kotlin.jvm") - `java-library` + id("java-library") // Test based plugins - id("com.diffplug.spotless") - id("org.jetbrains.dokka") - id("io.gitlab.arturbosch.detekt") + alias(libs.plugins.spotless) + alias(libs.plugins.dokka) + alias(libs.plugins.detekt) } repositories { @@ -56,26 +56,25 @@ val integrationTestImplementation: Configuration by dependencies { // Align versions of all Kotlin components - implementation(platform("org.jetbrains.kotlin:kotlin-bom")) - implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") + implementation(platform(libs.kotlin.bom)) + implementation(libs.kotlin.stdlib.jdk8) - implementation(platform("org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.4")) - api("org.jetbrains.kotlinx:kotlinx-coroutines-core") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactive") + implementation(platform(libs.kotlinx.coroutines.bom)) + api(libs.kotlinx.coroutines.core) + implementation(libs.kotlinx.coroutines.reactive) api(project(path = ":bson", configuration = "default")) api(project(path = ":driver-reactive-streams", configuration = "default")) implementation(project(path = ":bson-kotlin", configuration = "default")) - testImplementation("org.jetbrains.kotlin:kotlin-reflect") - testImplementation("org.jetbrains.kotlin:kotlin-test-junit") - testImplementation("org.mockito.kotlin:mockito-kotlin:4.1.0") - testImplementation("org.mockito:mockito-junit-jupiter:4.11.0") - testImplementation("org.assertj:assertj-core:3.24.2") - testImplementation("io.github.classgraph:classgraph:4.8.154") + testImplementation(libs.kotlin.reflect) + testImplementation(libs.junit.kotlin) + testImplementation(libs.bundles.mockito.kotlin) + testImplementation(libs.assertj) + testImplementation(libs.classgraph) - integrationTestImplementation("org.jetbrains.kotlin:kotlin-test-junit") - integrationTestImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test") + integrationTestImplementation(libs.junit.kotlin) + integrationTestImplementation(libs.kotlinx.coroutines.test) integrationTestImplementation(project(path = ":driver-sync")) integrationTestImplementation(project(path = ":driver-core")) integrationTestImplementation(project(path = ":bson")) diff --git a/driver-kotlin-extensions/build.gradle.kts b/driver-kotlin-extensions/build.gradle.kts index 76f36ca33b2..fc0e134749a 100644 --- a/driver-kotlin-extensions/build.gradle.kts +++ b/driver-kotlin-extensions/build.gradle.kts @@ -18,12 +18,12 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { id("org.jetbrains.kotlin.jvm") - `java-library` + id("java-library") // Test based plugins - id("com.diffplug.spotless") - id("org.jetbrains.dokka") - id("io.gitlab.arturbosch.detekt") + alias(libs.plugins.spotless) + alias(libs.plugins.dokka) + alias(libs.plugins.detekt) } repositories { @@ -41,8 +41,8 @@ java { registerFeature("kotlinDrivers") { usingSourceSet(sourceSets["main"]) } } dependencies { // Align versions of all Kotlin components - implementation(platform("org.jetbrains.kotlin:kotlin-bom")) - implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") + implementation(platform(libs.kotlin.bom)) + implementation(libs.kotlin.stdlib.jdk8) api(project(path = ":driver-core", configuration = "default")) @@ -51,11 +51,11 @@ dependencies { "kotlinDriversImplementation"(project(path = ":driver-kotlin-sync", configuration = "default")) "kotlinDriversImplementation"(project(path = ":driver-kotlin-coroutine", configuration = "default")) - testImplementation("org.jetbrains.kotlin:kotlin-reflect") - testImplementation("org.jetbrains.kotlin:kotlin-test-junit") - testImplementation("org.assertj:assertj-core:3.24.2") - testImplementation("io.github.classgraph:classgraph:4.8.154") - testImplementation("org.mockito.kotlin:mockito-kotlin:4.1.0") + testImplementation(libs.kotlin.reflect) + testImplementation(libs.junit.kotlin) + testImplementation(libs.bundles.mockito.kotlin) + testImplementation(libs.assertj) + testImplementation(libs.classgraph) } kotlin { explicitApi() } diff --git a/driver-kotlin-sync/build.gradle.kts b/driver-kotlin-sync/build.gradle.kts index e7fb132cb36..e0131613a97 100644 --- a/driver-kotlin-sync/build.gradle.kts +++ b/driver-kotlin-sync/build.gradle.kts @@ -18,12 +18,12 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { id("org.jetbrains.kotlin.jvm") - `java-library` + id("java-library") // Test based plugins - id("com.diffplug.spotless") - id("org.jetbrains.dokka") - id("io.gitlab.arturbosch.detekt") + alias(libs.plugins.spotless) + alias(libs.plugins.dokka) + alias(libs.plugins.detekt) } repositories { @@ -56,21 +56,20 @@ val integrationTestImplementation: Configuration by dependencies { // Align versions of all Kotlin components - implementation(platform("org.jetbrains.kotlin:kotlin-bom")) - implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") + implementation(platform(libs.kotlin.bom)) + implementation(libs.kotlin.stdlib.jdk8) api(project(path = ":bson", configuration = "default")) api(project(path = ":driver-sync", configuration = "default")) implementation(project(path = ":bson-kotlin", configuration = "default")) - testImplementation("org.jetbrains.kotlin:kotlin-reflect") - testImplementation("org.jetbrains.kotlin:kotlin-test-junit") - testImplementation("org.mockito.kotlin:mockito-kotlin:4.1.0") - testImplementation("org.mockito:mockito-junit-jupiter:4.11.0") - testImplementation("org.assertj:assertj-core:3.24.2") - testImplementation("io.github.classgraph:classgraph:4.8.154") + testImplementation(libs.kotlin.reflect) + testImplementation(libs.junit.kotlin) + testImplementation(libs.bundles.mockito.kotlin) + testImplementation(libs.assertj) + testImplementation(libs.classgraph) - integrationTestImplementation("org.jetbrains.kotlin:kotlin-test-junit") + integrationTestImplementation(libs.junit.kotlin) integrationTestImplementation(project(path = ":driver-sync")) integrationTestImplementation(project(path = ":driver-core")) } diff --git a/driver-lambda/build.gradle b/driver-lambda/build.gradle index d7b9928e8f7..d1e4f624629 100644 --- a/driver-lambda/build.gradle +++ b/driver-lambda/build.gradle @@ -14,23 +14,13 @@ * limitations under the License. */ -buildscript { - repositories { - maven { url "https://plugins.gradle.org/m2/" } - } - dependencies { - classpath 'com.github.jengelman.gradle.plugins:shadow:6.1.0' - } -} plugins { + id("java") id("application") + alias(libs.plugins.shadow) } -apply plugin: 'application' -apply plugin: 'com.github.johnrengelman.shadow' -apply plugin: 'java' - compileJava { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 @@ -53,10 +43,10 @@ dependencies { implementation project(':driver-sync') implementation project(':bson') - implementation('com.amazonaws:aws-lambda-java-core:1.2.2') - implementation('com.amazonaws:aws-lambda-java-events:3.11.1') - implementation(platform("org.junit:junit-bom:$junitBomVersion")) - implementation('org.junit.jupiter:junit-jupiter-api') + implementation(libs.aws.lambda.core) + implementation(libs.aws.lambda.events) + implementation(platform(libs.junit.bom)) + implementation(libs.bundles.junit) } diff --git a/driver-reactive-streams/build.gradle b/driver-reactive-streams/build.gradle index 7b86f010484..f50a12de147 100644 --- a/driver-reactive-streams/build.gradle +++ b/driver-reactive-streams/build.gradle @@ -21,20 +21,21 @@ dependencies { api project(path: ':bson', configuration: 'default') api project(path: ':driver-core', configuration: 'default') - api 'org.reactivestreams:reactive-streams:1.0.4' - implementation platform("io.projectreactor:reactor-bom:$projectReactorVersion") - implementation 'io.projectreactor:reactor-core' + api(libs.reactive.streams) + implementation(platform(libs.project.reactor.bom)) + implementation(libs.project.reactor.core) testImplementation project(':bson').sourceSets.test.output testImplementation project(':driver-sync') testImplementation project(':driver-sync').sourceSets.test.output testImplementation project(':driver-core').sourceSets.test.output - testImplementation 'org.reactivestreams:reactive-streams-tck:1.0.4' - testImplementation 'io.projectreactor:reactor-test' + testImplementation(libs.reactive.streams.tck) + + testImplementation(libs.project.reactor.test) if ('8'.equals(findProperty("javaVersion"))) { - testImplementation 'org.mockito:mockito-junit-jupiter:4.6.1' + testImplementation(libs.bundles.mockito.java8) } else { - testImplementation 'org.mockito:mockito-junit-jupiter:5.11.0' + testImplementation(libs.bundles.mockito) } testRuntimeOnly project(path: ':driver-core', configuration: 'consumableTestRuntimeOnly') diff --git a/driver-sync/build.gradle b/driver-sync/build.gradle index 1c2f3ac6c59..2ea76dbd829 100644 --- a/driver-sync/build.gradle +++ b/driver-sync/build.gradle @@ -28,7 +28,7 @@ dependencies { testImplementation project(':driver-core').sourceSets.test.output testRuntimeOnly project(path: ':driver-core', configuration: 'consumableTestRuntimeOnly') - testImplementation('com.amazonaws:aws-lambda-java-core:1.2.1') + testImplementation(libs.aws.lambda.core) } sourceSets { diff --git a/driver-workload-executor/build.gradle b/driver-workload-executor/build.gradle index 7c48e444dc2..8885e1fd59c 100644 --- a/driver-workload-executor/build.gradle +++ b/driver-workload-executor/build.gradle @@ -14,18 +14,12 @@ * limitations under the License. */ -buildscript { - repositories { - maven { url "https://plugins.gradle.org/m2/" } - } - dependencies { - classpath 'com.github.jengelman.gradle.plugins:shadow:6.1.0' - } +plugins { + id("java") + id("application") + alias(libs.plugins.shadow) } -apply plugin: 'application' -apply plugin: 'com.github.johnrengelman.shadow' - mainClassName = "com.mongodb.workload.WorkloadExecutor" sourceSets { @@ -43,10 +37,8 @@ dependencies { implementation project(':driver-sync') implementation project(':driver-core').sourceSets.test.output implementation project(':driver-sync').sourceSets.test.output - implementation "ch.qos.logback:logback-classic:$logbackVersion" - implementation(platform("org.junit:junit-bom:$junitBomVersion")) - implementation('org.junit.jupiter:junit-jupiter') - implementation('org.junit.vintage:junit-vintage-engine') + implementation(platform(libs.junit.bom)) + implementation(libs.bundles.junit.vintage) } javadoc { diff --git a/graalvm-native-image-app/build.gradle b/graalvm-native-image-app/build.gradle index b3d7335f9d9..e9a2c0433bb 100644 --- a/graalvm-native-image-app/build.gradle +++ b/graalvm-native-image-app/build.gradle @@ -17,8 +17,8 @@ // Note requires a Gradle project flag `-PincludeGraalvm` (see settings.gradle). plugins { - id 'application' - id 'org.graalvm.buildtools.native' version '0.9.23' + id("application") + alias(libs.plugins.graalvm.buildtools) } application { @@ -113,9 +113,10 @@ dependencies { implementation project(':driver-sync').sourceSets.test.output implementation project(':driver-legacy').sourceSets.test.output implementation project(':driver-reactive-streams').sourceSets.test.output - implementation 'org.slf4j:slf4j-api:2.0.12' - implementation "ch.qos.logback:logback-classic:$logbackVersion" - implementation platform("io.projectreactor:reactor-bom:$projectReactorVersion") - implementation 'io.projectreactor:reactor-core' - implementation "org.graalvm.sdk:nativeimage:$graalSdkVersion" + + implementation(libs.slf4j) + implementation(libs.logback) + implementation(platform(libs.reactor.bom)) + implementation(libs.reactor.core) + implementation(libs.graal.sdk.native) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000000..7eaf08263b4 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,178 @@ +# Copyright 2008-present MongoDB, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +[versions] +aws-sdk-v1 = "1.12.337" +aws-sdk-v2 = "2.18.9" +graal-sdk = "24.0.0" +jna = "5.11.0" +jnr-unixsocket = "0.38.17" +netty-bom = "4.1.87.Final" +project-reactor-bom = "2022.0.0" +reactive-streams = "1.0.4" +snappy = "1.1.10.3" +zstd = "1.5.5-3" + +kotlin = "1.8.10" +kotlinx-coroutines-bom = "1.6.4" +kotlinx-datetime = "0.4.0" +kotlinx-serialization = "1.5.0" + +scala = "%scala-version%" # Handled by the scala multiversion plugin + +# Test +assertj = "3.24.2" +aws-lambda-core = "1.2.2" +aws-lambda-events = "3.11.1" +cglib = "2.2.2" +classgraph = "4.8.154" +findbugs-jsr = "1.3.9" +groovy = "3.0.9" +hamcrest = "1.3" +junit-bom = "5.10.2" +logback = "1.3.14" +mockito = "5.11.0" +mockito-java8 = "4.6.1" +mockito-kotlin = "4.1.0" +objenesis = "1.3" +reflections = "0.9.10" +scalatest = "3.2.9" +scalatest-plus = "3.2.10.0" +slf4j = "1.7.6" +spock-bom = "2.1-groovy-3.0" + +# Plugins +plugin-bnd = "5.1.2" +plugin-build-config = "3.0.3" +plugin-detekt = "1.21.0" +plugin-dokka = "1.8.10" +plugin-download = "5.6.0" +plugin-graalvm = "0.9.23" +plugin-optional-base = "7.0.0" +plugin-scala-multiversion = "2.0.4" +plugin-shadow = "6.1.0" +plugin-spotbugs = "6.0.15" +plugin-spotless = "6.14.0" +plugin-test-logger = "2.1.0" + +[libraries] +aws-java-sdk-v1-core = { module = "com.amazonaws:aws-java-sdk-core", version.ref = "aws-sdk-v1" } +aws-java-sdk-v1-sts = { module = "com.amazonaws:aws-java-sdk-sts", version.ref = "aws-sdk-v1" } +aws-java-sdk-v2-auth = { module = "software.amazon.awssdk:auth", version.ref = "aws-sdk-v2" } +aws-java-sdk-v2-sts = { module = "software.amazon.awssdk:sts", version.ref = "aws-sdk-v2" } + +jna = { module = "net.java.dev.jna:jna", version.ref = "jna" } +jnr-unixsocket = { module = "com.github.jnr:jnr-unixsocket", version.ref = "jnr-unixsocket" } + +netty-bom = { module = "io.netty:netty-bom", version.ref = "netty-bom" } +netty-buffer = { module = "io.netty:netty-buffer" } +netty-handler = { module = "io.netty:netty-handler" } +netty-transport = { module = "io.netty:netty-transport" } + +project-reactor-bom = { module = "io.projectreactor:reactor-bom", version.ref = "project-reactor-bom" } +project-reactor-core = { module = "io.projectreactor:reactor-core" } +reactive-streams = { module = " org.reactivestreams:reactive-streams", version.ref = "reactive-streams" } + +slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } +snappy-java = { module = "org.xerial.snappy:snappy-java", version.ref = "snappy" } +zstd-jni = { module = "com.github.luben:zstd-jni", version.ref = "zstd" } + +graal-sdk = { module = "org.graalvm.sdk:graal-sdk", version.ref = "graal-sdk" } +graal-sdk-native = { module = "org.graalvm.sdk:native", version.ref = "graal-sdk" } + +kotlin-bom = { module = "org.jetbrains.kotlin:kotlin-bom" } +kotlin-stdlib-jdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8" } +kotlinx-coroutines-bom = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-bom", version.ref = "kotlinx-coroutines-bom" } +kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core" } +kotlinx-coroutines-reactive = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-reactive" } +kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect" } +kotlinx-serialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-bom", version.ref = "kotlinx-serialization" } +kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core" } +kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json" } +kotlinx-serialization-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx-datetime" } + +scala-library = {module = "org.scala-lang:scala-library", version.ref = "scala" } +scala-reflect = {module = "org.scala-lang:scala-reflect", version.ref = "scala" } + +# Test +junit-bom = { module = "org.junit:junit-bom", version.ref = "junit-bom" } +junit-jupiter = { module = "org.junit.jupiter:junit-jupiter" } +junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params" } +junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine" } +junit-vintage-engine = { module = "org.junit.vintage:junit-vintage-engine" } +junit-kotlin = { module = "org.jetbrains.kotlin:kotlin-test-junit" } + +spock-bom = { module = "org.spockframework:spock-bom", version.ref = "spock-bom" } +spock-core = { module = "org.spockframework:spock-core" } +spock-junit4 = { module = "org.spockframework:spock-junit4" } + +mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockito" } +mockito-junit-jupiter = { module = "org.mockito:mockito-junit-jupiter", version.ref = "mockito" } +mockito-junit-jupiter-java8 = { module = "org.mockito:mockito-junit-jupiter", version.ref = "mockito-java8" } +mockito-core-java8 = { module = "org.mockito:mockito-core", version.ref = "mockito-java8" } +mockito-inline-java8 = { module = "org.mockito:mockito-inline", version.ref = "mockito-java8" } +mockito-kotlin = { module = "org.mockito.kotlin:mockito-kotlin", version.ref = "mockito-kotlin" } + +scalatest-flatspec = { module = "org.scalatest:scalatest-flatspec_%%", version.ref = "scalatest" } +scalatest-should-matchers = { module = "org.scalatest:scalatest-shouldmatchers_%%", version.ref = "scalatest" } +scalatest-plus-junit4 = { module = "org.scalatestplus:junit-4-13_%%", version.ref = "scalatest-plus" } +scalatest-plus-mockito = { module = "org.scalatestplus:mockito-3-12_%%", version.ref = "scalatest-plus" } + +kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test" } + +assertj = { module = "org.assertj:assertj-core", version.ref = "assertj" } +aws-lambda-core = { module = " com.amazonaws:aws-lambda-java-core", version.ref = "aws-lambda-core" } +aws-lambda-events = { module = " com.amazonaws:aws-lambda-java-events", version.ref = "aws-lambda-events" } +cglib = { module = "cglib:cglib-nodep", version.ref = "cglib" } +classgraph = { module = "io.github.classgraph:classgraph", version.ref = "classgraph" } +findbugs-jsr = { module = "com.google.code.findbugs:jsr305", version.ref = "findbugs-jsr" } +groovy = { module = "org.codehaus.groovy:groovy-all", version.ref = "groovy" } +hamcrest-all = { module = "org.hamcrest:hamcrest-all", version.ref = "hamcrest" } +logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logback" } +netty-boringssl = { module = "io.netty:netty-tcnative-boringssl-static" } +objenesis = { module = "org.objenesis:objenesis", version.ref = "objenesis" } +project-reactor-test = { module = "io.projectreactor:reactor-test" } +reactive-streams-tck = { module = " org.reactivestreams:reactive-streams-tck", version.ref = "reactive-streams" } +reflections = { module = "org.reflections:reflections", version.ref = "reflections" } + +[bundles] +aws-java-sdk-v1 = ["aws-java-sdk-v1-core", "aws-java-sdk-v1-sts"] +aws-java-sdk-v2 = ["aws-java-sdk-v2-auth", "aws-java-sdk-v2-sts"] +netty = ["netty-buffer", "netty-handler", "netty-transport"] + +# Test +junit = ["junit-jupiter", "junit-jupiter-params", "junit-jupiter-engine", "junit-jupiter", "logback-classic", "hamcrest-all"] +junit-vintage = ["junit-vintage-engine", "junit-jupiter-params", "junit-jupiter-engine", "junit-jupiter", "logback-classic", "hamcrest-all"] +scalatest = ["scalatest-flatspec", "scalatest-should-matchers", "scalatest-plus-junit4", "scalatest-plus-mockito"] +spock = ["spock-core", "spock-junit4"] + +mockito = ["mockito-junit-jupiter", "mockito-core"] +mockito-java8 = ["mockito-junit-jupiter-java8", "mockito-core-java8", "mockito-inline-java8"] +mockito-kotlin = ["mockito-kotlin", "mockito-junit-jupiter-java8"] + +[plugins] +bnd = { id = "biz.aQute.bnd", version.ref = "plugin-bnd" } +build-config = { id = "com.github.gmazzo.buildconfig", version.ref = "plugin-build-config" } +detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "plugin-detekt" } +dokka = { id = "org.jetbrains.dokka", version.ref = "plugin-dokka" } +download = { id = "de.undercouch.download", version.ref = "plugin-download" } +graalvm-buildtools = { id = "org.graalvm.buildtools.native", version.ref = "plugin-graalvm" } +kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } +optional = { id = "nebula.optional-base", version.ref = "plugin-optional-base" } +scala-multiversion = { id = "com.adtran.scala-multiversion-plugin", version.ref = "plugin-scala-multiversion" } +shadow = { id = "com.github.johnrengelman.shadow", version.ref = "plugin-shadow" } +spotbugs = { id = "com.github.spotbugs", version.ref = "plugin-spotbugs" } +spotless = { id = "com.diffplug.spotless", version.ref = "plugin-spotless" } +test-logger = { id = "com.adarshr.test-logger", version.ref = "plugin-test-logger" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e750102e092..3994438e229 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 4f906e0c811..1b6c787337f 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/mongodb-crypt/build.gradle.kts b/mongodb-crypt/build.gradle.kts index 6c07a315185..405d16a9e79 100644 --- a/mongodb-crypt/build.gradle.kts +++ b/mongodb-crypt/build.gradle.kts @@ -17,19 +17,8 @@ import de.undercouch.gradle.tasks.download.Download -buildscript { - repositories { - mavenCentral() - google() - } - dependencies { - "classpath"(group = "net.java.dev.jna", name = "jna", version = "5.11.0") - } -} - plugins { - // Needed to download libmongocrypt from s3. - id("de.undercouch.download") version "5.6.0" + alias(libs.plugins.download) } group = "org.mongodb" @@ -44,10 +33,10 @@ java { dependencies { api(project(path = ":bson", configuration = "default")) - api("net.java.dev.jna:jna:5.11.0") + api(libs.jna) // Tests - testImplementation("org.junit.jupiter:junit-jupiter") + testImplementation(libs.bundles.junit) } /*