################################################################
# %toolchainName%
################################################################

cc_toolchain(
    name = "%toolchainName%",
    all_files = ":%toolchainName%-all_files",
    ar_files = ":%toolchainName%-all_files",
    as_files = ":%toolchainName%-all_files",
    compiler_files = ":%toolchainName%-all_files",
    dwp_files = ":%toolchainName%-all_files",
    dynamic_runtime_lib = ":%dynamicRuntimeLibs%",
    linker_files = ":%toolchainName%-all_files",
    objcopy_files = ":%toolchainName%-all_files",
    static_runtime_lib = ":%staticRuntimeLibs%",
    strip_files = ":%toolchainName%-all_files",
    supports_param_files = 0,
    toolchain_identifier = "%toolchainName%",
    toolchain_config = ":%toolchainName%-config",
)

cc_toolchain_config(
    name = "%toolchainName%-config",
    cpu = "%cpu%",
    compiler = "%compiler%",
    version = "%version%",
)

toolchain(
    name = "%toolchainName%_toolchain",
    target_compatible_with = [
        "@bazel_tools//platforms:android",
        "@bazel_tools//platforms:%platform_cpu%",
    ],
    toolchain = "@androidndk//:%toolchainName%",
    toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
)

filegroup(
    name = "%toolchainName%-all_files",
    srcs = glob(["ndk/toolchains/%toolchainDirectory%/**"]) + glob([
        %toolchainFileGlobs%
    ]) + [
      ":%dynamicRuntimeLibs%",
      ":%staticRuntimeLibs%",
    ],
)

