Add umbrella for react/renderer/graphics subtree (#58373)

Summary:
Pull Request resolved: https://github.com/react/react-native/pull/58373

Pull Request resolved: https://github.com/react/react-native/pull/58032

Rolls the umbrella-header + include-guard mechanism across the
`react/renderer/graphics` module, classifying the target as public.

- Adds `<React/Graphics.h>`, re-exporting the module's public interface headers.
- Adds `<react/cxxstableapi/UmbrellaGuard.h>` to 24 root headers and all 18
  platform headers.
- Wires the umbrella header directory into the Buck, CMake, CocoaPods, Gradle,
  and iOS prebuild header configurations.

`conversions.h` and `Geometry.h` are deliberately left unguarded. Both are
deprecation shims whose only content is a `#warning` redirecting to their
replacements.

`PlatformColorParser.h` and `fromRawValueShared.h` include
`react/renderer/core/RawValue.h`, which was only reachable on Apple platforms
because `react/renderer/core:rawValue` was restricted to `platforms = APPLE`.
No source inside the graphics target included those headers off-Apple, so the
breakage was latent and invisible; reaching them through the umbrella surfaces
it.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D116779866

fbshipit-source-id: 22a118acc4b0fc2e19d1da605acd9ee926905cd5
This commit is contained in:
Dawid Małecki
2026-09-22 06:26:57 -07:00
committed by meta-codesync[bot]
parent 335ef070e6
commit b16845f69b
40 changed files with 160 additions and 2 deletions
@@ -153,6 +153,7 @@ val preparePrefab by
Pair("../ReactCommon/react/renderer/debug/React/", "React/"),
// react_renderer_graphics
Pair("../ReactCommon/react/renderer/graphics/", "react/renderer/graphics/"),
Pair("../ReactCommon/react/renderer/graphics/React/", "React/"),
Pair("../ReactCommon/react/renderer/graphics/platform/android/", ""),
// react_renderer_imagemanager
Pair(
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/renderer/graphics/LinearGradient.h>
#include <react/renderer/graphics/RadialGradient.h>
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/renderer/graphics/ValueUnit.h>
#include <optional>
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
namespace facebook::react {
enum class BackgroundRepeatStyle {
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/renderer/graphics/ValueUnit.h>
#include <variant>
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <optional>
#include <string_view>
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/renderer/graphics/Color.h>
#include <react/renderer/graphics/Float.h>
@@ -23,12 +23,14 @@ target_include_directories(react_renderer_graphics
${REACT_COMMON_DIR}
${platform_DIR}
)
target_include_directories(react_renderer_graphics INTERFACE ${REACT_COMMON_DIR}/react/renderer/graphics)
react_native_android_selector(fbjni fbjni "")
target_link_libraries(react_renderer_graphics
glog
${fbjni}
folly_runtime
react_cxxstableapi
react_debug
react_renderer_debug
react_utils
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/renderer/graphics/ColorComponents.h>
#include <react/renderer/graphics/HostPlatformColor.h>
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
namespace facebook::react {
enum class ColorSpace { sRGB, DisplayP3 };
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/renderer/debug/flags.h>
#include <react/renderer/graphics/Color.h>
#include <react/renderer/graphics/Float.h>
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/renderer/graphics/Color.h>
#include <react/renderer/graphics/Float.h>
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <optional>
#include <string_view>
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/renderer/debug/flags.h>
#include <react/renderer/graphics/ColorStop.h>
#include <react/renderer/graphics/Float.h>
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/renderer/graphics/Float.h>
#include <react/utils/hash_combine.h>
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/renderer/debug/flags.h>
#include <react/renderer/graphics/ColorStop.h>
#include <react/renderer/graphics/Float.h>
@@ -38,6 +38,12 @@ Pod::Spec.new do |s|
header_search_paths = header_search_paths + ["\"$(PODS_TARGET_SRCROOT)/platform/ios\""]
end
s.subspec "graphicsUmbrella" do |ss|
ss.source_files = "React/*.h"
ss.header_dir = ""
ss.header_mappings_dir = "."
end
resolve_use_frameworks(s, header_mappings_dir: "../../..", module_name: "React_graphics")
s.pod_target_xcconfig = { "USE_HEADERMAP" => "NO",
@@ -50,6 +56,7 @@ Pod::Spec.new do |s|
s.dependency "React-featureflags"
s.dependency "React-utils"
s.dependency "React-rendererdebug"
s.dependency "React-cxxstableapi"
depend_on_js_engine(s)
add_rn_third_party_dependencies(s)
@@ -0,0 +1,67 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
// =============================================================================
// Umbrella header for the `react/renderer/graphics` module - public entry
// point.
//
// #include <React/Graphics.h>
//
// Re-exports the module's public interface headers. React Native's own code
// should keep using the fine-grained `<react/renderer/graphics/...>` includes;
// only outside consumers use this umbrella.
// =============================================================================
// Marks that the following headers are pulled in through the umbrella, so their
// shared guard (<react/cxxstableapi/UmbrellaGuard.h>) accepts them. The marker
// is saved and restored rather than defined and undefined: the scope ends at
// this block, so later *direct* includes in the same TU are still caught, and
// it nests inside an enclosing umbrella rather than disarming it.
#pragma push_macro("RN_UMBRELLA_CONTEXT")
#undef RN_UMBRELLA_CONTEXT
#define RN_UMBRELLA_CONTEXT 1
#include <react/renderer/graphics/BackgroundImage.h>
#include <react/renderer/graphics/BackgroundPosition.h>
#include <react/renderer/graphics/BackgroundRepeat.h>
#include <react/renderer/graphics/BackgroundSize.h>
#include <react/renderer/graphics/BlendMode.h>
#include <react/renderer/graphics/BoxShadow.h>
#include <react/renderer/graphics/Color.h>
#include <react/renderer/graphics/ColorComponents.h>
#include <react/renderer/graphics/ColorStop.h>
#include <react/renderer/graphics/Filter.h>
#include <react/renderer/graphics/Float.h>
#include <react/renderer/graphics/HostPlatformColor.h>
#include <react/renderer/graphics/Isolation.h>
#include <react/renderer/graphics/LinearGradient.h>
#include <react/renderer/graphics/PlatformColorParser.h>
#include <react/renderer/graphics/Point.h>
#include <react/renderer/graphics/RadialGradient.h>
#include <react/renderer/graphics/Rect.h>
#include <react/renderer/graphics/RectangleCorners.h>
#include <react/renderer/graphics/RectangleEdges.h>
#include <react/renderer/graphics/Size.h>
#include <react/renderer/graphics/Transform.h>
#include <react/renderer/graphics/TransformUtils.h>
#include <react/renderer/graphics/ValueUnit.h>
#include <react/renderer/graphics/Vector.h>
#include <react/renderer/graphics/fromRawValueShared.h>
#include <react/renderer/graphics/rounding.h>
#ifdef ANDROID
#include <react/renderer/graphics/configurePlatformColorCacheInvalidationHook.h>
#endif
#if defined(__APPLE__) && defined(__OBJC__)
#include <react/renderer/graphics/RCTPlatformColorUtils.h>
#endif
#undef RN_UMBRELLA_CONTEXT
#pragma pop_macro("RN_UMBRELLA_CONTEXT")
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <algorithm>
#include <tuple>
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <tuple>
#include <react/renderer/graphics/Float.h>
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <tuple>
#include <react/renderer/graphics/Float.h>
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <tuple>
#include <react/renderer/graphics/Float.h>
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <array>
#include <vector>
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <folly/dynamic.h>
#include <react/renderer/graphics/Transform.h>
#include <react/renderer/graphics/ValueUnit.h>
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/renderer/debug/flags.h>
#include <string>
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/renderer/graphics/Float.h>
namespace facebook::react {
@@ -5,6 +5,9 @@
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/debug/react_native_expect.h>
#include <react/featureflags/ReactNativeFeatureFlags.h>
#include <react/renderer/core/RawValue.h>
@@ -13,8 +16,6 @@
#include <react/renderer/graphics/Color.h>
#include <react/utils/ContextContainer.h>
#pragma once
namespace facebook::react {
using parsePlatformColorFn = SharedColor (*)(const ContextContainer &, int32_t, const RawValue &);
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <limits>
namespace facebook::react {
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/renderer/graphics/ColorComponents.h>
#include <react/utils/hash_combine.h>
#include <cmath>
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include "configurePlatformColorCacheInvalidationHook.h"
#include <fbjni/fbjni.h>
@@ -5,6 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <functional>
namespace facebook::react {
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <limits>
namespace facebook::react {
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/renderer/graphics/ColorComponents.h>
#include <cmath>
#include <cstdint>
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/debug/react_native_expect.h>
#include <react/renderer/core/RawValue.h>
#include <react/renderer/graphics/Color.h>
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <CoreGraphics/CoreGraphics.h>
#include <limits>
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/renderer/graphics/ColorComponents.h>
#include <react/utils/hash_combine.h>
#include <cmath>
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/debug/react_native_expect.h>
#include <react/renderer/core/RawValue.h>
#include <react/renderer/graphics/Color.h>
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#import <UIKit/UIKit.h>
#import <vector>
@@ -7,6 +7,8 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/renderer/graphics/Float.h>
namespace facebook::react {
@@ -563,6 +563,18 @@ const PodspecExceptions /*: {[key: string]: PodSpecConfiguration} */ = {
},
],
},
'ReactCommon/react/renderer/graphics/React-graphics.podspec': {
name: 'React-graphics',
headerPatterns: ['*.h', 'platform/ios/**/*.h'],
headerDir: 'react/renderer/graphics',
subSpecs: [
{
name: 'graphicsUmbrella',
headerPatterns: ['React/*.h'],
headerDir: 'React',
},
],
},
'React-Core.podspec': {
name: 'React-Core',
headerPatterns: [],