这是indexloc提供的服务,不要输入任何密码
Skip to content

Add config_settings for platforms #179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 23, 2023
Merged

Conversation

keith
Copy link
Member

@keith keith commented Jan 20, 2023

This is a common pattern you need to select on. Since we have a limited
set of CPUs it's nice to provide a source of truth for this type of
thing

@keith
Copy link
Member Author

keith commented Jan 20, 2023

looking for feedback, not sure if we should do this or not, but i figured i'd submit for discussion (right now it's missing many cpus)

@jszumski
Copy link

I've replicated something similar into a couple different projects already, so a single canonical list seems like a great idea 👍

@keith
Copy link
Member Author

keith commented Jan 20, 2023

Can you share what you have for this so we make sure we cover it?

@jszumski
Copy link

[
    config_setting(
        name = type,
        values = {"apple_platform_type": type},
    )
    for type in [
        "ios",
        "macos",
        "tvos",
        "watchos",
    ]
]

[
    config_setting(
        name = cpu,
        values = {"cpu": cpu},
    )
    for cpu in [
        "darwin_x86_64",
        "darwin_arm64",
        "darwin_arm64e",
        "ios_i386",
        "ios_x86_64",
        "ios_armv7",
        "ios_armv7s",
        "ios_arm64",
        "ios_arm64e",
        "ios_sim_arm64",
        "tvos_x86_64",
        "tvos_arm64",
        "tvos_sim_arm64",
        "watchos_arm64_32",
        "watchos_armv7k",
        "watchos_i386",
        "watchos_x86_64",
    ]
]

selects.config_setting_group(
    name = "any_device",
    match_any = [
        ":ios_armv7",
        ":ios_armv7s",
        ":ios_arm64",
        ":ios_arm64e",
        ":tvos_arm64",
        ":watchos_arm64_32",
        ":watchos_armv7k",
    ],
)

selects.config_setting_group(
    name = "any_simulator",
    match_any = [
        ":ios_i386",
        ":ios_x86_64",
        ":ios_sim_arm64",
        ":tvos_x86_64",
        ":tvos_sim_arm64",
        ":watchos_i386",
        ":watchos_x86_64",
        ":watchos_arm64",
    ],
)

@cgrindel
Copy link
Contributor

I am about to add this one to swift_bazel.

[
    config_setting(
        name = type,
        values = {"apple_platform_type": type},
    )
    for type in [
        "ios",
        "macos",
        "tvos",
        "watchos",
    ]
]

keith added 2 commits March 23, 2023 11:32
This is a common pattern you need to select on. Since we have a limited
set of CPUs it's nice to provide a source of truth for this type of
thing
@keith keith force-pushed the ks/add-config_settings-for-platforms branch from 3e3c9dd to 06da8c4 Compare March 23, 2023 18:32
@keith
Copy link
Member Author

keith commented Mar 23, 2023

ok i added those constraints here except for the apple_platform_type one. i don't feel strongly but i feel like we should leave that out since ideally things moves towards platforms instead and we don't rely on that as much going forward. but happy to add if folks think we should

@keith keith marked this pull request as ready for review March 23, 2023 18:35
@keith keith enabled auto-merge (squash) March 23, 2023 18:35
@keith keith merged commit baea9a2 into master Mar 23, 2023
@keith keith deleted the ks/add-config_settings-for-platforms branch March 23, 2023 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants