OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/android/config.gni") | 5 import("//build/config/android/config.gni") |
6 import("//build/config/android/internal_rules.gni") | 6 import("//build/config/android/internal_rules.gni") |
7 import("//tools/grit/grit_rule.gni") | 7 import("//tools/grit/grit_rule.gni") |
8 | 8 |
9 assert(is_android) | 9 assert(is_android) |
10 | 10 |
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 args = [ | 1084 args = [ |
1085 "--files=$rebased_binaries_list", | 1085 "--files=$rebased_binaries_list", |
1086 "--files=@FileArg($rebased_libraries_list:libraries)", | 1086 "--files=@FileArg($rebased_libraries_list:libraries)", |
1087 ] | 1087 ] |
1088 } | 1088 } |
1089 | 1089 |
1090 group(target_name) { | 1090 group(target_name) { |
1091 deps = final_deps | 1091 deps = final_deps |
1092 } | 1092 } |
1093 } | 1093 } |
| 1094 |
| 1095 |
| 1096 # Compile a protocol buffer to java. |
| 1097 # |
| 1098 # This generates java files from protocol buffers and creates an Android library |
| 1099 # containing the classes. |
| 1100 # |
| 1101 # Variables |
| 1102 # sources: Paths to .proto files to compile. |
| 1103 # proto_path: Root directory of .proto files. |
| 1104 # |
| 1105 # Example: |
| 1106 # proto_java_library("foo_proto_java") { |
| 1107 # proto_path = [ "src/foo" ] |
| 1108 # sources = [ "$proto_path/foo.proto" ] |
| 1109 # } |
| 1110 template("proto_java_library") { |
| 1111 _protoc_dep = "//third_party/android_protobuf:android_protoc($host_toolchain)" |
| 1112 _protoc_out_dir = get_label_info(_protoc_dep, "root_out_dir") |
| 1113 _protoc_bin = "$_protoc_out_dir/android_protoc" |
| 1114 _proto_path = invoker.proto_path |
| 1115 |
| 1116 _template_name = target_name |
| 1117 |
| 1118 action("${_template_name}__protoc_java") { |
| 1119 srcjar_path = "$target_gen_dir/$target_name.srcjar" |
| 1120 script = "//build/protoc_java.py" |
| 1121 deps = [ |
| 1122 _protoc_dep |
| 1123 ] |
| 1124 sources = invoker.sources |
| 1125 depfile = "$target_gen_dir/$target_name.d" |
| 1126 outputs = [ |
| 1127 depfile, |
| 1128 srcjar_path, |
| 1129 ] |
| 1130 args = [ |
| 1131 "--depfile", rebase_path(depfile, root_build_dir), |
| 1132 "--protoc", rebase_path(_protoc_bin, root_build_dir), |
| 1133 "--proto-path", rebase_path(_proto_path, root_build_dir), |
| 1134 "--srcjar", rebase_path(srcjar_path, root_build_dir), |
| 1135 ] + rebase_path(sources, root_build_dir) |
| 1136 } |
| 1137 |
| 1138 android_library(target_name) { |
| 1139 java_files = [] |
| 1140 srcjar_deps = [ ":${_template_name}__protoc_java" ] |
| 1141 deps = [ |
| 1142 "//third_party/android_protobuf:protobuf_nano_javalib", |
| 1143 ] |
| 1144 } |
| 1145 } |
OLD | NEW |