Lukasz Ciastko
04/15/2022, 1:53 PMVivek Modi
04/15/2022, 1:59 PMactual class Platform actual constructor() {
actual val versionCode = AppConfig.versionCode
}
interface AppConfig {
val versionCode: String
}
But I am getting errorjulioromano
04/15/2022, 4:01 PM> Task :shared:compileKotlinIosSimulatorArm64 NO-SOURCE
> Task :shared:linkDebugFrameworkIosSimulatorArm64 NO-SOURCE
> Task :shared:assembleDebugAppleFrameworkForXcodeIosSimulatorArm64 NO-SOURCE
Which is true because technically there is no source file in that module, it only includes other modules as dependencies.
Nevertheless no actual framework is generated and the next Gradle task fails with:
> Task :shared:embedAndSignAppleFrameworkForXcode FAILED
cp: /.../project/shared/build/xcode-frameworks/Debug/iphonesimulator15.4/shared.framework: No such file or directory
The same umbrella module works fine if imported from the android app (I can use and see all its transitive dependencies).
How to debug this?julioromano
04/15/2022, 7:36 PMUndefined symbols for architecture arm64
during a KMM build (using sqldelight).
See 🧵 for full error log.
It seems similar to https://github.com/cashapp/sqldelight/issues/1442 but it’s not the same exact missing symbols.
What could this be? (perhaps related to: https://kotlinlang.slack.com/archives/C3PQML5NU/p1650038479860419)James Black
04/17/2022, 2:10 AMfun addClothingToClothingWeather(clothing:ClothingTypes) {
if(clothingWeatherData == null) clothingWeatherData = ClothingWeatherModel()
clothingWeatherData!!.clothing?.toMutableList()?.add(clothing)
}
@Serializable
data class ClothingWeatherModel(val clothing:List<ClothingTypes>? = emptyList(), val temperature:MainTemperature? = null, val situation:Situations? = null)
martmists
04/17/2022, 1:37 PMtasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.freeCompilerArgs = listOf("-Xcontext-receivers")
}
tasks.withType<Kotlin2JsCompile> {
kotlinOptions.freeCompilerArgs = listOf("-Xcontext-receivers")
}
tasks.withType<KotlinCompileCommon> {
kotlinOptions.freeCompilerArgs = listOf("-Xcontext-receivers")
}
tasks.withType<KotlinNativeCompile> {
kotlinOptions.freeCompilerArgs = listOf("-Xcontext-receivers")
}
And then inspecting it in File -> Project Settings -> Modules shows it being added to every target except commonMain/commonTestArjan van Wieringen
04/17/2022, 5:52 PMtasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class).all {
kotlinOptions.freeCompilerArgs = listOf("-Xcontext-receivers")
}
And my context receiver is simple:
context(Node.BuilderScope)
fun foo() {
// nothing here yet
}
The error I am getting:
java.lang.IllegalStateException: FULL: FUN name:foo visibility:public modality:FINAL <> (<this>:nl.avwie.vdom.Node.BuilderScope) returnType:kotlin.Unit
Ir: nl.avwie.vdom#foo(nl.avwie.vdom.Node.BuilderScope){}
Descriptor: nl.avwie.vdom#foo!nl.avwie.vdom.Node.BuilderScope(){}
at org.jetbrains.kotlin.backend.common.serialization.mangle.ManglerChecker$visitDeclaration$2.invoke(ManglerChecker.kt:96)
at org.jetbrains.kotlin.backend.common.serialization.mangle.ManglerChecker$visitDeclaration$2.invoke(ManglerChecker.kt:95)
phuc.tran
04/18/2022, 6:08 AMHasan Nagizade
04/18/2022, 6:32 AMhandstandsam
04/18/2022, 1:26 PMjava-library
to a kotlin("multiplatform")
project configuration? I'm looking to slowly introduce Kotlin Multiplatform on a few modules that currently only target the JVM. I'd like a way to swap between the two so there is less hesitation from other developers to give it a try. Basically it would make the KMP module "backwards compatible" to just a java-library, and completely avoid any references to multiplatform plugins when it was switched off.
Goals:
• Just change "myplugin.jvm.lib" to "myplugin.kmp.lib".
• This would take all dependencies
from the java-library and make them dependencies on commonMain
.
• It would be nice to just change one line and see if it compiles to Kotlin Multiplatform as commonMain
.
I've given this a try, but when trying to map dependencies I get: Unresolved reference: implementation
because it should be a commonMain
dependency instead. I've thought about two ways of approaching this:
• See if I can just iterate through declared dependencies, move them to commonMain, and remove them from the default dependencies block.
• Create a custom "commonDependencies {}" extension that can then map to either.
I'm looking at how I can do this, but wanted to see if any tools or processes currently exist to make a one-line backwards compatible (java-library instead of kotlin("multiplatform")) module?Dan Katz
04/18/2022, 5:22 PMDavid Gonzalez
04/19/2022, 2:39 PMLucas Schiavini
04/19/2022, 2:39 PMMendess
04/19/2022, 4:22 PMSunny
04/19/2022, 6:02 PMException is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':database:jsBrowserTest'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:145)
at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:282)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:143)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:131)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:77)
at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:74)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:402)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:389)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:382)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:368)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:61)
Caused by: java.util.NoSuchElementException: No value present
kierans777
04/20/2022, 1:06 AMsdk
in the project) to iOS. When I run ./gradlew build
the compileKotlinMetadata
step fails. How can I fix this please?
(I've moved the CLI output into the thread)brabo-hi
04/20/2022, 2:48 AMMendess
04/20/2022, 9:51 AMclass Foo<T>(val array: Array<T>)
but when I annotate with @JsExport
I get the warning saying Array is not exportable, but the docs seem to suggest otherwise.
error: Exported declaration uses non-exportable property type: Array<T>
docs: https://kotlinlang.org/docs/js-to-kotlin-interop.html#kotlin-types-in-javascripteygraber
04/20/2022, 2:28 PMUri
, JS URL
, iOS swift-URI
, Native haven't found anything yet (all the implementations have slightly different behavior + I haven't found a simple solution for native)
3. Port an existing implementation to KMP
I've started all 3 approaches, and I'm leaning towards #3, and porting Android Uri
Slackbot
04/20/2022, 3:57 PMkierans777
04/21/2022, 2:06 AMNSDecimal
from a String
. However I'm not sure how to as the NSDecimal
constructor only takes a NativePtr
argument. Can someone tell me how to do this please? 😄benkuly
04/21/2022, 5:50 AMeygraber
04/21/2022, 6:40 AMcommonMain
source set, but Intellij 2022.1 can't resolve them (building via command line works fine). Android Studio Bumblebee works fine. Is that expected?martmists
04/21/2022, 12:59 PMansman
04/21/2022, 2:16 PMMap
types to JS so I added a MapWrapper<K, V> : Map<K, V
that is `@JsExport`ed. But even if I manually override the method they still don’t end up in the typescript definitions. It seems that all functions that are declared in a non exported interface are not included in the export. Does anyone know of a workaround?Jose Garcia
04/21/2022, 3:27 PMmyproject:iosX64Test
iosX64 target but is passing on myproject:iosSimulatorArm64Test
. How could I find the reason for this happening? Does anything to do with the fact I am using an Arm64 chip (Apple M1)?martmists
04/21/2022, 5:14 PMjulioromano
04/21/2022, 9:54 PMembedAndSignAppleFrameworkForXcode
to cocoapods ( following docs at: https://kotlinlang.org/docs/native-cocoapods-xcode.html ).
Whenever I try to launch the iosApp (both from within Android Studio and Xcode) it fails with: ld: framework not found Pods_iosApp
.
It seems the linker cannot find the framework generated by cocoapods? Any idea how to debug this?kpgalligan
04/21/2022, 10:37 PM*.xcworkspace
rather than *.xcodeproj
. When you use cocoapods, you need to open a different project file. I don’t know that AS would still be failing, though (not sure how the plugin picks project configs, and I use Xcode most of the time)eygraber
04/21/2022, 10:55 PMByteBuffer
code. I'm using ktor-io but there's something that I'm not doing correctly. Code in 🧵eygraber
04/21/2022, 10:55 PMByteBuffer
code. I'm using ktor-io but there's something that I'm not doing correctly. Code in 🧵if (byteBuffer.position() == 0) {
return;
}
byteBuffer.flip();
try {
builder.append(decoder.decode(byteBuffer));
} catch (CharacterCodingException e) {
if (throwOnFailure) {
throw new IllegalArgumentException(e);
} else {
builder.append(INVALID_INPUT_CHARACTER);
}
} finally {
// Use the byte buffer to write again.
byteBuffer.flip();
byteBuffer.limit(byteBuffer.capacity());
}
Buffer
):
if(writePosition == 0) return
resetForRead()
try {
builder.append(readBytes().decodeToString())
}
catch(e: Exception) {
if(throwOnFailure) {
throw IllegalArgumentException(e)
}
else {
builder.append(INVALID_INPUT_CHARACTER)
}
}
finally {
reset()
}
readBytes
(this is after writing 1 byte to the buffer then calling my function, then writing 3 bytes to the buffer then calling my function, then writing 3 bytes to the buffer then calling my function):
47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-60, -126, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-32, -95, -128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
ephemient
04/21/2022, 11:21 PMBuffer
you're using. doesn't seem to be okio.BufferresetForRead()
doesn't seem to be equivalent to `flip()`: it marks the whole buffer as readable, not just the part up to the write positioneygraber
04/21/2022, 11:25 PMBuffer
but my IDE is having issues resolving dependencies, so it's hard to step through it to see how it works.
I'm assuming there's a way to do it with okio.Buffer
as well?ephemient
04/21/2022, 11:28 PMeygraber
04/21/2022, 11:37 PM