feat(help): Generate Deprecated Properties page
package com.synopsys.integration.detect.docs
import com.google.gson.Gson
+import com.synopsys.integration.detect.docs.content.Terms
import com.synopsys.integration.detect.docs.copied.HelpJsonData
import com.synopsys.integration.detect.docs.copied.HelpJsonExitCode
import com.synopsys.integration.detect.docs.copied.HelpJsonOption
-import com.synopsys.integration.detect.docs.content.Terms
import com.synopsys.integration.detect.docs.markdown.MarkdownOutputFormat
import freemarker.template.Configuration
import freemarker.template.Template
@@ -42,7 +42,7 @@ open class GenerateDocsTask : DefaultTask() {
val file = File("synopsys-detect-${project.version}-help.json")
val helpJson: HelpJsonData = Gson().fromJson(file.reader(), HelpJsonData::class.java)
- val outputDir = project.file("docs/generated");
+ val outputDir = project.file("docs/generated")
val troubleshootingDir = File(outputDir, "advanced/troubleshooting")
outputDir.deleteRecursively()
troubleshootingDir.mkdirs()
@@ -140,7 +140,12 @@ open class GenerateDocsTask : DefaultTask() {
.filter { it.simple.isNotEmpty() }
.map { SimplePropertyTableGroup(it.groupName, groupLocations[it.groupName] ?: error("Missing group location: ${it.groupName}"), it.simple) }
+ val deprecatedPropertyTableData = splitGroupOptions
+ .filter { it.deprecated.isNotEmpty() }
+ .map { DeprecatedPropertyTableGroup(it.groupName, groupLocations[it.groupName] ?: error("Missing group location: ${it.groupName}"), it.deprecated) }
+
createFromFreemarker(templateProvider, propertiesFolder, "basic-properties", SimplePropertyTablePage(simplePropertyTableData))
+ createFromFreemarker(templateProvider, propertiesFolder, "deprecated-properties", DeprecatedPropertyTablePage(deprecatedPropertyTableData))
createFromFreemarker(templateProvider, propertiesFolder, "all-properties", AdvancedPropertyTablePage(splitGroupOptions))
}
@@ -148,7 +153,7 @@ open class GenerateDocsTask : DefaultTask() {
//TODO: Add a new object to the helpJson which is a super group lookup so that the super group lookup is not just embedded in the object and then we don't have to do this at all.
//TODO: Add the default "Configuration" to the help json instead of blank and having this populate.
private fun createSuperGroupLookup(helpJson: HelpJsonData): HashMap<String, String> {
- val lookup = HashMap<String, String>();
+ val lookup = HashMap<String, String>()
helpJson.options.forEach { option ->
val defaultSuperGroup = "Configuration"
val superGroup = if (StringUtils.isBlank(option.superGroup)) defaultSuperGroup else option.superGroup ?: defaultSuperGroup
@@ -188,6 +193,8 @@ data class Detector(val detectorType: String, val detectorName:String, val detec
data class SimplePropertyTablePage(val groups: List<SimplePropertyTableGroup>) {}
data class SimplePropertyTableGroup(val groupName: String, val location: String, val options: List<HelpJsonOption>) {}
+data class DeprecatedPropertyTablePage(val groups: List<DeprecatedPropertyTableGroup>) {}
+data class DeprecatedPropertyTableGroup(val groupName: String, val location: String, val options: List<HelpJsonOption>) {}
data class AdvancedPropertyTablePage(val groups: List<SplitGroup>) {}
data class SplitGroup(val groupName: String, val superGroup: String, val location: String, val simple: List<HelpJsonOption>, val advanced: List<HelpJsonOption>, val deprecated: List<HelpJsonOption>) {}
