Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Gradle 8 #1626

Draft
wants to merge 4 commits into
base: gradle
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,17 @@ configure(scalaProjects) {
}

configure(javaMainProjects) {
apply plugin: 'nebula.optional-base'
apply plugin: 'java-library'

java {
registerFeature('slf4Dependency') {
usingSourceSet(sourceSets.main)
}
}

dependencies {
compileOnly 'com.google.code.findbugs:jsr305:1.3.9'
api 'org.slf4j:slf4j-api:1.7.6', optional
slf4DependencyApi 'org.slf4j:slf4j-api:1.7.6'
testImplementation 'com.google.code.findbugs:jsr305:1.3.9'

// https://issues.apache.org/jira/browse/GROOVY-10194
Expand Down
80 changes: 67 additions & 13 deletions driver-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,84 @@ configurations {
}
}

task listConfigurations {
doLast {
configurations.each { config ->
println config.name
}
}
}

java {
registerFeature('bsonKotlin') {
usingSourceSet(sourceSets.main)
}
registerFeature('bsonKotlinx') {
usingSourceSet(sourceSets.main)
}
registerFeature('mongodbCrypt') {
usingSourceSet(sourceSets.main)
}
registerFeature('jnrUnixsocket') {
usingSourceSet(sourceSets.main)
}
registerFeature('nettyBuffer') {
usingSourceSet(sourceSets.main)
}
registerFeature('nettyTransport') {
usingSourceSet(sourceSets.main)
}
registerFeature('nettyHandler') {
usingSourceSet(sourceSets.main)
}
registerFeature('awssdkAuth') {
usingSourceSet(sourceSets.main)
}
registerFeature('awssdkSts') {
usingSourceSet(sourceSets.main)
}
registerFeature('awsJavaSdkCore') {
usingSourceSet(sourceSets.main)
}
registerFeature('awsJavaSdkSts') {
usingSourceSet(sourceSets.main)
}
registerFeature('snappyJava') {
usingSourceSet(sourceSets.main)
}
registerFeature('zstdJni') {
usingSourceSet(sourceSets.main)
}

}

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')
implementation project(path: ':bson-kotlin', configuration: 'default'), optional
implementation project(path: ':bson-kotlinx', configuration: 'default'), optional
implementation project(path: ':mongodb-crypt', configuration: 'default'), optional

implementation "com.github.jnr:jnr-unixsocket:$jnrUnixsocketVersion", optional
bsonKotlinImplementation project(path: ':bson-kotlin', configuration: 'default')
bsonKotlinxImplementation project(path: ':bson-kotlinx', configuration: 'default')

mongodbCryptApi project(path: ':mongodb-crypt', configuration: 'default')
jnrUnixsocketImplementation "com.github.jnr:jnr-unixsocket:$jnrUnixsocketVersion"

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
nettyBufferImplementation "io.netty:netty-buffer"
nettyTransportImplementation "io.netty:netty-transport"
nettyHandlerImplementation "io.netty:netty-handler"

compileOnly "org.graalvm.sdk:graal-sdk:$graalSdkVersion"

// 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
awssdkAuthImplementation "software.amazon.awssdk:auth:$awsSdkV2Version"
awssdkStsImplementation "software.amazon.awssdk:sts:$awsSdkV2Version"
awsJavaSdkCoreImplementation "com.amazonaws:aws-java-sdk-core:$awsSdkV1Version"
awsJavaSdkStsImplementation "com.amazonaws:aws-java-sdk-sts:$awsSdkV1Version"

implementation "org.xerial.snappy:snappy-java:$snappyVersion", optional
implementation "com.github.luben:zstd-jni:$zstdVersion", optional
snappyJavaImplementation "org.xerial.snappy:snappy-java:$snappyVersion"
zstdJniImplementation "com.github.luben:zstd-jni:$zstdVersion"

testImplementation project(':bson').sourceSets.test.output
testImplementation('org.junit.jupiter:junit-jupiter-api')
Expand Down
4 changes: 2 additions & 2 deletions driver-lambda/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ buildscript {
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:6.1.0'
classpath 'com.gradleup.shadow:shadow-gradle-plugin:8.3.5'
}
}

Expand All @@ -28,7 +28,7 @@ plugins {
}

apply plugin: 'application'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'com.gradleup.shadow'
apply plugin: 'java'

compileJava {
Expand Down
92 changes: 91 additions & 1 deletion driver-sync/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,100 @@ ext {
dependencies {
api project(path: ':bson', configuration: 'default')
api project(path: ':driver-core', configuration: 'default')
implementation("org.jetbrains:annotations:13.0") // previously brought transitively by driver-core (via bson-kotlin)

api(project(path: ':driver-core')) {
capabilities {
requireCapabilities("org.mongodb:driver-core-jnr-unixsocket")
}
}

api(project(path: ':driver-core')) {
capabilities {
requireCapabilities("org.mongodb:driver-core-bson-kotlin")
}
}

api(project(path: ':driver-core')) {
capabilities {
requireCapabilities("org.mongodb:driver-core-bson-kotlinx")
}
}

api(project(path: ':driver-core')) {
capabilities {
requireCapabilities("org.mongodb:driver-core-mongodb-crypt")
}
}

api(project(path: ':driver-core')) {
capabilities {
requireCapability("org.mongodb:driver-core-netty-buffer")
}
}

api(project(path: ':driver-core')) {
capabilities {
requireCapabilities("org.mongodb:driver-core-netty-transport")
}
}

api(project(path: ':driver-core')) {
capabilities {
requireCapabilities("org.mongodb:driver-core-netty-handler")
}
}

api(project(path: ':driver-core')) {
capabilities {
requireCapabilities("org.mongodb:driver-core-awssdk-auth")
}
}

api(project(path: ':driver-core')) {
capabilities {
requireCapabilities("org.mongodb:driver-core-awssdk-sts")
}
}

api(project(path: ':driver-core')) {
capabilities {
requireCapabilities("org.mongodb:driver-core-aws-java-sdk-core")
}
}

api(project(path: ':driver-core')) {
capabilities {
requireCapabilities("org.mongodb:driver-core-aws-java-sdk-sts")
}
}

api(project(path: ':driver-core')) {
capabilities {
requireCapabilities("org.mongodb:driver-core-snappy-java")
}
}

api(project(path: ':driver-core')) {
capabilities {
requireCapabilities("org.mongodb:driver-core-zstd-jni")
}
}







// includeLibraryWithCapabilities(":driver-core", [
// "org.mongodb:driver-core-jnr-unixsocket",
// "org.mongodb:driver-core-bson-kotlin"]
// )

testImplementation project(':bson').sourceSets.test.output
testImplementation project(':driver-core').sourceSets.test.output
testRuntimeOnly project(path: ':driver-core', configuration: 'consumableTestRuntimeOnly')
// testRuntimeOnly project(path: ':driver-core', configuration: 'consumableTestRuntimeOnly')

testImplementation('com.amazonaws:aws-lambda-java-core:1.2.1')
}
Expand Down
4 changes: 2 additions & 2 deletions driver-workload-executor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ buildscript {
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:6.1.0'
classpath 'com.gradleup.shadow:shadow-gradle-plugin:8.3.5'
}
}

apply plugin: 'application'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'com.gradleup.shadow'

mainClassName = "com.mongodb.workload.WorkloadExecutor"

Expand Down
8 changes: 4 additions & 4 deletions gradle/publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ configure(javaProjects) { project ->

task sourcesJar(type: Jar) {
from project.sourceSets.main.allJava
classifier = 'sources'
getArchiveClassifier().set('sources')
}

task javadocJar(type: Jar) {
from javadoc
classifier = 'javadoc'
getArchiveClassifier().set('javadoc')
}

publishing {
Expand Down Expand Up @@ -132,12 +132,12 @@ configure(scalaProjects) { project ->

task sourcesJar(type: Jar) {
from project.sourceSets.main.allScala
classifier = 'sources'
getArchiveClassifier().set('sources')
}

task scaladocJar(type: Jar) {
from scaladoc
classifier = 'javadoc'
getArchiveClassifier().set('javadoc')
}

publishing {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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-8.12-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists