From bf5032724f7c9d1863dee4c22658fc1ee8dffb43 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 10 Apr 2020 16:44:22 +0600 Subject: [PATCH] fixes --- postssystem.exposed/build.gradle | 2 +- postssystem.exposed/maven.publish.gradle | 81 ++++++++++++------------ postssystem.exposed/publish.gradle | 38 ++++------- 3 files changed, 52 insertions(+), 69 deletions(-) diff --git a/postssystem.exposed/build.gradle b/postssystem.exposed/build.gradle index 44e05b27..b123dcea 100644 --- a/postssystem.exposed/build.gradle +++ b/postssystem.exposed/build.gradle @@ -20,7 +20,7 @@ project.version = "$core_version" project.group = "com.insanusmokrassar" apply plugin: "java-library" -apply plugin: 'kotlin' +apply plugin: "kotlin" repositories { mavenLocal() diff --git a/postssystem.exposed/maven.publish.gradle b/postssystem.exposed/maven.publish.gradle index fe831bd3..8156d06c 100644 --- a/postssystem.exposed/maven.publish.gradle +++ b/postssystem.exposed/maven.publish.gradle @@ -1,55 +1,54 @@ apply plugin: 'maven-publish' -task javadocsJar(type: Jar) { +task sourcesJar(type: Jar) { + from sourceSets.main.allSource + classifier = 'sources' +} + +task javadocJar(type: Jar) { + from javadoc 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 + publications { + maven(MavenPublication) { + from components.java - pom.withXml { - asNode().children().last() + { - resolveStrategy = Closure.DELEGATE_FIRST + artifact sourcesJar + artifact javadocJar - description "Exposed realisation for PostsSystem Core" - name "PostsSystem Core Exposed realization" - url "https://git.insanusmokrassar.com/PostsSystem/Core/" + pom.withXml { + asNode().children().last() + { + resolveStrategy = Closure.DELEGATE_FIRST - scm { - developerConnection "scm:git:[fetch=]https://git.insanusmokrassar.com/PostsSystem/Core/.git[push=]https://git.insanusmokrassar.com/PostsSystem/Core/.git" - url "https://git.insanusmokrassar.com/PostsSystem/Core/.git" - } + description "Exposed realisation for PostsSystem Core" + name "PostsSystem Core Exposed realization" + url "https://git.insanusmokrassar.com/PostsSystem/Core/" - developers { - - developer { - id "InsanusMokrassar" - name "Ovsiannikov Aleksei" - email "ovsyannikov.alexey95@gmail.com" - } - - } + scm { + developerConnection "scm:git:[fetch=]https://git.insanusmokrassar.com/PostsSystem/Core/.git[push=]https://git.insanusmokrassar.com/PostsSystem/Core/.git" + url "https://git.insanusmokrassar.com/PostsSystem/Core/.git" + } - licenses { - - license { - name "Apache Software License 2.0" - url "https://git.insanusmokrassar.com/PostsSystem/Core/src/master/LICENSE" - } - + developers { + + developer { + id "InsanusMokrassar" + name "Ovsiannikov Aleksei" + email "ovsyannikov.alexey95@gmail.com" + } + + } + + licenses { + + license { + name "Apache Software License 2.0" + url "https://git.insanusmokrassar.com/PostsSystem/Core/src/master/LICENSE" + } + + } } } } diff --git a/postssystem.exposed/publish.gradle b/postssystem.exposed/publish.gradle index b8cf4528..fba05c9c 100644 --- a/postssystem.exposed/publish.gradle +++ b/postssystem.exposed/publish.gradle @@ -1,29 +1,21 @@ apply plugin: 'com.jfrog.bintray' -apply from: "maven.publish.gradle" +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 { - 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 "$projectBintrayDir" + from("build/libs") { + include "**/*.asc" + } + from("build/publications/maven") { + rename 'pom-default.xml(.*)', "${project.name}-${project.version}.pom\$1" } - into "${project.group}".replace(".", "/") } pkg { repo = "InsanusMokrassar" @@ -42,14 +34,6 @@ bintray { } } -bintrayUpload.doFirst { - publications = publishing.publications.collect { - if (it.name.contains('kotlinMultiplatform')) { - null - } else { - it.name - } - } - null -} +apply from: "maven.publish.gradle" bintrayUpload.dependsOn publishToMavenLocal \ No newline at end of file