Skip to content

Commit 242e805

Browse files
committed
publish to gradle plugin repository
1 parent 4a5a419 commit 242e805

File tree

8 files changed

+50
-44
lines changed

8 files changed

+50
-44
lines changed

README.md

+7-21
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,24 @@ gradle-scoverage
44
================
55
A plugin to enable the use of Scoverage in a gradle Scala project.
66

7-
This has now been deployed to maven central.
8-
9-
Using gradle-scoverage
10-
======================
11-
127
Getting started
138
---------------
149
```groovy
15-
buildscript {
16-
repositories {
17-
mavenCentral()
18-
}
19-
dependencies {
20-
classpath 'org.scoverage:gradle-scoverage:1.0.9'
21-
}
22-
}
10+
http://plugins.gradle.org/plugin/org.scoverage
11+
12+
This creates an additional task `testScoverage` which will run tests against instrumented code.
2313
24-
apply plugin: 'scoverage'
14+
A further task `reportScoverage` produces XML and HTML reports for analysing test code coverage.
15+
16+
You need to configure the version of Scoverage that will be used. This plugin should be compatible with all 1+ versions.
2517
2618
dependencies {
2719
scoverage 'org.scoverage:scalac-scoverage-plugin_2.11:1.1.0', 'org.scoverage:scalac-scoverage-runtime_2.11:1.1.0'
2820
}
2921
```
3022

31-
This creates an additional task testCoverage which will run tests against instrumented code
32-
33-
- [x] instrumenting main scala code
34-
- [x] running JUnit tests against instrumented scala code
35-
- [x] failing the build on lack of coverage
36-
3723
Then launch command :
38-
`gradle testScoverage` or `gradle checkScoverage`
24+
`gradle reportScoverage` or `gradle checkScoverage`
3925

4026
Available tasks
4127
---------------

build.gradle

+38-18
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,33 @@
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

2023
repositories {
2124
mavenCentral()
2225
}
2326

2427
ext {
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+
7696
uploadArchives {
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 {

gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=http\://services.gradle.org/distributions/gradle-2.0-bin.zip
6+
distributionUrl=http\://services.gradle.org/distributions/gradle-2.9-bin.zip

src/test/happy day/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ buildscript {
1010
}
1111
}
1212

13-
apply plugin: 'scoverage'
13+
apply plugin: 'org.scoverage'
1414

1515
repositories {
1616
mavenCentral()

src/test/runtime/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ buildscript {
1010
}
1111
}
1212

13-
apply plugin: 'scoverage'
13+
apply plugin: 'org.scoverage'
1414

1515
repositories {
1616
mavenCentral()

src/test/separate-tests/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ subprojects {
1717
}
1818

1919
apply plugin: 'scala'
20-
apply plugin: 'scoverage'
20+
apply plugin: 'org.scoverage'
2121

2222
dependencies {
2323
compile 'org.scala-lang:scala-library:2.11.4'

src/test/water/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ allprojects {
1717
mavenCentral()
1818
}
1919

20-
apply plugin: 'scoverage'
20+
apply plugin: 'org.scoverage'
2121

2222
dependencies {
2323
scoverage 'org.scoverage:scalac-scoverage-plugin_2.11:1.0.4',

0 commit comments

Comments
 (0)