-
Notifications
You must be signed in to change notification settings - Fork 8
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
Incompatibility with new Kotlin versions #125
Comments
Could you share a reproducer project? |
Does it work if you place this in the top-level
and this in the app
|
Good morning. Just tried right now, same error. |
Good morning. That's a different project right? If I do that on the example project that I sended last week, I receive this new error:
|
Yes, that's a different project. I was able to reproduce the issue with the
It seems that the |
I think that breaks somehow the dependencies on the other build.gradle.kts. Meaning, if we implement this: buildSrc/build.gradle.kts: plugins {
`kotlin-dsl`
id("pl.droidsonroids.pitest") version "0.2.18" apply true
}
buildscript {
repositories {
google()
gradlePluginPortal()
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.21")
classpath("de.mannodermaus.gradle.plugins:android-junit5:1.8.2.1")
}
}
repositories {
mavenCentral()
gradlePluginPortal()
google()
}
dependencies {
implementation("com.android.tools.build:gradle:8.1.1")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.21")
implementation("com.diffplug.spotless:spotless-plugin-gradle:6.8.0")
implementation("org.jacoco:org.jacoco.core:0.8.10")
implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.32.0")
implementation("com.github.ben-manes:gradle-versions-plugin:0.47.0")
implementation("com.google.dagger:hilt-android-gradle-plugin:2.46")
} applicationAndroid/build.gradle.kts: import Configuration.Environments
import org.gradle.api.Action
import pl.droidsonroids.gradle.pitest.PitestPluginExtension
plugins {
id(Plugins.Android.APPLICATION)
id(Plugins.Kotlin.ANDROID)
id(Plugins.Kotlin.KAPT)
id(Plugins.Kotlin.PARCELIZE)
id(Plugins.Hilt.ANDROID)
id("pl.droidsonroids.pitest")
id("org.jetbrains.kotlin.kapt")
}
val useArchetypeModule = project.properties["useArchetypeModule"]
android {
fun org.gradle.api.Project.pitest(configure: Action<PitestPluginExtension>): Unit =
(this as org.gradle.api.plugins.ExtensionAware).extensions.configure("pitest", configure)
// Configure the Pitest plugin
pitest {
targetClasses.set(listOf("com.whatever.applicationandroid.*"))
// Configure other properties as needed
mutators.set(listOf("DEFAULTS"))
excludedTestClasses.set(listOf(""))
//targetTests.set(listOf("com.whatever.libandroidpre.data.datasource.*"))
threads.set(4)
outputFormats.set(listOf("XML", "HTML"))
timestampedReports.set(false)
verbose.set(true)
pitestVersion.set("1.11.0")
junit5PluginVersion.set("1.1.2")
}
// Ensure Pitest tasks run after relevant compile tasks
tasks.withType<pl.droidsonroids.gradle.pitest.PitestTask> {
mustRunAfter("compileDESReleaseKotlin","compilePROReleaseKotlin","compileDESReleaseJavaWithJavac")
}
namespace = Configuration.Android.namespace
compileSdk = Configuration.Android.compileSdk
defaultConfig {
minSdk = Configuration.Android.DefaultConfig.minSdk
targetSdk = Configuration.Android.DefaultConfig.targetSdk
versionCode = Configuration.Android.DefaultConfig.versionCode
versionName = Configuration.Android.DefaultConfig.versionName
testInstrumentationRunner = Configuration.Android.DefaultConfig.testInstrumentationRunner
buildConfigField("String", "JIRA_KEY", "\"${Configuration.jiraKey}\"")
buildConfigField("String", "ARTIFACT_ID", "\"${Configuration.artifactId}\"")
addManifestPlaceholders(
mapOf(
"appIcon" to "@drawable/ic_launcher",
"appIconRound" to "@drawable/ic_launcher",
"itxAuthority" to Configuration.artifactId
)
)
}
signingConfigs {
}
flavorDimensions.add(FlavorDimension.environment)
productFlavors {
with(Environments.Development) {
create(name) {
dimension = FlavorDimension.environment
}
}
with(Environments.Preproduction) {
create(name) {
dimension = FlavorDimension.environment
}
}
with(Environments.Production) {
create(name) {
dimension = FlavorDimension.environment
}
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}
buildFeatures {
compose = true
buildConfig = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.4.7"
}
packaging {
resources.excludes.add("META-INF/{AL2.0,LGPL2.1}")
resources.excludes.add("META-INF/LICENSE.md")
resources.excludes.add("META-INF/LICENSE-notice.md")
}
configurations.all {
// Enabled jacoco for all configurations.
resolutionStrategy {
eachDependency {
if (requested.group == "org.jacoco") useVersion(libs.versions.jacoco.get())
}
}
// Don't cache changing modules at all.
resolutionStrategy.cacheChangingModulesFor(0, "seconds")
}
}
dependencies {
kapt(libs.bundles.hilt.compiler)
implementation(libs.bundles.hilt)
testImplementation(libs.bundles.unit.test)
androidTestImplementation(libs.bundles.ui.test)
debugImplementation(libs.bundles.debug)
// Add Kotlin plugin dependencies
testImplementation("org.jetbrains.kotlin:kotlin-reflect:2.0.0")
implementation("com.arcmutate:pitest-kotlin-plugin:1.3.0")
// Add JUnit 5 dependencies
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.2")
} Fails with a different error:
|
OK, I'll investigate exactly that case. |
I was able to successfully run pitest task in the project from example.zip using plugin version 0.2.19 (just released), with the following modifications:
|
Good morning.
First of all, I want to sincerely appreciate the good work it's being done here over the years.
I want to comment here what it seems to be some kind of incompatibility with at least the following versions:
The problem in fact is pretty simple to see, on a build.gradle.kts file, if you include this section:
The gradle sync fails already with the errors:
The feeling I get, but I could be totally wrong, is that internally Pitest does some kind of packaging too but there is some new way to call that function and Pitest is not able to do it right.
The "good thing" is that if we comment the packaging section, it works just fine:
And a
./gradlew pitest
:The text was updated successfully, but these errors were encountered: