-
Notifications
You must be signed in to change notification settings - Fork 15
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
Suppress "no changes" output by default #92
Changes from 4 commits
6fb489d
a5a91ff
f8210ee
2964356
18bf7a5
5bc477b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,14 +19,20 @@ import org.gradle.api.GradleException | |
import org.gradle.api.Project | ||
import org.gradle.api.artifacts.result.ResolvedComponentResult | ||
import org.gradle.api.file.DirectoryProperty | ||
import org.gradle.api.model.ObjectFactory | ||
import org.gradle.api.provider.MapProperty | ||
import org.gradle.api.provider.Property | ||
import org.gradle.api.provider.Provider | ||
import org.gradle.api.provider.ProviderFactory | ||
import org.gradle.api.tasks.Input | ||
import org.gradle.api.tasks.OutputDirectory | ||
import org.gradle.api.tasks.TaskAction | ||
import javax.inject.Inject | ||
|
||
internal abstract class DependencyGuardListTask : DefaultTask() { | ||
internal abstract class DependencyGuardListTask @Inject constructor( | ||
objects: ObjectFactory, | ||
providers: ProviderFactory | ||
) : DefaultTask() { | ||
|
||
init { | ||
group = DependencyGuardPlugin.DEPENDENCY_GUARD_TASK_GROUP | ||
|
@@ -61,6 +67,10 @@ internal abstract class DependencyGuardListTask : DefaultTask() { | |
@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 | ||
|
||
|
@@ -86,19 +96,24 @@ internal abstract class DependencyGuardListTask : DefaultTask() { | |
when (diffResult) { | ||
is DependencyListDiffResult.DiffPerformed.HasDiff -> { | ||
// Print to console in color | ||
println(diffResult.createDiffMessage(withColor = true)) | ||
logger.error(diffResult.createDiffMessage(withColor = true)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm still understanding the Gradle Logging https://docs.gradle.org/current/userguide/logging.html Why is this considered an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. error is always displayed to the user, and some folks may instrument their builds to capture and save/send/etc error level logs. Would it not be an error? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A detected difference would be an So, |
||
|
||
// Add to exception message without color | ||
exceptionMessage.appendLine(diffResult.createDiffMessage(withColor = false)) | ||
} | ||
|
||
is DependencyListDiffResult.DiffPerformed.NoDiff -> { | ||
// Print no diff message | ||
println(diffResult.noDiffMessage) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for getting rid of these |
||
val message = diffResult.noDiffMessage | ||
if (logVerbosely.get()) { | ||
logger.lifecycle(message) | ||
} else { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we just delete these lines, and then get rid of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm fine with that too, was just trying to leave existing functionality possible if it was wanted There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Appreciate it. Because it is just this case, I personally will not miss it. The goal of the If someone has a different option, an issue could be created for discussion, but this makes sense here IMO. |
||
logger.debug(message) | ||
} | ||
} | ||
|
||
is DependencyListDiffResult.BaselineCreated -> { | ||
println(diffResult.baselineCreatedMessage(true)) | ||
logger.lifecycle(diffResult.baselineCreatedMessage(true)) | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip | ||
networkTimeout=10000 | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a small opportunistic improvement as
all
eagerly configures targets and configureEach is lazy