diff --git a/build.gradle b/build.gradle index f48dc7f1f8..3ca197c8df 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,5 @@ -apply plugin: 'java' -apply plugin: "application" -apply plugin: 'kotlin' -apply plugin: 'kotlinx-serialization' +project.version = "0.8" +project.group = "com.github.insanusmokrassar" buildscript { repositories { @@ -13,9 +11,16 @@ buildscript { 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" } } +apply plugin: 'java-library' +apply plugin: 'kotlin' +apply plugin: 'kotlinx-serialization' + +apply from: "publish.gradle" + repositories { mavenLocal() jcenter() @@ -35,6 +40,3 @@ dependencies { // Use JUnit test framework testImplementation 'junit:junit:4.12' } - -mainClassName = "com.github.insanusmokrassar.TelegramBotAPI.IndexKt" - diff --git a/gradle.properties b/gradle.properties index 196d42ab4d..dc6da056e3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,3 +4,5 @@ kotlin_coroutines_version=1.1.0 kotlin_serialisation_runtime_version=0.9.1 joda_time_version=2.10.1 ktor_version=1.0.1 + +gradle_bintray_plugin_version=1.8.4 diff --git a/maven.publish.gradle b/maven.publish.gradle new file mode 100644 index 0000000000..93b7e35552 --- /dev/null +++ b/maven.publish.gradle @@ -0,0 +1,58 @@ +apply plugin: 'maven-publish' +apply plugin: 'signing' + +def pomConfig = { + licenses { + license { + name "The Apache Software License, Version 2.0" + url "http://www.apache.org/licenses/LICENSE-2.0.txt" + distribution "repo" + } + } + developers { + developer { + name "Ovsiannikov Aleksei" + email "ovsyannikov.alexey95@gmail.com" + } + } + + scm { + url "https://github.com/InsanusMokrassar/${project.name}" + } +} + +task sourcesJar(type: Jar) { + from sourceSets.main.allSource + classifier = 'sources' +} + +task javadocJar(type: Jar) { + from javadoc + classifier = 'javadoc' +} + +publishing { + publications { + maven(MavenPublication) { + from components.java + groupId "${project.group}" + artifactId "${project.name}" + version "${project.version}" + + artifact sourcesJar + artifact javadocJar + + pom.withXml { + def root = asNode() + root.appendNode('description', 'It is one more project which wish to be useful and full Telegram Bots API bridge for Kotlin') + root.appendNode('name', 'Telegram Bot API') + root.children().last() + pomConfig + } + } + } +} + +signing { + useGpgCmd() + sign publishing.publications.maven +} diff --git a/publish.gradle b/publish.gradle new file mode 100644 index 0000000000..6e8de12578 --- /dev/null +++ b/publish.gradle @@ -0,0 +1,33 @@ +apply plugin: 'com.jfrog.bintray' + +ext { + projectBintrayDir = "${project.group}/".replace(".", "/") + "${project.name}/${project.version}" +} + +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') + publications = ["maven"] + filesSpec { + into "$projectBintrayDir" + from("build/libs") { + include "**/*.asc" + } + from("build/publications/maven") { + rename 'pom-default.xml(.*)', "${project.name}-${project.version}.pom\$1" + } + } + pkg { + repo = 'StandardRepository' + name = "${project.name}" + vcsUrl = "https://github.com/InsanusMokrassar/${project.name}" + licenses = ['Apache-2.0'] + version { + name = "${project.version}" + released = new Date() + vcsTag = name + } + } +} + +apply from: "maven.publish.gradle"