Browse Source

Fix Todo example Deps (#1607)

task `gradlew jsBrowserDevelopmentRun` didn't work
pull/1614/head
Igor Demin 3 years ago committed by GitHub
parent
commit
b2213e3132
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      examples/todoapp/buildSrc/build.gradle.kts
  2. 29
      examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt
  3. 1
      examples/todoapp/buildSrc/gradle.properties
  4. 2
      examples/todoapp/buildSrc/src/main/kotlin/android-setup.gradle.kts
  5. 2
      examples/todoapp/buildSrc/src/main/kotlin/multiplatform-compose-setup.gradle.kts
  6. 12
      examples/todoapp/buildSrc/src/main/kotlin/multiplatform-setup.gradle.kts
  7. 3
      examples/todoapp/gradle.properties

8
examples/todoapp/buildSrc/build.gradle.kts

@ -2,6 +2,8 @@ plugins {
`kotlin-dsl`
}
initDeps(project)
repositories {
mavenLocal()
google()
@ -10,8 +12,8 @@ repositories {
}
dependencies {
implementation(Deps.JetBrains.Compose(project).gradlePlugin)
implementation(Deps.JetBrains.Kotlin(project).gradlePlugin)
implementation(Deps.JetBrains.Compose.gradlePlugin)
implementation(Deps.JetBrains.Kotlin.gradlePlugin)
implementation(Deps.Android.Tools.Build.gradlePlugin)
implementation(Deps.Squareup.SQLDelight.gradlePlugin)
}
@ -19,4 +21,4 @@ dependencies {
kotlin {
// Add Deps to compilation, so it will become available in main project
sourceSets.getByName("main").kotlin.srcDir("buildSrc/src/main/kotlin")
}
}

29
examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt

@ -1,23 +1,28 @@
// We store Kotlin and Compose versions in gradle.properties to
// We store Kotlin and Compose versions in gradle.properties to
// be able to override them on CI.
// You probably won't need this, so you can get rid of `project` in this file.
import org.gradle.api.Project
lateinit var properties: Map<String, *>
fun initDeps(project: Project) {
properties = project.properties
}
object Deps {
object JetBrains {
class Kotlin(private val project: Project) {
private val VERSION = project.properties["kotlin.version"]
val gradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$VERSION"
val testCommon = "org.jetbrains.kotlin:kotlin-test-common:$VERSION"
val testJunit = "org.jetbrains.kotlin:kotlin-test-junit:$VERSION"
val testJs = "org.jetbrains.kotlin:kotlin-test-js:$VERSION"
val testAnnotationsCommon = "org.jetbrains.kotlin:kotlin-test-annotations-common:$VERSION"
object Kotlin {
private val VERSION get() = properties["kotlin.version"]
val gradlePlugin get() = "org.jetbrains.kotlin:kotlin-gradle-plugin:$VERSION"
val testCommon get() = "org.jetbrains.kotlin:kotlin-test-common:$VERSION"
val testJunit get() = "org.jetbrains.kotlin:kotlin-test-junit:$VERSION"
val testJs get() = "org.jetbrains.kotlin:kotlin-test-js:$VERSION"
val testAnnotationsCommon get() = "org.jetbrains.kotlin:kotlin-test-annotations-common:$VERSION"
}
class Compose(private val project: Project) {
private val VERSION = project.properties["compose.version"]
val gradlePlugin = "org.jetbrains.compose:compose-gradle-plugin:$VERSION"
object Compose {
private val VERSION get() = properties["compose.version"]
val gradlePlugin get() = "org.jetbrains.compose:compose-gradle-plugin:$VERSION"
}
}

1
examples/todoapp/buildSrc/gradle.properties

@ -1,2 +1,3 @@
# TODO can we get rid of duplication with root gradle.properties?
kotlin.version=1.6.10
compose.version=1.0.1-rc2

2
examples/todoapp/buildSrc/src/main/kotlin/android-setup.gradle.kts

@ -2,6 +2,8 @@ plugins {
id("com.android.library")
}
initDeps(project)
android {
compileSdkVersion(31)

2
examples/todoapp/buildSrc/src/main/kotlin/multiplatform-compose-setup.gradle.kts

@ -6,6 +6,8 @@ plugins {
id("org.jetbrains.compose")
}
initDeps(project)
kotlin {
jvm("desktop")
android()

12
examples/todoapp/buildSrc/src/main/kotlin/multiplatform-setup.gradle.kts

@ -3,6 +3,8 @@ plugins {
id("kotlin-multiplatform")
}
initDeps(project)
kotlin {
jvm("desktop")
android()
@ -15,24 +17,24 @@ kotlin {
sourceSets {
named("commonTest") {
dependencies {
implementation(Deps.JetBrains.Kotlin(project).testCommon)
implementation(Deps.JetBrains.Kotlin(project).testAnnotationsCommon)
implementation(Deps.JetBrains.Kotlin.testCommon)
implementation(Deps.JetBrains.Kotlin.testAnnotationsCommon)
}
}
named("androidTest") {
dependencies {
implementation(Deps.JetBrains.Kotlin(project).testJunit)
implementation(Deps.JetBrains.Kotlin.testJunit)
}
}
named("desktopTest") {
dependencies {
implementation(Deps.JetBrains.Kotlin(project).testJunit)
implementation(Deps.JetBrains.Kotlin.testJunit)
}
}
named("jsTest") {
dependencies {
implementation(Deps.JetBrains.Kotlin(project).testJs)
implementation(Deps.JetBrains.Kotlin.testJs)
}
}
}

3
examples/todoapp/gradle.properties

@ -22,3 +22,6 @@ kotlin.code.style=official
org.gradle.parallel=true
org.gradle.caching=true
kotlin.native.disableCompilerDaemon=true
kotlin.version=1.6.10
compose.version=1.0.1-rc2
Loading…
Cancel
Save