diff --git a/README.md b/README.md index 2676ba0..cf0a517 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ From now on, the `sympathyForMrMaven` will run on every `check` task invocation. ```groovy tasks.named("sympathyForMrMaven") { - behaviorOnFailure = BehaviorOnFailure.Fail + behaviorOnMismatch = BehaviorOnMismatch.Fail } ``` @@ -40,9 +40,9 @@ tasks.named("sympathyForMrMaven") { ```kotlin tasks.named("sympathyForMrMaven") { - behaviorOnFailure = BehaviorOnFailure.Fail + behaviorOnMismatch = BehaviorOnMismatch.Fail } ``` -`behaviorOnFailure` - one of `Fail` (prints error logs + fails the build) or `Warn` (only prints error logs) +`behaviorOnMismatch` - one of `Fail` (prints error logs + fails the build) or `Warn` (only prints error logs) diff --git a/maven-sympathy/api/maven-sympathy.api b/maven-sympathy/api/maven-sympathy.api index 4c470a9..90160a7 100644 --- a/maven-sympathy/api/maven-sympathy.api +++ b/maven-sympathy/api/maven-sympathy.api @@ -1,9 +1,9 @@ -public final class io/github/usefulness/mavensympathy/BehaviorOnFailure : java/lang/Enum { - public static final field Fail Lio/github/usefulness/mavensympathy/BehaviorOnFailure; - public static final field Warn Lio/github/usefulness/mavensympathy/BehaviorOnFailure; +public final class io/github/usefulness/mavensympathy/BehaviorOnMismatch : java/lang/Enum { + public static final field Fail Lio/github/usefulness/mavensympathy/BehaviorOnMismatch; + public static final field Warn Lio/github/usefulness/mavensympathy/BehaviorOnMismatch; public static fun getEntries ()Lkotlin/enums/EnumEntries; - public static fun valueOf (Ljava/lang/String;)Lio/github/usefulness/mavensympathy/BehaviorOnFailure; - public static fun values ()[Lio/github/usefulness/mavensympathy/BehaviorOnFailure; + public static fun valueOf (Ljava/lang/String;)Lio/github/usefulness/mavensympathy/BehaviorOnMismatch; + public static fun values ()[Lio/github/usefulness/mavensympathy/BehaviorOnMismatch; } public final class io/github/usefulness/mavensympathy/MavenSympathyPlugin : org/gradle/api/Plugin { @@ -14,8 +14,8 @@ public final class io/github/usefulness/mavensympathy/MavenSympathyPlugin : org/ public class io/github/usefulness/mavensympathy/SympathyForMrMavenTask : org/gradle/api/DefaultTask { public fun (Lorg/gradle/api/model/ObjectFactory;)V - public final fun behaviorOnFailure (Ljava/lang/String;)V - public final fun getBehaviorOnFailure ()Lorg/gradle/api/provider/Property; + public final fun behaviorOnMismatch (Ljava/lang/String;)V + public final fun getBehaviorOnMismatch ()Lorg/gradle/api/provider/Property; public final fun getConfigurationWithDependencies ()Lorg/gradle/api/provider/MapProperty; public final fun getOutputFile ()Lorg/gradle/api/file/RegularFileProperty; public final fun run ()V diff --git a/maven-sympathy/src/main/kotlin/io/github/usefulness/mavensympathy/BehaviorOnFailure.kt b/maven-sympathy/src/main/kotlin/io/github/usefulness/mavensympathy/BehaviorOnMismatch.kt similarity index 62% rename from maven-sympathy/src/main/kotlin/io/github/usefulness/mavensympathy/BehaviorOnFailure.kt rename to maven-sympathy/src/main/kotlin/io/github/usefulness/mavensympathy/BehaviorOnMismatch.kt index cd652a6..9caebb9 100644 --- a/maven-sympathy/src/main/kotlin/io/github/usefulness/mavensympathy/BehaviorOnFailure.kt +++ b/maven-sympathy/src/main/kotlin/io/github/usefulness/mavensympathy/BehaviorOnMismatch.kt @@ -1,6 +1,6 @@ package io.github.usefulness.mavensympathy -public enum class BehaviorOnFailure { +public enum class BehaviorOnMismatch { Warn, Fail, } diff --git a/maven-sympathy/src/main/kotlin/io/github/usefulness/mavensympathy/SympathyForMrMavenTask.kt b/maven-sympathy/src/main/kotlin/io/github/usefulness/mavensympathy/SympathyForMrMavenTask.kt index 09e0f76..6861073 100644 --- a/maven-sympathy/src/main/kotlin/io/github/usefulness/mavensympathy/SympathyForMrMavenTask.kt +++ b/maven-sympathy/src/main/kotlin/io/github/usefulness/mavensympathy/SympathyForMrMavenTask.kt @@ -25,11 +25,11 @@ public open class SympathyForMrMavenTask @Inject constructor(objectFactory: Obje public val outputFile: RegularFileProperty = objectFactory.fileProperty() @Input - public val behaviorOnFailure: Property = objectFactory.property(BehaviorOnFailure::class.java) - .value(BehaviorOnFailure.Fail) + public val behaviorOnMismatch: Property = objectFactory.property(BehaviorOnMismatch::class.java) + .value(BehaviorOnMismatch.Fail) - public fun behaviorOnFailure(value: String) { - behaviorOnFailure.set(BehaviorOnFailure.entries.first { it.name.equals(value, ignoreCase = true) }) + public fun behaviorOnMismatch(value: String) { + behaviorOnMismatch.set(BehaviorOnMismatch.entries.first { it.name.equals(value, ignoreCase = true) }) } @TaskAction @@ -56,9 +56,9 @@ public open class SympathyForMrMavenTask @Inject constructor(objectFactory: Obje report.writeText(errorMessages.joinToString(separator = "\n")) val failureMessage = "Declared dependencies were upgraded transitively. See task output above. Please update their versions." - when (behaviorOnFailure.get()) { - BehaviorOnFailure.Warn -> logger.error(failureMessage) - BehaviorOnFailure.Fail, null -> error(failureMessage) + when (behaviorOnMismatch.get()) { + BehaviorOnMismatch.Warn -> logger.error(failureMessage) + BehaviorOnMismatch.Fail, null -> error(failureMessage) } } else { report.writeText("OK") diff --git a/maven-sympathy/src/test/kotlin/io/github/usefulness/mavensympathy/IntegrationTest.kt b/maven-sympathy/src/test/kotlin/io/github/usefulness/mavensympathy/IntegrationTest.kt index 3153887..ca8870c 100644 --- a/maven-sympathy/src/test/kotlin/io/github/usefulness/mavensympathy/IntegrationTest.kt +++ b/maven-sympathy/src/test/kotlin/io/github/usefulness/mavensympathy/IntegrationTest.kt @@ -177,7 +177,7 @@ class IntegrationTest { // language=groovy writeText( """ - import io.github.usefulness.mavensympathy.BehaviorOnFailure + import io.github.usefulness.mavensympathy.BehaviorOnMismatch plugins { id("java-library") @@ -185,8 +185,8 @@ class IntegrationTest { } tasks.named("sympathyForMrMaven") { - behaviorOnFailure "fail" - behaviorOnFailure = BehaviorOnFailure.Warn + behaviorOnMismatch "fail" + behaviorOnMismatch = BehaviorOnMismatch.Warn } dependencies {