Skip to content

Conversation

opatry
Copy link
Owner

@opatry opatry commented Jun 14, 2025

Description

Wasn't possible to tests Dao in :tasks-core because of the lack of database instance.
It is possible create a database dedicated to :tasks-core tests in test source set.
It can't be put in commonTest though, because only targeting jvm() and not androidTarget(), leading to KSP not generating database impl.


❌ After all, it doesn't work yet…

Cannot find implementation for net.opatry.tasks.data.TasksCoreTestDatabase. TasksCoreTestDatabase_Impl does not exist. Is Room annotation processor correctly configured?

It was working due to iterative tests locally.

Maybe it only works when DB is defined in module sources, not test sources.


❌ After moving test DB in main sources, tests work but Android app build fails due to Dao impl being defined multiple times.

ERROR: /home/runner/work/taskfolio/taskfolio/tasks-app-shared/build/intermediates/runtime_library_classes_jar/release/bundleLibRuntimeToJarRelease/classes.jar: R8: Type net.opatry.tasks.data.TaskDao_Impl$1 is defined multiple times: /home/runner/work/taskfolio/taskfolio/tasks-app-shared/build/intermediates/runtime_library_classes_jar/release/bundleLibRuntimeToJarRelease/classes.jar:net/opatry/tasks/data/TaskDao_Impl$1.class, /home/runner/work/taskfolio/taskfolio/tasks-core/build/libs/tasks-core-jvm.jar:net/opatry/tasks/data/TaskDao_Impl$1.class

Checklist

  • I have read the CONTRIBUTING guide
  • Code compiles correctly
  • Created tests which fail without the change (if possible)
  • All tests passing

Copy link
Contributor

Job Summary for Gradle

Build & Test :: unit-tests
Gradle Root Project Requested Tasks Gradle Version Build Outcome Build Scan®
Taskfolio test :tasks-app-android:testStoreReleaseUnitTest jvmTest 8.12.1 Build Scan not published

@opatry opatry force-pushed the tasks-core-tests branch from 14e68a5 to 152ab8d Compare June 14, 2025 18:52
Copy link
Contributor

Job Summary for Gradle

Build & Test :: unit-tests
Gradle Root Project Requested Tasks Gradle Version Build Outcome Build Scan®
Taskfolio test :tasks-app-android:testStoreReleaseUnitTest jvmTest 8.12.1 Build Scan not published

@opatry opatry marked this pull request as draft June 14, 2025 18:54
Copy link
Contributor

Job Summary for Gradle

Build & Test :: build
Gradle Root Project Requested Tasks Gradle Version Build Outcome Build Scan®
Taskfolio :tasks-app-android:assembleStoreRelease 8.12.1 Build Scan not published

@opatry
Copy link
Owner Author

opatry commented Jun 15, 2025

Use kspTest?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant