# Copyright 2023 The Pigweed Authors
#
# 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
#
#     https://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.

import("//build_overrides/pigweed.gni")

import("$dir_pw_build/python.gni")
import("$dir_pw_build/python_dist.gni")
import("$dir_pw_build/python_venv.gni")
import("$dir_pw_unit_test/test.gni")

# All the targets build by default with e.g. `ninja -C out`.
group("default") {
  deps = [
    ":applications",
    ":gonk_python.lint",
    ":gonk_python.tests",
    ":python.install",
  ]
}

group("applications") {
  deps = [
    "//applications/system_example(//targets/host:host_device_simulator.speed_optimized)",
    "//applications/system_example(//targets/stm32f769i_disc0_stm32cube:stm32f769i_disc0_stm32cube.size_optimized)",
  ]
}

# Python Targets
_gonk_python_packages = [ "//tools" ]

# Pigweed Python packages to include
_pigweed_python_packages = [ "$dir_pw_env_setup:core_pigweed_python_packages" ]

_all_python_packages = _gonk_python_packages + _pigweed_python_packages

pw_python_group("gonk_python") {
  python_deps = _gonk_python_packages
}

pw_python_venv("gonk_build_venv") {
  path = "$root_build_dir/python-venv"
  source_packages = _all_python_packages
}

# This template collects all python packages and their dependencies into a
# single super Python package for installation into the bootstrapped virtual
# environment.
pw_python_distribution("gonk_python_distribution") {
  packages = _pigweed_python_packages
  generate_setup_cfg = {
    name = "gonk-dist"
    version = "0.0.1"
    append_date_to_version = true
    include_default_pyproject_file = true
  }
}

pw_python_pip_install("pip_install_gonk_dist") {
  packages = [ ":gonk_python_distribution" ]
}

pw_python_pip_install("pip_install_gonk_editable_tools") {
  packages = _gonk_python_packages
  editable = true
}

pw_python_group("python") {
  python_deps = [
    # Generate and pip install _pigweed_python_packages
    ":pip_install_gonk_dist",
    ":pip_install_gonk_editable_tools",
  ]
}
