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 to AGP 8, Gradle 8 and latest Realm Kotlin version. #43

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions Intro/androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ dependencies {
}

android {
namespace = "io.realm.example.kmmsample.androidApp"
signingConfigs {
getByName("debug") {
keyAlias = "androiddebugkey"
Expand Down Expand Up @@ -65,3 +66,9 @@ android {
targetCompatibility = JavaVersion.VERSION_1_8
}
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().all {
kotlinOptions {
jvmTarget = "1.8"
}
}
3 changes: 1 addition & 2 deletions Intro/androidApp/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
~ limitations under the License.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.realm.example.kmmsample.androidApp">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:allowBackup="false"
Expand Down
8 changes: 4 additions & 4 deletions Intro/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
plugins {
kotlin("multiplatform") version "1.8.20" apply false
id("com.android.library") version "7.3.0" apply false
kotlin("multiplatform") version "1.9.0" apply false
id("com.android.library") version "8.1.0" apply false
}

// Explicitly adding the plugin to the classpath as it makes it easier to control the version
// centrally (don't need version in the 'plugins' block). Further, snapshots are not published with
// marker interface so would need to be added to the classpath manually anyway.
buildscript {
dependencies {
classpath("io.realm.kotlin:gradle-plugin:1.9.0")
classpath("io.realm.kotlin:gradle-plugin:1.10.2")
}
}
rootProject.extra["realmVersion"] = "1.9.0"
rootProject.extra["realmVersion"] = "1.10.2"

group = "io.realm.example"
version = "1.0.0"
2 changes: 1 addition & 1 deletion Intro/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip

13 changes: 8 additions & 5 deletions Intro/shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,20 @@ kotlin {
implementation("com.google.android.material:material:1.6.1")
}
}
val androidTest by getting {
val androidInstrumentedTest by getting {
dependencies {
implementation(kotlin("test-junit"))
implementation("junit:junit:4.13.2")
implementation("androidx.test:runner:1.4.0")
implementation("androidx.test.ext:junit-ktx:1.1.3")
}
}
val androidUnitTest by getting {
dependencies {
implementation(kotlin("test-junit"))
implementation("junit:junit:4.13.2")
}
}
val iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
Expand All @@ -81,15 +87,12 @@ kotlin {
}
}
android {
namespace = "io.realm.example.kmmsample.androidLib"
compileSdk = 33
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdk = 21
targetSdk = 33
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
// FIXME connectedAndroidTest does not trigger any test.
// https://youtrack.jetbrains.com/issue/KT-35016
// https://github.com/realm/realm-kotlin/issues/73
sourceSets.getByName("androidTest").java.srcDir(file("src/androidTest/kotlin"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.realm.example.kmmsample

import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Assert
import org.junit.Assert.assertTrue
import org.junit.Test
import org.junit.runner.RunWith

Expand All @@ -28,6 +27,6 @@ class GreetingTestAndroid {

@Test
fun testExample() {
Assert.assertTrue("Check Android is mentioned", Greeting().greeting().contains("Android"))
assertTrue("Check Android is mentioned", Greeting().greeting().contains("Android"))
}
}
2 changes: 1 addition & 1 deletion Intro/shared/src/androidMain/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
~ limitations under the License.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="io.realm.example.kmmsample"/>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright 2020 JetBrains s.r.o.
* Copyright 2020 Realm Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.realm.example.kmmsample

import org.junit.Assert.assertTrue
import org.junit.Test

class GreetingTestAndroid {

@Test
fun testExample() {
assertTrue("Check Android is mentioned", Greeting().greeting().contains("Android"))
}
}
Loading