# Copyright 2021 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.

"""A resilient API layer wrapping compilation and other logic for Rust rules.

This module is meant to be used by custom rules that need to compile Rust code
and cannot simply rely on writing a macro that wraps `rust_library`. This module
provides the lower-level interface to Rust providers, actions, and functions.
Do not load this file directly; instead, load the top-level `defs.bzl` file,
which exports the `rust_common` struct.

In the Bazel lingo, `rust_common` gives the access to the Rust Sandwich API.
"""

load(":providers.bzl", "CrateGroupInfo", "CrateInfo", "DepInfo", "DepVariantInfo", "StdLibInfo", "TestCrateInfo")

# This constant only represents the default value for attributes and macros
# defined in `rules_rust`. Like any attribute public attribute, it can be
# overwritten by the user on the rules they're defined on.
#
# Note: Code in `.github/workflows/crate_universe.yaml` looks for this line, if
# you remove it or change its format, you will also need to update that code.
DEFAULT_RUST_VERSION = "1.79.0"

DEFAULT_NIGHTLY_ISO_DATE = "2024-06-13"

def _create_crate_info(**kwargs):
    """A constructor for a `CrateInfo` provider

    This function should be used in place of directly creating a `CrateInfo`
    provider to improve API stability.

    Args:
        **kwargs: An inital set of keyword arguments.

    Returns:
        CrateInfo: A provider
    """
    if not "wrapped_crate_type" in kwargs:
        kwargs.update({"wrapped_crate_type": None})
    if not "metadata" in kwargs:
        kwargs.update({"metadata": None})
    if not "rustc_rmeta_output" in kwargs:
        kwargs.update({"rustc_rmeta_output": None})
    if not "rustc_output" in kwargs:
        kwargs.update({"rustc_output": None})
    if not "rustc_env_files" in kwargs:
        kwargs.update({"rustc_env_files": []})
    if not "data" in kwargs:
        kwargs.update({"data": depset([])})
    return CrateInfo(**kwargs)

rust_common = struct(
    create_crate_info = _create_crate_info,
    crate_info = CrateInfo,
    dep_info = DepInfo,
    dep_variant_info = DepVariantInfo,
    stdlib_info = StdLibInfo,
    test_crate_info = TestCrateInfo,
    crate_group_info = CrateGroupInfo,
    default_version = DEFAULT_RUST_VERSION,
)

COMMON_PROVIDERS = [
    CrateInfo,
    DepInfo,
    DefaultInfo,
]
