-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: If `embed_xctest_frameworks_in_test_host_app` is set on an `apple_test()`, the `config//marker/apple/constraints:embed_xctest_frameworks_enabled` constraint is then added to the `test_host_app` via a transition. This constraint is then used in `apple_bundle()` to embed XCTest frameworks. Reviewed By: manicaesar Differential Revision: D62936576 fbshipit-source-id: 62f95834503eee2dfac8ec71286b0f54c4dd5293
- Loading branch information
1 parent
c0597e2
commit e6c9982
Showing
2 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# | ||
# This source code is licensed under both the MIT license found in the | ||
# LICENSE-MIT file in the root directory of this source tree and the Apache | ||
# License, Version 2.0 found in the LICENSE-APACHE file in the root directory | ||
# of this source tree. | ||
|
||
def _apple_test_host_app_transition_impl(platform: PlatformInfo, refs: struct, attrs: struct) -> PlatformInfo: | ||
if not attrs.embed_xctest_frameworks_in_test_host_app: | ||
return platform | ||
|
||
updated_constraints = dict(platform.configuration.constraints) | ||
|
||
test_host_marker_setting_label = refs.embed_xctest_frameworks_constraint_setting[ConstraintSettingInfo].label | ||
if test_host_marker_setting_label in updated_constraints: | ||
return platform | ||
|
||
test_host_marker_value_info = refs.embed_xctest_frameworks_marker_constraint_value[ConstraintValueInfo] | ||
updated_constraints[test_host_marker_setting_label] = test_host_marker_value_info | ||
|
||
return PlatformInfo( | ||
label = platform.label + "-test-host-app", | ||
configuration = ConfigurationInfo( | ||
constraints = updated_constraints, | ||
values = platform.configuration.values, | ||
), | ||
) | ||
|
||
apple_test_host_app_transition = transition( | ||
impl = _apple_test_host_app_transition_impl, | ||
refs = { | ||
"embed_xctest_frameworks_constraint_setting": "config//marker/apple/constraints:embed_xctest_frameworks", | ||
"embed_xctest_frameworks_marker_constraint_value": "config//marker/apple/constraints:embed_xctest_frameworks_enabled", | ||
}, | ||
attrs = [ | ||
"embed_xctest_frameworks_in_test_host_app", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters