Skip to content
Closed
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
24 changes: 24 additions & 0 deletions .evergreen/.evg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,16 @@ functions:
${PREPARE_SHELL}
SCALA="${SCALA}" AUTH="${AUTH}" SSL="${SSL}" MONGODB_URI="${MONGODB_URI}" SAFE_FOR_MULTI_MONGOS="${SAFE_FOR_MULTI_MONGOS}" TOPOLOGY="${TOPOLOGY}" JAVA_VERSION="${JAVA_VERSION}" .evergreen/run-scala-tests.sh

"run kotlin tests":
- command: shell.exec
type: test
params:
working_dir: "src"
script: |
${PREPARE_SHELL}
AUTH="${AUTH}" SSL="${SSL}" MONGODB_URI="${MONGODB_URI}" SAFE_FOR_MULTI_MONGOS="${SAFE_FOR_MULTI_MONGOS}" TOPOLOGY="${TOPOLOGY}" JAVA_VERSION="${JAVA_VERSION}" .evergreen/run-kotlin-tests.sh


"run socket tests":
- command: shell.exec
type: test
Expand Down Expand Up @@ -904,6 +914,11 @@ tasks:
- func: "bootstrap mongo-orchestration"
- func: "run scala tests"

- name: "kotlin-tests"
commands:
- func: "bootstrap mongo-orchestration"
- func: "run kotlin tests"

- name: "reactive-streams-tck-test"
commands:
- func: "bootstrap mongo-orchestration"
Expand Down Expand Up @@ -1437,6 +1452,8 @@ tasks:
name: "plain-auth-test"
- variant: ".test-scala-variant"
name: "scala-tests"
- variant: ".test-kotlin-variant"
name: "kotlin-tests"
- variant: ".tests-netty-variant"
name: "netty-test"
commands:
Expand Down Expand Up @@ -2052,6 +2069,13 @@ buildvariants:
tasks:
- name: "scala-tests"

- matrix_name: "kotlin-tests"
matrix_spec: { auth: "noauth", ssl: "nossl", jdk: ["jdk8", "jdk17"], version: ["6.0"], topology: "replicaset", os: "ubuntu" }
display_name: "Kotlin: ${jdk} ${version} ${topology} ${os}"
tags: ["test-kotlin-variant"]
tasks:
- name: "kotlin-tests"

- name: publish-snapshot
display_name: "Publish Snapshot"
run_on: ubuntu1804-test
Expand Down
37 changes: 37 additions & 0 deletions .evergreen/run-kotlin-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

set -o xtrace # Write all commands first to stderr
set -o errexit # Exit the script with error if any of the commands fail


AUTH=${AUTH:-noauth}
SSL=${SSL:-nossl}
MONGODB_URI=${MONGODB_URI:-}
TOPOLOGY=${TOPOLOGY:-standalone}
SAFE_FOR_MULTI_MONGOS=${SAFE_FOR_MULTI_MONGOS:-}

############################################
# Main Program #
############################################
RELATIVE_DIR_PATH="$(dirname "${BASH_SOURCE:-$0}")"
. "${RELATIVE_DIR_PATH}/javaConfig.bash"


if [ "$SSL" != "nossl" ]; then
echo -e "\nSSL support not configured for Kotlin tests"
exit 1
fi

if [ "$AUTH" != "noauth" ]; then
echo -e "\nAuth support not configured for Kotlin tests"
exit 1
fi

if [ "$SAFE_FOR_MULTI_MONGOS" == "true" ]; then
export MULTI_MONGOS_URI_SYSTEM_PROPERTY="-Dorg.mongodb.test.multi.mongos.uri=${MONGODB_URI}"
fi

echo "Running Kotlin tests"

./gradlew -version
./gradlew kCheck -Dorg.mongodb.test.uri=${MONGODB_URI} ${MULTI_MONGOS_URI_SYSTEM_PROPERTY}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ local.properties
.java-version

# mongocryptd
**/mongocryptd.pid
**/mongocryptd*.pid

