chromium/components/dom_distiller/core/BUILD.gn

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

static_library("core") {
  sources = [
    "article_distillation_update.cc",
    "article_distillation_update.h",
    "article_entry.cc",
    "article_entry.h",
    "distillable_page_detector.cc",
    "distillable_page_detector.h",
    "distilled_content_store.cc",
    "distilled_content_store.h",
    "distilled_page_prefs.cc",
    "distilled_page_prefs.h",
    "distiller.cc",
    "distiller.h",
    "distiller_page.cc",
    "distiller_page.h",
    "distiller_ui_handle.h",
    "distiller_url_fetcher.cc",
    "distiller_url_fetcher.h",
    "dom_distiller_constants.cc",
    "dom_distiller_constants.h",
    "dom_distiller_features.cc",
    "dom_distiller_features.h",
    "dom_distiller_request_view_base.cc",
    "dom_distiller_request_view_base.h",
    "dom_distiller_service.cc",
    "dom_distiller_service.h",
    "dom_distiller_switches.cc",
    "dom_distiller_switches.h",
    "experiments.cc",
    "experiments.h",
    "page_features.cc",
    "page_features.h",
    "pref_names.h",
    "task_tracker.cc",
    "task_tracker.h",
    "url_constants.h",
    "url_utils.cc",
    "url_utils.h",
    "viewer.cc",
    "viewer.h",
  ]

  public_deps = [
    "//components/dom_distiller/core/proto",
    "//net",
    "//third_party/dom_distiller_js:proto",
  ]
  deps = [
    "//base",
    "//build:blink_buildflags",
    "//components/dom_distiller/core/mojom",
    "//components/leveldb_proto",
    "//components/pref_registry",
    "//components/prefs",
    "//components/resources",
    "//components/strings",
    "//components/variations",
    "//services/network/public/cpp:cpp",
    "//skia",
    "//third_party/re2",
    "//ui/base",
    "//url",
  ]
  configs += [ "//build/config/compiler:wexit_time_destructors" ]

  if (is_android) {
    sources += [
      "distilled_page_prefs_android.cc",
      "distilled_page_prefs_android.h",
      "dom_distiller_service_android.cc",
      "dom_distiller_service_android.h",
      "url_utils_android.cc",
    ]
    deps += [ "//components/dom_distiller/core/android:jni_headers" ]
  }
}

static_library("test_support") {
  testonly = true
  sources = [
    "fake_distiller.cc",
    "fake_distiller.h",
    "fake_distiller_page.cc",
    "fake_distiller_page.h",
    "test_request_view_handle.h",
  ]

  deps = [
    ":core",
    "//base",
    "//components/leveldb_proto:test_support",
    "//testing/gmock",
    "//testing/gtest",
    "//url",
  ]
}

bundle_data("unit_tests_bundle_data") {
  visibility = [ ":unit_tests" ]
  testonly = true
  sources = [
    "//components/test/data/dom_distiller/core_features.json",
    "//components/test/data/dom_distiller/derived_features.json",
  ]
  outputs = [ "{{bundle_resources_dir}}/" +
              "{{source_root_relative_dir}}/{{source_file_part}}" ]
}

source_set("unit_tests") {
  testonly = true
  sources = [
    "article_entry_unittest.cc",
    "distillable_page_detector_unittest.cc",
    "distilled_content_store_unittest.cc",
    "distilled_page_prefs_unittests.cc",
    "distiller_unittest.cc",
    "distiller_url_fetcher_unittest.cc",
    "dom_distiller_request_view_base_unittest.cc",
    "dom_distiller_service_unittest.cc",
    "page_features_unittest.cc",
    "task_tracker_unittest.cc",
    "url_utils_unittest.cc",
    "viewer_unittest.cc",
  ]

  deps = [
    ":core",
    ":test_support",
    ":unit_tests_bundle_data",
    "//base",
    "//components/leveldb_proto:test_support",
    "//components/resources",
    "//components/strings",
    "//components/sync_preferences:test_support",
    "//net:test_support",
    "//services/network:test_support",
    "//services/network/public/cpp:cpp",
    "//testing/gmock",
    "//testing/gtest",
    "//ui/base",
    "//url",
  ]
}

if (is_android) {
  import("//build/config/android/rules.gni")

  java_cpp_enum("distiller_type_java") {
    sources = [ "experiments.h" ]
  }
}