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

# This group requires the following tools for the FPGA build:
#   yosys, nextpnr-ice40, icepack, icetime
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 + _gonk_proto_packages + _pigweed_python_packages

# Group that defines all Python test and lint targets.
pw_python_group("gonk_python") {
  python_deps = _gonk_python_packages
}

# The python virtualenv used for testing and linting.
pw_python_venv("gonk_build_venv") {
  path = "$root_build_dir/python-venv"
  source_packages = _all_python_packages
}

# Bundle of all Gonk Python packages and their Pigweed dependencies
pw_python_distribution("gonk_python_tools") {
  packages = _gonk_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
  }
}

# Pip install target for Gonk Python tools and protos.
pw_python_pip_install("pip_install_gonk_tools") {
  packages = [ ":gonk_python_tools" ]
}

# Python data package for Gonk firmware build.
pw_python_distribution("gonk_firmware") {
  packages = []
  generate_setup_cfg = {
    name = "gonk-firmware"
    version = "0.0.1"
    append_date_to_version = true
    include_default_pyproject_file = true
    include_extra_files_in_package_data = true
    auto_create_package_data_init_py_files = true
  }

  public_deps = [
    "//applications/fpga_config:fpga_config(//targets/stm32f730r8tx_arduino:arduino_size_optimized)",
    "//applications/fpga_config:fpga_config.elf(//targets/stm32f730r8tx_arduino:arduino_size_optimized)",
  ]

  _gonk_bin = "$root_build_dir/arduino_size_optimized/obj/applications/fpga_config/fpga_config.bin"
  _gonk_elf = "$root_build_dir/arduino_size_optimized/obj/applications/fpga_config/bin/fpga_config.elf"
  extra_files = [
    "$_gonk_bin > gonk_firmware/gonk.bin",
    "$_gonk_elf > gonk_firmware/gonk.elf",
  ]

  # The FPGA image is only built on Linux so far.
  if (host_os == "linux") {
    _fpga_artifacts_dir = "$root_build_dir/obj/fpga/toplevel"

    public_deps += [ "//fpga:toplevel._bin($default_toolchain)" ]
    extra_files +=
        [ "$_fpga_artifacts_dir/toplevel.bin > gonk_firmware/fpga.bin" ]
  }
}

# Pip install target for the firmware datapackage only. This is separate since
# the FPGA toolchain is an optional build component.
pw_python_pip_install("pip_install_gonk_firmware") {
  packages = [ ":gonk_firmware" ]
}

# Python group used durring bootstrap.
pw_python_group("python") {
  python_deps = [
    ":pip_install_gonk_tools",
    "$dir_pw_env_setup:pip_install_pigweed_package",
  ]
}

_gonk_bundle_packages =
    _gonk_python_packages + _gonk_proto_packages + [ ":gonk_firmware" ]

pw_python_venv("gonk_bundle_venv") {
  path = "$root_build_dir/gonk-bundle-venv"
  source_packages = _gonk_bundle_packages
}

pw_python_zip_with_setup("gonk_bundle") {
  # Include vendored wheels for this virtualenv.
  venv = ":gonk_bundle_venv"

  # Gonk packages to include
  packages = [
    ":gonk_firmware",
    ":gonk_python_tools",
  ]

  # Add the tools README to the zipfile.
  inputs = [ "//tools/README.md > /README.md" ]
}
