Vendor dependencies
Let's see how I like this workflow.
This commit is contained in:
parent
34d1830413
commit
9c435dc440
7500 changed files with 1665121 additions and 99 deletions
87
vendor/cxx/tools/buck/prelude/kotlin/kotlin.bzl
vendored
Normal file
87
vendor/cxx/tools/buck/prelude/kotlin/kotlin.bzl
vendored
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
#
|
||||
# This source code is licensed under both the MIT license found in the
|
||||
# LICENSE-MIT file in the root directory of this source tree and the Apache
|
||||
# License, Version 2.0 found in the LICENSE-APACHE file in the root directory
|
||||
# of this source tree.
|
||||
|
||||
load("@prelude//android:configuration.bzl", "is_building_android_binary_attr")
|
||||
load("@prelude//java:dex_toolchain.bzl", "DexToolchainInfo")
|
||||
load("@prelude//java:java.bzl", "dex_min_sdk_version", "is_build_only_native_code", "select_dex_toolchain", "select_java_test_toolchain")
|
||||
load(
|
||||
"@prelude//java:java_toolchain.bzl",
|
||||
"JavaPlatformInfo",
|
||||
"JavaTestToolchainInfo",
|
||||
"JavaToolchainInfo",
|
||||
)
|
||||
load(
|
||||
"@prelude//kotlin:kotlin_toolchain.bzl",
|
||||
"KotlinToolchainInfo",
|
||||
)
|
||||
load(":kotlin_library.bzl", "kotlin_library_impl")
|
||||
load(":kotlin_test.bzl", "kotlin_test_impl")
|
||||
|
||||
def _select_java_toolchain():
|
||||
# FIXME: prelude// should be standalone (not refer to fbsource//)
|
||||
return "fbsource//xplat/buck2/platform/java:java"
|
||||
|
||||
def _select_kotlin_toolchain():
|
||||
# FIXME: prelude// should be standalone (not refer to fbsource//)
|
||||
return "fbsource//xplat/buck2/platform/kotlin:kotlin"
|
||||
|
||||
implemented_rules = {
|
||||
"kotlin_library": kotlin_library_impl,
|
||||
"kotlin_test": kotlin_test_impl,
|
||||
}
|
||||
|
||||
extra_attributes = {
|
||||
"kotlin_library": {
|
||||
"javac": attrs.option(attrs.one_of(attrs.dep(), attrs.source()), default = None),
|
||||
"resources_root": attrs.option(attrs.string(), default = None),
|
||||
"_build_only_native_code": attrs.default_only(attrs.bool(default = is_build_only_native_code())),
|
||||
"_dex_min_sdk_version": attrs.option(attrs.int(), default = dex_min_sdk_version()),
|
||||
"_dex_toolchain": attrs.option(attrs.exec_dep(
|
||||
providers = [
|
||||
DexToolchainInfo,
|
||||
],
|
||||
), default = select_dex_toolchain()),
|
||||
"_is_building_android_binary": is_building_android_binary_attr(),
|
||||
"_java_toolchain": attrs.exec_dep(
|
||||
default = _select_java_toolchain(),
|
||||
providers = [
|
||||
JavaPlatformInfo,
|
||||
JavaToolchainInfo,
|
||||
],
|
||||
),
|
||||
"_kotlin_toolchain": attrs.exec_dep(
|
||||
default = _select_kotlin_toolchain(),
|
||||
providers = [
|
||||
KotlinToolchainInfo,
|
||||
],
|
||||
),
|
||||
},
|
||||
"kotlin_test": {
|
||||
"javac": attrs.option(attrs.one_of(attrs.dep(), attrs.source()), default = None),
|
||||
"resources_root": attrs.option(attrs.string(), default = None),
|
||||
"_is_building_android_binary": attrs.default_only(attrs.bool(default = False)),
|
||||
"_java_test_toolchain": attrs.exec_dep(
|
||||
default = select_java_test_toolchain(),
|
||||
providers = [
|
||||
JavaTestToolchainInfo,
|
||||
],
|
||||
),
|
||||
"_java_toolchain": attrs.exec_dep(
|
||||
default = _select_java_toolchain(),
|
||||
providers = [
|
||||
JavaPlatformInfo,
|
||||
JavaToolchainInfo,
|
||||
],
|
||||
),
|
||||
"_kotlin_toolchain": attrs.exec_dep(
|
||||
default = _select_kotlin_toolchain(),
|
||||
providers = [
|
||||
KotlinToolchainInfo,
|
||||
],
|
||||
),
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue