Skip to content

Commit

Permalink
publish to gradle plugin repository
Browse files Browse the repository at this point in the history
  • Loading branch information
maiflai committed Dec 29, 2015
1 parent 4a5a419 commit 242e805
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 44 deletions.
28 changes: 7 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,24 @@ gradle-scoverage
================
A plugin to enable the use of Scoverage in a gradle Scala project.

This has now been deployed to maven central.

Using gradle-scoverage
======================

Getting started
---------------
```groovy
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.scoverage:gradle-scoverage:1.0.9'
}
}
http://plugins.gradle.org/plugin/org.scoverage
This creates an additional task `testScoverage` which will run tests against instrumented code.
apply plugin: 'scoverage'
A further task `reportScoverage` produces XML and HTML reports for analysing test code coverage.
You need to configure the version of Scoverage that will be used. This plugin should be compatible with all 1+ versions.
dependencies {
scoverage 'org.scoverage:scalac-scoverage-plugin_2.11:1.1.0', 'org.scoverage:scalac-scoverage-runtime_2.11:1.1.0'
}
```

This creates an additional task testCoverage which will run tests against instrumented code

- [x] instrumenting main scala code
- [x] running JUnit tests against instrumented scala code
- [x] failing the build on lack of coverage

Then launch command :
`gradle testScoverage` or `gradle checkScoverage`
`gradle reportScoverage` or `gradle checkScoverage`

Available tasks
---------------
Expand Down
56 changes: 38 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,27 +1,33 @@
def isDirty = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'status', '--porcelain'
standardOutput = stdout
// First, apply the publishing plugin
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.gradle.publish:plugin-publish-plugin:0.9.2"
}
return stdout.toString().trim()
}
def getVersionName = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags'
standardOutput = stdout

apply plugin: "com.gradle.plugin-publish"
description = 'gradle-scoverage is a Gradle plugin for calculating code coverage using Scoverage'
version = {
if (project.hasProperty('version')) {
return project.getProperty('version')
} else {
return '2.0.0-SNAPSHOT'
}
def gitVersionName = stdout.toString().trim()
return isDirty() ? gitVersionName + '-SNAPSHOT' : gitVersionName
}
version = getVersionName()

repositories {
mavenCentral()
}

ext {
website = 'http://scoverage.org'
vcsUrl = 'https://github.com/scoverage/gradle-scoverage.git'
scmUrl = "scm:git:$vcsUrl"
sonatypeUser = System.env.SONATYPE_USER
sonatypePass = System.env.SONATYPE_PASS
}
Expand Down Expand Up @@ -73,6 +79,20 @@ if (project.properties.containsKey('signing.keyId')) {
}
}

pluginBundle {
website = project.website
vcsUrl = project.vcsUrl
description = project.description
tags = ['coverage', 'scala', 'scoverage']

plugins {
scoveragePlugin {
id = 'org.scoverage'
displayName = 'Gradle Scoverage plugin'
}
}
}

uploadArchives {
repositories {
mavenDeployer {
Expand All @@ -90,12 +110,12 @@ uploadArchives {

pom.project {
name 'GradleScoverage'
description 'gradle-scoverage is a Gradle plugin for calculating code coverage using Scoverage'
url 'http://scoverage.org'
description project.description
url project.website

scm {
url 'scm:git:https://github.com/scoverage/gradle-scoverage.git'
developerConnection 'scm:git:https://github.com/scoverage/gradle-scoverage.git'
url scmUrl
developerConnection scmUrl
}

licenses {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-2.0-bin.zip
distributionUrl=http\://services.gradle.org/distributions/gradle-2.9-bin.zip
2 changes: 1 addition & 1 deletion src/test/happy day/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ buildscript {
}
}

apply plugin: 'scoverage'
apply plugin: 'org.scoverage'

repositories {
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion src/test/runtime/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ buildscript {
}
}

apply plugin: 'scoverage'
apply plugin: 'org.scoverage'

repositories {
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion src/test/separate-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ subprojects {
}

apply plugin: 'scala'
apply plugin: 'scoverage'
apply plugin: 'org.scoverage'

dependencies {
compile 'org.scala-lang:scala-library:2.11.4'
Expand Down
2 changes: 1 addition & 1 deletion src/test/water/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ allprojects {
mavenCentral()
}

apply plugin: 'scoverage'
apply plugin: 'org.scoverage'

dependencies {
scoverage 'org.scoverage:scalac-scoverage-plugin_2.11:1.0.4',
Expand Down

0 comments on commit 242e805

Please sign in to comment.