Skip to content

Upgrade kotlin #7

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
ext {
kotlin_version = '1.2.41'
protobufPluginVersion = '0.8.4'
protocVersion = '3.5.1'
kotlin_version = '1.3.72'
protobufPluginVersion = '0.8.17'
protocVersion = '3.6.1'

kotlinPlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
prtobufPlugin = "com.google.protobuf:protobuf-gradle-plugin:$protobufPluginVersion"
protobufPlugin = "com.google.protobuf:protobuf-gradle-plugin:$protobufPluginVersion"
junitPlugin = 'org.junit.platform:junit-platform-gradle-plugin:1.1.0'


Expand Down
172 changes: 119 additions & 53 deletions gradle/gradle-mvn-push.gradle
Original file line number Diff line number Diff line change
@@ -1,82 +1,148 @@
apply plugin: 'maven'
/*
* Copyright 2013 Chris Banes
*
* 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.
*/

apply plugin: 'maven-publish'
apply plugin: 'signing'

version = VERSION_NAME
group = GROUP

def isReleaseBuild() {
return VERSION_NAME.contains("SNAPSHOT") == false
}

def getReleaseRepositoryUrl() {
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
}

def getSnapshotRepositoryUrl() {
return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
: "https://oss.sonatype.org/content/repositories/snapshots/"
}

def getRepositoryUsername() {
return hasProperty('ossrhUsername') ? ossrhUsername : ""
return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
}

def getRepositoryPassword() {
return hasProperty('ossrhPassword') ? ossrhPassword : ""
return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
}

afterEvaluate { project ->
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
def configurePom(pom) {
pom.name = POM_NAME
pom.packaging = POM_PACKAGING
pom.description = POM_DESCRIPTION
pom.url = POM_URL

pom.groupId = GROUP
pom.artifactId = POM_ARTIFACT_ID
pom.version = VERSION_NAME
pom.scm {
url = POM_SCM_URL
connection = POM_SCM_CONNECTION
developerConnection = POM_SCM_DEV_CONNECTION
}

repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}
pom.licenses {
license {
name = POM_LICENCE_NAME
url = POM_LICENCE_URL
distribution = POM_LICENCE_DIST
}
}

pom.developers {
developer {
id = POM_DEVELOPER_ID
name = POM_DEVELOPER_NAME
}
}
}

afterEvaluate { project ->
publishing {
repositories {
maven {
def releasesRepoUrl = getReleaseRepositoryUrl()
def snapshotsRepoUrl = getSnapshotRepositoryUrl()
url = isReleaseBuild() ? releasesRepoUrl : snapshotsRepoUrl

pom.project {
name POM_NAME
packaging POM_PACKAGING
description POM_DESCRIPTION
url POM_URL

scm {
url POM_SCM_URL
connection POM_SCM_CONNECTION
developerConnection POM_SCM_DEV_CONNECTION
}

licenses {
license {
name POM_LICENCE_NAME
url POM_LICENCE_URL
distribution POM_LICENCE_DIST
}
}

developers {
developer {
id POM_DEVELOPER_ID
name POM_DEVELOPER_NAME
}
}
credentials(PasswordCredentials) {
username = getRepositoryUsername()
password = getRepositoryPassword()
}
}
}
}

signing {
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
if (project.getPlugins().hasPlugin('com.android.application') ||
project.getPlugins().hasPlugin('com.android.library')) {

task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.source
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
excludes = ['**/*.kt']
}

task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
classifier = 'javadoc'
from androidJavadocs.destinationDir
}

task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.source
}
}

task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}

task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
if (JavaVersion.current().isJava9Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addBooleanOption('html5', true)
}
}
}

artifacts {
archives sourcesJar, javadocJar
if (project.getPlugins().hasPlugin('com.android.application') ||
project.getPlugins().hasPlugin('com.android.library')) {
archives androidSourcesJar
archives androidJavadocsJar
}
}

publishing.publications.all { publication ->
publication.groupId = GROUP
publication.version = VERSION_NAME

publication.artifact androidSourcesJar
publication.artifact androidJavadocsJar

configurePom(publication.pom)
}

