Skip to content
This repository has been archived by the owner on Nov 24, 2024. It is now read-only.

Commit

Permalink
Pass --use-system-load-library to Jextract, bump version to 0.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
toasterofbread committed Jun 26, 2024
1 parent 4b8749f commit 06a445b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project.version=0.0.4
project.version=0.0.5

# Sample
mainClass=dev.toastbits.sample.SampleKt
Expand Down
2 changes: 1 addition & 1 deletion library/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ mavenPublishing {
coordinates("dev.toastbits.kjna", "library", project_version)

publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
// signAllPublications()
signAllPublications()

configure(KotlinMultiplatform(
javadocJar = JavadocJar.Dokka("dokkaHtml"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ open class KJnaJextractGenerateTask: DefaultTask(), KJnaJextractRuntimeOptions {
mutableListOf(
parser.getHeaderFile(header.header_path).absolutePath,
"--target-package", target_package,
"--header-class-name", header_class_name
"--header-class-name", header_class_name,
"--use-system-load-library"
)

for (macro in runtime_options.macros) {
Expand Down Expand Up @@ -160,7 +161,7 @@ open class KJnaJextractGenerateTask: DefaultTask(), KJnaJextractRuntimeOptions {
private fun processJextractGenFile(file: File) {
val lines: MutableList<String> = file.readLines().toMutableList()
val unnamed: MutableMap<String, UnnamedIdentifier> = mutableMapOf()

for ((index, line) in lines.withIndex()) {
var start: Int = 0
var last_identifier: UnnamedIdentifier? = null
Expand All @@ -176,7 +177,7 @@ open class KJnaJextractGenerateTask: DefaultTask(), KJnaJextractRuntimeOptions {

val path: String = line.substring(unnamed_start + 13, unnamed_end)
last_identifier = unnamed.getOrPut(path) { UnnamedIdentifier() }

last_identifier.lines[index] = line.substring(0, unnamed_start).indexOfLast { it.isWhitespace() || it == '.' || it == '"' } + 1 .. unnamed_end

start = unnamed_end
Expand All @@ -187,7 +188,7 @@ open class KJnaJextractGenerateTask: DefaultTask(), KJnaJextractRuntimeOptions {
if (withname_start != -1) {
val withName_end: Int = line.indexOf("\")", withname_start + 1)
check(withName_end != -1) { "$file ($index)" }

last_identifier.identifier = line.substring(withname_start + 11, withName_end)
}
}
Expand All @@ -203,7 +204,7 @@ open class KJnaJextractGenerateTask: DefaultTask(), KJnaJextractRuntimeOptions {
if (first == '/' || first == '*') {
continue
}

val final_identifier: String = identifier.identifier ?: throw NullPointerException("$file $line $range")
lines[line] = lines[line].replaceRange(range, final_identifier + "\u0000".repeat((range.endInclusive - range.start + 1) - final_identifier.length))
}
Expand Down
2 changes: 1 addition & 1 deletion runtime/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ mavenPublishing {
coordinates("dev.toastbits.kjna", "runtime", project_version)

publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
// signAllPublications()
signAllPublications()

configure(KotlinMultiplatform(
javadocJar = JavadocJar.Dokka("dokkaHtml"),
Expand Down
2 changes: 1 addition & 1 deletion sample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import dev.toastbits.kjna.c.CType

plugins {
kotlin("multiplatform")
id("dev.toastbits.kjna").version("0.0.4")
id("dev.toastbits.kjna").version("0.0.5")
}

kotlin {
Expand Down

0 comments on commit 06a445b

Please sign in to comment.