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

# Top-level test configuration.
# Converted from the following makefile
### PRODUCT_PACKAGES += dev
### PRODUCT_HOST_PACKAGES += host
### $(call inherit-product, $(LOCAL_PATH)/part1.mk)
### PRODUCT_COPY_FILES += device_from:device_to
### include $(LOCAL_PATH)/include1.mk
### PRODUCT_PACKAGES += dev_after
### PRODUCT_COPY_FILES += $(call find-copy-subdir-files,audio_platform_info*.xml,device/google/redfin/audio,$(TARGET_COPY_OUT_VENDOR)/etc) xyz:/etc/xyz
### PRODUCT_COPY_FILES += $(call copy-files,x.xml y.xml,/etc)
### $(call add_soong_config_namespace,NS1)
### $(call soong_config_append,NS1,v1,abc)
### $(call soong_config_append,NS1,v2,def)
### $(call add_soong_config_var_value,NS2,v3,abc)
### $(call soong_config_set,NS2,v3,xyz)

load("//build/make/core:product_config.rbc", "rblf")
load(":part1.rbc", _part1_init = "init")
load(":include1.rbc", _include1_init = "init")

def init(g, handle):
  cfg = rblf.cfg(handle)
  rblf.setdefault(handle, "PRODUCT_PACKAGES")
  cfg["PRODUCT_PACKAGES"] += ["dev"]
  rblf.setdefault(handle, "PRODUCT_HOST_PACKAGES")
  cfg["PRODUCT_HOST_PACKAGES"] += ["host"]
  rblf.inherit(handle, "test/part1", _part1_init)
  rblf.setdefault(handle, "PRODUCT_COPY_FILES")
  cfg["PRODUCT_COPY_FILES"] += ["device_from:device_to"]
  _include1_init(g, handle)
  cfg["PRODUCT_PACKAGES"] += ["dev_after"]
  cfg["PRODUCT_COPY_FILES"] += (rblf.find_and_copy("audio_platform_info*.xml", "device/google/redfin", "||VENDOR-PATH-PH||/etc") +
      ["xyz:/etc/xyz"])
  cfg["PRODUCT_COPY_FILES"] += rblf.copy_files("x.xml y.xml", "/etc")
  cfg["PRODUCT_COPY_FILES"] += rblf.copy_files(["from/sub/x", "from/sub/y"], "to")

  rblf.soong_config_namespace(g, "NS1")
  rblf.soong_config_append(g, "NS1", "v1", "abc")
  rblf.soong_config_append(g, "NS1", "v2", "def")
  rblf.soong_config_set(g, "NS2", "v3", "abc")
  rblf.soong_config_set(g, "NS2", "v3", "xyz")
  rblf.soong_config_set(g, "NS2", "v4", "xyz   ")

  rblf.mkdist_for_goals(g, "goal", "dir1/file1:out1 dir1/file2:out2")
  rblf.mkdist_for_goals(g, "goal", "dir2/file2:")

  if rblf.board_platform_in(g, "board1 board2"):
    cfg["PRODUCT_PACKAGES"] += ["bad_package"]
  g["TARGET_BOARD_PLATFORM"] = "board1"
  if rblf.board_platform_in(g, "board1 board2"):
    cfg["PRODUCT_PACKAGES"] += ["board1_in"]
  if rblf.board_platform_in(g, ["board3","board2"]):
    cfg["PRODUCT_PACKAGES"] += ["bad_board_in"]
  if rblf.board_platform_is(g, "board1"):
    cfg["PRODUCT_PACKAGES"] += ["board1_is"]
  if rblf.board_platform_is(g, "board2"):
    cfg["PRODUCT_PACKAGES"] += ["bad_board1_is"]
