chromium/components/feature_engagement/internal/BUILD.gn

# 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.

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

static_library("internal") {
  visibility = [
    ":*",
    "//components/feature_engagement",
    "//components/feature_engagement/internal/test:test_support",
    "//components/feature_engagement/test:test_support",
  ]

  sources = [
    "availability_model.h",
    "availability_model_impl.cc",
    "availability_model_impl.h",
    "blocked_iph_features.cc",
    "blocked_iph_features.h",
    "chrome_variations_configuration.cc",
    "chrome_variations_configuration.h",
    "condition_validator.cc",
    "condition_validator.h",
    "display_lock_controller.h",
    "display_lock_controller_impl.cc",
    "display_lock_controller_impl.h",
    "editable_configuration.cc",
    "editable_configuration.h",
    "event_model.h",
    "event_model_impl.cc",
    "event_model_impl.h",
    "event_storage_validator.h",
    "event_store.h",
    "feature_config_condition_validator.cc",
    "feature_config_condition_validator.h",
    "feature_config_event_storage_validator.cc",
    "feature_config_event_storage_validator.h",
    "in_memory_event_store.cc",
    "in_memory_event_store.h",
    "init_aware_event_model.cc",
    "init_aware_event_model.h",
    "never_availability_model.cc",
    "never_availability_model.h",
    "never_condition_validator.cc",
    "never_condition_validator.h",
    "never_event_storage_validator.cc",
    "never_event_storage_validator.h",
    "noop_display_lock_controller.cc",
    "noop_display_lock_controller.h",
    "once_condition_validator.cc",
    "once_condition_validator.h",
    "persistent_availability_store.cc",
    "persistent_availability_store.h",
    "persistent_event_store.cc",
    "persistent_event_store.h",
    "single_invalid_configuration.cc",
    "single_invalid_configuration.h",
    "stats.cc",
    "stats.h",
    "system_time_provider.cc",
    "system_time_provider.h",
    "testing_clock_time_provider.cc",
    "testing_clock_time_provider.h",
    "time_provider.h",
    "tracker_impl.cc",
    "tracker_impl.h",
  ]

  public_deps = [
    "//base",
    "//components/feature_engagement/internal/proto",
  ]

  deps = [
    "//components/feature_engagement/public",
    "//components/keyed_service/core",
    "//components/leveldb_proto",
  ]

  configs += [ "//build/config/compiler:wexit_time_destructors" ]

  if (is_android) {
    sources += [
      "android/tracker_impl_android.cc",
      "android/tracker_impl_android.h",
    ]

    deps += [ ":jni_headers" ]
  }
}

source_set("unit_tests") {
  testonly = true

  visibility = [ "//components/feature_engagement:unit_tests" ]

  # IMPORTANT NOTE: When adding new tests, also remember to update the list of
  # tests in //components/feature_engagement/components_unittests.filter
  sources = [
    "availability_model_impl_unittest.cc",
    "blocked_iph_features_unittest.cc",
    "chrome_variations_configuration_unittest.cc",
    "condition_validator_unittest.cc",
    "display_lock_controller_impl_unittest.cc",
    "editable_configuration_unittest.cc",
    "event_model_impl_unittest.cc",
    "feature_config_condition_validator_unittest.cc",
    "feature_config_event_storage_validator_unittest.cc",
    "in_memory_event_store_unittest.cc",
    "init_aware_event_model_unittest.cc",
    "never_availability_model_unittest.cc",
    "never_condition_validator_unittest.cc",
    "never_event_storage_validator_unittest.cc",
    "noop_display_lock_controller_unittest.cc",
    "once_condition_validator_unittest.cc",
    "persistent_availability_store_unittest.cc",
    "persistent_event_store_unittest.cc",
    "single_invalid_configuration_unittest.cc",
    "system_time_provider_unittest.cc",
    "tracker_impl_unittest.cc",
  ]

  deps = [
    ":internal",
    "//base/test:test_support",
    "//components/feature_engagement/internal/test:test_support",
    "//components/feature_engagement/public",
    "//components/feature_engagement/test:test_support",
    "//components/leveldb_proto:test_support",
    "//testing/gmock",
    "//testing/gtest",
  ]
}

if (is_android) {
  android_library("internal_java") {
    visibility = [ "//components/feature_engagement:feature_engagement_java" ]

    srcjar_deps = [ ":jni_headers" ]
    sources = [ "android/java/src/org/chromium/components/feature_engagement/internal/TrackerImpl.java" ]

    deps = [
      "//base:base_java",
      "//build/android:build_java",
      "//components/feature_engagement/public:public_java",
      "//third_party/androidx:androidx_annotation_annotation_java",
      "//third_party/jni_zero:jni_zero_java",
      "//ui/android:ui_java",
    ]
  }

  generate_jni("jni_headers") {
    visibility = [ ":*" ]
    sources = [ "android/java/src/org/chromium/components/feature_engagement/internal/TrackerImpl.java" ]
  }
}