Skip to content
Open
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
913b1ad
Initial changes to support kotlin-native toolchain
smocherla-brex Jul 6, 2025
e5eb0a5
KtKlibInfo
smocherla-brex Jul 6, 2025
94abd2d
Add initial support for kotlin-native toolchain and klib compilation
smocherla-brex Jul 13, 2025
3553ace
Fix cache marker for other platforms
smocherla-brex Jul 13, 2025
d2a3ca9
buildifier
smocherla-brex Jul 13, 2025
f0385a3
remove unused stuff
smocherla-brex Jul 13, 2025
b108308
remove opts.native.bzl
smocherla-brex Jul 14, 2025
5d6557a
Fix builder tests
smocherla-brex Jul 14, 2025
fa6291e
Add capabilties.bzl to release archive
smocherla-brex Jul 14, 2025
685e4d7
Add BUILD.kotlin-native_capabilities.bazel to release archive
smocherla-brex Jul 14, 2025
126931f
Feedback: Remove duplicate code and pass transitive klibs
smocherla-brex Aug 2, 2025
cefedcb
wip: Remove copy_to_directory and create a dedicated native toolchain
smocherla-brex Aug 3, 2025
a564355
Feedback: Pass konan_home as an arg, and attempt to remove marker files
smocherla-brex Aug 4, 2025
a0c2284
Remove some flags that don't seem needed and don't link with stdlib
smocherla-brex Aug 4, 2025
a57be2e
Fix path to konan_home in toolchain
smocherla-brex Aug 4, 2025
809270e
lint and fix starlark tests
smocherla-brex Aug 4, 2025
59b64c6
Rename klib package to native under kotlin/internal
smocherla-brex Aug 4, 2025
ce96a95
Update docs
smocherla-brex Aug 4, 2025
e902025
Make toolchain names and impl names consistent
smocherla-brex Aug 4, 2025
de83c33
Fix starlark tests
smocherla-brex Aug 4, 2025
3d06d53
Fix more references
smocherla-brex Aug 4, 2025
e940430
Fix more tests and buildifier
smocherla-brex Aug 4, 2025
f5b6641
Add -Xklib-relative-path-base and -Xdebug-prefix-map
smocherla-brex Aug 4, 2025
3def59a
Rename to kt_library and structure accordingly
smocherla-brex Aug 4, 2025
bc060d4
Remove konan_home attribute on the JVM toolchain
smocherla-brex Aug 4, 2025
eda9930
Add runfiles support with tests
smocherla-brex Aug 10, 2025
3dafe36
Mark targets within starkark tests as manual
smocherla-brex Aug 10, 2025
53bda70
Be explicit about --target and propagate it from toolchain to builder
smocherla-brex Aug 10, 2025
2e33d76
Set default target correctly
smocherla-brex Aug 10, 2025
0d6850e
Create CLI toolchain for kotlinc-native and use that for builder
smocherla-brex Aug 10, 2025
b1fba97
Fix build/test failures due to stale references
smocherla-brex Aug 10, 2025
cd60552
Fix checksum for windows
smocherla-brex Aug 10, 2025
bba1ea4
Regen docs
smocherla-brex Aug 10, 2025
96eb77a
Need an alias target in kotlin/compiler sadly to make runfiles work
smocherla-brex Aug 10, 2025
4906239
buildifier and fix one reference
smocherla-brex Aug 10, 2025
89c25cd
Fix some integration tests
smocherla-brex Aug 10, 2025
911f49d
Update docs
smocherla-brex Aug 10, 2025
c23bc5f
lint
smocherla-brex Aug 10, 2025
1cac1b1
Add tests for transitive outputs
smocherla-brex Aug 10, 2025
f244d54
Remove unused loads
smocherla-brex Aug 10, 2025
702ff09
Empty commit to retrigger build and deal with android flake
smocherla-brex Aug 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions kotlin/internal/klib/klib.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ def _kt_klib_library(ctx):

toolchains = ctx.toolchains[_TOOLCHAIN_TYPE]
deps_klibs = []
transitive_klibs = []
for dep in ctx.attr.deps:
deps_klibs.append(dep[_KtKlibInfo].klibs)
deps_klibs.append(dep[_KtKlibInfo].transitive_klibs)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does kotlin native support direct dependency compilation?

If not, just add the transitive deps to the depset transitive argument.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does seem to support it, so I've removed it from being passed to the action (and just keep it in the provider's depset)

transitive_klibs.append(dep[_KtKlibInfo].transitive_klibs)

libraries = depset(transitive = deps_klibs)
builder_args.add_all("--sources", ctx.files.srcs)
builder_inputs, _, input_manifests = ctx.resolve_command(tools = [toolchains.kotlinbuilder, toolchains.konan_home])
Expand All @@ -20,9 +24,6 @@ def _kt_klib_library(ctx):
builder_args.add("--reduced_classpath_mode", "off")
builder_args.add("--output_klib", klib.path)

deps_klibs = []
for dep in ctx.attr.deps:
deps_klibs.append(dep[_KtKlibInfo].klibs)
libraries = depset(transitive = deps_klibs)
builder_args.add_all("--klibs", libraries, omit_if_empty = False)

Expand Down Expand Up @@ -54,6 +55,7 @@ def _kt_klib_library(ctx):
DefaultInfo(files = depset(outputs)),
_KtKlibInfo(
klibs = depset(outputs),
Copy link
Collaborator

Choose a reason for hiding this comment

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

You'll want to include the transitive outputs here.

transitive_klibs = depset(transitive = transitive_klibs),
),
]

Expand Down