@@ -159,16 +159,64 @@ if (is_fuchsia) {
159159 import (" third_party/fuchsia/sdk/linux/build/component.gni" )
160160 import (" third_party/fuchsia/sdk/linux/build/package.gni" )
161161
162- fuchsia_component (" fuchsia_test_component" ) {
163- testonly = true
164- data_deps = [ " runtime/bin:dart" ]
165- manifest = " build/fuchsia/dart.cmx"
162+ template (" dart_fuchsia_test_package" ) {
163+ fuchsia_package (target_name ) {
164+ package_name = invoker .package_name
165+ if (is_debug ) {
166+ package_name += " _debug"
167+ } else if (is_release ) {
168+ package_name += " _release"
169+ } else if (is_product ) {
170+ package_name += " _product"
171+ }
172+ testonly = true
173+ deps = invoker .deps
174+ }
175+ }
166176
167- resource_files = [
168- " .dart_tool/package_config.json" ,
169- " pkg/testing/test/hello_test.dart" ,
170- " tools/addlatexhash.dart" ,
171- ]
177+ template (" dart_fuchsia_test_component" ) {
178+ fuchsia_component (target_name ) {
179+ testonly = true
180+ data_deps = [ " runtime/bin:dart" ]
181+ if (defined (invoker .data_deps )) {
182+ data_deps += invoker .data_deps
183+ }
184+ manifest = " build/fuchsia/dart.cmx"
185+
186+ library_files = []
187+ if (defined (invoker .library_files )) {
188+ library_files += invoker .library_files
189+ }
190+ resource_files = [
191+ " .dart_tool/package_config.json" ,
192+ " pkg/testing/test/hello_test.dart" ,
193+ " tools/addlatexhash.dart" ,
194+ ]
195+ resource_dirs = invoker .resource_dirs
196+
197+ resources = []
198+ foreach (file , library_files ) {
199+ resources += [
200+ {
201+ path = root_out_dir + " /" + file
202+ dest = " lib/" + file
203+ },
204+ ]
205+ }
206+ foreach (file , resource_files ) {
207+ resources += [
208+ {
209+ path = file
210+ dest = " data/" + file
211+ },
212+ ]
213+ }
214+ resources +=
215+ exec_script (" tools/fuchsia/find_resources.py" , resource_dirs , " json" )
216+ }
217+ }
218+
219+ dart_fuchsia_test_component (" fuchsia_test_component" ) {
172220 resource_dirs = [
173221 " tests/standalone_2" ,
174222 " pkg/async_helper" ,
@@ -190,30 +238,32 @@ if (is_fuchsia) {
190238 " third_party/pkg/string_scanner" ,
191239 " third_party/pkg/typed_data" ,
192240 ]
193-
194- resources = []
195- foreach (file , resource_files ) {
196- resources += [
197- {
198- path = file
199- dest = " data/" + file
200- },
201- ]
202- }
203- resources +=
204- exec_script (" tools/fuchsia/find_resources.py" , resource_dirs , " json" )
205241 }
206242
207- fuchsia_package (" fuchsia_test_package" ) {
208- package_name = " dart_test_"
209- if (is_debug ) {
210- package_name += " debug"
211- } else if (is_release ) {
212- package_name += " release"
213- } else if (is_product ) {
214- package_name += " product"
215- }
216- testonly = true
243+ dart_fuchsia_test_package (" fuchsia_test_package" ) {
244+ package_name = " dart_test"
217245 deps = [ " :fuchsia_test_component" ]
218246 }
247+
248+ dart_fuchsia_test_component (" fuchsia_ffi_test_component" ) {
249+ data_deps = [
250+ " runtime/bin:ffi_test_dynamic_library" ,
251+ " runtime/bin:ffi_test_functions" ,
252+ ]
253+ library_files = [
254+ " libffi_test_dynamic_library.so" ,
255+ " libffi_test_functions.so" ,
256+ ]
257+ resource_dirs = [
258+ " pkg/expect" ,
259+ " pkg/meta" ,
260+ " tests/ffi" ,
261+ " third_party/pkg/ffi" ,
262+ ]
263+ }
264+
265+ dart_fuchsia_test_package (" fuchsia_ffi_test_package" ) {
266+ package_name = " dart_ffi_test"
267+ deps = [ " :fuchsia_ffi_test_component" ]
268+ }
219269}
0 commit comments