-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: filter out
maccatalyst
SPM platform (#829)
Bazel currently does not support `maccatalyst` as a platform. We were mapping it to `ios` as they are Mac apps that use iOS frameworks. However, this can lead to warnings if define values exist with the same name mapped for `ios` and `maccatalyst` (e.g. Firebase). This PR filters out `maccatalyst` conditions. Closes #801.
- Loading branch information
Showing
6 changed files
with
88 additions
and
28 deletions.
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
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,6 @@ | ||
load("@cgrindel_bazel_starlib//bzlformat:defs.bzl", "bzlformat_pkg") | ||
load(":platforms_tests.bzl", "platforms_test_suite") | ||
|
||
bzlformat_pkg(name = "bzlformat") | ||
|
||
platforms_test_suite() |
57 changes: 57 additions & 0 deletions
57
config_settings/spm/tests/platform_tests/platforms_tests.bzl
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,57 @@ | ||
"""Tests for `platforms` module.""" | ||
|
||
load("@bazel_skylib//lib:unittest.bzl", "asserts", "unittest") | ||
load("//config_settings/spm/platform:platforms.bzl", "platforms") | ||
|
||
def _is_supported_test(ctx): | ||
env = unittest.begin(ctx) | ||
|
||
tests = [ | ||
struct(name = "maccatalyst", exp = False), | ||
] + [ | ||
struct(name = name, exp = True) | ||
for name in platforms.all_values | ||
] | ||
for t in tests: | ||
actual = platforms.is_supported(t.name) | ||
msg = getattr(t, "msg", t.name) | ||
asserts.equals(env, t.exp, actual, msg) | ||
|
||
return unittest.end(env) | ||
|
||
is_supported_test = unittest.make(_is_supported_test) | ||
|
||
def _supported_test(ctx): | ||
env = unittest.begin(ctx) | ||
|
||
tests = [ | ||
struct( | ||
msg = "all valid names", | ||
names = platforms.all_values, | ||
exp = platforms.all_values, | ||
), | ||
struct( | ||
msg = "some invalid names", | ||
names = [platforms.ios, platforms.maccatalyst, platforms.macos], | ||
exp = [platforms.ios, platforms.macos], | ||
), | ||
struct( | ||
msg = "only invalid names", | ||
names = [platforms.maccatalyst], | ||
exp = [], | ||
), | ||
] | ||
for t in tests: | ||
actual = platforms.supported(t.names) | ||
asserts.equals(env, t.exp, actual, t.msg) | ||
|
||
return unittest.end(env) | ||
|
||
supported_test = unittest.make(_supported_test) | ||
|
||
def platforms_test_suite(name = "platforms_tests"): | ||
return unittest.suite( | ||
name, | ||
is_supported_test, | ||
supported_test, | ||
) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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