signing {
publishing.publications.all { publication ->
sign publication
}
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
21 changes: 10 additions & 11 deletions kotlin-protobuf-bson-codec/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
buildscript {
ext {
kotlin_version = '1.2.41'
protobufPluginVersion = '0.8.4'
protocVersion = '3.5.1'
kotlin_version = '1.3.72'
protobufPluginVersion = '0.8.17'
protocVersion = '3.6.1'
}
repositories {
mavenCentral()
}
dependencies {
classpath rootProject.ext.kotlinPlugin
classpath rootProject.ext.prtobufPlugin
classpath rootProject.ext.protobufPlugin
classpath rootProject.ext.junitPlugin
}
}
Expand All @@ -21,14 +21,15 @@ apply plugin: 'kotlin'
apply plugin: 'com.google.protobuf'
apply plugin: 'org.junit.platform.gradle.plugin'

sourceCompatibility = 1.8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

repositories {
mavenCentral()
}

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

// protobuf
compile "com.google.protobuf:protobuf-java:$protocVersion"
Expand All @@ -38,10 +39,9 @@ dependencies {
compile 'org.mongodb:bson:3.6.3'

// KMongo
testCompile 'org.litote.kmongo:kmongo-coroutine:3.6.2'
testCompile 'io.kotlintest:kotlintest-runner-junit5:3.0.4'
testCompile "org.jetbrains.kotlinx:kotlinx-coroutines-core:0.22.3"

testCompile 'org.litote.kmongo:kmongo-coroutine:3.12.2'
testCompile 'io.kotest:kotest-runner-junit5:4.1.3'
testCompile "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.8"
}


Expand Down Expand Up @@ -72,6 +72,5 @@ compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}

kotlin.experimental.coroutines 'enable'

apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import com.mongodb.async.client.MongoCollection
import io.github.gaplotech.pb.Test.CamelCase
import io.github.gaplotech.repository.MongoPBRepository
import io.kotlintest.shouldBe
import io.kotlintest.specs.FeatureSpec
import kotlinx.coroutines.experimental.runBlocking
import io.kotest.matchers.shouldBe
import io.kotest.core.spec.style.FeatureSpec
import kotlinx.coroutines.runBlocking
import org.litote.kmongo.coroutine.findOne
import org.litote.kmongo.coroutine.getCollectionOfName
import org.litote.kmongo.coroutine.insertOne
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import com.google.protobuf.ByteString
import io.github.gaplotech.pb.Test.MyEnumV3
import io.github.gaplotech.pb.Test.MyTestV3
import io.github.gaplotech.repository.MongoPBRepository
import io.kotlintest.shouldBe
import io.kotlintest.specs.FeatureSpec
import kotlinx.coroutines.experimental.runBlocking
import io.kotest.matchers.shouldBe
import io.kotest.core.spec.style.FeatureSpec
import kotlinx.coroutines.runBlocking
import org.litote.kmongo.coroutine.findOne
import org.litote.kmongo.coroutine.getCollectionOfName
import org.litote.kmongo.coroutine.insertOne
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import com.mongodb.async.client.MongoCollection
import io.github.gaplotech.pb.Test.MyTestSpecial
import io.github.gaplotech.pb.Test.MyTestV3
import io.github.gaplotech.repository.MongoPBRepository
import io.kotlintest.shouldBe
import io.kotlintest.specs.FeatureSpec
import kotlinx.coroutines.experimental.runBlocking
import io.kotest.matchers.shouldBe
import io.kotest.core.spec.style.FeatureSpec
import kotlinx.coroutines.runBlocking
import org.litote.kmongo.coroutine.findOne
import org.litote.kmongo.coroutine.getCollectionOfName
import org.litote.kmongo.coroutine.insertOne
Expand Down
15 changes: 7 additions & 8 deletions pbmongo-async/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,23 @@ buildscript {
}
dependencies {
classpath rootProject.ext.kotlinPlugin
classpath rootProject.ext.prtobufPlugin
classpath rootProject.ext.protobufPlugin
}
}

apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'com.google.protobuf'

sourceCompatibility = 1.8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

repositories {
mavenCentral()
}

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
testCompile group: 'junit', name: 'junit', version: '4.12'

compile project(':kotlin-protobuf-bson-codec')
Expand All @@ -30,9 +31,9 @@ dependencies {
compile "com.google.protobuf:protobuf-java-util:$protocVersion"

// KMongo
testCompile 'org.litote.kmongo:kmongo-coroutine:3.6.2'
testCompile 'io.kotlintest:kotlintest-runner-junit5:3.0.4'
testCompile "org.jetbrains.kotlinx:kotlinx-coroutines-core:0.22.3"
testCompile 'org.litote.kmongo:kmongo-coroutine:3.12.2'
testCompile 'io.kotest:kotest-runner-junit5-jvm:4.1.3'
testCompile 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.8'
}

compileKotlin {
Expand All @@ -57,6 +58,4 @@ protobuf {
}
}

kotlin.experimental.coroutines 'enable'

apply from: rootProject.file('gradle/gradle-mvn-push.gradle')