From dbacfbe841b1fd9b5bc8bbef1628134b9925cd6b Mon Sep 17 00:00:00 2001 From: AlmazKo Date: Wed, 20 May 2020 00:24:08 +0300 Subject: [PATCH] ci: setup bintray publishing --- build.gradle.kts | 86 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 85 insertions(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 0e3d621..45c0a11 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,14 +1,18 @@ +import java.util.* + plugins { java jacoco `maven-publish` + id("com.jfrog.bintray") version "1.8.5" } group = "almazko" -version = "1.0-SNAPSHOT" +version = "0.2" repositories { mavenCentral() + jcenter() } java { @@ -64,5 +68,85 @@ dependencies { } +val sourcesJar by tasks.creating(Jar::class) { + archiveClassifier.set("sources") + from(sourceSets.getByName("main").allSource) +} + + +val artifactName = project.name +val artifactGroup = project.group.toString() +val artifactVersion = project.version.toString() +val baseUrl = "https://github.com/AlmazKo/microjson" +val pomUrl = baseUrl +val pomScmUrl = baseUrl +val pomIssueUrl = "$baseUrl/issues" +val pomDesc = baseUrl +val githubRepo = "AlmazKo/microjson" +val githubReadme = "README.md" +val pomLicenseName = "MIT" +val pomLicenseUrl = "https://opensource.org/licenses/mit-license.php" +val pomLicenseDist = "repo" +val pomDeveloperId = "AlmazKo" +val pomDeveloperName = "Alex Suslov" +publishing { + publications { + create("microjson") { + groupId = artifactGroup + artifactId = artifactName + version = artifactVersion + from(components["java"]) + artifact(sourcesJar) + pom.withXml { + asNode().apply { + appendNode("description", pomDesc) + appendNode("name", rootProject.name) + appendNode("url", pomUrl) + appendNode("licenses").appendNode("license").apply { + appendNode("name", pomLicenseName) + appendNode("url", pomLicenseUrl) + appendNode("distribution", pomLicenseDist) + } + appendNode("developers").appendNode("developer").apply { + appendNode("id", pomDeveloperId) + appendNode("name", pomDeveloperName) + } + appendNode("scm").apply { + appendNode("url", pomScmUrl) + } + } + } + } + } +} + + +bintray { + user = project.findProperty("bintrayUser").toString() + key = project.findProperty("bintrayKey").toString() + publish = true + setPublications("microjson") + pkg.apply { + repo = "microjson" + name = artifactName + userOrg = "almazko" + githubRepo = githubRepo + vcsUrl = pomScmUrl + description = "JSON tiny library written in modern Java" + setLabels("json-parser") + setLicenses("MIT") + desc = description + websiteUrl = pomUrl + issueTrackerUrl = pomIssueUrl + githubReleaseNotesFile = githubReadme + + version.apply { + name = artifactVersion + desc = pomDesc + released = Date().toString() + vcsTag = artifactVersion + } + } +}