Respect quiet mode in version printout

This commit is contained in:
Jason Penilla 2023-10-09 17:35:29 -07:00
parent 5389e61eee
commit 2b1404179e
No known key found for this signature in database
GPG key ID: 0E75A301420E48F8
3 changed files with 8 additions and 3 deletions

View file

@ -44,7 +44,7 @@ class PaperweightCore : Plugin<Project> {
override fun apply(target: Project) {
checkJavaVersion()
Git.checkForGit()
printId<PaperweightCore>("paperweight-core")
printId<PaperweightCore>("paperweight-core", target.gradle)
val ext = target.extensions.create(PAPERWEIGHT_EXTENSION, PaperweightCoreExtension::class, target)

View file

@ -56,6 +56,8 @@ import org.gradle.api.file.FileSystemLocation
import org.gradle.api.file.ProjectLayout
import org.gradle.api.file.RegularFile
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.invocation.Gradle
import org.gradle.api.logging.LogLevel
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.api.provider.Property
import org.gradle.api.provider.Provider
@ -352,6 +354,9 @@ fun checkJavaVersion() {
}
}
inline fun <reified P> printId(pluginId: String) {
inline fun <reified P> printId(pluginId: String, gradle: Gradle) {
if (gradle.startParameter.logLevel == LogLevel.QUIET) {
return
}
println("$pluginId v${P::class.java.`package`.implementationVersion} (running on '${System.getProperty("os.name")}')")
}

View file

@ -50,7 +50,7 @@ class PaperweightPatcher : Plugin<Project> {
override fun apply(target: Project) {
checkJavaVersion()
Git.checkForGit()
printId<PaperweightPatcher>("paperweight-patcher")
printId<PaperweightPatcher>("paperweight-patcher", target.gradle)
val patcher = target.extensions.create(PAPERWEIGHT_EXTENSION, PaperweightPatcherExtension::class, target)