# Copyright 2017 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/cronet/config.gni")
import("//third_party/protobuf/proto_library.gni")

proto_library("json_proto") {
  proto_in_dir = "//"
  sources = [ "json.proto" ]
}

proto_library("url_proto") {
  proto_in_dir = "//"
  sources = [ "url.proto" ]
}

source_set("url_proto_converter") {
  sources = [
    "url_proto_converter.cc",
    "url_proto_converter.h",
  ]
  deps = [
    ":url_proto",
    "//base",
  ]
}

if (!is_cronet_build) {
  source_set("json_proto_converter") {
    sources = [
      "json_proto_converter.cc",
      "json_proto_converter.h",
    ]
    deps = [ ":json_proto" ]
  }

  static_library("skia_image_filter_converter") {
    sources = [
      "skia_image_filter_proto_converter.cc",
      "skia_image_filter_proto_converter.h",
    ]
    deps = [
      ":skia_image_filter_proto",
      "//base",
      "//skia",
      "//third_party/libprotobuf-mutator",
    ]
    defines = [ "AVOID_MISBEHAVIOR=1" ]
    testonly = true

    #  Can't disable instrumentation because of container-overflow false
    # positives.
    # Assertion failures and integer oveflows in skia are uninteresting.
    if (is_debug || is_ubsan) {
      all_dependent_configs = [ "//testing/libfuzzer:no_clusterfuzz" ]
    }

    # TODO(crbug.com/40031409): Fix code that adds exit-time destructors and
    # enable the diagnostic by removing this line.
    configs += [ "//build/config/compiler:no_exit_time_destructors" ]
  }

  proto_library("skia_image_filter_proto") {
    sources = [ "skia_image_filter.proto" ]
  }

  proto_library("string_compare_proto") {
    sources = [ "string_compare.proto" ]
  }
}
