forked from terrakok/kmp-web-wizard
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
88 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 5 additions & 8 deletions
13
src/commonMain/kotlin/org/jetbrains/webwiz/generator/files/RootBuildGradle.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 50 additions & 27 deletions
77
src/commonMain/kotlin/org/jetbrains/webwiz/generator/files/SettingsGradle.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,58 @@ | ||
package org.jetbrains.webwiz.generator.files | ||
|
||
import org.jetbrains.webwiz.generator.NAN | ||
import org.jetbrains.webwiz.generator.ProjectFile | ||
import org.jetbrains.webwiz.generator.deleteNans | ||
import org.jetbrains.webwiz.models.* | ||
|
||
class SettingsGradle( | ||
val projectName: String, | ||
val moduleName: String, | ||
val addDevMaven: Boolean | ||
) : ProjectFile { | ||
class SettingsGradle(val projectInfo: ProjectInfo) : ProjectFile { | ||
private val addDevMaven = projectInfo.kotlinVersion == KotlinVersion.EAP | ||
override val path = "settings.gradle.kts" | ||
override val content: String | ||
get() = """ | ||
pluginManagement { | ||
repositories { | ||
google() | ||
gradlePluginPortal() | ||
mavenCentral() | ||
${if (addDevMaven) "maven(\"https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev/\")" else NAN} | ||
} | ||
} | ||
get() = buildString { | ||
appendLine("rootProject.name = \"${projectInfo.projectName.replace(' ', '_')}\"") | ||
appendLine("include(\":${projectInfo.moduleName}\")") | ||
appendLine() | ||
appendLine("pluginManagement {") | ||
appendLine(" repositories {") | ||
appendLine(" google()") | ||
appendLine(" gradlePluginPortal()") | ||
appendLine(" mavenCentral()") | ||
if (addDevMaven) { | ||
appendLine(" maven(\"https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev/\")") | ||
} | ||
appendLine(" }") | ||
appendLine(" plugins {") | ||
appendLine(" kotlin(\"multiplatform\").version(\"${projectInfo.kotlinVersion.versionName}\")") | ||
if (projectInfo.dependencies.contains(KmpLibrary.SERIALIZATION)) { | ||
appendLine(" kotlin(\"plugin.serialization\").version(\"${projectInfo.kotlinVersion.versionName}\")") | ||
} | ||
if (projectInfo.targets.contains(Target.ANDROID)) { | ||
appendLine(" id(\"com.android.library\").version(\"$AndroidGradlePluginVersion\")") | ||
} | ||
if (GradlePlugin.SQL_DELIGHT in projectInfo.gradlePlugins) { | ||
appendLine(" id(\"com.squareup.sqldelight\").version(\"$SqlDelightVersion\")") | ||
} | ||
if (GradlePlugin.REALM in projectInfo.gradlePlugins) { | ||
appendLine(" id(\"io.realm.kotlin\").version(\"$RealmVersion\")") | ||
} | ||
|
||
dependencyResolutionManagement { | ||
repositories { | ||
google() | ||
mavenCentral() | ||
${if (addDevMaven) "maven(\"https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev/\")" else NAN} | ||
} | ||
} | ||
rootProject.name = "${projectName.replace(' ', '_')}" | ||
include(":$moduleName") | ||
""".trimIndent().deleteNans() | ||
appendLine(" }") | ||
appendLine("}") | ||
appendLine() | ||
appendLine("dependencyResolutionManagement {") | ||
appendLine(" repositories {") | ||
appendLine(" google()") | ||
appendLine(" mavenCentral()") | ||
if (addDevMaven) { | ||
appendLine(" maven(\"https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev/\")") | ||
} | ||
appendLine(" }") | ||
appendLine(" versionCatalogs {") | ||
appendLine(" create(\"libs\") {") | ||
projectInfo.dependencies.forEach { dep -> | ||
appendLine(" library(\"${dep.versionCatalogName.replace(".", "-")}\",\"${dep.dep}\")") | ||
} | ||
appendLine(" }") | ||
appendLine(" }") | ||
appendLine("}") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.