Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(415)

Unified Diff: services/service_manager/public/cpp/service.gni

Issue 2557213002: Build services as standalone executables (Closed)
Patch Set: remove DCHECKs with side effects -_- Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: services/service_manager/public/cpp/service.gni
diff --git a/services/service_manager/public/cpp/service.gni b/services/service_manager/public/cpp/service.gni
index 5faeb259bb86578856843f8ab23e5e1a11cd6324..2fb99919ab7bdf2a4f6765a11e642c61be28e014 100644
--- a/services/service_manager/public/cpp/service.gni
+++ b/services/service_manager/public/cpp/service.gni
@@ -11,12 +11,13 @@ if (is_android) {
}
# Generates a Service "package", which includes:
-# . A self-named subdirectory
-# . A binary .library
-# . A resources subdirectory alongside .library that contains the contents of
-# "resources"
#
-# The parameters of this template are those of a shared library.
+# - A self-named subdirectory
+# - A binary .service executable
+# - A resources subdirectory alongside the executable, which contains the
+# contents of "resources"
+#
+# The parameters of this template are those of an executable
template("service") {
base_target_name = target_name
if (defined(invoker.output_name)) {
@@ -25,12 +26,13 @@ template("service") {
final_target_name = target_name
- library_deps = []
+ service_deps = []
if (defined(invoker.deps)) {
- library_deps += invoker.deps
+ service_deps += invoker.deps
}
- library_data_deps = []
+ service_data_deps =
+ [ "//services/service_manager/public/cpp/standalone_service:main" ]
if (defined(invoker.resources)) {
copy_step_name = "${base_target_name}__copy_resources"
@@ -42,16 +44,22 @@ template("service") {
if (defined(invoker.testonly)) {
testonly = invoker.testonly
}
- deps = library_deps
+ deps = service_deps
}
- library_data_deps += [ ":$copy_step_name" ]
+ service_data_deps += [ ":$copy_step_name" ]
+ }
+
+ if (defined(invoker.data_deps)) {
+ service_data_deps += invoker.data_deps
}
- output = base_target_name + ".library"
- library_target_name = base_target_name + "_library"
- library_name = "${shlib_prefix}${library_target_name}${shlib_extension}"
+ executable_target_name = base_target_name + "_executable"
+ executable_name = base_target_name + ".service"
+
+ executable(executable_target_name) {
+ output_name = base_target_name
+ output_extension = "service"
- shared_library(library_target_name) {
if (defined(invoker.cflags)) {
cflags = invoker.cflags
}
@@ -83,22 +91,13 @@ template("service") {
libs = invoker.libs
}
- data_deps = []
- if (!defined(invoker.avoid_runner_cycle) || !invoker.avoid_runner_cycle) {
- # Give the user an out; as some Services are depended on by the runner.
- data_deps += [ "//services/service_manager/standalone" ]
- }
- if (defined(invoker.data_deps)) {
- data_deps += invoker.data_deps
- }
- data_deps += library_data_deps
+ data_deps = service_data_deps
deps = [
- "//mojo/public/c/system:set_thunks_for_app",
- "//services/service_manager/public/cpp:application_support",
+ "//services/service_manager/public/cpp/standalone_service:main",
]
- deps += library_deps
+ deps += service_deps
if (defined(invoker.public_deps)) {
public_deps = invoker.public_deps
}
@@ -138,14 +137,20 @@ template("service") {
"visibility",
])
deps = [
- ":${library_target_name}",
+ ":${executable_target_name}",
]
+ # NOTE: We have to explicitly inherit the same data_deps as the executable
+ # target itself, rather than specifying a data depenedency on the executable
+ # target. This avoids needless duplication of service binary artifacts in
+ # test isolates, as the executable is unused in its original location.
+ data_deps = service_data_deps
+
sources = [
- "${root_shlib_dir}/${library_name}",
+ "${root_out_dir}/${executable_name}",
]
outputs = [
- "${root_out_dir}/${packages_directory}/${base_target_name}/${output}",
+ "${root_out_dir}/${packages_directory}/${base_target_name}/${executable_name}",
]
}
}
« no previous file with comments | « services/service_manager/public/cpp/service.h ('k') | services/service_manager/public/cpp/standalone_service/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698