summaryrefslogtreecommitdiff
path: root/chromium/components/background_task_scheduler/BUILD.gn
blob: a24e667918e23a8114c750895ef3f2af91c4f51f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# Copyright 2017 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.

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

if (is_android) {
  java_group("background_task_scheduler_java") {
    deps = [
      "//components/background_task_scheduler:factory_java",
      "//components/background_task_scheduler:public_java",
      "//components/background_task_scheduler/internal:native_task_java",
    ]
  }
}

group("background_task_scheduler") {
  public_deps = [
    ":factory",
    ":public",
  ]
}

static_library("public") {
  sources = [
    "background_task.h",
    "background_task_scheduler.h",
    "task_ids.h",
    "task_info.cc",
    "task_info.h",
    "task_parameters.cc",
    "task_parameters.h",
  ]

  public_deps = [
    "//base",
    "//components/keyed_service/core",
  ]
}

static_library("factory") {
  sources = [
    "background_task_scheduler_factory.cc",
    "background_task_scheduler_factory.h",
  ]

  deps = [ ":public" ]

  if (is_android) {
    deps += [ "internal:native_task" ]
  }
}

if (is_android) {
  # This is shared between WebView and Chrome. We do not want to add GCM
  # related permissions for WebView while still wanting to avoid collision
  # between WebView and Chrome.
  android_library("background_task_scheduler_task_ids_java") {
    srcjar_deps = [ ":jni_enums" ]
    deps = [ "//third_party/android_deps:androidx_annotation_annotation_java" ]
  }

  java_cpp_enum("jni_enums") {
    visibility = [ "*" ]

    sources = [ "task_ids.h" ]
  }

  android_library("public_java") {
    sources = [
      "android/java/src/org/chromium/components/background_task_scheduler/BackgroundTask.java",
      "android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskFactory.java",
      "android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskScheduler.java",
      "android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerExternalUma.java",
      "android/java/src/org/chromium/components/background_task_scheduler/NativeBackgroundTask.java",
      "android/java/src/org/chromium/components/background_task_scheduler/NativeBackgroundTaskDelegate.java",
      "android/java/src/org/chromium/components/background_task_scheduler/TaskInfo.java",
      "android/java/src/org/chromium/components/background_task_scheduler/TaskParameters.java",
    ]

    deps = [
      ":background_task_scheduler_task_ids_java",
      "//base:base_java",
      "//content/public/android:content_java",
      "//third_party/android_deps:androidx_annotation_annotation_java",
    ]
  }

  android_library("factory_java") {
    sources = [ "android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerFactory.java" ]

    deps = [
      ":public_java",
      "internal:internal_java",
      "//third_party/android_deps:androidx_annotation_annotation_java",
    ]
  }

  java_library("components_background_task_scheduler_junit_tests") {
    # Platform checks are broken for Robolectric. See https://crbug.com/1071638.
    bypass_platform_checks = true
    testonly = true
    sources = [
      "internal/android/junit/src/org/chromium/components/background_task_scheduler/internal/BackgroundTaskGcmTaskServiceTest.java",
      "internal/android/junit/src/org/chromium/components/background_task_scheduler/internal/BackgroundTaskJobServiceTest.java",
      "internal/android/junit/src/org/chromium/components/background_task_scheduler/internal/BackgroundTaskSchedulerAlarmManagerTest.java",
      "internal/android/junit/src/org/chromium/components/background_task_scheduler/internal/BackgroundTaskSchedulerGcmNetworkManagerTest.java",
      "internal/android/junit/src/org/chromium/components/background_task_scheduler/internal/BackgroundTaskSchedulerImplTest.java",
      "internal/android/junit/src/org/chromium/components/background_task_scheduler/internal/BackgroundTaskSchedulerPrefsTest.java",
      "internal/android/junit/src/org/chromium/components/background_task_scheduler/internal/BackgroundTaskSchedulerUmaTest.java",
      "internal/android/junit/src/org/chromium/components/background_task_scheduler/internal/BroadcastReceiverRobolectricTest.java",
      "internal/android/junit/src/org/chromium/components/background_task_scheduler/internal/ExtrasToProtoConverterTest.java",
      "internal/android/junit/src/org/chromium/components/background_task_scheduler/internal/ShadowGcmNetworkManager.java",
      "internal/android/junit/src/org/chromium/components/background_task_scheduler/internal/TaskInfoTest.java",
      "internal/android/junit/src/org/chromium/components/background_task_scheduler/internal/TestBackgroundTask.java",
      "internal/android/junit/src/org/chromium/components/background_task_scheduler/internal/TestBackgroundTaskFactory.java",
    ]

    deps = [
      ":background_task_scheduler_task_ids_java",
      "$google_play_services_package:google_play_services_auth_base_java",
      "$google_play_services_package:google_play_services_base_java",
      "$google_play_services_package:google_play_services_basement_java",
      "$google_play_services_package:google_play_services_gcm_java",
      "$google_play_services_package:google_play_services_tasks_java",
      "internal:internal_java",
      "internal:proto_java",
      "//base:base_java",
      "//base:base_java_test_support",
      "//base:base_junit_test_support",
      "//components/background_task_scheduler:public_java",
      "//third_party/android_deps:chromium_play_services_availability_shadows_java",
      "//third_party/android_deps:robolectric_all_java",
      "//third_party/junit",
      "//third_party/mockito:mockito_java",
    ]
  }
}