reline
08/12/2019, 7:45 PMtasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
kotlinOptions.freeCompilerArgs += ["-Xuse-experimental=kotlin.Experimental"]
}
}
louiscad
08/12/2019, 7:51 PMreline
08/12/2019, 8:09 PMThis declaration is experimental and its usages should be marked with @ExperimentalCoroutinesApi or @UseExperimental(ExperimentalCoroutinesApi::class)
so I marked the class with the @UseExperimental annotation but then it warns me This class can only be used with the compiler argument -Xuse-experimental=kotlin.Experimental
. Does that differ from what you just said?
I’m also unsure on what operators to use to filter on test tasks only.louiscad
08/12/2019, 8:46 PMlouiscad
08/12/2019, 8:49 PM@UseExperimental
is experimental, so you need to opt-in to kotlin.Experimental
, but an alternative is to opt-in to kotlinx.coroutines.ExperimentalCoroutinesApi
and not need to add @UseExperimental
annotation to its usages.
I tend to use @UseExperimental
so I know exactly where they are in case I want or need to change them while them not being deprecated, but I could as well opt-in for all.miqbaldc
08/13/2019, 3:00 AM@EXperimentalApi
you'll refactor your code to the outside layer as well (the code that implemented it) and it's ugly imhomiqbaldc
08/13/2019, 3:03 AMtask.withType
inside the if condition if the source directory is under test
or androidTest
. But that would be my suggestion, I didn't tried that one as well.
*nice question