1- def isDirty = { ->
2- def stdout = new ByteArrayOutputStream ()
3- exec {
4- commandLine ' git' , ' status' , ' --porcelain'
5- standardOutput = stdout
1+ // First, apply the publishing plugin
2+ buildscript {
3+ repositories {
4+ maven {
5+ url " https://plugins.gradle.org/m2/"
6+ }
7+ }
8+ dependencies {
9+ classpath " com.gradle.publish:plugin-publish-plugin:0.9.2"
610 }
7- return stdout. toString(). trim()
811}
9- def getVersionName = { ->
10- def stdout = new ByteArrayOutputStream ()
11- exec {
12- commandLine ' git' , ' describe' , ' --tags'
13- standardOutput = stdout
12+
13+ apply plugin : " com.gradle.plugin-publish"
14+ description = ' gradle-scoverage is a Gradle plugin for calculating code coverage using Scoverage'
15+ version = {
16+ if (project. hasProperty(' version' )) {
17+ return project. getProperty(' version' )
18+ } else {
19+ return ' 2.0.0-SNAPSHOT'
1420 }
15- def gitVersionName = stdout. toString(). trim()
16- return isDirty() ? gitVersionName + ' -SNAPSHOT' : gitVersionName
1721}
18- version = getVersionName()
1922
2023repositories {
2124 mavenCentral()
2225}
2326
2427ext {
28+ website = ' http://scoverage.org'
29+ vcsUrl = ' https://github.com/scoverage/gradle-scoverage.git'
30+ scmUrl = " scm:git:$vcsUrl "
2531 sonatypeUser = System . env. SONATYPE_USER
2632 sonatypePass = System . env. SONATYPE_PASS
2733}
@@ -73,6 +79,20 @@ if (project.properties.containsKey('signing.keyId')) {
7379 }
7480}
7581
82+ pluginBundle {
83+ website = project. website
84+ vcsUrl = project. vcsUrl
85+ description = project. description
86+ tags = [' coverage' , ' scala' , ' scoverage' ]
87+
88+ plugins {
89+ scoveragePlugin {
90+ id = ' org.scoverage'
91+ displayName = ' Gradle Scoverage plugin'
92+ }
93+ }
94+ }
95+
7696uploadArchives {
7797 repositories {
7898 mavenDeployer {
@@ -90,12 +110,12 @@ uploadArchives {
90110
91111 pom. project {
92112 name ' GradleScoverage'
93- description ' gradle-scoverage is a Gradle plugin for calculating code coverage using Scoverage '
94- url ' http://scoverage.org '
113+ description project . description
114+ url project . website
95115
96116 scm {
97- url ' scm:git:https://github.com/scoverage/gradle-scoverage.git '
98- developerConnection ' scm:git:https://github.com/scoverage/gradle-scoverage.git '
117+ url scmUrl
118+ developerConnection scmUrl
99119 }
100120
101121 licenses {
0 commit comments