# Copyright (c) 2022 Project CHIP 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
#
# 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.

import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")
import("//build_overrides/jsoncpp.gni")

import("${chip_root}/build/chip/tools.gni")
import("${chip_root}/build/config/compiler/compiler.gni")
import("${chip_root}/build/config/mac/mac_sdk.gni")
import("${chip_root}/examples//chip-tool/chip-tool.gni")

if (config_use_interactive_mode) {
  import("//build_overrides/editline.gni")
}

assert(chip_build_tools)

declare_args() {
  chip_codesign = current_os == "ios"

  # When config_enable_yaml_tests is false, the Matter SDK options are not available.
  if (!config_enable_yaml_tests) {
    chip_inet_config_enable_ipv4 = true
    if (!defined(chip_config_network_layer_ble)) {
      chip_config_network_layer_ble = true
    }
    if (!defined(is_clang)) {
      is_clang = false
    }
  }

  enable_provisional_features = config_enable_yaml_tests
}

sdk = "macosx"
sdk_build_dir_suffix = ""
if (getenv("SDKROOT") != "") {
  sdk = getenv("SDKROOT")
  sdk_root_parts = string_split(getenv("SDKROOT"), ".")
  sdk_build_dir_suffix = "-${sdk_root_parts[0]}"
}
output_sdk_type = "Debug${sdk_build_dir_suffix}"

action("build-darwin-framework") {
  script = "${chip_root}/scripts/build/build_darwin_framework.py"

  inputs = [
    "${chip_root}/src/darwin/Framework/CHIP",
    "${chip_root}/src/darwin/Framework/CHIP/zap-generated",
    "${chip_root}/src/darwin/Framework/Matter.xcodeproj",
  ]

  args = [
    "--project_path",
    rebase_path("${chip_root}/src/darwin/Framework/Matter.xcodeproj",
                root_build_dir),
    "--out_path",
    "macos_framework_output",
    "--target",
    "Matter Framework",
    "--log_path",
    rebase_path("${root_build_dir}/darwin_framework_build.log", root_build_dir),
    "--target_arch",
    mac_target_arch,
  ]

  if (sdk != "macosx") {
    args += [
      "--target_sdk",
      sdk,
    ]
  }

  if (defined(chip_inet_config_enable_ipv4) && chip_inet_config_enable_ipv4) {
    args += [ "--ipv4" ]
  } else {
    args += [ "--no-ipv4" ]
  }

  if (defined(is_asan) && is_asan) {
    args += [ "--asan" ]
  } else {
    args += [ "--no-asan" ]
  }

  if (defined(chip_config_network_layer_ble) && chip_config_network_layer_ble) {
    args += [ "--ble" ]
  } else {
    args += [ "--no-ble" ]
  }

  if (defined(is_clang) && is_clang) {
    args += [ "--clang" ]
  } else {
    args += [ "--no-clang" ]
  }

  if (config_enable_yaml_tests) {
    args += [ "--enable-encoding-sentinel-enum-values" ]
  } else {
    args += [ "--no-enable-encoding-sentinel-enum-values" ]
  }

  output_name = "Matter.framework"
  outputs = [
    "${root_out_dir}/macos_framework_output/Build/Products/${output_sdk_type}/${output_name}",
    "${root_build_dir}/darwin_framework_build.log",
    "${root_out_dir}/macos_framework_output/ModuleCache.noindex/",
    "${root_out_dir}/macos_framework_output/Logs",
    "${root_out_dir}/macos_framework_output/Index",
    "${root_out_dir}/macos_framework_output/Build",
  ]
}

config("config") {
  include_dirs = [
    ".",
    "${chip_root}/examples/common",
    "${chip_root}/examples/darwin-framework-tool/commands/common",
    "${chip_root}/zzz_generated/darwin-framework-tool",
    "${chip_root}/zzz_generated/controller-clusters",
    "${chip_root}/examples/chip-tool",
    "${chip_root}/zzz_generated/chip-tool",
    "${root_out_dir}/macos_framework_output/Build/Products/${output_sdk_type}/",
  ]

  framework_dirs = [
    "${root_out_dir}/macos_framework_output/Build/Products/${output_sdk_type}/",
  ]

  defines = [
    "CONFIG_ENABLE_YAML_TESTS=${config_enable_yaml_tests}",
    "CONFIG_USE_INTERACTIVE_MODE=${config_use_interactive_mode}",

    # Disable availability annotations in Matter.framework headers because we
    # are not building against a system Matter.framework here anyway.
    "MTR_NO_AVAILABILITY=1",
  ]

  cflags = [
    "-Wconversion",
    "-fobjc-arc",
  ]
}

executable("darwin-framework-tool") {
  sources = [
    "${chip_root}/examples/chip-tool/commands/common/Command.cpp",
    "${chip_root}/examples/chip-tool/commands/common/Command.h",
    "${chip_root}/examples/chip-tool/commands/common/Commands.cpp",
    "${chip_root}/examples/chip-tool/commands/common/Commands.h",
    "${chip_root}/examples/chip-tool/commands/common/HexConversion.h",
    "${chip_root}/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp",
    "commands/clusters/ClusterCommandBridge.h",
    "commands/clusters/ModelCommandBridge.mm",
    "commands/clusters/ReportCommandBridge.h",
    "commands/clusters/WriteAttributeCommandBridge.h",
    "commands/common/CHIPCommandBridge.mm",
    "commands/common/CHIPCommandStorageDelegate.mm",
    "commands/common/CHIPToolKeypair.mm",
    "commands/common/MTRDevice_Externs.h",
    "commands/common/MTRError.mm",
    "commands/common/MTRError_Utils.h",
    "commands/common/MTRLogging.h",
    "commands/common/RemoteDataModelLogger.h",
    "commands/common/RemoteDataModelLogger.mm",
    "commands/delay/Commands.h",
    "commands/delay/SleepCommand.h",
    "commands/delay/SleepCommand.mm",
    "commands/delay/WaitForCommissioneeCommand.h",
    "commands/delay/WaitForCommissioneeCommand.mm",
    "commands/discover/Commands.h",
    "commands/discover/DiscoverCommissionablesCommand.h",
    "commands/discover/DiscoverCommissionablesCommand.mm",
    "commands/pairing/Commands.h",
    "commands/pairing/DeviceControllerDelegateBridge.mm",
    "commands/pairing/GetCommissionerNodeIdCommand.h",
    "commands/pairing/GetCommissionerNodeIdCommand.mm",
    "commands/pairing/OpenCommissioningWindowCommand.h",
    "commands/pairing/OpenCommissioningWindowCommand.mm",
    "commands/pairing/PairingCommandBridge.mm",
    "commands/payload/SetupPayloadParseCommand.mm",
    "commands/provider/Commands.h",
    "commands/provider/OTAProviderDelegate.mm",
    "commands/provider/OTASoftwareUpdateInteractive.mm",
    "commands/storage/Commands.h",
    "commands/storage/StorageManagementCommand.mm",
    "logging/logging.mm",
    "main.mm",
  ]

  deps = [
    ":build-darwin-framework",
    jsoncpp_root,
  ]

  if (config_use_interactive_mode) {
    sources += [ "commands/interactive/InteractiveCommands.mm" ]

    deps += [
      "${chip_root}/examples/common/websocket-server",
      "${chip_root}/src/platform/logging:headers",
      "${editline_root}:editline",
    ]
  }

  ldflags = [
    "-rpath",
    "@executable_path/macos_framework_output/Build/Products/${output_sdk_type}/",
  ]

  frameworks = [
    "Matter.framework",
    "Security.framework",
  ]

  # When config_enable_yaml_tests=true the Matter SDK is pulled in as a dependency because the code of the test suite
  # uses some helpers from the Matter SDK. As a result, the SDK is built twice. Once because of this dependency and once
  # when the Matter.framework is built.
  # It may results in different versions of the Matter SDK between the output binary and the linked Matter.framework.
  #
  # When config_enable_yaml_tests=false the Matter SDK is built once when the Matter.framework is built and the resulting
  # libCHIP.a library is linked statically to the output binary.
  if (config_enable_yaml_tests) {
    deps += [
      "${chip_root}/src/app/tests/suites/commands/delay",

      # IM is needed for MTRError
      "${chip_root}/src/app/tests/suites/commands/interaction_model",

      # Log is needed by tests UserPrompt and Log
      "${chip_root}/src/app/tests/suites/commands/log",

      # System is needed by tests FactoryReset etc..
      "${chip_root}/src/app/tests/suites/commands/system",

      # pics is needed by tests
      "${chip_root}/src/app/tests/suites/pics",
      "${chip_root}/src/protocols/interaction_model",
    ]

    defines = []
  } else {
    include_dirs = [
      "${chip_root}/config/standalone/",
      "${chip_root}/src/",
      "${chip_root}/src/include/",
      "${chip_root}/src/protocols/",
      "${chip_root}/src/protocols/interaction_model",
      "${chip_root}/third_party/nlassert/repo/include/",
      "${chip_root}/third_party/nlio/repo/include/",
      "${chip_root}/zzz_generated/app-common/",
      "${root_gen_dir}/include",
      "${root_out_dir}/macos_framework_output/Build/Intermediates.noindex/Matter.build/${output_sdk_type}/Matter.build/out/gen/include",
    ]

    defines = [
      "CHIP_HAVE_CONFIG_H=1",
      "CHIP_SYSTEM_CONFIG_USE_SOCKETS=1",
    ]

    frameworks += [
      "CoreFoundation.framework",
      "Foundation.framework",
      "CoreBluetooth.framework",
      "Network.framework",
    ]

    # Other SDKs are linked statically to Matter.framework but the macosx SDK is linked dynamically but needs some symbols that are
    # not exposed by the dylib.
    if (sdk == "macosx") {
      libs = [ "${root_out_dir}/macos_framework_output/Build/Intermediates.noindex/Matter.build/${output_sdk_type}/Matter.build/out/lib/libCHIP.a" ]
    }
  }

  if (enable_provisional_features) {
    defines += [ "MTR_ENABLE_PROVISIONAL=1" ]
  }

  public_configs = [ ":config" ]

  output_dir = root_out_dir
}

if (chip_codesign) {
  action("codesign") {
    script = "entitlements/codesign.py"
    public_deps = [ ":darwin-framework-tool" ]

    args = [
      "--target_path",
      rebase_path("${root_build_dir}/darwin-framework-tool", root_build_dir),
      "--log_path",
      rebase_path("${root_build_dir}/codesign_log.txt", root_build_dir),
    ]

    output_name = "codesign_log.txt"
    outputs = [ "${root_build_dir}/${output_name}" ]
  }
}

# Make sure we only build darwin-framework-tool, and not extraneous
# things like address-resolve, by default.
group("default") {
  deps = [ ":darwin-framework-tool" ]
}
