diff --git a/build.gradle b/build.gradle index 49597f8..c80fff4 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,3 @@ - buildscript { repositories { mavenLocal() @@ -21,6 +20,8 @@ plugins { project.version = "$project_public_version" project.group = "$project_public_group" +apply from: "publish.gradle" + repositories { mavenLocal() jcenter() @@ -35,8 +36,7 @@ kotlin { commonMain { dependencies { implementation kotlin('stdlib') - implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - api "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$kotlin_coroutines_version" + api "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" api "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$kotlin_serialisation_runtime_version" } } @@ -49,7 +49,6 @@ kotlin { jvmMain { dependencies { implementation kotlin('stdlib-jdk8') - api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version" api "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$kotlin_serialisation_runtime_version" } } @@ -60,4 +59,3 @@ kotlin { } } } - diff --git a/gradle.properties b/gradle.properties index cc0e78d..2cbf820 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,13 +1,22 @@ kotlin.code.style=official kotlin_version=1.3.60 -kotlin_coroutines_version=1.3.2 kotlin_serialisation_runtime_version=0.14.0 gradle_bintray_plugin_version=1.8.4 -test_sqlite_version=3.28.0 -test_junit_version=5.5.2 - project_public_version=0.1.0 project_public_group=com.insanusmokrassar project_public_description=Simple DI library + +project_public_name=PostsSystemCore + +project_public_license_name=Apache-2.0 +project_public_license_fullname=The Apache Software License, Version 2.0 +project_public_license_url=https://git.insanusmokrassar.com/InsanusMokrassar/SDI/src/master/LICENSE + +project_bintray_repo=InsanusMokrassar + +project_url=https://git.insanusmokrassar.com/InsanusMokrassar/SDI +project_vcs=https://git.insanusmokrassar.com/InsanusMokrassar/SDI.git + +kotlin.incremental.multiplatform=true diff --git a/maven.publish.gradle b/maven.publish.gradle new file mode 100644 index 0000000..33d23a3 --- /dev/null +++ b/maven.publish.gradle @@ -0,0 +1,65 @@ +apply plugin: 'maven-publish' +apply plugin: 'signing' + +task javadocsJar(type: Jar) { + classifier = 'javadoc' +} + +afterEvaluate { + project.publishing.publications.all { + // rename artifacts + groupId "${project.group}" + if (it.name.contains('kotlinMultiplatform')) { + artifactId = "${project.name}" + } else { + artifactId = "${project.name}-$name" + } + } +} + +publishing { + publications.all { + artifact javadocsJar + + pom.withXml { + asNode().children().last() + { + resolveStrategy = Closure.DELEGATE_FIRST + + description "${project_public_description}" + name "${project_public_name}" + url "${project_url}" + + scm { + developerConnection "scm:git:[fetch=]${project_vcs}[push=]${project_vcs}" + url "${project_vcs}" + } + + developers { + developer { + id "InsanusMokrassar" + name "Ovsyannikov Alexey" + email "ovsyannikov.alexey95@gmail.com" + } + developer { + id "mi-ast" + name "Michail Astafiev" + email "astaf65@gmail.com" + } + } + + licenses { + license { + name "${project_public_license_fullname}" + url "${project_public_license_url}" + distribution "repo" + } + } + } + } + } +} + +signing { + useGpgCmd() + sign(publishing.publications) +} diff --git a/publish.gradle b/publish.gradle new file mode 100644 index 0000000..5a9be9a --- /dev/null +++ b/publish.gradle @@ -0,0 +1,27 @@ +apply plugin: 'com.jfrog.bintray' + +apply from: "maven.publish.gradle" + +bintray { + user = project.hasProperty('BINTRAY_USER') ? project.property('BINTRAY_USER') : System.getenv('BINTRAY_USER') + key = project.hasProperty('BINTRAY_KEY') ? project.property('BINTRAY_KEY') : System.getenv('BINTRAY_KEY') + pkg { + repo = "$project_bintray_repo" + name = "${project.name}" + vcsUrl = "${project_url}" + licenses = ["${project_public_license_name}"] + version { + name = "${project.version}" + released = new Date() + vcsTag = "${project.version}" + } + } +} + +bintrayUpload.doFirst { + publications = publishing.publications.collect { + it.name + } +} + +bintrayUpload.dependsOn publishToMavenLocal diff --git a/settings.gradle b/settings.gradle index 99f0987..fdeb278 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,18 +1,3 @@ -/* - * This settings file was generated by the Gradle 'init' task. - * - * The settings file is used to specify which projects to include in your build. - * In a single project build this file can be empty or even removed. - * - * Detailed information about configuring a multi-project build in Gradle can be found - * in the user guide at https://docs.gradle.org/4.4.1/userguide/multi_project_builds.html - */ - -/* -// To declare projects as part of a multi-project build use the 'include' method -include 'shared' -include 'api' -include 'services:webservice' -*/ - rootProject.name = 'sdi' + +enableFeaturePreview("GRADLE_METADATA") diff --git a/src/commonTest/kotlin/com/insanusmokrassar/sdi/DeserializationTest.kt b/src/commonTest/kotlin/com/insanusmokrassar/sdi/DeserializationTest.kt index b7edb73..51ac3f5 100644 --- a/src/commonTest/kotlin/com/insanusmokrassar/sdi/DeserializationTest.kt +++ b/src/commonTest/kotlin/com/insanusmokrassar/sdi/DeserializationTest.kt @@ -3,6 +3,7 @@ package com.insanusmokrassar.sdi import kotlinx.serialization.* import kotlinx.serialization.json.Json import kotlin.test.Test +import kotlin.test.assertTrue interface ControllerAPI { fun showUp() @@ -12,8 +13,7 @@ interface ServiceAPI { } @Serializable -class Controller(@ContextualSerialization private val service : ServiceAPI) : - ControllerAPI { +class Controller(@ContextualSerialization private val service : ServiceAPI) : ControllerAPI { override fun showUp() { println("Inited with name \"${service.name}\"") } @@ -27,7 +27,7 @@ class BusinessService : ServiceAPI { @ImplicitReflectionSerializer class DeserializationTest { @Test - fun `Test_that_simple_config_correctly_work`() { + fun test_that_simple_config_correctly_work() { val input = """ { "service": [