• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From 85b3c2a956d2cef02f16cb45e6b8a470fa2efe26 Mon Sep 17 00:00:00 2001
2From: Stefano Duo <stefanoduo@google.com>
3Date: Wed, 11 Jan 2023 13:46:47 +0000
4Subject: [PATCH] Introduce is_cronet_build and move process_launcher into its
5 own target
6
7Cronet doesn't require the setup and handling of multiple processes
8(it simply spawns threads within the application process that uses
9it). This wouldn't be that big of a problem, but many of the
10multiprocess tooling makes use of AndroidX, which Cronet is trying not
11to depend on.
12
13To achieve that, move process_launcher files into its own target not
14included in base_java (which Cronet depends on). Also, drop
15IntentUtils for Cronet's builds (through the use of the new GN arg
16is_cronet_built).
17
18Test: m
19Change-Id: I84f0d81f4feddce8094b6f400f6291a78c953dff
20---
21 base/BUILD.gn                  | 53 ++++++++++++++++++++++++----------
22 base/test/BUILD.gn             |  1 +
23 build/config/cronet/config.gni | 10 +++++++
24 build/config/ios/config.gni    |  5 ----
25 net/BUILD.gn                   |  2 +-
26 5 files changed, 49 insertions(+), 22 deletions(-)
27 create mode 100644 build/config/cronet/config.gni
28
29diff --git a/base/BUILD.gn b/base/BUILD.gn
30index 255ed8a9806bd..b737dad33c4a7 100644
31--- a/base/BUILD.gn
32+++ b/base/BUILD.gn
33@@ -26,6 +26,7 @@ import("//build/config/c++/c++.gni")
34 import("//build/config/chromecast_build.gni")
35 import("//build/config/chromeos/ui_mode.gni")
36 import("//build/config/compiler/compiler.gni")
37+import("//build/config/cronet/config.gni")
38 import("//build/config/dcheck_always_on.gni")
39 import("//build/config/ios/config.gni")
40 import("//build/config/logging.gni")
41@@ -4146,10 +4147,39 @@ if (is_android) {
42     template = "android/java/src/org/chromium/base/BaseSwitches.java.tmpl"
43   }
44
45+  android_library("process_launcher_java") {
46+    srcjar_deps = [ ":process_launcher_aidl" ]
47+    deps = [
48+      ":base_java",
49+      ":jni_java",
50+      "//build/android:build_java",
51+      "//third_party/android_deps:com_google_code_findbugs_jsr305_java",
52+      "//third_party/androidx:androidx_annotation_annotation_experimental_java",
53+      "//third_party/androidx:androidx_annotation_annotation_java",
54+      "//third_party/androidx:androidx_collection_collection_java",
55+      "//third_party/androidx:androidx_core_core_java",
56+    ]
57+    sources = [
58+      "android/java/src/org/chromium/base/process_launcher/BindService.java",
59+      "android/java/src/org/chromium/base/process_launcher/ChildConnectionAllocator.java",
60+      "android/java/src/org/chromium/base/process_launcher/ChildProcessConnection.java",
61+      "android/java/src/org/chromium/base/process_launcher/ChildProcessConstants.java",
62+      "android/java/src/org/chromium/base/process_launcher/ChildProcessLauncher.java",
63+      "android/java/src/org/chromium/base/process_launcher/ChildProcessService.java",
64+      "android/java/src/org/chromium/base/process_launcher/ChildProcessServiceDelegate.java",
65+      "android/java/src/org/chromium/base/process_launcher/ChildServiceConnection.java",
66+      "android/java/src/org/chromium/base/process_launcher/ChildServiceConnectionDelegate.java",
67+      "android/java/src/org/chromium/base/process_launcher/ChildServiceConnectionFactory.java",
68+      "android/java/src/org/chromium/base/process_launcher/ChildServiceConnectionImpl.java",
69+      "android/java/src/org/chromium/base/process_launcher/FileDescriptorInfo.java",
70+    ]
71+
72+    annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ]
73+  }
74+
75   android_library("base_java") {
76     srcjar_deps = [
77       ":base_android_java_enums_srcjar",
78-      ":base_java_aidl",
79       ":java_features_srcjar",
80       ":java_switches_srcjar",
81     ]
82@@ -4191,7 +4221,6 @@ if (is_android) {
83       "android/java/src/org/chromium/base/Flag.java",
84       "android/java/src/org/chromium/base/ImportantFileWriterAndroid.java",
85       "android/java/src/org/chromium/base/IntStringCallback.java",
86-      "android/java/src/org/chromium/base/IntentUtils.java",
87       "android/java/src/org/chromium/base/JNIUtils.java",
88       "android/java/src/org/chromium/base/JavaExceptionReporter.java",
89       "android/java/src/org/chromium/base/JavaHandlerThread.java",
90@@ -4269,18 +4298,6 @@ if (is_android) {
91       "android/java/src/org/chromium/base/metrics/TimingMetric.java",
92       "android/java/src/org/chromium/base/metrics/UmaRecorder.java",
93       "android/java/src/org/chromium/base/metrics/UmaRecorderHolder.java",
94-      "android/java/src/org/chromium/base/process_launcher/BindService.java",
95-      "android/java/src/org/chromium/base/process_launcher/ChildConnectionAllocator.java",
96-      "android/java/src/org/chromium/base/process_launcher/ChildProcessConnection.java",
97-      "android/java/src/org/chromium/base/process_launcher/ChildProcessConstants.java",
98-      "android/java/src/org/chromium/base/process_launcher/ChildProcessLauncher.java",
99-      "android/java/src/org/chromium/base/process_launcher/ChildProcessService.java",
100-      "android/java/src/org/chromium/base/process_launcher/ChildProcessServiceDelegate.java",
101-      "android/java/src/org/chromium/base/process_launcher/ChildServiceConnection.java",
102-      "android/java/src/org/chromium/base/process_launcher/ChildServiceConnectionDelegate.java",
103-      "android/java/src/org/chromium/base/process_launcher/ChildServiceConnectionFactory.java",
104-      "android/java/src/org/chromium/base/process_launcher/ChildServiceConnectionImpl.java",
105-      "android/java/src/org/chromium/base/process_launcher/FileDescriptorInfo.java",
106       "android/java/src/org/chromium/base/supplier/DestroyableObservableSupplier.java",
107       "android/java/src/org/chromium/base/supplier/ObservableSupplier.java",
108       "android/java/src/org/chromium/base/supplier/ObservableSupplierImpl.java",
109@@ -4308,6 +4325,10 @@ if (is_android) {
110       "android/java/src/org/chromium/base/task/TaskTraitsExtensionDescriptor.java",
111     ]
112
113+    if (!is_cronet_build) {
114+      sources += [ "android/java/src/org/chromium/base/IntentUtils.java" ]
115+    }
116+
117     annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ]
118
119     resources_package = "org.chromium.base"
120@@ -4319,7 +4340,7 @@ if (is_android) {
121     ]
122   }
123
124-  android_aidl("base_java_aidl") {
125+  android_aidl("process_launcher_aidl") {
126     import_include = [ "android/java/src" ]
127     sources = [
128       "android/java/src/org/chromium/base/process_launcher/IChildProcessService.aidl",
129@@ -4513,7 +4534,7 @@ if (is_android) {
130   android_library("base_java_process_launcher_test_support") {
131     testonly = true
132
133-    deps = [ ":base_java" ]
134+    public_deps = [ ":process_launcher_java" ]
135
136     sources = [ "test/android/javatests/src/org/chromium/base/process_launcher/TestChildProcessConnection.java" ]
137   }
138diff --git a/base/test/BUILD.gn b/base/test/BUILD.gn
139index ca4a051cce41c..061c169690918 100644
140--- a/base/test/BUILD.gn
141+++ b/base/test/BUILD.gn
142@@ -397,6 +397,7 @@ if (is_android) {
143     deps = [
144       "//base:base_java",
145       "//base:jni_java",
146+      "//base:process_launcher_java",
147       "//testing/android/native_test:native_main_runner_java",
148       "//third_party/android_deps:com_google_code_findbugs_jsr305_java",
149     ]
150diff --git a/build/config/cronet/config.gni b/build/config/cronet/config.gni
151new file mode 100644
152index 0000000000000..1468ec17a05ee
153--- /dev/null
154+++ b/build/config/cronet/config.gni
155@@ -0,0 +1,10 @@
156+# Copyright 2022 The Chromium Authors
157+# Use of this source code is governed by a BSD-style license that can be
158+# found in the LICENSE file.
159+
160+declare_args() {
161+  # Control whether cronet is built (this is usually set by the script
162+  # components/cronet/tools/cr_cronet.py as cronet requires specific
163+  # gn args to build correctly).
164+  is_cronet_build = false
165+}
166diff --git a/build/config/ios/config.gni b/build/config/ios/config.gni
167index 74d064532d5f8..c5c10c3f7e5c3 100644
168--- a/build/config/ios/config.gni
169+++ b/build/config/ios/config.gni
170@@ -9,11 +9,6 @@ declare_args() {
171   # default is only there for compatibility reasons and will be removed (see
172   # crbug.com/1138425 for more details).
173   target_environment = ""
174-
175-  # Control whether cronet is built (this is usually set by the script
176-  # components/cronet/tools/cr_cronet.py as cronet requires specific
177-  # gn args to build correctly).
178-  is_cronet_build = false
179 }
180
181 if (target_environment == "") {
182diff --git a/net/BUILD.gn b/net/BUILD.gn
183index c633dcd9554d0..2fc1a575d0387 100644
184--- a/net/BUILD.gn
185+++ b/net/BUILD.gn
186@@ -6,8 +6,8 @@ import("//build/buildflag_header.gni")
187 import("//build/config/chromecast_build.gni")
188 import("//build/config/chromeos/ui_mode.gni")
189 import("//build/config/compiler/compiler.gni")
190+import("//build/config/cronet/config.gni")
191 import("//build/config/features.gni")
192-import("//build/config/ios/config.gni")
193 import("//crypto/features.gni")
194 import("//net/features.gni")
195 import("//testing/libfuzzer/fuzzer_test.gni")
196--
1972.40.0.348.gf938b09366-goog
198
199