CommonizerHierarchicalIT: Implement test commonizeHierarchicallyMultiModule
^KT-46107
This commit is contained in:
committed by
Space
parent
5fb30b05ff
commit
95a1a4e66a
+21
@@ -6,6 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.gradle
|
package org.jetbrains.kotlin.gradle
|
||||||
|
|
||||||
import org.gradle.internal.os.OperatingSystem
|
import org.gradle.internal.os.OperatingSystem
|
||||||
|
import org.junit.Ignore
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class CommonizerHierarchicalIT : BaseGradleIT() {
|
class CommonizerHierarchicalIT : BaseGradleIT() {
|
||||||
@@ -86,6 +87,26 @@ class CommonizerHierarchicalIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Ignore("Waiting for next bootstrap compiler")
|
||||||
|
@Test
|
||||||
|
fun `test commonizeHierarchicallyMultiModule`() {
|
||||||
|
with(Project("commonizeHierarchicallyMultiModule")) {
|
||||||
|
build("assemble") {
|
||||||
|
assertSuccessful()
|
||||||
|
assertTasksExecuted(":p1:commonizeCInterop")
|
||||||
|
assertTasksExecuted(":p2:commonizeCInterop")
|
||||||
|
assertTasksExecuted(":p3:commonizeCInterop")
|
||||||
|
|
||||||
|
/*
|
||||||
|
Commonized C-Interops are not published or forwarded to other Gradle projects.
|
||||||
|
The missing dependency will be ignored by the metadata compiler.
|
||||||
|
We still expect a warning being printed.
|
||||||
|
*/
|
||||||
|
assertContains("w: Could not find \"commonizeHierarchicallyMultiModule:p1-cinterop-withPosix\" in ")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private object Os {
|
private object Os {
|
||||||
private val os = OperatingSystem.current()
|
private val os = OperatingSystem.current()
|
||||||
val canCompileApple get() = os.isMacOsX
|
val canCompileApple get() = os.isMacOsX
|
||||||
|
|||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
plugins {
|
||||||
|
kotlin("multiplatform") apply false
|
||||||
|
}
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
}
|
||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
kotlin.code.style=official
|
||||||
|
org.gradle.debug=false
|
||||||
|
kotlin.mpp.enableGranularSourceSetsMetadata=true
|
||||||
|
kotlin.native.enableDependencyPropagation=false
|
||||||
|
kotlin.mpp.enableCInteropCommonization=true
|
||||||
|
kotlin.mpp.enableHierarchicalCommonization=true
|
||||||
+79
@@ -0,0 +1,79 @@
|
|||||||
|
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
|
||||||
|
|
||||||
|
operator fun KotlinSourceSet.invoke(builder: SourceSetHierarchyBuilder.() -> Unit): KotlinSourceSet {
|
||||||
|
SourceSetHierarchyBuilder(this).builder()
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
class SourceSetHierarchyBuilder(private val node: KotlinSourceSet) {
|
||||||
|
operator fun KotlinSourceSet.unaryMinus() = this.dependsOn(node)
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
kotlin("multiplatform")
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
js()
|
||||||
|
jvm()
|
||||||
|
|
||||||
|
linuxX64()
|
||||||
|
linuxArm64()
|
||||||
|
|
||||||
|
macosX64("macos")
|
||||||
|
ios()
|
||||||
|
|
||||||
|
mingwX64("windowsX64")
|
||||||
|
mingwX86("windowsX86")
|
||||||
|
|
||||||
|
val commonMain by sourceSets.getting
|
||||||
|
val concurrentMain by sourceSets.creating
|
||||||
|
val jvmMain by sourceSets.getting
|
||||||
|
val jsMain by sourceSets.getting
|
||||||
|
val nativeMain by sourceSets.creating
|
||||||
|
val appleAndLinuxMain by sourceSets.creating
|
||||||
|
val linuxMain by sourceSets.creating
|
||||||
|
val linuxX64Main by sourceSets.getting
|
||||||
|
val linuxArm64Main by sourceSets.getting
|
||||||
|
val appleMain by sourceSets.creating
|
||||||
|
val macosMain by sourceSets.getting
|
||||||
|
val iosMain by sourceSets.getting
|
||||||
|
val windowsMain by sourceSets.creating
|
||||||
|
val windowsX64Main by sourceSets.getting
|
||||||
|
val windowsX86Main by sourceSets.getting
|
||||||
|
|
||||||
|
commonMain {
|
||||||
|
-jsMain
|
||||||
|
-concurrentMain {
|
||||||
|
-jvmMain
|
||||||
|
-nativeMain {
|
||||||
|
-appleAndLinuxMain {
|
||||||
|
-appleMain {
|
||||||
|
-iosMain
|
||||||
|
-macosMain
|
||||||
|
}
|
||||||
|
-linuxMain {
|
||||||
|
-linuxArm64Main
|
||||||
|
-linuxX64Main
|
||||||
|
}
|
||||||
|
}
|
||||||
|
-windowsMain {
|
||||||
|
-windowsX64Main
|
||||||
|
-windowsX86Main
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sourceSets.all {
|
||||||
|
languageSettings.useExperimentalAnnotation("kotlin.RequiresOptIn")
|
||||||
|
}
|
||||||
|
|
||||||
|
targets.withType<KotlinNativeTarget>().forEach { target ->
|
||||||
|
target.compilations.getByName("main").cinterops.create("withPosix") {
|
||||||
|
header(file("libs/withPosix.h"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+43
@@ -0,0 +1,43 @@
|
|||||||
|
#include <sys/stat.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
struct stat getStructFromPosix();
|
||||||
|
|
||||||
|
struct stat* getStructPointerFromPosix();
|
||||||
|
|
||||||
|
struct MyStruct getMyStruct();
|
||||||
|
|
||||||
|
struct MyStruct* getMyStructPointer();
|
||||||
|
|
||||||
|
struct MyStruct {
|
||||||
|
struct stat posixProperty;
|
||||||
|
|
||||||
|
#if _WIN32
|
||||||
|
long long longProperty;
|
||||||
|
#else
|
||||||
|
long longProperty;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
double doubleProperty;
|
||||||
|
|
||||||
|
int32_t int32tProperty;
|
||||||
|
|
||||||
|
int64_t int64tProperty;
|
||||||
|
|
||||||
|
#if __linux__
|
||||||
|
bool linuxOnlyProperty;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if __APPLE__
|
||||||
|
bool appleOnlyProperty;
|
||||||
|
#include "TargetConditionals.h"
|
||||||
|
#if TARGET_OS_IPHONE
|
||||||
|
bool iosOnlyProperty;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if _WIN32
|
||||||
|
bool windowsOnlyProperty;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import kotlinx.cinterop.pointed
|
||||||
|
import platform.posix.stat
|
||||||
|
import withPosix.getMyStructPointer
|
||||||
|
import withPosix.getStructFromPosix
|
||||||
|
import withPosix.getStructPointerFromPosix
|
||||||
|
|
||||||
|
object AppleAndLinuxMain {
|
||||||
|
val structFromPosix = getStructFromPosix()
|
||||||
|
val structPointerFromPosix = getStructPointerFromPosix()
|
||||||
|
|
||||||
|
object MyStruct {
|
||||||
|
val struct = getMyStructPointer()?.pointed ?: error("Missing my struct")
|
||||||
|
val posixProperty: stat = struct.posixProperty
|
||||||
|
val longProperty: Long = struct.longProperty
|
||||||
|
val doubleProperty: Double = struct.doubleProperty
|
||||||
|
val int32tProperty: Int = struct.int32tProperty
|
||||||
|
val int64TProperty: Long = struct.int64tProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import kotlinx.cinterop.pointed
|
||||||
|
import platform.posix.stat
|
||||||
|
import withPosix.getMyStructPointer
|
||||||
|
import withPosix.getStructFromPosix
|
||||||
|
import withPosix.getStructPointerFromPosix
|
||||||
|
|
||||||
|
object AppleMain {
|
||||||
|
val structFromPosix = getStructFromPosix()
|
||||||
|
val structPointerFromPosix = getStructPointerFromPosix()
|
||||||
|
|
||||||
|
object MyStruct {
|
||||||
|
val struct = getMyStructPointer()?.pointed ?: error("Missing my struct")
|
||||||
|
val posixProperty: stat = struct.posixProperty
|
||||||
|
val longProperty: Long = struct.longProperty
|
||||||
|
val doubleProperty: Double = struct.doubleProperty
|
||||||
|
val int32tProperty: Int = struct.int32tProperty
|
||||||
|
val int64TProperty: Long = struct.int64tProperty
|
||||||
|
val appleOnlyProperty: Boolean = struct.appleOnlyProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
class CommonMain {
|
||||||
|
}
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import kotlinx.cinterop.pointed
|
||||||
|
import platform.posix.stat
|
||||||
|
import withPosix.getMyStructPointer
|
||||||
|
import withPosix.getStructFromPosix
|
||||||
|
import withPosix.getStructPointerFromPosix
|
||||||
|
|
||||||
|
object IosMain {
|
||||||
|
val structFromPosix = getStructFromPosix()
|
||||||
|
val structPointerFromPosix = getStructPointerFromPosix()
|
||||||
|
|
||||||
|
object MyStruct {
|
||||||
|
val struct = getMyStructPointer()?.pointed ?: error("Missing my struct")
|
||||||
|
val posixProperty: stat = struct.posixProperty
|
||||||
|
val longProperty: Long = struct.longProperty
|
||||||
|
val doubleProperty: Double = struct.doubleProperty
|
||||||
|
val int32tProperty: Int = struct.int32tProperty
|
||||||
|
val int64TProperty: Long = struct.int64tProperty
|
||||||
|
val appleOnly: Boolean = struct.appleOnlyProperty
|
||||||
|
val iosOnly: Boolean = struct.iosOnlyProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import kotlinx.cinterop.pointed
|
||||||
|
import platform.posix.stat
|
||||||
|
import withPosix.getMyStructPointer
|
||||||
|
import withPosix.getStructFromPosix
|
||||||
|
import withPosix.getStructPointerFromPosix
|
||||||
|
|
||||||
|
object LinuxArm64Main {
|
||||||
|
val structFromPosix = getStructFromPosix()
|
||||||
|
val structPointerFromPosix = getStructPointerFromPosix()
|
||||||
|
|
||||||
|
object MyStruct {
|
||||||
|
val struct = getMyStructPointer()?.pointed ?: error("Missing my struct")
|
||||||
|
val posixProperty: stat = struct.posixProperty
|
||||||
|
val longProperty: Long = struct.longProperty
|
||||||
|
val doubleProperty: Double = struct.doubleProperty
|
||||||
|
val int32tProperty: Int = struct.int32tProperty
|
||||||
|
val int64TProperty: Long = struct.int64tProperty
|
||||||
|
val linuxOnlyProperty: Boolean = struct.linuxOnlyProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import kotlinx.cinterop.pointed
|
||||||
|
import platform.posix.stat
|
||||||
|
import withPosix.getMyStructPointer
|
||||||
|
import withPosix.getStructFromPosix
|
||||||
|
import withPosix.getStructPointerFromPosix
|
||||||
|
|
||||||
|
object LinuxMain {
|
||||||
|
val structFromPosix = getStructFromPosix()
|
||||||
|
val structPointerFromPosix = getStructPointerFromPosix()
|
||||||
|
|
||||||
|
object MyStruct {
|
||||||
|
val struct = getMyStructPointer()?.pointed ?: error("Missing my struct")
|
||||||
|
val posixProperty: stat = struct.posixProperty
|
||||||
|
val longProperty: Long = struct.longProperty
|
||||||
|
val doubleProperty: Double = struct.doubleProperty
|
||||||
|
val int32tProperty: Int = struct.int32tProperty
|
||||||
|
val int64TProperty: Long = struct.int64tProperty
|
||||||
|
val linuxOnlyProperty: Boolean = struct.linuxOnlyProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import kotlinx.cinterop.pointed
|
||||||
|
import platform.posix.stat
|
||||||
|
import withPosix.getMyStructPointer
|
||||||
|
import withPosix.getStructFromPosix
|
||||||
|
import withPosix.getStructPointerFromPosix
|
||||||
|
|
||||||
|
object LinuxX64Main {
|
||||||
|
val structFromPosix = getStructFromPosix()
|
||||||
|
val structPointerFromPosix = getStructPointerFromPosix()
|
||||||
|
|
||||||
|
object MyStruct {
|
||||||
|
val struct = getMyStructPointer()?.pointed ?: error("Missing my struct")
|
||||||
|
val posixProperty: stat = struct.posixProperty
|
||||||
|
val longProperty: Long = struct.longProperty
|
||||||
|
val doubleProperty: Double = struct.doubleProperty
|
||||||
|
val int32tProperty: Int = struct.int32tProperty
|
||||||
|
val int64TProperty: Long = struct.int64tProperty
|
||||||
|
val linuxOnlyProperty: Boolean = struct.linuxOnlyProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import kotlinx.cinterop.pointed
|
||||||
|
import platform.posix.stat
|
||||||
|
import withPosix.getMyStructPointer
|
||||||
|
import withPosix.getStructFromPosix
|
||||||
|
import withPosix.getStructPointerFromPosix
|
||||||
|
|
||||||
|
object MacosMain {
|
||||||
|
val structFromPosix = getStructFromPosix()
|
||||||
|
val structPointerFromPosix = getStructPointerFromPosix()
|
||||||
|
|
||||||
|
object MyStruct {
|
||||||
|
val struct = getMyStructPointer()?.pointed ?: error("Missing my struct")
|
||||||
|
val posixProperty: stat = struct.posixProperty
|
||||||
|
val longProperty: Long = struct.longProperty
|
||||||
|
val doubleProperty: Double = struct.doubleProperty
|
||||||
|
val int32tProperty: Int = struct.int32tProperty
|
||||||
|
val int64TProperty: Long = struct.int64tProperty
|
||||||
|
val appleOnlyProperty: Boolean = struct.appleOnlyProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import kotlinx.cinterop.pointed
|
||||||
|
import platform.posix.stat
|
||||||
|
import withPosix.getMyStructPointer
|
||||||
|
import withPosix.getStructFromPosix
|
||||||
|
import withPosix.getStructPointerFromPosix
|
||||||
|
|
||||||
|
object NativeMain {
|
||||||
|
val structFromPosix = getStructFromPosix()
|
||||||
|
val structPointerFromPosix = getStructPointerFromPosix()
|
||||||
|
|
||||||
|
object MyStruct {
|
||||||
|
val struct = getMyStructPointer()?.pointed ?: error("Missing my struct")
|
||||||
|
val posixProperty: stat = struct.posixProperty
|
||||||
|
val longProperty: Long = struct.longProperty
|
||||||
|
val doubleProperty: Double = struct.doubleProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import kotlinx.cinterop.pointed
|
||||||
|
import platform.posix.stat
|
||||||
|
import withPosix.getMyStructPointer
|
||||||
|
import withPosix.getStructFromPosix
|
||||||
|
import withPosix.getStructPointerFromPosix
|
||||||
|
|
||||||
|
object WindowsMain {
|
||||||
|
val structFromPosix = getStructFromPosix()
|
||||||
|
val structPointerFromPosix = getStructPointerFromPosix()
|
||||||
|
|
||||||
|
object MyStruct {
|
||||||
|
val struct = getMyStructPointer()?.pointed ?: error("Missing my struct")
|
||||||
|
val posixProperty: stat = struct.posixProperty
|
||||||
|
val longProperty: Long = struct.longProperty
|
||||||
|
val doubleProperty: Double = struct.doubleProperty
|
||||||
|
val int32tProperty: Int = struct.int32tProperty
|
||||||
|
val int64TProperty: Long = struct.int64tProperty
|
||||||
|
val windowsOnly: Boolean = struct.windowsOnlyProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
+82
@@ -0,0 +1,82 @@
|
|||||||
|
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
|
||||||
|
|
||||||
|
operator fun KotlinSourceSet.invoke(builder: SourceSetHierarchyBuilder.() -> Unit): KotlinSourceSet {
|
||||||
|
SourceSetHierarchyBuilder(this).builder()
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
class SourceSetHierarchyBuilder(private val node: KotlinSourceSet) {
|
||||||
|
operator fun KotlinSourceSet.unaryMinus() = this.dependsOn(node)
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
kotlin("multiplatform")
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
js()
|
||||||
|
jvm()
|
||||||
|
|
||||||
|
linuxX64()
|
||||||
|
linuxArm64()
|
||||||
|
|
||||||
|
macosX64("macos")
|
||||||
|
ios()
|
||||||
|
|
||||||
|
mingwX64("windowsX64")
|
||||||
|
mingwX86("windowsX86")
|
||||||
|
|
||||||
|
val commonMain by sourceSets.getting
|
||||||
|
val concurrentMain by sourceSets.creating
|
||||||
|
val jvmMain by sourceSets.getting
|
||||||
|
val jsMain by sourceSets.getting
|
||||||
|
val nativeMain by sourceSets.creating
|
||||||
|
val appleAndLinuxMain by sourceSets.creating
|
||||||
|
val linuxMain by sourceSets.creating
|
||||||
|
val linuxX64Main by sourceSets.getting
|
||||||
|
val linuxArm64Main by sourceSets.getting
|
||||||
|
val appleMain by sourceSets.creating
|
||||||
|
val macosMain by sourceSets.getting
|
||||||
|
val iosMain by sourceSets.getting
|
||||||
|
val windowsMain by sourceSets.creating
|
||||||
|
val windowsX64Main by sourceSets.getting
|
||||||
|
val windowsX86Main by sourceSets.getting
|
||||||
|
|
||||||
|
commonMain {
|
||||||
|
-jsMain
|
||||||
|
-concurrentMain {
|
||||||
|
-jvmMain
|
||||||
|
-nativeMain {
|
||||||
|
-appleAndLinuxMain {
|
||||||
|
-appleMain {
|
||||||
|
-iosMain
|
||||||
|
-macosMain
|
||||||
|
}
|
||||||
|
-linuxMain {
|
||||||
|
-linuxArm64Main
|
||||||
|
-linuxX64Main
|
||||||
|
}
|
||||||
|
}
|
||||||
|
-windowsMain {
|
||||||
|
-windowsX64Main
|
||||||
|
-windowsX86Main
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
commonMain.dependencies {
|
||||||
|
implementation(project(":p1"))
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets.all {
|
||||||
|
languageSettings.useExperimentalAnnotation("kotlin.RequiresOptIn")
|
||||||
|
}
|
||||||
|
|
||||||
|
targets.withType<KotlinNativeTarget>().forEach { target ->
|
||||||
|
target.compilations.getByName("main").cinterops.create("withPosixOther") {
|
||||||
|
header(file("libs/withPosix.h"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+48
@@ -0,0 +1,48 @@
|
|||||||
|
#include <sys/stat.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
Special function that will differentiate this header file from p1/../withPosix.h and p3/../withPosix.h
|
||||||
|
*/
|
||||||
|
void p2();
|
||||||
|
|
||||||
|
struct stat getStructFromPosix();
|
||||||
|
|
||||||
|
struct stat* getStructPointerFromPosix();
|
||||||
|
|
||||||
|
struct MyStruct getMyStruct();
|
||||||
|
|
||||||
|
struct MyStruct* getMyStructPointer();
|
||||||
|
|
||||||
|
struct MyStruct {
|
||||||
|
struct stat posixProperty;
|
||||||
|
|
||||||
|
#if _WIN32
|
||||||
|
long long longProperty;
|
||||||
|
#else
|
||||||
|
long longProperty;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
double doubleProperty;
|
||||||
|
|
||||||
|
int32_t int32tProperty;
|
||||||
|
|
||||||
|
int64_t int64tProperty;
|
||||||
|
|
||||||
|
#if __linux__
|
||||||
|
bool linuxOnlyProperty;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if __APPLE__
|
||||||
|
bool appleOnlyProperty;
|
||||||
|
#include "TargetConditionals.h"
|
||||||
|
#if TARGET_OS_IPHONE
|
||||||
|
bool iosOnlyProperty;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if _WIN32
|
||||||
|
bool windowsOnlyProperty;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import kotlinx.cinterop.pointed
|
||||||
|
import platform.posix.stat
|
||||||
|
import withPosixOther.getMyStructPointer
|
||||||
|
import withPosixOther.getStructFromPosix
|
||||||
|
import withPosixOther.getStructPointerFromPosix
|
||||||
|
|
||||||
|
object AppleAndLinuxMain {
|
||||||
|
val structFromPosix = getStructFromPosix()
|
||||||
|
val structPointerFromPosix = getStructPointerFromPosix()
|
||||||
|
|
||||||
|
object MyStruct {
|
||||||
|
val struct = getMyStructPointer()?.pointed ?: error("Missing my struct")
|
||||||
|
val posixProperty: stat = struct.posixProperty
|
||||||
|
val longProperty: Long = struct.longProperty
|
||||||
|
val doubleProperty: Double = struct.doubleProperty
|
||||||
|
val int32tProperty: Int = struct.int32tProperty
|
||||||
|
val int64TProperty: Long = struct.int64tProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import kotlinx.cinterop.pointed
|
||||||
|
import platform.posix.stat
|
||||||
|
import withPosixOther.getMyStructPointer
|
||||||
|
import withPosixOther.getStructFromPosix
|
||||||
|
import withPosixOther.getStructPointerFromPosix
|
||||||
|
|
||||||
|
object AppleMain {
|
||||||
|
val structFromPosix = getStructFromPosix()
|
||||||
|
val structPointerFromPosix = getStructPointerFromPosix()
|
||||||
|
|
||||||
|
object MyStruct {
|
||||||
|
val struct = getMyStructPointer()?.pointed ?: error("Missing my struct")
|
||||||
|
val posixProperty: stat = struct.posixProperty
|
||||||
|
val longProperty: Long = struct.longProperty
|
||||||
|
val doubleProperty: Double = struct.doubleProperty
|
||||||
|
val int32tProperty: Int = struct.int32tProperty
|
||||||
|
val int64TProperty: Long = struct.int64tProperty
|
||||||
|
val appleOnlyProperty: Boolean = struct.appleOnlyProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
class CommonMain {
|
||||||
|
}
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import kotlinx.cinterop.pointed
|
||||||
|
import platform.posix.stat
|
||||||
|
import withPosixOther.getMyStructPointer
|
||||||
|
import withPosixOther.getStructFromPosix
|
||||||
|
import withPosixOther.getStructPointerFromPosix
|
||||||
|
|
||||||
|
object IosMain {
|
||||||
|
val structFromPosix = getStructFromPosix()
|
||||||
|
val structPointerFromPosix = getStructPointerFromPosix()
|
||||||
|
|
||||||
|
object MyStruct {
|
||||||
|
val struct = getMyStructPointer()?.pointed ?: error("Missing my struct")
|
||||||
|
val posixProperty: stat = struct.posixProperty
|
||||||
|
val longProperty: Long = struct.longProperty
|
||||||
|
val doubleProperty: Double = struct.doubleProperty
|
||||||
|
val int32tProperty: Int = struct.int32tProperty
|
||||||
|
val int64TProperty: Long = struct.int64tProperty
|
||||||
|
val appleOnly: Boolean = struct.appleOnlyProperty
|
||||||
|
val iosOnly: Boolean = struct.iosOnlyProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import kotlinx.cinterop.pointed
|
||||||
|
import platform.posix.stat
|
||||||
|
import withPosixOther.getMyStructPointer
|
||||||
|
import withPosixOther.getStructFromPosix
|
||||||
|
import withPosixOther.getStructPointerFromPosix
|
||||||
|
|
||||||
|
object LinuxArm64Main {
|
||||||
|
val structFromPosix = getStructFromPosix()
|
||||||
|
val structPointerFromPosix = getStructPointerFromPosix()
|
||||||
|
|
||||||
|
object MyStruct {
|
||||||
|
val struct = getMyStructPointer()?.pointed ?: error("Missing my struct")
|
||||||
|
val posixProperty: stat = struct.posixProperty
|
||||||
|
val longProperty: Long = struct.longProperty
|
||||||
|
val doubleProperty: Double = struct.doubleProperty
|
||||||
|
val int32tProperty: Int = struct.int32tProperty
|
||||||
|
val int64TProperty: Long = struct.int64tProperty
|
||||||
|
val linuxOnlyProperty: Boolean = struct.linuxOnlyProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import kotlinx.cinterop.pointed
|
||||||
|
import platform.posix.stat
|
||||||
|
import withPosixOther.getMyStructPointer
|
||||||
|
import withPosixOther.getStructFromPosix
|
||||||
|
import withPosixOther.getStructPointerFromPosix
|
||||||
|
|
||||||
|
object LinuxMain {
|
||||||
|
val structFromPosix = getStructFromPosix()
|
||||||
|
val structPointerFromPosix = getStructPointerFromPosix()
|
||||||
|
|
||||||
|
object MyStruct {
|
||||||
|
val struct = getMyStructPointer()?.pointed ?: error("Missing my struct")
|
||||||
|
val posixProperty: stat = struct.posixProperty
|
||||||
|
val longProperty: Long = struct.longProperty
|
||||||
|
val doubleProperty: Double = struct.doubleProperty
|
||||||
|
val int32tProperty: Int = struct.int32tProperty
|
||||||
|
val int64TProperty: Long = struct.int64tProperty
|
||||||
|
val linuxOnlyProperty: Boolean = struct.linuxOnlyProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import kotlinx.cinterop.pointed
|
||||||
|
import platform.posix.stat
|
||||||
|
import withPosixOther.getMyStructPointer
|
||||||
|
import withPosixOther.getStructFromPosix
|
||||||
|
import withPosixOther.getStructPointerFromPosix
|
||||||
|
|
||||||
|
object LinuxX64Main {
|
||||||
|
val structFromPosix = getStructFromPosix()
|
||||||
|
val structPointerFromPosix = getStructPointerFromPosix()
|
||||||
|
|
||||||
|
object MyStruct {
|
||||||
|
val struct = getMyStructPointer()?.pointed ?: error("Missing my struct")
|
||||||
|
val posixProperty: stat = struct.posixProperty
|
||||||
|
val longProperty: Long = struct.longProperty
|
||||||
|
val doubleProperty: Double = struct.doubleProperty
|
||||||
|
val int32tProperty: Int = struct.int32tProperty
|
||||||
|
val int64TProperty: Long = struct.int64tProperty
|
||||||
|
val linuxOnlyProperty: Boolean = struct.linuxOnlyProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import kotlinx.cinterop.pointed
|
||||||
|
import platform.posix.stat
|
||||||
|
import withPosixOther.getMyStructPointer
|
||||||
|
import withPosixOther.getStructFromPosix
|
||||||
|
import withPosixOther.getStructPointerFromPosix
|
||||||
|
|
||||||
|
object MacosMain {
|
||||||
|
val structFromPosix = getStructFromPosix()
|
||||||
|
val structPointerFromPosix = getStructPointerFromPosix()
|
||||||
|
|
||||||
|
object MyStruct {
|
||||||
|
val struct = getMyStructPointer()?.pointed ?: error("Missing my struct")
|
||||||
|
val posixProperty: stat = struct.posixProperty
|
||||||
|
val longProperty: Long = struct.longProperty
|
||||||
|
val doubleProperty: Double = struct.doubleProperty
|
||||||
|
val int32tProperty: Int = struct.int32tProperty
|
||||||
|
val int64TProperty: Long = struct.int64tProperty
|
||||||
|
val appleOnlyProperty: Boolean = struct.appleOnlyProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import kotlinx.cinterop.pointed
|
||||||
|
import platform.posix.stat
|
||||||
|
import withPosixOther.getMyStructPointer
|
||||||
|
import withPosixOther.getStructFromPosix
|
||||||
|
import withPosixOther.getStructPointerFromPosix
|
||||||
|
|
||||||
|
object NativeMain {
|
||||||
|
val structFromPosix = getStructFromPosix()
|
||||||
|
val structPointerFromPosix = getStructPointerFromPosix()
|
||||||
|
|
||||||
|
object MyStruct {
|
||||||
|
val struct = getMyStructPointer()?.pointed ?: error("Missing my struct")
|
||||||
|
val posixProperty: stat = struct.posixProperty
|
||||||
|
val longProperty: Long = struct.longProperty
|
||||||
|
val doubleProperty: Double = struct.doubleProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import kotlinx.cinterop.pointed
|
||||||
|
import platform.posix.stat
|
||||||
|
import withPosixOther.getMyStructPointer
|
||||||
|
import withPosixOther.getStructFromPosix
|
||||||
|
import withPosixOther.getStructPointerFromPosix
|
||||||
|
|
||||||
|
object WindowsMain {
|
||||||
|
val structFromPosix = getStructFromPosix()
|
||||||
|
val structPointerFromPosix = getStructPointerFromPosix()
|
||||||
|
|
||||||
|
object MyStruct {
|
||||||
|
val struct = getMyStructPointer()?.pointed ?: error("Missing my struct")
|
||||||
|
val posixProperty: stat = struct.posixProperty
|
||||||
|
val longProperty: Long = struct.longProperty
|
||||||
|
val doubleProperty: Double = struct.doubleProperty
|
||||||
|
val int32tProperty: Int = struct.int32tProperty
|
||||||
|
val int64TProperty: Long = struct.int64tProperty
|
||||||
|
val windowsOnly: Boolean = struct.windowsOnlyProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
+78
@@ -0,0 +1,78 @@
|
|||||||
|
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
|
||||||
|
|
||||||
|
operator fun KotlinSourceSet.invoke(builder: SourceSetHierarchyBuilder.() -> Unit): KotlinSourceSet {
|
||||||
|
SourceSetHierarchyBuilder(this).builder()
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
class SourceSetHierarchyBuilder(private val node: KotlinSourceSet) {
|
||||||
|
operator fun KotlinSourceSet.unaryMinus() = this.dependsOn(node)
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
kotlin("multiplatform")
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
js()
|
||||||
|
jvm()
|
||||||
|
|
||||||
|
linuxX64()
|
||||||
|
linuxArm64()
|
||||||
|
|
||||||
|
macosX64("macos")
|
||||||
|
ios()
|
||||||
|
|
||||||
|
mingwX64("windowsX64")
|
||||||
|
mingwX86("windowsX86")
|
||||||
|
|
||||||
|
val commonMain by sourceSets.getting
|
||||||
|
val concurrentMain by sourceSets.creating
|
||||||
|
val jvmMain by sourceSets.getting
|
||||||
|
val jsMain by sourceSets.getting
|
||||||
|
val nativeMain by sourceSets.creating
|
||||||
|
val appleAndLinuxMain by sourceSets.creating
|
||||||
|
val linuxMain by sourceSets.creating
|
||||||
|
val linuxX64Main by sourceSets.getting
|
||||||
|
val linuxArm64Main by sourceSets.getting
|
||||||
|
val appleMain by sourceSets.creating
|
||||||
|
val macosMain by sourceSets.getting
|
||||||
|
val iosMain by sourceSets.getting
|
||||||
|
val windowsMain by sourceSets.creating
|
||||||
|
val windowsX64Main by sourceSets.getting
|
||||||
|
val windowsX86Main by sourceSets.getting
|
||||||
|
|
||||||
|
commonMain {
|
||||||
|
-jsMain
|
||||||
|
-concurrentMain {
|
||||||
|
-jvmMain
|
||||||
|
-nativeMain {
|
||||||
|
-appleAndLinuxMain {
|
||||||
|
-appleMain {
|
||||||
|
-iosMain
|
||||||
|
-macosMain
|
||||||
|
}
|
||||||
|
-linuxMain {
|
||||||
|
-linuxArm64Main
|
||||||
|
-linuxX64Main
|
||||||
|
}
|
||||||
|
}
|
||||||
|
-windowsMain {
|
||||||
|
-windowsX64Main
|
||||||
|
-windowsX86Main
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets.all {
|
||||||
|
languageSettings.useExperimentalAnnotation("kotlin.RequiresOptIn")
|
||||||
|
}
|
||||||
|
|
||||||
|
targets.withType<KotlinNativeTarget>().forEach { target ->
|
||||||
|
target.compilations.getByName("main").cinterops.create("withPosix") {
|
||||||
|
header(file("libs/withPosix.h"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+43
@@ -0,0 +1,43 @@
|
|||||||
|
#include <sys/stat.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
struct stat getStructFromPosix();
|
||||||
|
|
||||||
|
struct stat* getStructPointerFromPosix();
|
||||||
|
|
||||||
|
struct MyStruct getMyStruct();
|
||||||
|
|
||||||
|
struct MyStruct* getMyStructPointer();
|
||||||
|
|
||||||
|
struct MyStruct {
|
||||||
|
struct stat posixProperty;
|
||||||
|
|
||||||
|
#if _WIN32
|
||||||
|
long long longProperty;
|
||||||
|
#else
|
||||||
|
long longProperty;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
double doubleProperty;
|
||||||
|
|
||||||
|
int32_t int32tProperty;
|
||||||
|
|
||||||
|
int64_t int64tProperty;
|
||||||
|
|
||||||
|
#if __linux__
|
||||||
|
bool linuxOnlyProperty;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if __APPLE__
|
||||||
|
bool appleOnlyProperty;
|
||||||
|
#include "TargetConditionals.h"
|
||||||
|
#if TARGET_OS_IPHONE
|
||||||
|
bool iosOnlyProperty;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if _WIN32
|
||||||
|
bool windowsOnlyProperty;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import kotlinx.cinterop.pointed
|
||||||
|
import platform.posix.stat
|
||||||
|
import withPosix.getMyStructPointer
|
||||||
|
import withPosix.getStructFromPosix
|
||||||
|
import withPosix.getStructPointerFromPosix
|
||||||
|
|
||||||
|
object AppleAndLinuxMain {
|
||||||
|
val structFromPosix = getStructFromPosix()
|
||||||
|
val structPointerFromPosix = getStructPointerFromPosix()
|
||||||
|
|
||||||
|
object MyStruct {
|
||||||
|
val struct = getMyStructPointer()?.pointed ?: error("Missing my struct")
|
||||||
|
val posixProperty: stat = struct.posixProperty
|
||||||
|
val longProperty: Long = struct.longProperty
|
||||||
|
val doubleProperty: Double = struct.doubleProperty
|
||||||
|
val int32tProperty: Int = struct.int32tProperty
|
||||||
|
val int64TProperty: Long = struct.int64tProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import kotlinx.cinterop.pointed
|
||||||
|
import platform.posix.stat
|
||||||
|
import withPosix.getMyStructPointer
|
||||||
|
import withPosix.getStructFromPosix
|
||||||
|
import withPosix.getStructPointerFromPosix
|
||||||
|
|
||||||
|
object AppleMain {
|
||||||
|
val structFromPosix = getStructFromPosix()
|
||||||
|
val structPointerFromPosix = getStructPointerFromPosix()
|
||||||
|
|
||||||
|
object MyStruct {
|
||||||
|
val struct = getMyStructPointer()?.pointed ?: error("Missing my struct")
|
||||||
|
val posixProperty: stat = struct.posixProperty
|
||||||
|
val longProperty: Long = struct.longProperty
|
||||||
|
val doubleProperty: Double = struct.doubleProperty
|
||||||
|
val int32tProperty: Int = struct.int32tProperty
|
||||||
|
val int64TProperty: Long = struct.int64tProperty
|
||||||
|
val appleOnlyProperty: Boolean = struct.appleOnlyProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
class CommonMain {
|
||||||
|
}
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import kotlinx.cinterop.pointed
|
||||||
|
import platform.posix.stat
|
||||||
|
import withPosix.getMyStructPointer
|
||||||
|
import withPosix.getStructFromPosix
|
||||||
|
import withPosix.getStructPointerFromPosix
|
||||||
|
|
||||||
|
object IosMain {
|
||||||
|
val structFromPosix = getStructFromPosix()
|
||||||
|
val structPointerFromPosix = getStructPointerFromPosix()
|
||||||
|
|
||||||
|
object MyStruct {
|
||||||
|
val struct = getMyStructPointer()?.pointed ?: error("Missing my struct")
|
||||||
|
val posixProperty: stat = struct.posixProperty
|
||||||
|
val longProperty: Long = struct.longProperty
|
||||||
|
val doubleProperty: Double = struct.doubleProperty
|
||||||
|
val int32tProperty: Int = struct.int32tProperty
|
||||||
|
val int64TProperty: Long = struct.int64tProperty
|
||||||
|
val appleOnly: Boolean = struct.appleOnlyProperty
|
||||||
|
val iosOnly: Boolean = struct.iosOnlyProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import kotlinx.cinterop.pointed
|
||||||
|
import platform.posix.stat
|
||||||
|
import withPosix.getMyStructPointer
|
||||||
|
import withPosix.getStructFromPosix
|
||||||
|
import withPosix.getStructPointerFromPosix
|
||||||
|
|
||||||
|
object LinuxArm64Main {
|
||||||
|
val structFromPosix = getStructFromPosix()
|
||||||
|
val structPointerFromPosix = getStructPointerFromPosix()
|
||||||
|
|
||||||
|
object MyStruct {
|
||||||
|
val struct = getMyStructPointer()?.pointed ?: error("Missing my struct")
|
||||||
|
val posixProperty: stat = struct.posixProperty
|
||||||
|
val longProperty: Long = struct.longProperty
|
||||||
|
val doubleProperty: Double = struct.doubleProperty
|
||||||
|
val int32tProperty: Int = struct.int32tProperty
|
||||||
|
val int64TProperty: Long = struct.int64tProperty
|
||||||
|
val linuxOnlyProperty: Boolean = struct.linuxOnlyProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import kotlinx.cinterop.pointed
|
||||||
|
import platform.posix.stat
|
||||||
|
import withPosix.getMyStructPointer
|
||||||
|
import withPosix.getStructFromPosix
|
||||||
|
import withPosix.getStructPointerFromPosix
|
||||||
|
|
||||||
|
object LinuxMain {
|
||||||
|
val structFromPosix = getStructFromPosix()
|
||||||
|
val structPointerFromPosix = getStructPointerFromPosix()
|
||||||
|
|
||||||
|
object MyStruct {
|
||||||
|
val struct = getMyStructPointer()?.pointed ?: error("Missing my struct")
|
||||||
|
val posixProperty: stat = struct.posixProperty
|
||||||
|
val longProperty: Long = struct.longProperty
|
||||||
|
val doubleProperty: Double = struct.doubleProperty
|
||||||
|
val int32tProperty: Int = struct.int32tProperty
|
||||||
|
val int64TProperty: Long = struct.int64tProperty
|
||||||
|
val linuxOnlyProperty: Boolean = struct.linuxOnlyProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import kotlinx.cinterop.pointed
|
||||||
|
import platform.posix.stat
|
||||||
|
import withPosix.getMyStructPointer
|
||||||
|
import withPosix.getStructFromPosix
|
||||||
|
import withPosix.getStructPointerFromPosix
|
||||||
|
|
||||||
|
object LinuxX64Main {
|
||||||
|
val structFromPosix = getStructFromPosix()
|
||||||
|
val structPointerFromPosix = getStructPointerFromPosix()
|
||||||
|
|
||||||
|
object MyStruct {
|
||||||
|
val struct = getMyStructPointer()?.pointed ?: error("Missing my struct")
|
||||||
|
val posixProperty: stat = struct.posixProperty
|
||||||
|
val longProperty: Long = struct.longProperty
|
||||||
|
val doubleProperty: Double = struct.doubleProperty
|
||||||
|
val int32tProperty: Int = struct.int32tProperty
|
||||||
|
val int64TProperty: Long = struct.int64tProperty
|
||||||
|
val linuxOnlyProperty: Boolean = struct.linuxOnlyProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import kotlinx.cinterop.pointed
|
||||||
|
import platform.posix.stat
|
||||||
|
import withPosix.getMyStructPointer
|
||||||
|
import withPosix.getStructFromPosix
|
||||||
|
import withPosix.getStructPointerFromPosix
|
||||||
|
|
||||||
|
object MacosMain {
|
||||||
|
val structFromPosix = getStructFromPosix()
|
||||||
|
val structPointerFromPosix = getStructPointerFromPosix()
|
||||||
|
|
||||||
|
object MyStruct {
|
||||||
|
val struct = getMyStructPointer()?.pointed ?: error("Missing my struct")
|
||||||
|
val posixProperty: stat = struct.posixProperty
|
||||||
|
val longProperty: Long = struct.longProperty
|
||||||
|
val doubleProperty: Double = struct.doubleProperty
|
||||||
|
val int32tProperty: Int = struct.int32tProperty
|
||||||
|
val int64TProperty: Long = struct.int64tProperty
|
||||||
|
val appleOnlyProperty: Boolean = struct.appleOnlyProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import kotlinx.cinterop.pointed
|
||||||
|
import platform.posix.stat
|
||||||
|
import withPosix.getMyStructPointer
|
||||||
|
import withPosix.getStructFromPosix
|
||||||
|
import withPosix.getStructPointerFromPosix
|
||||||
|
|
||||||
|
object NativeMain {
|
||||||
|
val structFromPosix = getStructFromPosix()
|
||||||
|
val structPointerFromPosix = getStructPointerFromPosix()
|
||||||
|
|
||||||
|
object MyStruct {
|
||||||
|
val struct = getMyStructPointer()?.pointed ?: error("Missing my struct")
|
||||||
|
val posixProperty: stat = struct.posixProperty
|
||||||
|
val longProperty: Long = struct.longProperty
|
||||||
|
val doubleProperty: Double = struct.doubleProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
import kotlinx.cinterop.pointed
|
||||||
|
import platform.posix.stat
|
||||||
|
import withPosix.getMyStructPointer
|
||||||
|
import withPosix.getStructFromPosix
|
||||||
|
import withPosix.getStructPointerFromPosix
|
||||||
|
|
||||||
|
object WindowsMain {
|
||||||
|
val structFromPosix = getStructFromPosix()
|
||||||
|
val structPointerFromPosix = getStructPointerFromPosix()
|
||||||
|
|
||||||
|
object MyStruct {
|
||||||
|
val struct = getMyStructPointer()?.pointed ?: error("Missing my struct")
|
||||||
|
val posixProperty: stat = struct.posixProperty
|
||||||
|
val longProperty: Long = struct.longProperty
|
||||||
|
val doubleProperty: Double = struct.doubleProperty
|
||||||
|
val int32tProperty: Int = struct.int32tProperty
|
||||||
|
val int64TProperty: Long = struct.int64tProperty
|
||||||
|
val windowsOnly: Boolean = struct.windowsOnlyProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
val kotlin_version: String by settings
|
||||||
|
plugins {
|
||||||
|
kotlin("multiplatform").version(kotlin_version)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
include(":p1")
|
||||||
|
include(":p2")
|
||||||
|
include(":p3")
|
||||||
Reference in New Issue
Block a user