From f90e28d33c70beb369d04cbbcd785d9a55b61f65 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 12 Nov 2020 11:58:08 +0600 Subject: [PATCH] add publication workaround --- bot/build.gradle | 2 ++ bot/maven.publish.gradle | 54 +++++++++++++++++++++++++++++++++++++ bot/pubconf.kpsb | 1 + bot/publish.gradle | 43 +++++++++++++++++++++++++++++ build.gradle | 3 +++ gradle.properties | 3 +++ plugin/build.gradle | 2 ++ plugin/maven.publish.gradle | 54 +++++++++++++++++++++++++++++++++++++ plugin/pubconf.kpsb | 1 + plugin/publish.gradle | 43 +++++++++++++++++++++++++++++ 10 files changed, 206 insertions(+) create mode 100644 bot/maven.publish.gradle create mode 100644 bot/pubconf.kpsb create mode 100644 bot/publish.gradle create mode 100644 plugin/maven.publish.gradle create mode 100644 plugin/pubconf.kpsb create mode 100644 plugin/publish.gradle diff --git a/bot/build.gradle b/bot/build.gradle index 2549ab4..0cfd5d3 100644 --- a/bot/build.gradle +++ b/bot/build.gradle @@ -8,6 +8,8 @@ plugins { project.group="$group" project.version="$version" +apply from: "publish.gradle" + dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version" diff --git a/bot/maven.publish.gradle b/bot/maven.publish.gradle new file mode 100644 index 0000000..6e01cf9 --- /dev/null +++ b/bot/maven.publish.gradle @@ -0,0 +1,54 @@ +apply plugin: 'maven-publish' + +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 + + artifact sourcesJar + artifact javadocJar + + pom { + resolveStrategy = Closure.DELEGATE_FIRST + + description = "" + name = "PlaguBot ${project.name}" + url = "https://github.com/InsanusMokrassar/PlaguBot" + + scm { + developerConnection = "scm:git:[fetch=]ssh://git@github.com/InsanusMokrassar/PlaguBot.git[push=]ssh://git@github.com/InsanusMokrassar/PlaguBot.git" + url = "ssh://git@github.com/InsanusMokrassar/PlaguBot.git" + } + + developers { + + developer { + id = "InsanusMokrassar" + name = "Aleksei Ovsiannikov" + email = "ovsyannikov.alexey95@gmail.com" + } + + } + + licenses { + + license { + name = "Apache Software License 2.0" + url = "https://github.com/InsanusMokrassar/PlaguBot/LICENSE" + } + + } + } + } + } +} \ No newline at end of file diff --git a/bot/pubconf.kpsb b/bot/pubconf.kpsb new file mode 100644 index 0000000..4657aab --- /dev/null +++ b/bot/pubconf.kpsb @@ -0,0 +1 @@ +{"bintrayConfig":{"repo":"PlaguBot Bot","packageName":"${project.name}","packageVcs":"https://github.com/InsanusMokrassar/PlaguBot","autoPublish":true,"overridePublish":true},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/PlaguBot/LICENSE"}],"mavenConfig":{"name":"PlaguBot ${project.name}","description":"","url":"https://github.com/InsanusMokrassar/PlaguBot","vcsUrl":"ssh://git@github.com/InsanusMokrassar/PlaguBot.git","developers":[{"id":"InsanusMokrassar","name":"Aleksei Ovsiannikov","eMail":"ovsyannikov.alexey95@gmail.com"}]},"type":"JVM"} \ No newline at end of file diff --git a/bot/publish.gradle b/bot/publish.gradle new file mode 100644 index 0000000..bae30ed --- /dev/null +++ b/bot/publish.gradle @@ -0,0 +1,43 @@ +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" + } + } + + publish = true + override = true + + pkg { + repo = "PlaguBot Bot" + name = "${project.name}" + vcsUrl = "https://github.com/InsanusMokrassar/PlaguBot" + 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') + } + } + } +} + +apply from: "maven.publish.gradle" + +bintrayUpload.dependsOn publishToMavenLocal \ No newline at end of file diff --git a/build.gradle b/build.gradle index 26dd3c8..a26e938 100644 --- a/build.gradle +++ b/build.gradle @@ -1,11 +1,14 @@ buildscript { repositories { jcenter() + maven { url "https://plugins.gradle.org/m2/" } } 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" + classpath "com.github.breadmoirai:github-release:$github_release_plugin_version" } } diff --git a/gradle.properties b/gradle.properties index 7a03964..67cd148 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,5 +13,8 @@ microutils_version=0.3.2 klassindex_version=4.1.0-rc.1 sqlite_version=3.30.1 +gradle_bintray_plugin_version=1.8.5 +github_release_plugin_version=2.2.12 + group=dev.inmo version=0.0.1 diff --git a/plugin/build.gradle b/plugin/build.gradle index ea3d933..4a95f1d 100644 --- a/plugin/build.gradle +++ b/plugin/build.gradle @@ -6,6 +6,8 @@ plugins { project.group="$group" project.version="$version" +apply from: "publish.gradle" + dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlin_serialisation_runtime_version" diff --git a/plugin/maven.publish.gradle b/plugin/maven.publish.gradle new file mode 100644 index 0000000..6e01cf9 --- /dev/null +++ b/plugin/maven.publish.gradle @@ -0,0 +1,54 @@ +apply plugin: 'maven-publish' + +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 + + artifact sourcesJar + artifact javadocJar + + pom { + resolveStrategy = Closure.DELEGATE_FIRST + + description = "" + name = "PlaguBot ${project.name}" + url = "https://github.com/InsanusMokrassar/PlaguBot" + + scm { + developerConnection = "scm:git:[fetch=]ssh://git@github.com/InsanusMokrassar/PlaguBot.git[push=]ssh://git@github.com/InsanusMokrassar/PlaguBot.git" + url = "ssh://git@github.com/InsanusMokrassar/PlaguBot.git" + } + + developers { + + developer { + id = "InsanusMokrassar" + name = "Aleksei Ovsiannikov" + email = "ovsyannikov.alexey95@gmail.com" + } + + } + + licenses { + + license { + name = "Apache Software License 2.0" + url = "https://github.com/InsanusMokrassar/PlaguBot/LICENSE" + } + + } + } + } + } +} \ No newline at end of file diff --git a/plugin/pubconf.kpsb b/plugin/pubconf.kpsb new file mode 100644 index 0000000..31beb06 --- /dev/null +++ b/plugin/pubconf.kpsb @@ -0,0 +1 @@ +{"bintrayConfig":{"repo":"PlaguBot Plugin","packageName":"${project.name}","packageVcs":"https://github.com/InsanusMokrassar/PlaguBot","autoPublish":true,"overridePublish":true},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/PlaguBot/LICENSE"}],"mavenConfig":{"name":"PlaguBot ${project.name}","description":"","url":"https://github.com/InsanusMokrassar/PlaguBot","vcsUrl":"ssh://git@github.com/InsanusMokrassar/PlaguBot.git","developers":[{"id":"InsanusMokrassar","name":"Aleksei Ovsiannikov","eMail":"ovsyannikov.alexey95@gmail.com"}]},"type":"JVM"} \ No newline at end of file diff --git a/plugin/publish.gradle b/plugin/publish.gradle new file mode 100644 index 0000000..daaa88a --- /dev/null +++ b/plugin/publish.gradle @@ -0,0 +1,43 @@ +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" + } + } + + publish = true + override = true + + pkg { + repo = "PlaguBot Plugin" + name = "${project.name}" + vcsUrl = "https://github.com/InsanusMokrassar/PlaguBot" + 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') + } + } + } +} + +apply from: "maven.publish.gradle" + +bintrayUpload.dependsOn publishToMavenLocal \ No newline at end of file