Amritansh
02/08/2021, 7:41 PMPaul Woitaschek
02/09/2021, 5:32 PMPeter Tran
02/10/2021, 12:00 AMT_(Data) data = __ kotlin.root.getMutable();
Why is this object not released via DisposeStablePointer()
like the other objects returned from the KN side?
(@olonho/@svyatoslav.scherbina ?)Paul Woitaschek
02/10/2021, 7:32 AMwatchos
shortcut but don't want the new watchosx64
that gets added on 1.3.0 because the stable versions of serialization and ktor don't support it yet.Andrey Logoshko
02/11/2021, 1:38 PMaleksey.tomin
02/17/2021, 1:19 PMe: Compilation failed: Backend Internal error: Exception during IR lowering
File being compiled: /Users/atomin/Documents/iq/xpoint-sdk/sdk/src/commonMain/kotlin/com/inventale/xpoint/sdk/Checker.kt
The root cause java.lang.AssertionError was thrown at: org.jetbrains.kotlin.ir.overrides.FakeOverrideBuilderStrategy.fakeOverrideMember(IrOverridingUtil.kt:43)
* Source files:
* Compiler version info: Konan: 1.4.30 / Kotlin: 1.4.30
* Output kind: PROGRAM
e: org.jetbrains.kotlin.backend.common.BackendException: Backend Internal error: Exception during IR lowering
File being compiled: /Users/atomin/Documents/iq/xpoint-sdk/sdk/src/commonMain/kotlin/com/inventale/xpoint/sdk/Checker.kt
The root cause java.lang.AssertionError was thrown at: org.jetbrains.kotlin.ir.overrides.FakeOverrideBuilderStrategy.fakeOverrideMember(IrOverridingUtil.kt:43)
at org.jetbrains.kotlin.backend.common.CodegenUtil.reportBackendException(CodegenUtil.kt:239)
at org.jetbrains.kotlin.backend.common.CodegenUtil.reportBackendException$default(CodegenUtil.kt:235)
at org.jetbrains.kotlin.backend.common.phaser.PerformByIrFilePhase.invoke(PhaseBuilders.kt:124)
...
Caused by: java.lang.AssertionError: Unexpected variance in super type argument: in @0
at org.jetbrains.kotlin.ir.overrides.FakeOverrideBuilderStrategy.fakeOverrideMember(IrOverridingUtil.kt:43)
at org.jetbrains.kotlin.ir.overrides.IrOverridingUtil.buildFakeOverridesForClassUsingOverriddenSymbols(IrOverridingUtil.kt:168)
at org.jetbrains.kotlin.backend.common.ir.IrUtilsKt.addFakeOverrides(IrUtils.kt:487)
at org.jetbrains.kotlin.backend.common.ir.IrUtilsKt.addFakeOverrides$default(IrUtils.kt:485)
I can’t share project source.
How can I fix the problem?tieskedh
02/17/2021, 7:27 PMsalomonbrys
02/19/2021, 3:10 PMosVersionMin.ios_x64
and osVersionMin.ios_arm64
on a per-project basis (rather in ~/.konan
) ?JoakimForslund
02/21/2021, 10:13 AMDave Trollope
02/21/2021, 6:51 PMJeff Tycz
02/22/2021, 3:45 AM- (NSString *)hmacsha1:(NSString *)data secret:(NSString *)key {
const char *cKey = [key cStringUsingEncoding:NSASCIIStringEncoding];
const char *cData = [data cStringUsingEncoding:NSASCIIStringEncoding];
unsigned char cHMAC[CC_SHA1_DIGEST_LENGTH];
CCHmac(kCCHmacAlgSHA1, cKey, strlen(cKey), cData, strlen(cData), cHMAC);
NSData *HMAC = [[NSData alloc] initWithBytes:cHMAC length:sizeof(cHMAC)];
NSString *hash = [HMAC base64String];
return hash;
}
This is currently what I have
actual fun generateHmacSha1Signature(key: String, value: String): String = memScoped{
val nsKey = NSString.create(string = key)
val nsValue = NSString.create(string = value)
val encodedKey = nsKey.cStringUsingEncoding(NSUTF16StringEncoding)
val encodedValue = nsValue.cStringUsingEncoding(NSUTF16StringEncoding)
val cHMAC = ByteArray(CC_SHA1_DIGEST_LENGTH)
CCHmac(kCCHmacAlgSHA1, encodedKey, strlen(encodedKey?.toKString()), encodedValue, strlen(encodedValue?.toKString()), cHMAC.asUByteArray().toCValues())
val data:NSData = NSData.create(bytes = allocArrayOf(cHMAC), length = cHMAC.size.toULong())
return data.base64EncodedStringWithOptions(NSDataBase64DecodingIgnoreUnknownCharacters)
}
The problem with what I have though is that it does not seem to be generating a correct SHA1 signature. I get AAAAAAAAAAAAAAAAAAAAAAAAAAA=
as a value when I use it. The part that don't think is correct is the CCHmac
because I was not sure if I was getting the string length correctly and the cHMAC
ByteArray correctly.
Can anyone tell me where I went wrong?Brian Dilley
02/22/2021, 4:50 AMMatthieu Stombellini
02/22/2021, 1:27 PMval result: CValue<Thing> = my_c_function_call()
val resultButRealThisTime: Thing = ???
Doing
val result = my_c_function_call()
val resultButReal: Thing? = null
result.useContents { resultButReal = this@useContents }
Works, but looks awful and I don't think that's how you're supposed to do thatutikeev
02/22/2021, 11:01 PMcglm
library (https://github.com/recp/cglm) for supporting OpenGL maths. Though, I have some problems with it. Details in 🧵.Clocks
02/23/2021, 5:48 AMval int1: CValue<IntVarOf<Int>> = cValue()
val int2: CValue<IntVarOf<Int>> = cValue()
gtk_window_get_default_size(
window = windowPointer,
width = int1,
height = int2
)
gtk_window_get_default_size
takes in a pointer to the window, then a pointer to `Int`s that it will populate.
How can I get the Int
out of CValue<IntVarOf<Int>>
?nirazo
02/25/2021, 10:11 AMexecute
method from APP to get value.
The return values from UseCases are defined as Results, and puts it in Output of UseCase, and returns it to my APP.
Define of Results:
sealed class Results<out T, out S> {
class Success<out T>(val data: T) : Results<T, Nothing>()
class Failure<out S>(val cause: S) : Results<Nothing, S>()
}
Sample useCase and it’s IO:
interface SampleUseCaseInterface {
suspend fun execute(): sampleUseCaseIO.Output
}
class sampleUseCase() : SampleUseCaseInterface {
override suspend fun execute(): sampleUseCaseIO.Output =
sampleUseCaseIO.Output(Results.Success("success!"))
}
class sampleUseCaseIO {
data class Output(val results: Results<String, Error>)
}
Now, I want to mock the execute method of UseCase and return an arbitrary Output in order to write a Unit Test in an iOS app.
However, now the following error is displayed and it is not possible to create an arbitrary output.
Both data and error are required to be included in Results, and the required Output cannot be created.
Is there any way to avoid this?
Also, is it possible to realize a mechanism like Either on the iOS side with Kotlin/Native?Casey Brooks
02/25/2021, 8:01 PMKy Leggiero
02/27/2021, 11:24 PMdarkmoon_uk
03/01/2021, 1:11 AMaleksey.tomin
03/01/2021, 12:12 PMcodesign -dvv --force --timestamp --sign ***
for all dylib’s and my kexe with a Mac App Distribution
certificate
Next I’ve signed productsign --sign
and codesign -dvv --force --timestamp --sign
with a Mac Installer Distribution
certificate
And the last: xcrun altool --notarize-app --primary-bundle-id "ID"
- AppID configuration.
After this in the log I see
{
"severity": "error",
"code": null,
"path": "MY.pkg xpoint-sdk.kexe",
"message": "The binary is not signed with a valid Developer ID certificate.",
"docUrl": null,
"architecture": "x86_64"
},
{
"severity": "error",
"code": null,
"path": "MY.pkg .../xpoint-sdk.kexe",
"message": "The executable does not have the hardened runtime enabled.",
"docUrl": null,
"architecture": "x86_64"
}
...
{
"severity": "error",
"code": null,
"path": "MY.pkg .../some.dylib",
"message": "The binary is not signed with a valid Developer ID certificate.",
"docUrl": null,
"architecture": "x86_64"
}
How can I fix it?Iaroslav Postovalov
03/01/2021, 6:18 PMIaroslav Postovalov
03/01/2021, 6:27 PMe: /home/commandertvis/IdeaProjects/communicator/communicator-zmq-c-transport/src/nativeMain/kotlin/Server.kt: (22, 43): type @[ParameterName(name = 'argument')] kotlin.ByteArray is not supported here: doesn't correspond to any C type
arnaud.giuliani
03/02/2021, 3:54 PMdarkmoon_uk
03/03/2021, 11:57 AMUncaught Kotlin exception: kotlinx.coroutines.CoroutinesInternalError: Fatal exception in coroutines machinery for DispatchedContinuation[WorkerCoroutineDispatcherImpl@d81448, Continuation @ $collect_2COROUTINE$220]. Please read KDoc to 'handleFatalException' method and report this incident to maintainers
This is when one of my Flows ends; everything is in the main thread... 😱John O'Reilly
03/03/2021, 12:18 PMnative-mt
version will be available? 🙂sergey.bogolepov
03/04/2021, 7:11 AMmacosX64
and iosX64
targets. Long story short, compiler caches make compilation time of debug builds (e.g. linkDebug...
) in Gradle significantly faster (well, except the first one, when dependencies are caching and Gradle daemon is warming up).
In 1.5.0-M1 we add opt-in support for compiler caches for two more targets:
• iosArm64
• linuxX64
(only on Linux host)
To enable them add a single line to your gradle.properties
.
For linuxX64
target:
kotlin.native.cacheKind.linuxX64=static
For iosArm64
target:
kotlin.native.cacheKind.iosArm64=static
"Why not enable it by default?" you might ask. While it doesn't break our test projects, it might break yours.
And who likes broken compilation after compiler update? :)
So, we asking you to test compiler caches on your projects and report to us if you encounter any kind of problems. Let's make Kotlin faster together!Paul Woitaschek
03/04/2021, 1:33 PMinternal fun NSInteger.toInt(): Int {
return asInt()
}
private fun Any.asInt(): Int {
return when (this) {
is Long -> this.toInt()
is Int -> this
else -> error("Could not convert $this to Int")
}
}
Is there a better way to do that? I’m kind of looking for the opposite of cinterop.convert.serebit
03/04/2021, 4:13 PMPaul Woitaschek
03/05/2021, 6:03 AM...
object WATCHOS_ARM32 : KonanTarget("watchos_arm32", Family.WATCHOS, Architecture.ARM32)
object WATCHOS_ARM64 : KonanTarget("watchos_arm64", Family.WATCHOS, Architecture.ARM64)
...
And this https://github.com/JetBrains/kotlin/blob/06498c0efdb218da4bd1b09b6ae0b98beb8b7af9/native/utils/src/org/jetbrains/kotlin/konan/target/Architecture.kt
enum class Architecture(val bitness: Int) {
...
ARM64(64),
ARM32(32)
,...
}
watchosarm32 is 32 bit and watchosarm64 is 64 bit.
However when I now take a look at my watchosArm32Main
source set, for example NSDateComponents
have `NSInteger`s which will be interpreted as kotlin ints.
Makes sense to me.
Now however in watchosArm64Main
it’s also an Int. Why is that? Why isn’t this now a Long
?
Apparently all ios source sets have longs, all watchos source sets have ints. I thought this is dependent on the bitness?william
03/07/2021, 8:58 PMinit
block and then top level value assignments causing an exception. heres a min example:
class Foo(bar: Bar) {
init {
CoroutineScope(Dispatchers.Default).launch {
bar.buzz()
}
}
val a = 3
}
in the init block since bar is accessed, it seems like that is causing the entire foo object to also get frozen
then when it gets to val a = 3
during runtime - it complains about foo instance already being frozen. how can i go about fixing this?