mirror of
https://github.com/HighCapable/Gropify.git
synced 2025-12-11 15:53:54 +08:00
feat: enhance debug logging in buildscript generation process
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
package com.highcapable.gropify.plugin.generator
|
package com.highcapable.gropify.plugin.generator
|
||||||
|
|
||||||
import com.highcapable.gropify.gradle.api.GradleDescriptor
|
import com.highcapable.gropify.gradle.api.GradleDescriptor
|
||||||
|
import com.highcapable.gropify.internal.Logger
|
||||||
import com.highcapable.gropify.internal.error
|
import com.highcapable.gropify.internal.error
|
||||||
import com.highcapable.gropify.internal.require
|
import com.highcapable.gropify.internal.require
|
||||||
import com.highcapable.gropify.plugin.Gropify
|
import com.highcapable.gropify.plugin.Gropify
|
||||||
@@ -299,6 +300,7 @@ internal class BuildscriptGenerator {
|
|||||||
* - Note: [allConfig] and [allKeyValues] must be equal in number.
|
* - Note: [allConfig] and [allKeyValues] must be equal in number.
|
||||||
*/
|
*/
|
||||||
fun build(
|
fun build(
|
||||||
|
config: GropifyConfig,
|
||||||
allConfig: MutableList<GropifyConfig.BuildscriptGenerateConfig>,
|
allConfig: MutableList<GropifyConfig.BuildscriptGenerateConfig>,
|
||||||
allKeyValues: MutableList<PropertyMap>
|
allKeyValues: MutableList<PropertyMap>
|
||||||
) = runCatching {
|
) = runCatching {
|
||||||
@@ -307,7 +309,10 @@ internal class BuildscriptGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val files = mutableListOf<JavaFile>()
|
val files = mutableListOf<JavaFile>()
|
||||||
if (allConfig.isEmpty()) return@runCatching files
|
if (allConfig.isEmpty()) return@runCatching let {
|
||||||
|
if (config.debugMode) Logger.get().debug("No buildscript accessors classes to generate.")
|
||||||
|
files
|
||||||
|
}
|
||||||
|
|
||||||
clearGeneratedData(clearAll = true)
|
clearGeneratedData(clearAll = true)
|
||||||
allConfig.forEachIndexed { index, configs ->
|
allConfig.forEachIndexed { index, configs ->
|
||||||
@@ -324,8 +329,15 @@ internal class BuildscriptGenerator {
|
|||||||
files.add(buildTypeSpec().createJavaFile(ACCESSORS_PACKAGE_NAME))
|
files.add(buildTypeSpec().createJavaFile(ACCESSORS_PACKAGE_NAME))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config.debugMode) files.forEach {
|
||||||
|
Logger.get().debug(
|
||||||
|
"Generated buildscript accessors class: ${it.typeSpec().name()}\n" +
|
||||||
|
"====== BEGIN FILE CONTENT ======\n$it\n====== END FILE CONTENT ======"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
files
|
files
|
||||||
}.getOrElse { Gropify.error("Failed to generated accessors classes.\n$it") }
|
}.getOrElse { Gropify.error("Failed to generated accessors classes.\n${it.stackTraceToString()}") }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate compile only stub files for buildscript accessors.
|
* Generate compile only stub files for buildscript accessors.
|
||||||
|
|||||||
Reference in New Issue
Block a user