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
4 changed files
with
47 additions
and
32 deletions.
There are no files selected for viewing
46 changes: 17 additions & 29 deletions
46
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,29 @@ | ||
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.GradlePlugin | ||
import org.jetbrains.webwiz.models.KmpLibrary | ||
import org.jetbrains.webwiz.models.KotlinVersion | ||
import org.jetbrains.webwiz.models.ProjectInfo | ||
import org.jetbrains.webwiz.models.Target | ||
|
||
class RootBuildGradle(val projectInfo: ProjectInfo) : ProjectFile { | ||
override val path = "build.gradle.kts" | ||
override val content: String | ||
get() = | ||
""" | ||
buildscript { | ||
repositories { | ||
gradlePluginPortal() | ||
google() | ||
mavenCentral() | ||
${if (projectInfo.kotlinVersion == KotlinVersion.Dev) "maven(\"https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev/\")" else NAN} | ||
} | ||
dependencies { | ||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${projectInfo.kotlinVersion.versionName}") | ||
${if (projectInfo.dependencies.contains(KmpLibrary.SERIALIZATION)) "classpath(\"org.jetbrains.kotlin:kotlin-serialization:${projectInfo.kotlinVersion.versionName}\")" else NAN} | ||
${if (projectInfo.targets.contains(Target.ANDROID)) "classpath(\"com.android.tools.build:gradle:7.1.2\")" else NAN} | ||
${if (GradlePlugin.SQL_DELIGHT in projectInfo.gradlePlugins) "classpath(\"com.squareup.sqldelight:gradle-plugin:1.5.3\")" else NAN} | ||
${if (GradlePlugin.REALM in projectInfo.gradlePlugins) "classpath(\"io.realm.kotlin:gradle-plugin:0.9.0\")" else NAN} | ||
} | ||
} | ||
allprojects { | ||
repositories { | ||
google() | ||
mavenCentral() | ||
${if (projectInfo.kotlinVersion == KotlinVersion.Dev) "maven(\"https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev/\")" else NAN} | ||
} | ||
} | ||
""".trimIndent().deleteNans() | ||
get() = buildString { | ||
appendLine("plugins {") | ||
appendLine(" kotlin(\"multiplatform\").version(\"${projectInfo.kotlinVersion.versionName}\").apply(false)") | ||
if (projectInfo.dependencies.contains(KmpLibrary.SERIALIZATION)) { | ||
appendLine(" kotlin(\"plugin.serialization\").version(\"${projectInfo.kotlinVersion.versionName}\").apply(false)") | ||
} | ||
if (projectInfo.targets.contains(Target.ANDROID)) { | ||
appendLine(" id(\"com.android.library\").version(\"7.2.0\").apply(false)") | ||
} | ||
if (GradlePlugin.SQL_DELIGHT in projectInfo.gradlePlugins) { | ||
appendLine(" id(\"com.squareup.sqldelight\").version(\"1.5.3\").apply(false)") | ||
} | ||
if (GradlePlugin.REALM in projectInfo.gradlePlugins) { | ||
appendLine(" id(\"io.realm.kotlin\").version(\"0.9.0\").apply(false)") | ||
} | ||
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