tirbofish/dropbear · diff
fixed lack of ExperimentalNativeAPI, general housekeeping and some plugin updates. it still doesn't work but hey more to come amirite???
Signature present but could not be verified.
Unverified
@@ -16,6 +16,7 @@ If you might have not realised, all the crates/projects names are after Australi ### Related Projects - [magna-carta](https://github.com/4tkbytes/dropbear/tree/main/magna-carta) is a rust library used to generate compile-time Kotlin/Native and Kotlin/JVM metadata for searching. +- [magna-carta-plugin](https://github.com/4tkbytes/dropbear/tree/main/magna-carta-plugin) is a Gradle plugin for generating metadata during compile time with the help of the magna-carta cli tool. - [dropbear_future-queue](https://github.com/4tkbytes/dropbear/tree/main/dropbear_future-queue) is a handy library for dealing with async in a sync context - [model_to_image](https://github.com/4tkbytes/model_to_image) is a library used to generate thumbnails and images from a 3D model with the help of `russimp-ng` and a custom made rasteriser. _(very crude but usable)_ @@ -35,17 +35,29 @@ class MagnaCartaPlugin : Plugin<Project> { project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") { val kotlin = project.extensions.getByType(KotlinMultiplatformExtension::class) + kotlin.sourceSets.apply { - val jvmMain = getByName("jvmMain") - jvmMain.kotlin.srcDir(generateJvmTask.map { it.outputDir }) + if (names.contains("jvmMain")) { + val jvmMain = getByName("jvmMain") + jvmMain.kotlin.srcDir(generateJvmTask.map { it.outputDir }) + } - val nativeMain = maybeCreate("nativeMain") + val nativeMain = findByName("nativeMain") ?: create("nativeMain") nativeMain.kotlin.srcDir(generateNativeTask.map { it.outputDir }) kotlin.targets.withType(KotlinNativeTarget::class.java) { compilations.getByName("main").defaultSourceSet.dependsOn(nativeMain) } } + + + kotlin.targets.all { + this.compilations.all { + this.compileTaskProvider.configure { + this.dependsOn(generateJvmTask, generateNativeTask) + } + } + } } } } @@ -18,8 +18,6 @@ impl Generator for KotlinJVMGenerator { local_time.format("%Y-%m-%d %H:%M:%S") )?; writeln!(output)?; - writeln!(output, "package com.dropbear")?; - writeln!(output)?; let mut imported_packages = std::collections::HashSet::new(); for item in manifest.items() { @@ -17,11 +17,9 @@ impl Generator for KotlinNativeGenerator { )?; writeln!( output, - "@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)" + "@file:OptIn(ExperimentalForeignApi::class, ExperimentalNativeApi::class)" )?; writeln!(output)?; - writeln!(output, "package com.dropbear")?; - writeln!(output)?; writeln!(output, "import com.dropbear.DropbearEngine")?; writeln!(output, "import com.dropbear.EntityId")?; @@ -79,7 +77,7 @@ impl Generator for KotlinNativeGenerator { writeln!( output, - "private fun getDropbearEngine(worldPointer: COpaquePointer?, currentEntity: Long?): DropbearEngine {{" + "private fun getDropbearEngine(worldPointer: COpaquePointer?, currentEntity: ULong?): DropbearEngine {{" )?; writeln!(output, " val nativeEngine = NativeEngine()")?; writeln!(output, " nativeEngine.init(worldPointer)")?; @@ -110,7 +108,7 @@ impl Generator for KotlinNativeGenerator { writeln!(output, "@CName(\"{}\")", func_name)?; writeln!( output, - "fun {}ScriptByTag(worldPointer: COpaquePointer?, currentEntity: Long?, tag: String?{}) {{", + "fun {}ScriptByTag(worldPointer: COpaquePointer?, currentEntity: ULong?, tag: String?{}) {{", method_name, param_extra )?;