Skip to content

kn: fix CI and add documents for building script#1039

Merged
axxel merged 9 commits intozxing-cpp:masterfrom
isning:kn-ci-fix
Feb 1, 2026
Merged

kn: fix CI and add documents for building script#1039
axxel merged 9 commits intozxing-cpp:masterfrom
isning:kn-ci-fix

Conversation

@isning
Copy link
Copy Markdown
Contributor

@isning isning commented Jan 30, 2026

This pull request had done following things:

  1. Switched cinterop to use built header files rather than source headers to avoid failure of finding building artifact Version.h.
  2. Introduced zig for providing sysroot for building linux targets and build shared libraries for them. This allows us to reuse the generated header files and run tests against the resulting dynamic libraries. But it's notable that we still do NOT ship shared libraries for linux targets.
  3. Moved content of libZXing.def to build.gradle.kts.
  4. Fixed invalid strictEnums configuration in libZXing.def before.

Although Zig is often described as “another language compatible with C,” in this context we only use it for the cross-compilation sysroot it provides, in order to build Linux targets. In practice, it is essentially a wrapper around Clang, combined with a set of tools that handle tasks such as downloading and managing sysroots. It also makes it easy to specify details like the glibc version used by the sysroot.

Otherwise, we would have to maintain the sysroot ourselves and handle compilation for architectures such as ARM64. Given the fragmented nature of the Linux ecosystem, this would likely be quite cumbersome.

Copilot AI review requested due to automatic review settings January 30, 2026 15:54
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Kotlin/Native wrapper and CI to improve Linux testing/linking and align the wrapper API with the current ZXing C API.

Changes:

  • Refactors Kotlin/Native barcode format interop (switching from raw bitmask parsing to enum/value mapping and updating reader options formats getter/setter).
  • Moves cinterop configuration from libZXing.def into Gradle and adjusts Linux CI to build/test against shared libraries via Zig.
  • Tweaks CI workflows and ignores additional Kotlin tooling artifacts.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
wrappers/kn/src/nativeMain/kotlin/zxingcpp/BarcodeWriter.kt Updates creator options format interop to use the new cValue mapping.
wrappers/kn/src/nativeMain/kotlin/zxingcpp/BarcodeReader.kt Reworks ReaderOptions.formats interop to use list + count API and pinned arrays.
wrappers/kn/src/nativeMain/kotlin/zxingcpp/BarcodeFormat.kt Refactors BarcodeFormat to wrap ZXing_BarcodeFormat and adds conversion helpers.
wrappers/kn/src/nativeMain/kotlin/zxingcpp/Barcode.kt Simplifies barcode format mapping via toKObject().
wrappers/kn/build.gradle.kts Embeds cinterop config in Gradle and configures Linux tests to use shared libs; adds Zig-based builds for Linux.
wrappers/kn/.gitignore Ignores .kotlin directory.
.github/workflows/publish-kn.yml Removes prebuilt linux artifact dependency; installs Zig; uploads built Linux shared libs.
.github/workflows/ci.yml Removes system lib install step; installs Zig; updates konan version.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@isning isning changed the title K/N CI fixes and documents kn: fix CI and add documents for building script Jan 30, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +84 to +90
val soPath = "build/cmake/libZXing/${target.name}/out/lib"
when (target) {
is KotlinNativeTargetWithHostTests -> {
target.testRuns.withType<DefaultHostTestRun> {
executionTask.configure {
environment("LD_LIBRARY_PATH", soPath)
}
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LD_LIBRARY_PATH is being set to just soPath, which overwrites any existing LD_LIBRARY_PATH value for the test process. This can break environments that rely on additional shared-library search paths (including CI runners and developer machines). Prefer prepending/appending soPath to the existing value (and handle the empty/null case) rather than replacing it outright.

Copilot uses AI. Check for mistakes.
@axxel
Copy link
Copy Markdown
Collaborator

axxel commented Feb 1, 2026

Could you do me the favor and resolve the merge conflicts?

@isning
Copy link
Copy Markdown
Contributor Author

isning commented Feb 1, 2026

confilict resolved :)

@axxel axxel merged commit 99d0123 into zxing-cpp:master Feb 1, 2026
19 checks passed
@isning isning deleted the kn-ci-fix branch February 2, 2026 04:39
@axxel
Copy link
Copy Markdown
Collaborator

axxel commented Feb 10, 2026

Unfortunately, the publish-kn job failed to publish the results: https://github.com/axxel/zxing-cpp/actions/runs/14321812223

Could you have a look at this? Note that my lengthy work on fixing the publication of the android artifacts was apparently successful. Maybe there is some insight to have.

@isning
Copy link
Copy Markdown
Contributor Author

isning commented Feb 10, 2026

Unfortunately, the publish-kn job failed to publish the results: https://github.com/axxel/zxing-cpp/actions/runs/14321812223

Could you have a look at this? Note that my lengthy work on fixing the publication of the android artifacts was apparently successful. Maybe there is some insight to have.

Sorry but I cant access the workflow's log for it says "The logs for this run have expired and are no longer available."
Do you have any idea about this?

@axxel
Copy link
Copy Markdown
Collaborator

axxel commented Feb 11, 2026

My bad, I sent you the wrong link. Here is the right one: https://github.com/zxing-cpp/zxing-cpp/actions/runs/21869699416

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants