Skip to content

Commit

Permalink
Respect quiet mode in version printout
Browse files Browse the repository at this point in the history
  • Loading branch information
jpenilla committed Oct 10, 2023
1 parent 5389e61 commit 2b14041
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")}')")
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 2b14041

Please sign in to comment.