Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the tutorial build scripts with 1.9.20 APIs #3824

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,25 +78,23 @@ Both the `kotlinx.serialization` and SQLDelight libraries also require additiona
val dateTimeVersion = "%dateTimeVersion%"

sourceSets {
targetHierarchy.default()

val commonMain by getting {
commonMain {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
implementation("io.ktor:ktor-client-core:$ktorVersion")
implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
implementation("com.squareup.sqldelight:runtime:$sqlDelightVersion")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:$dateTimeVersion")
}
}
val androidMain by getting {
}
androidMain {
dependencies {
implementation("io.ktor:ktor-client-android:$ktorVersion")
implementation("com.squareup.sqldelight:android-driver:$sqlDelightVersion")
}
}
val iosMain by getting {
iosMain {
// ...
dependencies {
implementation("io.ktor:ktor-client-darwin:$ktorVersion")
Expand All @@ -117,32 +115,12 @@ Both the `kotlinx.serialization` and SQLDelight libraries also require additiona
```kotlin
plugins {
// ...
kotlin("plugin.serialization") version "%kotlinVersion%"
id("com.squareup.sqldelight")
kotlin("plugin.serialization").version("%kotlinVersion%")
id("com.squareup.sqldelight").version("%sqlDelightVersion%")
}
```

3. Now go to the `build.gradle.kts` file in the project _root directory_ and specify the classpath for the plugin in the
build system dependencies:

```kotlin
buildscript {

dependencies {
// ...
classpath("com.squareup.sqldelight:gradle-plugin:%sqlDelightVersion%")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason to specify buildscript dependencies explicitly? I think the explicit version in the plugins block achieves the same goal

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, looks better. If it's not used in the sample project, we can remove it

}
}
```

4. Finally, define the SQLDelight version in the `gradle.properties` file in the project _root directory_ to ensure that
the SQLDelight versions of the plugin and the libraries are the same:

```none
sqlDelightVersion=%sqlDelightVersion%
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find a reference to this property anywhere. Could it have been left by accident from an earlier tutorial revision or did I miss something?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I guess it's something old. If it's not used in the sample project, we can remove it

```

5. Sync the Gradle project.
3. Sync the Gradle project.

Learn more about adding [dependencies on multiplatform libraries](multiplatform-add-dependencies.md).

Expand Down Expand Up @@ -574,8 +552,8 @@ dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1")
implementation("androidx.core:core-ktx:1.10.1")
implementation("androidx.recyclerview:recyclerview:1.3.0")
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
implementation("androidx.cardview:cardview:1.0.0")
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
implementation("androidx.cardview:cardview:1.0.0")
}
// ...
```
Expand Down