diff --git a/data/build.gradle b/data/build.gradle deleted file mode 100644 index 53515eb..0000000 --- a/data/build.gradle +++ /dev/null @@ -1,27 +0,0 @@ -plugins { - id("java-library") - id("kotlin") -} - -apply { - from(file("$rootDir/gradle_tests_report.gradle.kts")) -} - -java { - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 -} - -dependencies { - implementation project(":shared") - implementation(Deps.kotlin) - implementation(Deps.coroutines_android) - implementation(Deps.koin_core) - - testImplementation(Deps.junit) - testImplementation(Deps.coroutines_test) - testImplementation(Deps.hamcrest) - testImplementation(Deps.mockito) - testImplementation(Deps.mockk) - testImplementation(Deps.koin_test) -} \ No newline at end of file diff --git a/data/build.gradle.kts b/data/build.gradle.kts new file mode 100644 index 0000000..1bf24bc --- /dev/null +++ b/data/build.gradle.kts @@ -0,0 +1,55 @@ +plugins { + id("java-library") + kotlin("multiplatform") +} + +apply { + from(file("$rootDir/gradle_tests_report.gradle.kts")) +} + +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 +} + +kotlin { + jvm() + ios { + binaries.framework { + baseName = "data" + } + } + + sourceSets { + val commonMain by getting { + dependencies { + implementation(project(":shared")) + implementation(Deps.kotlin) + implementation(Deps.coroutines_core) + implementation(Deps.koin_core) + } + } + + val commonTest by getting { + dependencies { + implementation(Deps.commonTest) + implementation(Deps.commonAnnotations) + } + } + } + +} + +//dependencies { +// implementation(project(":shared")) +// implementation(Deps.kotlin) +// implementation(Deps.coroutines_android) +// implementation(Deps.koin_core) +// +// testImplementation(Deps.junit) +// testImplementation(Deps.coroutines_test) +// testImplementation(Deps.hamcrest) +// testImplementation(Deps.mockito) +// testImplementation(Deps.mockk) +// testImplementation(Deps.koin_test) +//} \ No newline at end of file diff --git a/data/src/main/java/com/soulesidibe/data/datasource/TodoLocalDataSource.kt b/data/src/commonMain/kotlin/com/soulesidibe/data/datasource/TodoLocalDataSource.kt similarity index 73% rename from data/src/main/java/com/soulesidibe/data/datasource/TodoLocalDataSource.kt rename to data/src/commonMain/kotlin/com/soulesidibe/data/datasource/TodoLocalDataSource.kt index 23a22cc..9b438e2 100644 --- a/data/src/main/java/com/soulesidibe/data/datasource/TodoLocalDataSource.kt +++ b/data/src/commonMain/kotlin/com/soulesidibe/data/datasource/TodoLocalDataSource.kt @@ -2,8 +2,6 @@ package com.soulesidibe.data.datasource import com.soulesidibe.data.model.TodoData import kotlinx.coroutines.flow.Flow -import java.sql.SQLException -import kotlin.jvm.Throws interface TodoLocalDataSource { @@ -11,9 +9,7 @@ interface TodoLocalDataSource { suspend fun getBy(id: String): TodoData? - @Throws(SQLException::class) suspend fun insert(todo: TodoData): Boolean - @Throws(SQLException::class) suspend fun remove(todo: TodoData) } \ No newline at end of file diff --git a/data/src/main/java/com/soulesidibe/data/di.kt b/data/src/commonMain/kotlin/com/soulesidibe/data/di.kt similarity index 100% rename from data/src/main/java/com/soulesidibe/data/di.kt rename to data/src/commonMain/kotlin/com/soulesidibe/data/di.kt diff --git a/data/src/commonMain/kotlin/com/soulesidibe/data/model/TodoData.kt b/data/src/commonMain/kotlin/com/soulesidibe/data/model/TodoData.kt new file mode 100644 index 0000000..29fb151 --- /dev/null +++ b/data/src/commonMain/kotlin/com/soulesidibe/data/model/TodoData.kt @@ -0,0 +1,3 @@ +package com.soulesidibe.data.model + +data class TodoData(val id: String, val title: String) \ No newline at end of file diff --git a/data/src/main/java/com/soulesidibe/data/model/mapper/mapper.kt b/data/src/commonMain/kotlin/com/soulesidibe/data/model/mapper/mapper.kt similarity index 100% rename from data/src/main/java/com/soulesidibe/data/model/mapper/mapper.kt rename to data/src/commonMain/kotlin/com/soulesidibe/data/model/mapper/mapper.kt diff --git a/data/src/main/java/com/soulesidibe/data/repository/TodoRepositoryImpl.kt b/data/src/commonMain/kotlin/com/soulesidibe/data/repository/TodoRepositoryImpl.kt similarity index 94% rename from data/src/main/java/com/soulesidibe/data/repository/TodoRepositoryImpl.kt rename to data/src/commonMain/kotlin/com/soulesidibe/data/repository/TodoRepositoryImpl.kt index a8ea1e2..e7271e3 100644 --- a/data/src/main/java/com/soulesidibe/data/repository/TodoRepositoryImpl.kt +++ b/data/src/commonMain/kotlin/com/soulesidibe/data/repository/TodoRepositoryImpl.kt @@ -12,7 +12,6 @@ import com.soulesidibe.domain.exception.NoTodosFoundException import com.soulesidibe.domain.repository.TodoRepository import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map -import java.sql.SQLException internal class TodoRepositoryImpl( private val dataSource: TodoLocalDataSource @@ -37,7 +36,7 @@ internal class TodoRepositoryImpl( override suspend fun addOrUpdate(todoEntity: TodoEntity): Boolean { try { return dataSource.insert(todoEntity.toDb()) - } catch (e: SQLException) { + } catch (e: Exception) { throw CannotAddOrUpdateException } @@ -47,7 +46,7 @@ internal class TodoRepositoryImpl( try { dataSource.remove(todoEntity.toDb()) return true - } catch (e: SQLException) { + } catch (e: Exception) { throw CannotRemoveTodoException } } diff --git a/data/src/test/kotlin/com/soulesidibe/data/repository/TodoRepositoryImplTest.kt b/data/src/commonTest/kotlin/com/soulesidibe/data/repository/TodoRepositoryImplTest.kt similarity index 100% rename from data/src/test/kotlin/com/soulesidibe/data/repository/TodoRepositoryImplTest.kt rename to data/src/commonTest/kotlin/com/soulesidibe/data/repository/TodoRepositoryImplTest.kt diff --git a/data/src/main/java/com/soulesidibe/data/model/TodoData.kt b/data/src/main/java/com/soulesidibe/data/model/TodoData.kt deleted file mode 100644 index 9c54f70..0000000 --- a/data/src/main/java/com/soulesidibe/data/model/TodoData.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.soulesidibe.data.model - -data class TodoData(val id: String = "${System.currentTimeMillis()}", val title: String) \ No newline at end of file diff --git a/domain/build.gradle b/domain/build.gradle index 354abd6..2af8ff5 100644 --- a/domain/build.gradle +++ b/domain/build.gradle @@ -7,8 +7,8 @@ apply { } java { - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 } dependencies {