chromium/chrome/browser/flags/BUILD.gn

# Copyright 2020 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/android/rules.gni")
import("//third_party/jni_zero/jni_zero.gni")

android_library("java") {
  sources = [
    "android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java",
    "android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureMap.java",
    "android/java/src/org/chromium/chrome/browser/flags/ChromeSessionState.java",
  ]
  public_deps = [ "//base:base_cached_flags_java" ]
  deps = [
    "//base:base_java",
    "//base/version_info/android:version_constants_java",
    "//build:chromeos_buildflags",
    "//build/android:build_java",
    "//chrome/browser/preferences:java",
    "//third_party/android_deps:guava_android_java",
    "//third_party/androidx:androidx_annotation_annotation_java",
    "//third_party/jni_zero:jni_zero_java",
  ]
  srcjar_deps = [
    ":chrome_android_java_switches_srcjar",
    ":chrome_browser_flags_enums_srcjar",
    ":jni_headers",
  ]
}

generate_jni("jni_headers") {
  sources = [
    "android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureMap.java",
    "android/java/src/org/chromium/chrome/browser/flags/ChromeSessionState.java",
  ]
}

static_library("flags_android") {
  sources = [
    "android/chrome_session_state.cc",
    "android/chrome_session_state.h",
  ]
  deps = [
    ":jni_headers",
    "//base",
    "//chrome/browser:browser_process",
    "//components/prefs:prefs",
    "//content/public/browser",
    "//content/public/common",
  ]
}

java_cpp_strings("chrome_android_java_switches_srcjar") {
  sources = [ "//chrome/common/chrome_switches.cc" ]
  template = "android/java_templates/ChromeSwitches.java.tmpl"
}

java_cpp_enum("chrome_browser_flags_enums_srcjar") {
  sources = [ "android/chrome_session_state.h" ]
}

robolectric_library("flags_junit_tests") {
  sources = [
    "android/java/src/org/chromium/chrome/browser/flags/CachedFeatureFlagsAnnotationUnitTest.java",
    "android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureListWithProcessorUnitTest.java",
  ]
  deps = [
    ":java",
    "//base:base_java",
    "//base:base_java_test_support",
    "//base:base_junit_test_support",
    "//base/test:test_support_java",
    "//chrome/browser/preferences:java",
    "//chrome/test/android:chrome_java_unit_test_support",
    "//third_party/android_deps:guava_android_java",
    "//third_party/junit",
    "//third_party/mockito:mockito_java",
  ]
}

android_library("javatests") {
  testonly = true
  sources = [
    "android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureListInstrumentationTest.java",
    "android/java/src/org/chromium/chrome/browser/flags/FieldTrialsInstrumentationTest.java",
  ]
  deps = [
    ":java",
    "//base:base_java",
    "//base:base_java_test_support",
    "//base/test:test_support_java",
    "//chrome/android:chrome_java",
    "//chrome/test/android:chrome_java_integration_test_support",
    "//third_party/android_sdk:android_test_mock_java",
    "//third_party/androidx:androidx_test_runner_java",
    "//third_party/junit",
    "//third_party/mockito:mockito_java",
  ]
}