-
Notifications
You must be signed in to change notification settings - Fork 235
Add initial kotlin native toolchain and kt_library
rule
#1351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
smocherla-brex
wants to merge
41
commits into
bazelbuild:master
Choose a base branch
from
smocherla-brex:smocherla/kotlin-native-klib
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
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 e5eb0a5
KtKlibInfo
smocherla-brex 94abd2d
Add initial support for kotlin-native toolchain and klib compilation
smocherla-brex 3553ace
Fix cache marker for other platforms
smocherla-brex d2a3ca9
buildifier
smocherla-brex f0385a3
remove unused stuff
smocherla-brex b108308
remove opts.native.bzl
smocherla-brex 5d6557a
Fix builder tests
smocherla-brex fa6291e
Add capabilties.bzl to release archive
smocherla-brex 685e4d7
Add BUILD.kotlin-native_capabilities.bazel to release archive
smocherla-brex 126931f
Feedback: Remove duplicate code and pass transitive klibs
smocherla-brex cefedcb
wip: Remove copy_to_directory and create a dedicated native toolchain
smocherla-brex a564355
Feedback: Pass konan_home as an arg, and attempt to remove marker files
smocherla-brex a0c2284
Remove some flags that don't seem needed and don't link with stdlib
smocherla-brex a57be2e
Fix path to konan_home in toolchain
smocherla-brex 809270e
lint and fix starlark tests
smocherla-brex 59b64c6
Rename klib package to native under kotlin/internal
smocherla-brex ce96a95
Update docs
smocherla-brex e902025
Make toolchain names and impl names consistent
smocherla-brex de83c33
Fix starlark tests
smocherla-brex 3d06d53
Fix more references
smocherla-brex e940430
Fix more tests and buildifier
smocherla-brex f5b6641
Add -Xklib-relative-path-base and -Xdebug-prefix-map
smocherla-brex 3def59a
Rename to kt_library and structure accordingly
smocherla-brex bc060d4
Remove konan_home attribute on the JVM toolchain
smocherla-brex eda9930
Add runfiles support with tests
smocherla-brex 3dafe36
Mark targets within starkark tests as manual
smocherla-brex 53bda70
Be explicit about --target and propagate it from toolchain to builder
smocherla-brex 2e33d76
Set default target correctly
smocherla-brex 0d6850e
Create CLI toolchain for kotlinc-native and use that for builder
smocherla-brex b1fba97
Fix build/test failures due to stale references
smocherla-brex cd60552
Fix checksum for windows
smocherla-brex bba1ea4
Regen docs
smocherla-brex 96eb77a
Need an alias target in kotlin/compiler sadly to make runfiles work
smocherla-brex 4906239
buildifier and fix one reference
smocherla-brex 89c25cd
Fix some integration tests
smocherla-brex 911f49d
Update docs
smocherla-brex c23bc5f
lint
smocherla-brex 1cac1b1
Add tests for transitive outputs
smocherla-brex f244d54
Remove unused loads
smocherla-brex 702ff09
Empty commit to retrigger build and deal with android flake
smocherla-brex File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
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]) | ||
|
@@ -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) | ||
|
||
|
@@ -54,6 +55,7 @@ def _kt_klib_library(ctx): | |
DefaultInfo(files = depset(outputs)), | ||
_KtKlibInfo( | ||
klibs = depset(outputs), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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), | ||
), | ||
] | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.There was a problem hiding this comment.
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)