Skip to content

Commit

Permalink
Fix don't attempt to get extension_host for launch_path
Browse files Browse the repository at this point in the history
The `launch_path` does not have an `extension_host` attr

Signed-off-by: Luis Padron <lpadron@squareup.com>
  • Loading branch information
luispadron committed Apr 4, 2024
1 parent a822bea commit ae90937
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 21 deletions.
57 changes: 36 additions & 21 deletions test/internal/xcschemes/infos_from_json_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,35 @@ def infos_from_json_test_suite(name):
],
)

expected_launch_path = xcscheme_infos_testable.make_launch_target(
path = "/path/to/App.app",
post_actions = [
xcscheme_infos_testable.make_pre_post_action(
for_build = True,
order = "",
script_text = "ssss",
title = "ttt",
),
],
pre_actions = [
xcscheme_infos_testable.make_pre_post_action(
for_build = True,
order = "7",
script_text = "s",
title = "tttt",
),
],
working_directory = "wd",
)
expected_profile_same_as_run_launch_path = (
xcscheme_infos_testable.make_launch_target(
path = "/path/to/App.app",
post_actions = [],
pre_actions = [],
working_directory = "wd",
)
)

_add_test(
name = "{}_run_launch_path".format(name),

Expand All @@ -716,7 +745,7 @@ def infos_from_json_test_suite(name):
json_str = json.encode([
{
"name": "A scheme",
"profile": None,
"profile": "same_as_run",
"run": struct(
args = full_args,
build_targets = full_build_targets,
Expand Down Expand Up @@ -759,6 +788,11 @@ def infos_from_json_test_suite(name):
expected_infos = [
xcscheme_infos_testable.make_scheme(
name = "A scheme",
profile = xcscheme_infos_testable.make_profile(
build_targets = expected_full_build_targets,
env_include_defaults = "0",
launch_target = expected_profile_same_as_run_launch_path,
),
run = xcscheme_infos_testable.make_run(
args = expected_full_args,
build_targets = expected_full_build_targets,
Expand All @@ -769,26 +803,7 @@ def infos_from_json_test_suite(name):
),
env = expected_full_env,
env_include_defaults = "0",
launch_target = xcscheme_infos_testable.make_launch_target(
path = "/path/to/App.app",
post_actions = [
xcscheme_infos_testable.make_pre_post_action(
for_build = True,
order = "",
script_text = "ssss",
title = "ttt",
),
],
pre_actions = [
xcscheme_infos_testable.make_pre_post_action(
for_build = True,
order = "7",
script_text = "s",
title = "tttt",
),
],
working_directory = "wd",
),
launch_target = expected_launch_path,
xcode_configuration = "custom",
),
),
Expand Down
9 changes: 9 additions & 0 deletions xcodeproj/internal/xcschemes/xcscheme_infos.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ def _make_launch_target(
)

def _make_same_as_run_launch_target(run_launch_target):
if run_launch_target.is_path == TRUE_ARG:
return struct(
is_path = TRUE_ARG,
path = run_launch_target.path,
post_actions = EMPTY_LIST,
pre_actions = EMPTY_LIST,
working_directory = run_launch_target.working_directory,
)

return struct(
extension_host = run_launch_target.extension_host,
id = run_launch_target.id,
Expand Down

0 comments on commit ae90937

Please sign in to comment.