-
Notifications
You must be signed in to change notification settings - Fork 11
Description
Hi!
I'm trying to set up pitest in a test project and I'm getting the following error:
- What went wrong:
A problem was found with the configuration of task ':app:compileReleaseKotlin' (type 'KotlinCompile').-
Gradle detected a problem with the following location: 'C:\Users\Me\AndroidStudioProjects\mutation_testing_android-master\app\build\tmp\kotlin-classes\release'.
Reason: Task ':app:pitestDebug' uses this output of task ':app:compileReleaseKotlin' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
Possible solutions:
- Declare task ':app:compileReleaseKotlin' as an input of ':app:pitestDebug'.
- Declare an explicit dependency on ':app:compileReleaseKotlin' from ':app:pitestDebug' using Task#dependsOn.
- Declare an explicit dependency on ':app:compileReleaseKotlin' from ':app:pitestDebug' using Task#mustRunAfter.
-
I tried to declare the explicit dependency but it didn't work.
Can you help me?
This is my gradle:
build.gradle (:app)
`plugins {
id 'com.android.application'
id 'kotlin-android'
id "pl.droidsonroids.pitest"
}
android {
compileSdkVersion 33
defaultConfig {
applicationId "com.link.mutation_testing"
minSdkVersion 27
targetSdkVersion 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
lintOptions {
disable('AllowBackup', 'GoogleAppIndexingWarning', 'MissingApplicationIcon')
}
testOptions {
unitTests.all {
useJUnitPlatform()
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions{
jvmTarget = JavaVersion.VERSION_17
}
}
build.dependsOn 'pitest'
tasks.withType(Test) {
if (name.contains("pitestDebug")) {
dependsOn(":app:compileReleaseKotlin")
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
testImplementation(platform("org.junit:junit-bom:5.7.0"))
testImplementation("org.junit.jupiter:junit-jupiter")
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
compileOnly 'com.google.android.things:androidthings:1.0'
testImplementation "org.junit.jupiter:junit-jupiter-engine:5.7.0"
}
pitest {
junit5PluginVersion = '1.2.2'
targetClasses = ['com.link.mutation_testing.'] //by default "${project.group}."
threads = 4
outputFormats = ['XML', 'HTML']
timestampedReports = true
}`
build.gradle(mutation_project)
`// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.9.24"
repositories {
google()
gradlePluginPortal()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.4.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "pl.droidsonroids.gradle:gradle-pitest-plugin:0.2.18"
classpath "org.junit.jupiter:junit-jupiter-engine:5.7.0"
}
}
allprojects {
repositories {
google()
gradlePluginPortal()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
`
I am using java 17 and gradle-8.4-all
I don't know what it could be