Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scm task #71

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified .editorconfig
100644 → 100755
Empty file.
Empty file modified .gitattributes
100644 → 100755
Empty file.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified .travis.yml
100644 → 100755
Empty file.
Empty file modified CHANGELOG.md
100644 → 100755
Empty file.
Empty file modified LICENSE-2.0.txt
100644 → 100755
Empty file.
20 changes: 19 additions & 1 deletion README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,30 @@ calculate a mutation coverage of a [Gradle](https://gradle.org/)-based projects
Add gradle-pitest-plugin to the `plugins` configuration in your `build.gradle` file:

plugins {
id "info.solidsoft.pitest" version "1.2.2"
id "info.solidsoft.pitest" version "1.3.0-SNAPSHOT"
}

Call Gradle with pitest task:

gradle pitest

### SCM task

SCM task runs PIT on mutations on target classes based on their SCM status
To execute SCM task, task must be configured correctly. SCM task configuration example:

scmPitest {
scm {
connection = "scm:git:[email protected]/sample"
}
connectionType = "connection"
scmRoot = projectDir
include = ['added','modified','checked-in']
}

To apply, call scmPitest task:

gradle scmPitest

After the measurements a report created by PIT will be placed in `${PROJECT_DIR}/build/reports/pitest` directory.

Expand Down
Empty file modified appveyor.yml
100644 → 100755
Empty file.
164 changes: 60 additions & 104 deletions build.gradle
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
apply plugin: 'groovy'
apply plugin: 'info.solidsoft.cdeliveryboy'
apply plugin: 'ru.vyarus.animalsniffer'
import ru.vyarus.gradle.plugin.animalsniffer.AnimalSniffer

group = 'info.solidsoft.gradle.pitest'
//apply plugin: 'groovy'
apply plugin: 'info.solidsoft.cdeliveryboy'

buildscript {
repositories {
Expand All @@ -16,90 +15,75 @@ buildscript {
classpath 'info.solidsoft.gradle:cdeliveryboy:0.6.0'
classpath 'ru.vyarus:gradle-animalsniffer-plugin:1.4.2'
classpath 'com.gradle.publish:plugin-publish-plugin:0.9.7'
classpath 'io.spring.gradle:dependency-management-plugin:1.0.3.RELEASE'
}
}

cDeliveryBoy {
tasks {
promoteRepositoryTask = "releaseRepository"
}
nexus {
autoPromote = true
allprojects {
repositories {
mavenCentral()
mavenLocal()
maven {
url 'https://plugins.gradle.org/m2/'
}
}
}

scmVersion {
hooks {
pre 'fileUpdate', [file : 'README.md', pattern: { previousVersion, context -> /classpath\ "info\.solidsoft\.gradle\.pitest:gradle-pitest-plugin:$previousVersion"/ },
replacement: { currentVersion, context -> "classpath \"info.solidsoft.gradle.pitest:gradle-pitest-plugin:$currentVersion\"" }]
pre 'fileUpdate', [file : 'README.md', pattern: { previousVersion, context -> /id\ "info\.solidsoft\.pitest"\ version\ "$previousVersion"/ },
replacement: { currentVersion, context -> "id \"info.solidsoft.pitest\" version \"$currentVersion\"" }]
pre 'fileUpdate', [file : 'CHANGELOG.md', pattern: { previousVersion, context -> /^##\ ${context.currentVersion}\ -\ Unreleased$/ },
replacement: { currentVersion, context -> "## $currentVersion - ${new Date().format( 'yyyy-MM-dd' )}" }]
scmVersion {
hooks {
pre 'fileUpdate', [file : 'README.md', pattern: { previousVersion, context -> /classpath\ "info\.solidsoft\.gradle\.pitest:gradle-pitest-plugin:$previousVersion"/ },
replacement: { currentVersion, context -> "classpath \"info.solidsoft.gradle.pitest:gradle-pitest-plugin:$currentVersion\"" }]
pre 'fileUpdate', [file : 'README.md', pattern: { previousVersion, context -> /id\ "info\.solidsoft\.pitest"\ version\ "$previousVersion"/ },
replacement: { currentVersion, context -> "id \"info.solidsoft.pitest\" version \"$currentVersion\"" }]
pre 'fileUpdate', [file : 'CHANGELOG.md', pattern: { previousVersion, context -> /^##\ ${context.currentVersion}\ -\ Unreleased$/ },
replacement: { currentVersion, context -> "## $currentVersion - ${new Date().format( 'yyyy-MM-dd' )}" }]
}
}
}

project.version = scmVersion.version

sourceCompatibility = 1.7

repositories {
mavenCentral()
mavenLocal()
project.version = scmVersion.version
}

sourceSets {
funcTest {
java.srcDir file('src/funcTest/java')
groovy.srcDir file('src/funcTest/groovy')
resources.srcDir file('src/funcTest/resources')
subprojects { subproject ->

apply plugin: 'java'
apply plugin: 'ru.vyarus.animalsniffer'
apply plugin: 'io.spring.dependency-management'
group = 'info.solidsoft.gradle.pitest'
sourceCompatibility = 1.7
task testReport(type: TestReport) {
destinationDir = file("$buildDir/reports/allTests")
reportOn test, 'functional-tests:funcTest'
}
}
dependencies {
compile gradleApi()
compile localGroovy()

dependencies {
compile gradleApi()
compile localGroovy()
testCompile('org.spockframework:spock-core:1.1-groovy-2.4') {
//groovy 2.3.x is already provided by Gradle itself
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
}
testCompile 'info.solidsoft.spock:spock-global-unroll:0.5.1'
testCompile 'net.bytebuddy:byte-buddy:1.7.5' //for Spying in Spock
testCompile 'junit:junit:4.12'

testCompile('org.spockframework:spock-core:1.1-groovy-2.4') {
//groovy 2.3.x is already provided by Gradle itself
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
signature 'org.codehaus.mojo.signature:java17:1.0@signature'
}
testCompile 'info.solidsoft.spock:spock-global-unroll:0.5.1'
testCompile 'net.bytebuddy:byte-buddy:1.7.5' //for Spying in Spock
testCompile 'junit:junit:4.12'

funcTestCompile sourceSets.main.output //to make production plugin classes visible in functional tests (it's not in testCompile configuration)
funcTestCompile configurations.testCompile
funcTestRuntime configurations.testRuntime
funcTestCompile('com.netflix.nebula:nebula-test:6.1.2') {
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
}
signature 'org.codehaus.mojo.signature:java17:1.0@signature'
}

task funcTest(type: Test) {
description = 'Run the functional tests.'
group = 'Verification'
testClassesDirs = sourceSets.funcTest.output.classesDirs
classpath = sourceSets.funcTest.runtimeClasspath
jvmArgs '-Xmx1g'
}
funcTest.shouldRunAfter test
check.shouldRunAfter funcTest
check.dependsOn funcTestClasses
uploadArchives.dependsOn funcTest, check

task testReport(type: TestReport) {
destinationDir = file("$buildDir/reports/allTests")
reportOn test, funcTest
animalsniffer {
sourceSets = [subproject.sourceSets.main] //just for production classes - Animal Sniffer fails with: 'Undefined reference: void for Spock tests'
//https://github.com/mojohaus/animal-sniffer/issues/27
}
}

animalsniffer {
sourceSets = [project.sourceSets.main] //just for production classes - Animal Sniffer fails with: 'Undefined reference: void for Spock tests'
//https://github.com/mojohaus/animal-sniffer/issues/27
cDeliveryBoy {
tasks {
promoteRepositoryTask = "releaseRepository"
}
nexus {
autoPromote = true
}
}

tasks.withType(ru.vyarus.gradle.plugin.animalsniffer.AnimalSniffer) {
tasks.withType(AnimalSniffer) {
onlyIf { project.hasProperty('compatibility') }
}

Expand All @@ -108,40 +92,11 @@ nexusStaging {
stagingProfileId = "34a3a5beeaa96"
}

modifyPom {
project {
name 'Gradle PIT Plugin'
description 'Gradle plugin for PIT Mutation Testing'
url 'http://gradle-pitest-plugin.solidsoft.info/'

scm {
connection 'scm:git:git://github.com/szpak/gradle-pitest-plugin.git'
developerConnection 'scm:git:[email protected]:szpak/gradle-pitest-plugin.git'
url 'https://github.com/szpak/gradle-pitest-plugin'
}

licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0'
distribution 'repo'
}
}

developers {
developer {
id 'szpak'
name 'Marcin Zajączkowski'
email 'mszpak ATT wp DOTT pl'
roles {
role 'despot'
role 'developer'
}
}
}
}
}

/*
check.shouldRunAfter('functional-tests:funcTest')
check.dependsOn ('functional-tests:classes')
uploadArchives.dependsOn('functional-tests:funcTest', 'check')
*/
if (hasProperty('pluginPortal')) {

apply plugin: 'com.gradle.plugin-publish'
Expand Down Expand Up @@ -188,3 +143,4 @@ if (hasProperty('changelogSync')) {
}
ciBuild.dependsOn syncChangelog
}

21 changes: 21 additions & 0 deletions functional-tests/functional-tests.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apply plugin: 'groovy'

dependencies{
testCompile project(':plugin')
testCompile('com.netflix.nebula:nebula-test:6.1.2') {
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
}
}

task funcTest(type: Test) {
description = 'Run the functional tests.'
group = 'Verification'
testClassesDirs = sourceSets.test.output.classesDirs
classpath = sourceSets.test.runtimeClasspath
jvmArgs '-Xmx1g'
}

tasks.funcTest.dependsOn(":plugin:test")

test.enabled = false

Binary file not shown.
5 changes: 5 additions & 0 deletions functional-tests/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.2-bin.zip
Loading