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 5846b1375740b8471b6c3950f8f50188a21632f2..6fce5888f010832aef616cf6f207eeb9515b6958 100644 |
--- a/services/service_manager/public/cpp/service.gni |
+++ b/services/service_manager/public/cpp/service.gni |
@@ -3,29 +3,20 @@ |
# found in the LICENSE file. |
import("//build/toolchain/toolchain.gni") |
-import("//services/service_manager/public/constants.gni") |
if (is_android) { |
import("//build/config/android/rules.gni") |
import("//build/config/zip.gni") |
} |
-# Generates a Service "package", which includes: |
-# |
-# - 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 |
+# Generates a Service binary. The parameters of this template are those of an |
+# executable. |
template("service") { |
base_target_name = target_name |
if (defined(invoker.output_name)) { |
base_target_name = invoker.output_name |
} |
- final_target_name = target_name |
- |
service_deps = [] |
if (defined(invoker.deps)) { |
service_deps += invoker.deps |
@@ -34,35 +25,28 @@ template("service") { |
service_data_deps = |
[ "//services/service_manager/public/cpp/standalone_service:main" ] |
- if (defined(invoker.resources)) { |
- copy_step_name = "${base_target_name}__copy_resources" |
- copy(copy_step_name) { |
- sources = invoker.resources |
- outputs = [ |
- "${root_out_dir}/${packages_directory}/${base_target_name}/resources/{{source_file_part}}", |
- ] |
- if (defined(invoker.testonly)) { |
- testonly = invoker.testonly |
- } |
- deps = service_deps |
- } |
- service_data_deps += [ ":$copy_step_name" ] |
- } |
- |
if (defined(invoker.data_deps)) { |
service_data_deps += invoker.data_deps |
} |
+ if (defined(invoker.resources)) { |
+ # TODO(rockot): Remove this once all existing service targets have stopped |
+ # setting |resources|. This target serves no purpose other than to ensure |
+ # that |resources| is actually used, avoiding GN complaints. |
+ source_set("${target_name}__unused_resources_target") { |
+ testonly = true |
+ sources = invoker.resources |
+ deps = invoker.deps |
+ } |
+ } |
+ |
if (is_win) { |
executable_extension = "service.exe" |
} else { |
executable_extension = "service" |
} |
- executable_target_name = base_target_name + "_executable" |
- executable_name = base_target_name + "." + executable_extension |
- |
- executable(executable_target_name) { |
+ executable(target_name) { |
output_name = base_target_name |
output_extension = executable_extension |
@@ -136,28 +120,4 @@ template("service") { |
testonly = invoker.testonly |
} |
} |
- |
- copy(final_target_name) { |
- forward_variables_from(invoker, |
- [ |
- "testonly", |
- "visibility", |
- ]) |
- deps = [ |
- ":${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_out_dir}/${executable_name}", |
- ] |
- outputs = [ |
- "${root_out_dir}/${packages_directory}/${base_target_name}/${executable_name}", |
- ] |
- } |
} |