diff --git a/TelegramBotAPI-extensions-api/.gitignore b/TelegramBotAPI-extensions-api/.gitignore new file mode 100644 index 0000000000..2eea525d88 --- /dev/null +++ b/TelegramBotAPI-extensions-api/.gitignore @@ -0,0 +1 @@ +.env \ No newline at end of file diff --git a/TelegramBotAPI-extensions-api/build.gradle b/TelegramBotAPI-extensions-api/build.gradle new file mode 100644 index 0000000000..df8c3f07bd --- /dev/null +++ b/TelegramBotAPI-extensions-api/build.gradle @@ -0,0 +1,48 @@ +buildscript { + repositories { + mavenLocal() + jcenter() + mavenCentral() + } + + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" + classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$gradle_bintray_plugin_version" + } +} + +plugins { + id "org.jetbrains.kotlin.multiplatform" version "$kotlin_version" + id "org.jetbrains.kotlin.plugin.serialization" version "$kotlin_version" +} + +project.version = "$library_version" +project.group = "com.github.insanusmokrassar" + +apply from: "publish.gradle" + +repositories { + mavenLocal() + jcenter() + mavenCentral() + maven { url "https://kotlin.bintray.com/kotlinx" } +} + +kotlin { + jvm() + js() + + sourceSets { + commonMain { + dependencies { + implementation kotlin('stdlib') + if (project.hasProperty('DEV_MODE') && project.property('DEV_MODE') == "true") { + project (":TelegramBotAPI") + } else { + api "${project.group}:TelegramBotAPI:$library_version" + } + } + } + } +} diff --git a/TelegramBotAPI-extensions-api/maven.publish.gradle b/TelegramBotAPI-extensions-api/maven.publish.gradle new file mode 100644 index 0000000000..8fc16d04e8 --- /dev/null +++ b/TelegramBotAPI-extensions-api/maven.publish.gradle @@ -0,0 +1,57 @@ +apply plugin: 'maven-publish' + +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 "API extensions which provide work with RequestsExecutor of TelegramBotAPI almost like it is described in original Telegram Bot API reference" + name "Telegram Bot API Extensions for API" + url "https://insanusmokrassar.github.io/TelegramBotAPI" + + scm { + developerConnection "scm:git:[fetch=]https://github.com/insanusmokrassar/TelegramBotAPI.git[push=]https://github.com/insanusmokrassar/TelegramBotAPI.git" + url "https://github.com/insanusmokrassar/TelegramBotAPI.git" + } + + developers { + + developer { + id "InsanusMokrassar" + name "Ovsiannikov Aleksei" + email "ovsyannikov.alexey95@gmail.com" + } + + } + + licenses { + + license { + name "Apache Software License 2.0" + url "https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE" + } + + } + } + } + } +} \ No newline at end of file diff --git a/TelegramBotAPI-extensions-api/mpp_publish_template.json b/TelegramBotAPI-extensions-api/mpp_publish_template.json new file mode 100644 index 0000000000..7558d0e4c0 --- /dev/null +++ b/TelegramBotAPI-extensions-api/mpp_publish_template.json @@ -0,0 +1 @@ +{"bintrayConfig":{"repo":"StandardRepository","packageName":"${project.name}","packageVcs":"https://github.com/InsanusMokrassar/TelegramBotAPI"},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"Telegram Bot API Extensions for API","description":"API extensions which provide work with RequestsExecutor of TelegramBotAPI almost like it is described in original Telegram Bot API reference","url":"https://insanusmokrassar.github.io/TelegramBotAPI","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}]},"type":"Multiplatform"} \ No newline at end of file diff --git a/TelegramBotAPI-extensions-api/publish.gradle b/TelegramBotAPI-extensions-api/publish.gradle new file mode 100644 index 0000000000..2fd72b3b1a --- /dev/null +++ b/TelegramBotAPI-extensions-api/publish.gradle @@ -0,0 +1,55 @@ +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') + filesSpec { + from "${buildDir}/publications/" + eachFile { + String directorySubname = it.getFile().parentFile.name + if (it.getName() == "module.json") { + if (directorySubname == "kotlinMultiplatform") { + it.setPath("${project.name}/${project.version}/${project.name}-${project.version}.module") + } else { + it.setPath("${project.name}-${directorySubname}/${project.version}/${project.name}-${directorySubname}-${project.version}.module") + } + } else { + if (directorySubname == "kotlinMultiplatform" && it.getName() == "pom-default.xml") { + it.setPath("${project.name}/${project.version}/${project.name}-${project.version}.pom") + } else { + it.exclude() + } + } + } + into "${project.group}".replace(".", "/") + } + pkg { + repo = "StandardRepository" + name = "${project.name}" + vcsUrl = "https://github.com/InsanusMokrassar/TelegramBotAPI" + licenses = ["Apache-2.0"] + version { + name = "${project.version}" + released = new Date() + vcsTag = "${project.version}" + gpg { + sign = true + passphrase = project.hasProperty('signing.gnupg.passphrase') ? project.property('signing.gnupg.passphrase') : System.getenv('signing.gnupg.passphrase') + } + } + } +} + +bintrayUpload.doFirst { + publications = publishing.publications.collect { + if (it.name.contains('kotlinMultiplatform')) { + null + } else { + it.name + } + } - null +} + +bintrayUpload.dependsOn publishToMavenLocal \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 92ee4e80c8..251b72d9fc 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,2 @@ include ":TelegramBotAPI" +include ":TelegramBotAPI-extensions-api"