core/patcher: print version and os on plugin apply & don't require unsupported property for windows dev bundle gen
This commit is contained in:
parent
586f6a7d49
commit
3a4ea86b77
5 changed files with 24 additions and 22 deletions
|
@ -55,6 +55,14 @@ tasks.withType<KotlinCompile> {
|
|||
}
|
||||
}
|
||||
|
||||
tasks.jar {
|
||||
manifest {
|
||||
attributes(
|
||||
"Implementation-Version" to project.version
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
ktlint {
|
||||
enableExperimentalRules.set(true)
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ class PaperweightCore : Plugin<Project> {
|
|||
override fun apply(target: Project) {
|
||||
checkJavaVersion()
|
||||
Git.checkForGit()
|
||||
printId<PaperweightCore>("paperweight-core")
|
||||
|
||||
val ext = target.extensions.create(PAPERWEIGHT_EXTENSION, PaperweightCoreExtension::class, target)
|
||||
|
||||
|
|
|
@ -447,34 +447,22 @@ abstract class GenerateDevBundle : DefaultTask() {
|
|||
}
|
||||
|
||||
private fun checkEnvironment() {
|
||||
var unsupported = false
|
||||
|
||||
val osName = System.getProperty("os.name")
|
||||
logger.lifecycle("Dev bundle generation running on '{}'...", osName)
|
||||
if (osName.contains("win", true)) {
|
||||
logger.warn("Dev bundle generation is not tested to work on Windows.")
|
||||
unsupported = true
|
||||
}
|
||||
|
||||
val diffVersion = runDiff(null, listOf("--version")) + " " // add whitespace so pattern still works even with eol
|
||||
val matcher = Pattern.compile("diff \\(GNU diffutils\\) (.*?)\\s").matcher(diffVersion)
|
||||
if (matcher.find()) {
|
||||
logger.lifecycle("Using 'diff (GNU diffutils) {}'.", matcher.group(1))
|
||||
} else {
|
||||
logger.warn("Non-GNU diffutils diff detected, '--version' returned:\n{}", diffVersion)
|
||||
unsupported = true
|
||||
return
|
||||
}
|
||||
|
||||
if (unsupported) {
|
||||
if (this.ignoreUnsupportedEnvironment.getOrElse(false)) {
|
||||
logger.warn("Ignoring unsupported environment as per user configuration.")
|
||||
} else {
|
||||
throw PaperweightException(
|
||||
"Dev bundle generation is running in an unsupported environment (see above log messages).\n" +
|
||||
"You can ignore this and attempt to generate a dev bundle anyways by setting the '$unsupportedEnvironmentPropName' Gradle " +
|
||||
"property to 'true'."
|
||||
)
|
||||
}
|
||||
logger.warn("Non-GNU diffutils diff detected, '--version' returned:\n{}", diffVersion)
|
||||
if (this.ignoreUnsupportedEnvironment.getOrElse(false)) {
|
||||
logger.warn("Ignoring unsupported environment as per user configuration.")
|
||||
} else {
|
||||
throw PaperweightException(
|
||||
"Dev bundle generation is running in an unsupported environment (see above log messages).\n" +
|
||||
"You can ignore this and attempt to generate a dev bundle anyways by setting the '$unsupportedEnvironmentPropName' Gradle " +
|
||||
"property to 'true'."
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -348,3 +348,7 @@ fun checkJavaVersion() {
|
|||
throw PaperweightException(msg)
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <reified P> printId(pluginId: String) {
|
||||
println("$pluginId v${P::class.java.`package`.implementationVersion} (running on '${System.getProperty("os.name")}')")
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ class PaperweightPatcher : Plugin<Project> {
|
|||
override fun apply(target: Project) {
|
||||
checkJavaVersion()
|
||||
Git.checkForGit()
|
||||
printId<PaperweightPatcher>("paperweight-patcher")
|
||||
|
||||
val patcher = target.extensions.create(PAPERWEIGHT_EXTENSION, PaperweightPatcherExtension::class, target)
|
||||
|
||||
|
|
Loading…
Reference in a new issue