Skip to content

Commit f35d630

Browse files
clocksarestupidmeta-codesync[bot]
authored andcommitted
tvOS: build ocean's imageio and platform/apple for appletvos
Summary: Prerequisite for the InstagramTV tvOS app. `xplat/ocean/impl/ocean/media/imageio` and `xplat/ocean/impl/ocean/platform/apple` both declared `compatible_with = [iphoneos, macos]`, which hard-fails buck2 analysis the moment anything reaches them from an appletvos configuration. They are ImageIO, CoreGraphics and Foundation wrappers, and all three frameworks exist on tvOS, so appletvos is added to `compatible_with` and APPLETVOS to `apple_sdks`. `ocean/base/Base.h` additionally classified tvOS as iOS, because Apple sets TARGET_OS_IPHONE (and TARGET_IPHONE_SIMULATOR on the tvOS simulator) to 1 there. That made ocean compile UIKit paths tvOS does not provide. A TARGET_OS_TV branch is added ahead of the iOS ones, with the matching platform string in `Build.cpp`. This is split out of D114947077 and placed at the bottom of the stack on purpose. InstagramTV's story tray (D113821281) is what first pulls ocean's imageio into the tvOS app closure, via IGStoryTraySection -> ... -> CTSmartCreationUtils. With the fix sitting above that diff, the InstagramTV CI target failed on D113821281, and more importantly it would have broken the tvOS build on master for the window between D113821281 landing and D114947077 landing, since diffs land bottom-to-top. Owned by the `ocean` oncall — flagging for their review. No behaviour change on iOS, macOS or Android: the only new configuration is appletvos, which previously could not build these targets at all. Differential Revision: D115018853 fbshipit-source-id: d5ca2bdf448d3b0d144c5b5687322c23e90e1132
1 parent c9e1456 commit f35d630

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

impl/ocean/base/Base.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,14 @@ inline constexpr bool oceanFalse()
604604

605605
#define OCEAN_PLATFORM_BUILD_APPLE
606606

607-
#if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR == 1
607+
// tvOS must be tested before the iOS branches: Apple sets TARGET_OS_IPHONE (and
608+
// TARGET_IPHONE_SIMULATOR on the tvOS simulator) to 1 there, so without this tvOS would
609+
// be classified as iOS and would pull in UIKit APIs that tvOS does not provide.
610+
#if defined(TARGET_OS_TV) && TARGET_OS_TV == 1
611+
612+
#define OCEAN_PLATFORM_BUILD_APPLE_TVOS
613+
614+
#elif defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR == 1
608615

609616
#define OCEAN_PLATFORM_BUILD_APPLE_IOS_SIMULATOR
610617

impl/ocean/base/Build.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ std::string Build::platformType()
3131

3232
return std::string("ios");
3333

34+
#elif defined(OCEAN_PLATFORM_BUILD_APPLE_TVOS)
35+
36+
return std::string("tvos");
37+
3438
#elif defined(OCEAN_PLATFORM_BUILD_APPLE_MACOS)
3539

3640
return std::string("osx");

0 commit comments

Comments
 (0)