# Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

workspace(name = "toolchain_config_host")

local_repository(
    name = "bazel_toolchains",
    path = "../../../..",
)

load("@bazel_toolchains//rules:rbe_repo.bzl", "rbe_autoconfig")
load(
    "//configs/test_configs:repo.bzl",
    "CUSTOM_BAZEL_DIGEST1",
    "CUSTOM_BAZEL_DIGEST2",
    "CUSTOM_BAZEL_DIGEST3",
    "CUSTOM_BAZEL_VERSION1",
    "CUSTOM_BAZEL_VERSION2",
    "CUSTOM_BAZEL_VERSION3",
    "CUSTOM_ENV1",
    "CUSTOM_ENV2",
    "CUSTOM_ENV3",
    "CUSTOM_TOOLCHAIN_CONFIG_SUITE_SPEC",
)
load(
    "//configs/test_configs_no_java:repo.bzl",
    NO_JAVA_TOOLCHAIN_CONFIG_SUITE_SPEC = "CUSTOM_TOOLCHAIN_CONFIG_SUITE_SPEC",
)

rbe_autoconfig(
    name = "rbe_custom",
    export_configs = True,
    toolchain_config_suite_spec = CUSTOM_TOOLCHAIN_CONFIG_SUITE_SPEC,
)

rbe_autoconfig(
    name = "rbe_custom_toolchain_config_spec_name",
    export_configs = True,
    toolchain_config_spec_name = "test_toolchain_config_spec_name",
    toolchain_config_suite_spec = CUSTOM_TOOLCHAIN_CONFIG_SUITE_SPEC,
)

rbe_autoconfig(
    name = "rbe_custom_env1",
    env = CUSTOM_ENV1,
    export_configs = True,
    toolchain_config_spec_name = "test_env1",
    toolchain_config_suite_spec = CUSTOM_TOOLCHAIN_CONFIG_SUITE_SPEC,
)

rbe_autoconfig(
    name = "rbe_custom_env2",
    env = CUSTOM_ENV2,
    export_configs = True,
    toolchain_config_spec_name = "test_env2",
    toolchain_config_suite_spec = CUSTOM_TOOLCHAIN_CONFIG_SUITE_SPEC,
)

rbe_autoconfig(
    name = "rbe_custom_env3",
    env = CUSTOM_ENV3,
    export_configs = True,
    toolchain_config_spec_name = "test_env3",
    toolchain_config_suite_spec = CUSTOM_TOOLCHAIN_CONFIG_SUITE_SPEC,
)

rbe_autoconfig(
    name = "rbe_custom_bazel_version1",
    bazel_version = CUSTOM_BAZEL_VERSION1,
    export_configs = True,
    toolchain_config_spec_name = "test_bazel_version1",
    toolchain_config_suite_spec = CUSTOM_TOOLCHAIN_CONFIG_SUITE_SPEC,
)

rbe_autoconfig(
    name = "rbe_custom_bazel_version2",
    bazel_version = CUSTOM_BAZEL_VERSION2,
    export_configs = True,
    toolchain_config_spec_name = "test_bazel_version2",
    toolchain_config_suite_spec = CUSTOM_TOOLCHAIN_CONFIG_SUITE_SPEC,
)

rbe_autoconfig(
    name = "rbe_custom_bazel_version3",
    bazel_version = CUSTOM_BAZEL_VERSION3,
    export_configs = True,
    toolchain_config_spec_name = "test_bazel_version3",
    toolchain_config_suite_spec = CUSTOM_TOOLCHAIN_CONFIG_SUITE_SPEC,
)

rbe_autoconfig(
    name = "rbe_custom_containers1",
    bazel_version = CUSTOM_BAZEL_VERSION1,
    digest = CUSTOM_BAZEL_DIGEST1,
    export_configs = True,
    registry = CUSTOM_TOOLCHAIN_CONFIG_SUITE_SPEC["container_registry"],
    repository = CUSTOM_TOOLCHAIN_CONFIG_SUITE_SPEC["container_repo"],
    toolchain_config_suite_spec = CUSTOM_TOOLCHAIN_CONFIG_SUITE_SPEC,
)

rbe_autoconfig(
    name = "rbe_custom_containers2",
    bazel_version = CUSTOM_BAZEL_VERSION2,
    digest = CUSTOM_BAZEL_DIGEST2,
    export_configs = True,
    registry = CUSTOM_TOOLCHAIN_CONFIG_SUITE_SPEC["container_registry"],
    repository = CUSTOM_TOOLCHAIN_CONFIG_SUITE_SPEC["container_repo"],
    toolchain_config_suite_spec = CUSTOM_TOOLCHAIN_CONFIG_SUITE_SPEC,
)

rbe_autoconfig(
    name = "rbe_custom_containers3",
    bazel_version = CUSTOM_BAZEL_VERSION3,
    digest = CUSTOM_BAZEL_DIGEST3,
    export_configs = True,
    registry = CUSTOM_TOOLCHAIN_CONFIG_SUITE_SPEC["container_registry"],
    repository = CUSTOM_TOOLCHAIN_CONFIG_SUITE_SPEC["container_repo"],
    toolchain_config_suite_spec = CUSTOM_TOOLCHAIN_CONFIG_SUITE_SPEC,
)

rbe_autoconfig(
    name = "rbe_custom_config_tar",
    toolchain_config_suite_spec = CUSTOM_TOOLCHAIN_CONFIG_SUITE_SPEC,
)

rbe_autoconfig(
    name = "rbe_custom_no_java",
    create_java_configs = False,
    export_configs = True,
    toolchain_config_suite_spec = NO_JAVA_TOOLCHAIN_CONFIG_SUITE_SPEC,
)
