@@ -10,6 +10,7 @@ load("//xcodeproj/internal:pbxproj_partials.bzl", "pbxproj_partials")
1010_TARGET_DEPENDENCIES_DECLARED_FILE = "a_generator_name_pbxproj_partials/pbxtargetdependencies"
1111_TARGETS_DECLARED_FILE = "a_generator_name_pbxproj_partials/pbxproject_targets"
1212_TARGET_ATTRIBUTES_DECLARED_FILE = "a_generator_name_pbxproj_partials/pbxproject_target_attributes"
13+ _CONSOLIDATION_MAPS_INPUTS_FILE = "a_generator_name_pbxproj_partials/consolidation_maps_inputs_file"
1314
1415def _consolidation_map_declared_file (idx ):
1516 return "a_generator_name_pbxproj_partials/consolidation_maps/{}" .format (idx )
@@ -84,7 +85,13 @@ def _write_pbxtargetdependencies_test_impl(ctx):
8485 _TARGET_DEPENDENCIES_DECLARED_FILE : None ,
8586 _TARGETS_DECLARED_FILE : None ,
8687 _TARGET_ATTRIBUTES_DECLARED_FILE : None ,
88+ _CONSOLIDATION_MAPS_INPUTS_FILE : None ,
8789 }
90+ expected_outputs = [
91+ _TARGET_DEPENDENCIES_DECLARED_FILE ,
92+ _TARGETS_DECLARED_FILE ,
93+ _TARGET_ATTRIBUTES_DECLARED_FILE ,
94+ ]
8895
8996 xcode_targets_by_label = _json_to_xcode_targets_by_label (
9097 ctx .attr .xcode_targets_by_label ,
@@ -99,6 +106,7 @@ def _write_pbxtargetdependencies_test_impl(ctx):
99106 file = _consolidation_map_declared_file (idx )
100107 expected_consolidation_maps [file ] = labels
101108 expected_declared_files [file ] = None
109+ expected_outputs .append (file )
102110
103111 # Act
104112
@@ -128,6 +136,13 @@ def _write_pbxtargetdependencies_test_impl(ctx):
128136 "actions.declare_file" ,
129137 )
130138
139+ asserts .equals (
140+ env ,
141+ ctx .attr .expected_writes ,
142+ actions .writes ,
143+ "actions.write" ,
144+ )
145+
131146 asserts .equals (
132147 env ,
133148 "@%s" ,
@@ -158,7 +173,7 @@ def _write_pbxtargetdependencies_test_impl(ctx):
158173
159174 asserts .equals (
160175 env ,
161- expected_declared_files . keys () ,
176+ expected_outputs ,
162177 actions .run_args ["outputs" ],
163178 "actions.run.outputs" ,
164179 )
@@ -199,6 +214,7 @@ write_pbxtargetdependencies_test = unittest.make(
199214
200215 # Expected
201216 "expected_args" : attr .string_list (mandatory = True ),
217+ "expected_writes" : attr .string_dict (mandatory = True ),
202218 "minimum_xcode_version" : attr .string (mandatory = True ),
203219 "xcode_target_configurations" : attr .string_list_dict (mandatory = True ),
204220 "xcode_targets_by_label" : attr .string (mandatory = True ),
@@ -225,7 +241,8 @@ def write_pbxtargetdependencies_test_suite(name):
225241 xcode_targets_by_label ,
226242
227243 # Expected
228- expected_args ):
244+ expected_args ,
245+ expected_writes ):
229246 test_names .append (name )
230247 write_pbxtargetdependencies_test (
231248 name = name ,
@@ -238,6 +255,7 @@ def write_pbxtargetdependencies_test_suite(name):
238255
239256 # Expected
240257 expected_args = expected_args ,
258+ expected_writes = expected_writes ,
241259 )
242260
243261 # Full
@@ -310,96 +328,71 @@ def write_pbxtargetdependencies_test_suite(name):
310328 _TARGETS_DECLARED_FILE ,
311329 # targetAttributesOutputPath
312330 _TARGET_ATTRIBUTES_DECLARED_FILE ,
331+ # consolidationMapsInputsFile,
332+ _CONSOLIDATION_MAPS_INPUTS_FILE ,
313333 # minimumXcodeVersion
314334 "14.3.1" ,
315335 # targetAndTestHosts
316336 "--target-and-test-hosts" ,
317- "' //tools/generators/legacy/test:tests.__internal__.__test_bundle applebin_macos-darwin_x86_64-dbg-STABLE-3' " ,
318- "' //tools/generators/legacy:generator applebin_macos-darwin_x86_64-dbg-STABLE-3' " ,
337+ "//tools/generators/legacy/test:tests.__internal__.__test_bundle applebin_macos-darwin_x86_64-dbg-STABLE-3" ,
338+ "//tools/generators/legacy:generator applebin_macos-darwin_x86_64-dbg-STABLE-3" ,
319339 # targetAndWatchKitExtensions
320340 "--target-and-watch-kit-extensions" ,
321- "'//tools/generators/legacy:generator.library macos-x86_64-min12.0-applebin_macos-darwin_x86_64-dbg-STABLE-1'" ,
322- "'//some/extension some-config'" ,
323- # consolidationMapOutputPaths
324- "--consolidation-map-output-paths" ,
325- _consolidation_map_declared_file (0 ),
326- _consolidation_map_declared_file (1 ),
327- # labelCounts
328- "--label-counts" ,
329- "2" ,
330- "1" ,
331- # labels
332- "--labels" ,
333- str (Label ("//tools/generators/legacy/test:tests.__internal__.__test_bundle" )),
334- str (Label ("//tools/generators/legacy:generator" )),
335- str (Label ("//tools/generators/legacy:generator.library" )),
336- # targetCounts
337- "--target-counts" ,
338- "1" ,
339- "1" ,
340- "1" ,
341- # targets
342- "--targets" ,
343- "'//tools/generators/legacy/test:tests.__internal__.__test_bundle applebin_macos-darwin_x86_64-dbg-STABLE-3'" ,
344- "'//tools/generators/legacy:generator applebin_macos-darwin_x86_64-dbg-STABLE-3'" ,
345- "'//tools/generators/legacy:generator.library macos-x86_64-min12.0-applebin_macos-darwin_x86_64-dbg-STABLE-1'" ,
346- # xcodeConfigurationCounts
347- "--xcode-configuration-counts" ,
348- "1" ,
349- "2" ,
350- "1" ,
351- # xcodeConfigurations
352- "--xcode-configurations" ,
353- "Release" ,
354- "Debug" ,
355- "Release" ,
356- "Debug" ,
357- # productTypes
358- "--product-types" ,
359- "u" ,
360- "T" ,
361- "L" ,
362- # platforms
363- "--platforms" ,
364- "macosx" ,
365- "iphoneos" ,
366- "watchsimulator" ,
367- # osVersions
368- "--os-versions" ,
369- "16.2.1" ,
370- "12.0" ,
371- "9.1" ,
372- # archs
373- "--archs" ,
374- "arm64" ,
375- "x86_64" ,
376- "i386" ,
377- # moduleNames
378- "--module-names" ,
379- "tests" ,
380- "" ,
381- "generator" ,
382- # productPaths
383- "--product-paths" ,
384- "bazel-out/applebin_macos-darwin_x86_64-dbg-STABLE-3/bin/tools/generators/legacy/test/tests.__internal__.__test_bundle_archive-root/tests.xctest" ,
385- "bazel-out/applebin_macos-darwin_x86_64-dbg-STABLE-3/bin/tools/generators/legacy/generator" ,
386- "bazel-out/applebin_macos-darwin_x86_64-dbg-STABLE-3/bin/tools/generators/legacy/libgenerator.a" ,
387- # productBasenames
388- "--product-basenames" ,
389- "tests.xctest" ,
390- "codesigned_generator" ,
391- "libgenerator.a" ,
392- # dependencyCounts
393- "--dependency-counts" ,
394- "1" ,
395- "1" ,
396- "0" ,
397- # dependencies
398- "--dependencies" ,
399- "'//tools/generators/legacy:generator.library macos-x86_64-min12.0-applebin_macos-darwin_x86_64-dbg-STABLE-2'" ,
400- "'//tools/generators/legacy:generator.library macos-x86_64-min12.0-applebin_macos-darwin_x86_64-dbg-STABLE-1'" ,
341+ "//tools/generators/legacy:generator.library macos-x86_64-min12.0-applebin_macos-darwin_x86_64-dbg-STABLE-1" ,
342+ "//some/extension some-config" ,
401343 "--colorize" ,
402344 ],
345+ expected_writes = {
346+ _CONSOLIDATION_MAPS_INPUTS_FILE : "\n " .join ([
347+ _consolidation_map_declared_file (0 ),
348+ _consolidation_map_declared_file (1 ),
349+ "--" ,
350+ "2" ,
351+ str (Label ("//tools/generators/legacy/test:tests.__internal__.__test_bundle" )),
352+ "1" ,
353+ "//tools/generators/legacy/test:tests.__internal__.__test_bundle applebin_macos-darwin_x86_64-dbg-STABLE-3" ,
354+ "u" ,
355+ "macosx" ,
356+ "16.2.1" ,
357+ "arm64" ,
358+ "tests" ,
359+ "bazel-out/applebin_macos-darwin_x86_64-dbg-STABLE-3/bin/tools/generators/legacy/test/tests.__internal__.__test_bundle_archive-root/tests.xctest" ,
360+ "tests.xctest" ,
361+ "//tools/generators/legacy:generator.library macos-x86_64-min12.0-applebin_macos-darwin_x86_64-dbg-STABLE-2" ,
362+ "--" ,
363+ "Release" ,
364+ "--" ,
365+ str (Label ("//tools/generators/legacy:generator" )),
366+ "1" ,
367+ "//tools/generators/legacy:generator applebin_macos-darwin_x86_64-dbg-STABLE-3" ,
368+ "T" ,
369+ "iphoneos" ,
370+ "12.0" ,
371+ "x86_64" ,
372+ "" ,
373+ "bazel-out/applebin_macos-darwin_x86_64-dbg-STABLE-3/bin/tools/generators/legacy/generator" ,
374+ "codesigned_generator" ,
375+ "//tools/generators/legacy:generator.library macos-x86_64-min12.0-applebin_macos-darwin_x86_64-dbg-STABLE-1" ,
376+ "--" ,
377+ "Debug" ,
378+ "Release" ,
379+ "--" ,
380+ "1" ,
381+ str (Label ("//tools/generators/legacy:generator.library" )),
382+ "1" ,
383+ "//tools/generators/legacy:generator.library macos-x86_64-min12.0-applebin_macos-darwin_x86_64-dbg-STABLE-1" ,
384+ "L" ,
385+ "watchsimulator" ,
386+ "9.1" ,
387+ "i386" ,
388+ "generator" ,
389+ "bazel-out/applebin_macos-darwin_x86_64-dbg-STABLE-3/bin/tools/generators/legacy/libgenerator.a" ,
390+ "libgenerator.a" ,
391+ "--" ,
392+ "Debug" ,
393+ "--" ,
394+ ]) + "\n " ,
395+ },
403396 )
404397
405398 # Test suite
0 commit comments