Skip to content

Commit 8eacfbf

Browse files
authored
Remove duplicate post/pre actions (#3122)
When using custom schemes with "same_as_run" for the profile action, I noticed that the build target's pre/post build actions were being duplicated in the generated scheme because we copy the whole build target into the profile action (incl post_actions and pre_actions). This just copies the `id` from the build target instead. Signed-off-by: Sebastian Shanus <[email protected]>
1 parent 912599c commit 8eacfbf

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

test/internal/xcschemes/infos_from_json_tests.bzl

+5-3
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,8 @@ def infos_from_json_test_suite(name):
380380
],
381381
),
382382
]
383+
expected_id_full_launch_build_targets = [xcscheme_infos_testable.make_build_target(t.id) for t in expected_full_launch_build_targets]
384+
expected_id_full_build_targets = [xcscheme_infos_testable.make_build_target(t.id) for t in expected_full_build_targets]
383385

384386
# Empty
385387

@@ -605,8 +607,8 @@ def infos_from_json_test_suite(name):
605607
name = "A scheme",
606608
profile = xcscheme_infos_testable.make_profile(
607609
build_targets = (
608-
expected_full_launch_build_targets +
609-
expected_full_build_targets
610+
expected_id_full_launch_build_targets +
611+
expected_id_full_build_targets
610612
),
611613
env_include_defaults = "0",
612614
launch_target = expected_profile_same_as_run_launch_target,
@@ -791,7 +793,7 @@ def infos_from_json_test_suite(name):
791793
xcscheme_infos_testable.make_scheme(
792794
name = "A scheme",
793795
profile = xcscheme_infos_testable.make_profile(
794-
build_targets = expected_full_build_targets,
796+
build_targets = expected_id_full_build_targets,
795797
env_include_defaults = "0",
796798
launch_target = expected_profile_same_as_run_launch_path,
797799
),

xcodeproj/internal/xcschemes/xcscheme_infos.bzl

+1-1
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ def _profile_info_from_dict(
531531
top_level_deps):
532532
if profile == "same_as_run":
533533
return _make_profile(
534-
build_targets = run.build_targets,
534+
build_targets = [_make_build_target(t.id) for t in run.build_targets],
535535
launch_target = _make_same_as_run_launch_target(
536536
run.launch_target,
537537
),

0 commit comments

Comments
 (0)