Wizard: add setting to hide version & groupId in gradle
This commit is contained in:
+4
-1
@@ -24,6 +24,7 @@ data class BuildFileIR(
|
||||
val fromModules: List<Module>,
|
||||
val pom: PomIR,
|
||||
val isRoot: Boolean,
|
||||
val renderPomIr: Boolean,
|
||||
override val irs: PersistentList<BuildSystemIR>,
|
||||
) : FileIR {
|
||||
override fun withReplacedIrs(irs: PersistentList<BuildSystemIR>): BuildFileIR = copy(irs = irs)
|
||||
@@ -57,7 +58,9 @@ data class BuildFileIR(
|
||||
}
|
||||
}
|
||||
sectionCall("plugins", irsOfType<BuildSystemPluginIR>()); nl(lineBreaks = 2)
|
||||
pom.render(this); nl()
|
||||
if (renderPomIr) {
|
||||
pom.render(this); nl()
|
||||
}
|
||||
distinctRepositories().takeIf { it.isNotEmpty() }?.let { repositories ->
|
||||
sectionCall("repositories", repositories)
|
||||
nl(lineBreaks = 2)
|
||||
|
||||
+10
-1
@@ -72,6 +72,14 @@ class StructurePlugin(context: Context) : Plugin(context) {
|
||||
validate(StringValidators.shouldBeValidIdentifier(title, ALLOWED_SPECIAL_CHARS_IN_VERSION))
|
||||
defaultValue = value("1.0-SNAPSHOT")
|
||||
}
|
||||
|
||||
val renderPomIR by booleanSetting(
|
||||
"<RENDER_POM_IR>",
|
||||
GenerationPhase.FIRST_STEP,
|
||||
) {
|
||||
defaultValue = value(true)
|
||||
}
|
||||
|
||||
val createProjectDir by pipelineTask(GenerationPhase.PROJECT_GENERATION) {
|
||||
withAction {
|
||||
service<FileSystemWizardService>().createDirectory(StructurePlugin.projectPath.settingValue)
|
||||
@@ -85,7 +93,8 @@ class StructurePlugin(context: Context) : Plugin(context) {
|
||||
name,
|
||||
groupId,
|
||||
artifactId,
|
||||
version
|
||||
version,
|
||||
renderPomIR
|
||||
)
|
||||
override val pipelineTasks: List<PipelineTask> =
|
||||
listOf(createProjectDir)
|
||||
|
||||
+5
-1
@@ -8,6 +8,7 @@ import org.jetbrains.kotlin.tools.projectWizard.core.*
|
||||
import org.jetbrains.kotlin.tools.projectWizard.core.service.WizardKotlinVersion
|
||||
import org.jetbrains.kotlin.tools.projectWizard.ir.buildsystem.*
|
||||
import org.jetbrains.kotlin.tools.projectWizard.moduleConfigurators.*
|
||||
import org.jetbrains.kotlin.tools.projectWizard.plugins.StructurePlugin
|
||||
import org.jetbrains.kotlin.tools.projectWizard.plugins.buildSystem.BuildSystemType
|
||||
import org.jetbrains.kotlin.tools.projectWizard.plugins.buildSystem.buildSystemType
|
||||
import org.jetbrains.kotlin.tools.projectWizard.plugins.buildSystem.gradle.GradlePlugin
|
||||
@@ -102,7 +103,7 @@ class ModulesToIRsConverter(
|
||||
}
|
||||
}
|
||||
|
||||
private fun createRootBuildFile(): BuildFileIR = with(data) {
|
||||
private fun Reader.createRootBuildFile(): BuildFileIR = with(data) {
|
||||
BuildFileIR(
|
||||
projectName,
|
||||
projectPath,
|
||||
@@ -110,6 +111,7 @@ class ModulesToIRsConverter(
|
||||
emptyList(),
|
||||
pomIr,
|
||||
isRoot = true,
|
||||
renderPomIr = StructurePlugin.renderPomIR.settingValue,
|
||||
rootBuildFileIrs.toPersistentList()
|
||||
)
|
||||
}
|
||||
@@ -191,6 +193,7 @@ class ModulesToIRsConverter(
|
||||
listOf(module),
|
||||
data.pomIr.copy(artifactId = module.name),
|
||||
isRoot = false, /* TODO */
|
||||
renderPomIr = StructurePlugin.renderPomIR.settingValue,
|
||||
createBuildFileIRs(module, state)
|
||||
).also {
|
||||
moduleToBuildFile[module] = it
|
||||
@@ -233,6 +236,7 @@ class ModulesToIRsConverter(
|
||||
module.subModules + module,
|
||||
pomIr,
|
||||
isRoot = false,
|
||||
renderPomIr = StructurePlugin.renderPomIR.settingValue,
|
||||
buildPersistenceList {
|
||||
+createBuildFileIRs(module, state)
|
||||
module.subModules.forEach { +createBuildFileIRs(it, state) }
|
||||
|
||||
Reference in New Issue
Block a user