|
| 1 | +buildscript { |
| 2 | + repositories { |
| 3 | + jcenter() |
| 4 | + } |
| 5 | + |
| 6 | + dependencies { |
| 7 | + classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' |
| 8 | + } |
| 9 | +} |
| 10 | + |
| 11 | +// https://discuss.gradle.org/t/plugin/7508/2 |
| 12 | +apply plugin: com.jfrog.bintray.gradle.BintrayPlugin |
| 13 | +apply plugin: "maven-publish" |
| 14 | + |
| 15 | +project.ext["signing.keyId"] = '74B2DD02' |
| 16 | +project.ext["signing.password"] = System.getenv("GPG_PASSPHRASE") ?: "" |
| 17 | +project.ext["signing.secretKeyRingFile"] = file("../sec.gpg").absolutePath |
| 18 | + |
| 19 | +group = 'com.wtanaka' |
| 20 | +project.ext["artifactId"] = 'kotlin-sample' |
| 21 | +project.ext["websiteUrl"] = 'https://wtanaka.com/' |
| 22 | +project.ext["description"] = 'Sample Kotlin Project Layout' |
| 23 | +project.ext["githubuser"] = "wtanaka" |
| 24 | +project.ext["githubrepo"] = "streaming" |
| 25 | + |
| 26 | +def pomConfig = { |
| 27 | + licenses { |
| 28 | + license { |
| 29 | + name "GNU General Public License, Version 3.0" |
| 30 | + url "http://www.gnu.org/licenses/gpl-3.0.html" |
| 31 | + distribution "repo" |
| 32 | + } |
| 33 | + } |
| 34 | + developers { |
| 35 | + developer { |
| 36 | + id "wtanaka" |
| 37 | + name "wtanaka.com" |
| 38 | + |
| 39 | + } |
| 40 | + } |
| 41 | + scm { |
| 42 | + connection "scm:git:git://github.com/" + project.ext['githubuser'] + |
| 43 | + "/" + project.ext['githubrepo'] + ".git" |
| 44 | + developerConnection "scm:git:ssh://github.com:" + project.ext['githubuser'] + |
| 45 | + "/" + project.ext['githubrepo'] + ".git" |
| 46 | + url "https://github.com/" + project.ext['githubuser'] + |
| 47 | + "/" + project.ext['githubrepo'] + "/tree/master" |
| 48 | + } |
| 49 | +} |
| 50 | + |
| 51 | +// Used for bintray |
| 52 | +publishing { |
| 53 | + publications { |
| 54 | + MyPublication(MavenPublication) { |
| 55 | + from components.java |
| 56 | + |
| 57 | + project.configurations.archives.allArtifacts.findAll({ |
| 58 | + it.classifier in (["sources", "javadoc"] as Set) |
| 59 | + }).each({ |
| 60 | + artifact it |
| 61 | + }) |
| 62 | + |
| 63 | + groupId project.group |
| 64 | + artifactId project.ext['artifactId'] |
| 65 | + version project.version |
| 66 | + pom.withXml { |
| 67 | + def root = asNode() |
| 68 | + root.appendNode('description', project.ext['description']) |
| 69 | + root.appendNode('name', project.group + '.' + project.ext['artifactId']) |
| 70 | + root.appendNode('url', project.ext['websiteUrl']) |
| 71 | + root.children().last() + pomConfig |
| 72 | + } |
| 73 | + } |
| 74 | + } |
| 75 | +} |
| 76 | + |
| 77 | +bintray { |
| 78 | + user = System.getenv('BINTRAY_USER') |
| 79 | + key = System.getenv('BINTRAY_KEY') |
| 80 | + publications = ['MyPublication'] |
| 81 | + publish = true |
| 82 | + override = true |
| 83 | + pkg { |
| 84 | + repo = 'maven' |
| 85 | + name = project.ext['artifactId'] |
| 86 | + userOrg = System.getenv('BINTRAY_USER') |
| 87 | + desc = project.ext['description'] |
| 88 | + licenses = ["GPL-3.0"] |
| 89 | + issueTrackerUrl = 'https://github.com/wtanaka/kotlin-sample/issues' |
| 90 | + vcsUrl = 'https://github.com/wtanaka/kotlin-sample.git' |
| 91 | + websiteUrl = project.ext['websiteUrl'] |
| 92 | + publicDownloadNumbers = true |
| 93 | + version { |
| 94 | + name = project.version |
| 95 | + released = new Date() |
| 96 | + gpg { |
| 97 | + sign = true |
| 98 | + // passphrase = '' |
| 99 | + } |
| 100 | + } |
| 101 | + } |
| 102 | +} |
| 103 | + |
0 commit comments