louiscad
03/07/2019, 12:51 AMandroidMain
sourceSet from Kotlin multiplatform plugin in an androidTest
sourceSet (instrumented test)?
My build.gradle.kts
includes the following:
android {
setDefaults()
sourceSets.getByName("androidTest").java.srcDir("src/androidInstrumentedTest/kotlin") // I put my instrumented tests here.
}
kotlin {
android()
sourceSets {
getByName("androidMain").dependencies {
// Some dependencies here
}
}
}
dependencies {
androidTestImplementation(Libs.kotlin.testJunit)
androidTestImplementation(Libs.androidX.test.coreKtx)
androidTestImplementation(Libs.androidX.test.ext.junit)
androidTestImplementation(Libs.androidX.test.runner)
androidTestImplementation(Libs.kotlinX.coroutines.android)
}
The problem I encounter is that it compiles, but when an instrumented test is run, there's NoClassDefFoundError
on anything defined in androidMain
(be it source or dependency).
Note that the IDE shows no warning and allows me to use the dependencies from androidInstrumentedTest
, but it fails at runtime.carlos cdmp
03/07/2019, 12:44 PMpardom
03/07/2019, 3:06 PM@property (class, readonly) CounterCoreCoroutineStart *default;
Jaroslav
03/08/2019, 11:22 AMkotlin.NotImplementedError: An operation is not implemented: Not implemented
? I`m using kotlin library in ios, with a lot of code, so it will take me a lot of time to find what exactly is not implemented 😞pardom
03/08/2019, 2:52 PMkotlin.TypeCastException
that I’m hoping you all can help with. In order to get around generics and casting issues in K/N, I’ve quarantined a call to a generic function to the common Kotlin code in an mpp project: https://github.com/pardom/oolong/pull/16/files#diff-b6307a0524635d6d8940c58b27823806R48. This fixes the compiler errors in Swift, however it fails at runtime due to casting. Any ideas why?pardom
03/08/2019, 3:00 PMGarouDan
03/08/2019, 3:22 PMkotlin("multiplatform")
and spring boot.
I’ve filed an issue about that here: https://youtrack.jetbrains.com/issue/KT-30340
I was talking with the folks in the spring boot gitter chat and they said: but I would guess that, unlike, the JVM platform plugin, it doesn't apply Gradle's Java plugin
If someone knows how to fix this please tell me 😃pardom
03/08/2019, 4:00 PMAndrey Gromov
03/09/2019, 3:33 PMenableFeaturePreview("GRADLE_METADATA")
into settings.gradle resolve problem. 7 f**g hours dancing with tambourine...pardom
03/10/2019, 1:36 AMjs
target for npm? I thought I saw one somewhere but I don’t remember where.Trevor Stone
03/11/2019, 4:44 AMgumil
03/11/2019, 9:58 AMkotlin-platform-common
already deprecated? should we just use the `multiplatform`plugin? I can’t find documentation on kotlin-platform-common
Riccardo Montagnin
03/12/2019, 6:42 AMcommonTest
without any jvm
or other module? If I try to run gradle check
I get the following error:
> Task :compileKotlinJvm
e: ...: Unresolved reference: Json
Where Json
is imported as
import kotlinx.serialization.json.Json
And my dependencies are the following:
kotlin.sourceSets {
commonMain.dependencies {
api "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serialization_version"
}
}
pajatopmr
03/12/2019, 1:31 PMMarc Knaup
03/12/2019, 3:42 PMbasher
03/12/2019, 4:37 PMwarning: inliner failed to obtain function declaration: <package>.<class>.<function>
Has anyone run into this before?jw
03/13/2019, 12:26 AMPatrick Jackson
03/13/2019, 2:02 PMby lazy
fixes the problem.pajatopmr
03/13/2019, 6:02 PMclassLoader.getResource("foo.txt")
during a test? And is the package relevant?ivan.savytskyi
03/13/2019, 8:27 PMlinkerOpts
for compilation tests? in MPP project (MPP gradle plugin)
If I do this:
def iosPreset = findProperty("kn.ios.target") == "arm" ? presets.iosArm64 : presets.iosX64
fromPreset(iosPreset, 'ios') {
compilations.all {
kotlinOptions.freeCompilerArgs = ["-Xverbose-phases=linker"]
outputKinds('FRAMEWORK')
linkerOpts "-F./libs"
I’m getting error llvm-lto: error: Linking globals named 'ktype:com.greeter.NSObjectProtocolMeta': symbol multiply defined!
Is there any way I can provide linkerOpts
for test compilationivan.savytskyi
03/13/2019, 9:58 PMlinkTestDebugExecutableIos
task (test.kexe). As if I run this kexe on the simulator obviously I get dyld: Library not loaded
?Cyrille QUÉMIN
03/14/2019, 6:55 PM1.3.30-eap-42
, it used to build properly with kotlin 1.3.20
. Now it crashes when creating the test executable with this error:
> Task :p2p-common:linkTestDebugExecutableIOS
e: Compilation failed: null
* Source files: ExtensionsTest.kt, P2PCommandMessageBuilderTest.kt, SerializationTests.kt
* Compiler version info: Konan: 1.2-eap-8472 / Kotlin: 1.3.30
* Output kind: PROGRAM
e: kotlin.KotlinNullPointerException
Marc Knaup
03/14/2019, 8:13 PMPatrick Jackson
03/15/2019, 3:20 PMobject
singletons treated like normal classes in kotlin native? specifically when accessing from iOS Swift? Seems like the responsibility of swift code to maintain the singleton instance unless I am missing something.galex
03/15/2019, 6:32 PMkotlin-multiplatform
gradle plugin? I keep seeing libraries using the org.jetbrains.kotlin.multiplatform
plugin. Is it the same one as kotlin-multiplatform
plugin?GarouDan
03/15/2019, 6:41 PMkotlin("multiplatform")
plugin we can do something like:
val jvmMain by getting {
...
}
but how our build process knows that if we write jvmMain2
in the variable name instead of jvmMain
our sourceset does not exist?
My motivation is that I would like to do something similar, probably using my buildSrc
, but I don’t know which kind of magic we are using here.
Is the kotlin build process somehow extracting the variable names and comparing them with the available sourcesets?Dico
03/16/2019, 12:18 PMMarc Knaup
03/16/2019, 3:36 PMLocale
and/or Currency
yet?GarouDan
03/16/2019, 7:23 PMval mobileMain by creating {...}
, can we put this result in a map, without creating a new val
?
For example, something similar to: myMap["mobileMain"] by creating {...}
(do not compile)
My motivation is that I would like to create a helper method to store sourceSets in a map, since I would like to consult this map later.
The creating
delegation is using something like:
operator fun provideDelegate(thisRef: Any?, property: KProperty<*>) = ExistingDomainObjectDelegate.of(
when (configuration) {
null -> container.create(property.name)
else -> container.create(property.name, configuration)
}
)
gumil
03/16/2019, 9:35 PMgumil
03/16/2019, 9:35 PMDominaezzz
03/16/2019, 9:43 PMgumil
03/16/2019, 10:02 PMmain {
kotlin.srcDirs = ['src/main/kotlin', '../common/src/main/kotlin', '../../json/common/src']
component {
baseName = "kotlinx-serialization-runtime-native"
// todo: fixme, k/n!
publishJavadoc = false
publishSources = false
outputKinds = [KLIBRARY]
if (!deployMode)
target 'host'
else
targets = [ 'ios_arm64', 'ios_arm32', 'ios_x64', 'macos_x64', 'linux_x64', 'mingw_x64' ]
extraOpts experimentalsEnabled
}
}
outputKinds = [KLIBRARY]
but KLIBRARY seems not an enum anymore.Dominaezzz
03/16/2019, 10:04 PMKLIBRARY
, if you don't specify any other type.gumil
03/16/2019, 10:06 PMDominaezzz
03/16/2019, 10:12 PMgumil
03/16/2019, 10:17 PMDominaezzz
03/16/2019, 10:19 PMgumil
03/16/2019, 10:29 PMDominaezzz
03/16/2019, 10:33 PM