# shell scripts
*.sh
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,24 @@ Release notes are available [here](https://github.com/mongodb/mongo-java-driver/

Reference and API documentation is available [here](http://mongodb.github.io/mongo-java-driver/).

## Tutorials / Training

For tutorials on how to use the MongoDB Java Driver, please reference MongoDB University's Java offerings [here](https://learn.mongodb.com/catalog?labels=%5B%22Language%22%5D&values=%5B%22Java%22%5D). Additional tutorials, videos, and code examples using the Java Driver can also be found in the [MongoDB Developer Center](https://www.mongodb.com/developer/languages/java/).

## Support / Feedback

For issues with, questions about, or feedback for the MongoDB Java driver, please look into
our [support channels](https://www.mongodb.com/docs/manual/support/). Please
do not email any of the Java driver developers directly with issues or
questions - you're more likely to get an answer on the [MongoDB Community Forums](https://community.mongodb.com/tags/c/drivers-odms-connectors/7/java-driver).
questions - you're more likely to get an answer on the [MongoDB Community Forums](https://community.mongodb.com/tags/c/drivers-odms-connectors/7/java-driver) or [StackOverflow](https://stackoverflow.com/questions/tagged/mongodb+java).

At a minimum, please include in your description the exact version of the driver that you are using. If you are having
connectivity issues, it's often also useful to paste in the line of code where you construct the MongoClient instance,
along with the values of all parameters that you pass to the constructor. You should also check your application logs for
any connectivity-related exceptions and post those as well.



## Bugs / Feature Requests

Think you’ve found a bug? Want to see a new feature in the Java driver? Please open a
Expand Down
145 changes: 145 additions & 0 deletions bson-kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
/*
* 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.
*/
import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("org.jetbrains.kotlin.jvm") version "1.8.10"
`java-library`

// Test based plugins
id("com.diffplug.spotless")
id("org.jetbrains.dokka") version "1.7.20"
id("io.gitlab.arturbosch.detekt") version "1.21.0"
}

repositories {
mavenCentral()
google()
}

base.archivesName.set("bson-kotlin")

description = "Bson Kotlin Codecs"

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")

api(project(path = ":bson", configuration = "default"))
implementation("org.jetbrains.kotlin:kotlin-reflect")

testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
testImplementation(project(path = ":driver-core", configuration = "default"))
}

kotlin { explicitApi() }

tasks.withType<KotlinCompile> { kotlinOptions.jvmTarget = "1.8" }

// ===========================
// Code Quality checks
// ===========================
spotless {
kotlinGradle {
ktfmt("0.39").dropboxStyle().configure { it.setMaxWidth(120) }
trimTrailingWhitespace()
indentWithSpaces()
endWithNewline()
licenseHeaderFile(rootProject.file("config/mongodb.license"), "(group|plugins|import|buildscript|rootProject)")
}

kotlin {
target("**/*.kt")
ktfmt().dropboxStyle().configure { it.setMaxWidth(120) }
trimTrailingWhitespace()
indentWithSpaces()
endWithNewline()
licenseHeaderFile(rootProject.file("config/mongodb.license"))
}

format("extraneous") {
target("*.xml", "*.yml", "*.md")
trimTrailingWhitespace()
indentWithSpaces()
endWithNewline()
}
}

tasks.named("check") { dependsOn("spotlessApply") }

detekt {
allRules = true // fail build on any finding
buildUponDefaultConfig = true // preconfigure defaults
config = rootProject.files("config/detekt/detekt.yml") // point to your custom config defining rules to run,
// overwriting default behavior
baseline = rootProject.file("config/detekt/baseline.xml") // a way of suppressing issues before introducing detekt
source =
files(
file("src/main/kotlin"),
file("src/test/kotlin"),
file("src/integrationTest/kotlin"),
)
}

tasks.withType<Detekt>().configureEach {
reports {
html.required.set(true) // observe findings in your browser with structure and code snippets
xml.required.set(true) // checkstyle like format mainly for integrations like Jenkins
txt.required.set(false) // similar to the console output, contains issue signature to manually edit
}
}

spotbugs { showProgress.set(true) }

// ===========================
// Test Configuration
// ===========================
tasks.create("kCheck") {
description = "Runs all the kotlin checks"
group = "verification"

dependsOn("clean", "check")
tasks.findByName("check")?.mustRunAfter("clean")
}

tasks.test { useJUnitPlatform() }

// ===========================
// Dokka Configuration
// ===========================
val dokkaOutputDir = "${rootProject.buildDir}/docs/${base.archivesName.get()}"

tasks.dokkaHtml.configure {
outputDirectory.set(file(dokkaOutputDir))
moduleName.set(base.archivesName.get())
}

val cleanDokka by tasks.register<Delete>("cleanDokka") { delete(dokkaOutputDir) }

project.parent?.tasks?.named("docs") {
dependsOn(tasks.dokkaHtml)
mustRunAfter(cleanDokka)
}

tasks.javadocJar.configure {
dependsOn(cleanDokka, tasks.dokkaHtml)
archiveClassifier.set("javadoc")
from(dokkaOutputDir)
}
Loading