| # Copyright 2015 The Chromium Authors. All rights reserved. |
| # 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") |
| |
| _jni_sources = [ |
| "java/src/org/chromium/policy/CombinedPolicyProvider.java", |
| "java/src/org/chromium/policy/PolicyConverter.java", |
| "java/src/org/chromium/policy/PolicyService.java", |
| ] |
| |
| java_cpp_strings("java_switches_srcjar") { |
| # External code should depend on ":policy_java" instead. |
| visibility = [ ":*" ] |
| sources = [ "//components/policy/core/common/policy_switches.cc" ] |
| template = "java_templates/PolicySwitches.java.tmpl" |
| } |
| |
| android_library("policy_java") { |
| deps = [ |
| "//base:base_java", |
| "//base:jni_java", |
| "//third_party/android_deps:androidx_annotation_annotation_java", |
| ] |
| srcjar_deps = [ ":java_switches_srcjar" ] |
| annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] |
| |
| sources = |
| _jni_sources + [ |
| "java/src/org/chromium/policy/AbstractAppRestrictionsProvider.java", |
| "java/src/org/chromium/policy/AppRestrictionsProvider.java", |
| "java/src/org/chromium/policy/PolicyProvider.java", |
| ] |
| } |
| |
| android_library("policy_java_test_support") { |
| testonly = true |
| deps = [ |
| ":policy_java", |
| "//base:base_java", |
| "//base:base_java_test_support", |
| "//third_party/android_deps:androidx_annotation_annotation_java", |
| "//third_party/junit", |
| ] |
| sources = [ |
| "javatests/src/org/chromium/policy/test/PolicyData.java", |
| "javatests/src/org/chromium/policy/test/annotations/Policies.java", |
| ] |
| } |
| |
| generate_jni("jni_headers") { |
| visibility = [ "//components/policy/*" ] |
| sources = _jni_sources |
| } |
| |
| java_library("components_policy_junit_tests") { |
| # Platform checks are broken for Robolectric. See https://crbug.com/1071638. |
| bypass_platform_checks = true |
| testonly = true |
| sources = [ |
| "junit/src/org/chromium/policy/AbstractAppRestrictionsProviderTest.java", |
| "junit/src/org/chromium/policy/CombinedPolicyProviderTest.java", |
| "junit/src/org/chromium/policy/PolicyConverterTest.java", |
| "junit/src/org/chromium/policy/test/annotations/PoliciesTest.java", |
| ] |
| deps = [ |
| ":policy_java", |
| ":policy_java_test_support", |
| "//base:base_java", |
| "//base:base_java_test_support", |
| "//base:base_junit_test_support", |
| "//third_party/android_deps:robolectric_all_java", |
| "//third_party/hamcrest:hamcrest_java", |
| "//third_party/junit", |
| "//third_party/mockito:mockito_java", |
| ] |
| } |
| |
| _test_jni_sources = |
| [ "javatests/src/org/chromium/policy/test/PolicyServiceTestSupporter.java" ] |
| |
| android_library("native_test_support_java") { |
| testonly = true |
| deps = [ |
| ":policy_java", |
| "//base:base_java", |
| "//base:jni_java", |
| "//third_party/junit", |
| "//third_party/mockito:mockito_java", |
| ] |
| annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] |
| |
| sources = _test_jni_sources |
| } |
| |
| generate_jni("test_jni_headers") { |
| testonly = true |
| visibility = [ "//components/policy/*" ] |
| sources = _test_jni_sources |
| } |