Skip to content

Commit

Permalink
Fix a typo
Browse files Browse the repository at this point in the history
And make sure that the target_libc macos string literal is kept in sync between the legacy read-from-CROSSTOOL and the new all-is-Starlark behavior.

Issue #7397

RELNOTES: None.
PiperOrigin-RevId: 233716569
  • Loading branch information
scentini authored and Copybara-Service committed Feb 13, 2019
1 parent 73d5381 commit 6ca7763
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,10 @@ public CcToolchainConfigInfo ccToolchainConfigInfoFromSkylark(
}
}

CppPlatform platform = targetLibc.equals("macos") ? CppPlatform.MAC : CppPlatform.LINUX;
CppPlatform platform =
targetLibc.equals(CppActionConfigs.MACOS_TARGET_LIBC)
? CppPlatform.MAC
: CppPlatform.LINUX;
for (CToolchain.Feature feature :
CppActionConfigs.getLegacyFeatures(
platform,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public enum CppPlatform {
MAC
}

/** A string constant for the macOS target libc value. */
public static final String MACOS_TARGET_LIBC = "macosx";

// Note: these features won't be added to the crosstools that defines no_legacy_features feature
// (e.g. ndk, apple, enclave crosstools). Those need to be modified separately.
public static ImmutableList<CToolchain.Feature> getLegacyFeatures(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,9 @@ public static CToolchain addLegacyFeatures(
toolchain = removeSpecialFeatureFromToolchain(toolchain);

CppPlatform platform =
toolchain.getTargetLibc().equals("macosx") ? CppPlatform.MAC : CppPlatform.LINUX;
toolchain.getTargetLibc().equals(CppActionConfigs.MACOS_TARGET_LIBC)
? CppPlatform.MAC
: CppPlatform.LINUX;

toolchainBuilder.addAllActionConfig(
CppActionConfigs.getLegacyActionConfigs(
Expand Down

0 comments on commit 6ca7763

Please sign in to comment.