# 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",

    # TODO(tonymd): Enable the verilog build by default when the following tools
    # are available in CIPD: yosys, nextpnr-ice40, icetime, icepack
    # ":fpga",
  ]
}

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)",

    # Arduino targets
    "//applications/fpga_config(//targets/stm32f730r8tx_arduino:arduino_size_optimized)",
    "//applications/spi_flash_test(//targets/stm32f730r8tx_arduino:arduino_size_optimized)",
  ]
}

group("fpga") {
  deps = [ "//fpga" ]
}

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

_gonk_proto_packages = [ "//lib/adc:protos.python" ]

# 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 + _gonk_proto_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",
  ]
}
