Skip to content

Commit

Permalink
Merge pull request #115 from koral--/issue-112
Browse files Browse the repository at this point in the history
Change additional classpath building
  • Loading branch information
koral-- authored Nov 12, 2023
2 parents 7230ce0 + 5fb80c8 commit f53d0c3
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.2.15 - 2023-11-12

- Change additional classpath building [#112](https://github.com/koral--/gradle-pitest-plugin/issue/112)

# 0.2.14 - 2023-11-06

- Update dependency versions
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ which supports Android gradle projects.

```groovy
plugins {
id 'pl.droidsonroids.pitest' version '0.2.14'
id 'pl.droidsonroids.pitest' version '0.2.15'
}
```

```kotlin
plugins {
id("pl.droidsonroids.pitest") version "0.2.14"
id("pl.droidsonroids.pitest") version "0.2.15"
}
```

Expand All @@ -25,7 +25,7 @@ buildscript {
google()
}
dependencies {
classpath("pl.droidsonroids.gradle:gradle-pitest-plugin:0.2.14")
classpath("pl.droidsonroids.gradle:gradle-pitest-plugin:0.2.15")
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=0.2.14
VERSION_NAME=0.2.15
GROUP=pl.droidsonroids.gradle
POM_DESCRIPTION=Gradle plugin for PIT Mutation Testing in Android projects
POM_URL=https://github.com/koral--/gradle-pitest-plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,11 @@ class PitestPlugin implements Plugin<Project> {

if (ANDROID_GRADLE_PLUGIN_VERSION_NUMBER.major == 3 && project.findProperty("android.enableJetifier") != "true") {
if (ANDROID_GRADLE_PLUGIN_VERSION_NUMBER.minor < 3) {
from(project.configurations["${variant.name}CompileClasspath"].copyRecursive { configuration ->
configuration.properties.dependencyProject == null
from(project.configurations["${variant.name}CompileClasspath"].copyRecursive { dependency ->
dependency.properties.dependencyProject == null
})
from(project.configurations["${variant.name}UnitTestCompileClasspath"].copyRecursive { configuration ->
configuration.properties.dependencyProject == null
from(project.configurations["${variant.name}UnitTestCompileClasspath"].copyRecursive { dependency ->
dependency.properties.dependencyProject == null
})
} else if (ANDROID_GRADLE_PLUGIN_VERSION_NUMBER.minor < 4) {
from(project.configurations["${variant.name}CompileClasspath"])
Expand All @@ -225,9 +225,10 @@ class PitestPlugin implements Plugin<Project> {
from(project.configurations["compile"])
from(project.configurations["testCompile"])
} else if (ANDROID_GRADLE_PLUGIN_VERSION_NUMBER.major > 4 && project.findProperty("android.enableJetifier") != "true") {
from(project.configurations["${variant.name}UnitTestRuntimeClasspath"].copyRecursive { configuration ->
configuration.properties.dependencyProject == null && configuration.version != null
})
Configuration unittestRuntimeConfig = project.configurations.getByName("${variant.name}UnitTestRuntimeClasspath")
from(unittestRuntimeConfig.copyRecursive { dependency ->
dependency.properties.dependencyProject == null && dependency.version != null
}.shouldResolveConsistentlyWith(unittestRuntimeConfig))
}
from(project.configurations["pitestRuntimeOnly"])
from(project.files("${project.buildDir}/intermediates/sourceFolderJavaResources/${variant.dirName}"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ class AndroidUtils {
unitTests.returnDefaultValues = true
}
}
project.dependencies {
implementation("org.jetbrains.kotlin:kotlin-reflect:1.6.10")
testImplementation("io.mockk:mockk:1.11.0")
}
project.repositories {
mavenCentral()
google()
}
project.apply(plugin: "pl.droidsonroids.pitest")
return project
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,17 @@ class PitestPluginTest extends Specification {
assert classpath.find { it.toString().endsWith('sourceFolderJavaResources/test/freeBlue/release') }
}
@SuppressWarnings("ImplicitClosureParameter")
void "combined task classpath contains dependencies in correct order"() {
when:
Project project = AndroidUtils.createSampleApplicationProject()
project.evaluate()
then:
Set<File> classpath = project.tasks["${PitestPlugin.PITEST_TASK_NAME}FreeBlueRelease"].additionalClasspath.files
assert classpath.find { it.toString().endsWith('kotlin-reflect-1.3.72.jar') } == null
assert classpath.find { it.toString().endsWith('kotlin-reflect-1.6.10.jar') }
}
void "strange sdk versions get properly sanitized"() {
when:
String version = PitestPlugin.sanitizeSdkVersion('strange version (0)')
Expand Down

0 comments on commit f53d0c3

Please sign in to comment.