From d02aa32ac882f8b5f247214ad769d4a68c82b455 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Sun, 24 Jan 2021 18:39:34 +0800 Subject: [PATCH] Log plugin version --- build.gradle | 6 ++++++ .../me/shedaniel/architect/plugin/ArchitectPlugin.kt | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/build.gradle b/build.gradle index bd6fb61..caff81b 100644 --- a/build.gradle +++ b/build.gradle @@ -74,6 +74,12 @@ compileKotlin { } } +jar { + manifest { + attributes 'Implementation-Version': project.version + } +} + gradlePlugin { plugins { architect { diff --git a/src/main/kotlin/me/shedaniel/architect/plugin/ArchitectPlugin.kt b/src/main/kotlin/me/shedaniel/architect/plugin/ArchitectPlugin.kt index 0f2228c..343517f 100644 --- a/src/main/kotlin/me/shedaniel/architect/plugin/ArchitectPlugin.kt +++ b/src/main/kotlin/me/shedaniel/architect/plugin/ArchitectPlugin.kt @@ -8,6 +8,15 @@ import java.net.URI class ArchitectPlugin : Plugin { override fun apply(project: Project) { + val version = ArchitectPlugin::class.java.getPackage().implementationVersion + val loggedVersions = System.getProperty("architectury.printed.logged", "").split(",").toMutableSet() + + if (!loggedVersions.contains(version)) { + loggedVersions.add(version) + System.setProperty("architectury.printed.logged", loggedVersions.joinToString(",")) + project.logger.lifecycle("Architect Plugin: $version") + } + LoggerFilter.replaceSystemOut() project.apply(