Skip to content

Commit

Permalink
Update wit changes from main + remove logVerbosely
Browse files Browse the repository at this point in the history
  • Loading branch information
ZacSweers committed Apr 22, 2023
1 parent 18bf7a5 commit 5bc477b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class PluginTest {
gradleVersion = args.gradleVersion,
withConfigurationCache = args.withConfigurationCache,
project = project,
args = arrayOf(":lib:dependencyGuard", "-PdependencyGuard.verbose=true")
args = arrayOf(":lib:dependencyGuard", "--debug")
)

assertThat(result.output)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.TaskAction
import javax.inject.Inject

internal abstract class DependencyGuardListTask @Inject constructor(
objects: ObjectFactory,
providers: ProviderFactory
) : DefaultTask() {
internal abstract class DependencyGuardListTask : DefaultTask() {

init {
group = DependencyGuardPlugin.DEPENDENCY_GUARD_TASK_GROUP
Expand Down Expand Up @@ -70,10 +67,6 @@ internal abstract class DependencyGuardListTask @Inject constructor(
@get:Input
abstract val monitoredConfigurationsMap: MapProperty<DependencyGuardConfiguration, Provider<ResolvedComponentResult>>

@get:Input
val logVerbosely: Property<Boolean> = objects.property(Boolean::class.java)
.convention(providers.gradleProperty("dependencyGuard.verbose").map { it.toBoolean() }.orElse(false))

@get:OutputDirectory
abstract val projectDirectoryDependenciesDir: DirectoryProperty

Expand All @@ -97,13 +90,13 @@ internal abstract class DependencyGuardListTask @Inject constructor(
when (val diff = writeListReport(dependencyGuardConfig, report)) {
is HasDiff -> {
// Print to console in color
println(diff.createDiffMessage(withColor = true))
logger.error(diff.createDiffMessage(withColor = true))

// Add to exception message without color
exceptionMessage.appendLine(diff.createDiffMessage(withColor = false))
}
is NoDiff -> println(diff.noDiffMessage)
is BaselineCreated -> println(diff.baselineCreatedMessage(withColor = true))
is NoDiff -> logger.debug(diff.noDiffMessage)
is BaselineCreated -> logger.lifecycle(diff.baselineCreatedMessage(withColor = true))
}
}

Expand Down

0 comments on commit 5bc477b

Please sign in to comment.