diff --git a/ReactCommon/fabric/debug/BUCK b/ReactCommon/fabric/debug/BUCK index 6ce9e7f29..d22caf8f9 100644 --- a/ReactCommon/fabric/debug/BUCK +++ b/ReactCommon/fabric/debug/BUCK @@ -10,14 +10,12 @@ if not IS_OSS_BUILD: rn_xplat_cxx_library( name = "debug", srcs = glob( - [ - "*.cpp", - ], + ["**/*.cpp"], + excludes = glob(["tests/**/*.cpp"]), ), headers = glob( - [ - "*.h", - ], + ["**/*.h"], + excludes = glob(["tests/**/*.h"]), ), header_namespace = "", exported_headers = subdir_glob( @@ -54,6 +52,7 @@ if not IS_OSS_BUILD: cxx_test( name = "tests", srcs = glob(["tests/**/*.cpp"]), + headers = glob(["tests/**/*.h"]), contacts = ["oncall+react_native@xmail.facebook.com"], compiler_flags = [ "-fexceptions", diff --git a/ReactCommon/fabric/graphics/BUCK b/ReactCommon/fabric/graphics/BUCK index e1a020d73..967f33aaf 100644 --- a/ReactCommon/fabric/graphics/BUCK +++ b/ReactCommon/fabric/graphics/BUCK @@ -10,14 +10,12 @@ if not IS_OSS_BUILD: rn_xplat_cxx_library( name = "graphics", srcs = glob( - [ - "**/*.cpp", - ], + ["**/*.cpp"], + excludes = glob(["tests/**/*.cpp"]), ), headers = glob( - [ - "**/*.h", - ], + ["**/*.h"], + excludes = glob(["tests/**/*.h"]), ), header_namespace = "", exported_headers = subdir_glob( @@ -39,6 +37,9 @@ rn_xplat_cxx_library( "-DLOG_TAG=\"ReactNative\"", "-DWITH_FBSYSTRACE=1", ], + tests = [ + ":tests", + ], visibility = ["PUBLIC"], deps = [ "xplat//fbsystrace:fbsystrace", @@ -48,3 +49,25 @@ rn_xplat_cxx_library( "xplat//third-party/glog:glog", ], ) + +if not IS_OSS_BUILD: + load("@xplat//configurations/buck:default_platform_defs.bzl", "APPLE") + + cxx_test( + name = "tests", + srcs = glob(["tests/**/*.cpp"]), + headers = glob(["tests/**/*.h"]), + contacts = ["oncall+react_native@xmail.facebook.com"], + compiler_flags = [ + "-fexceptions", + "-frtti", + "-std=c++14", + "-Wall", + ], + platforms = APPLE, + deps = [ + "xplat//folly:molly", + "xplat//third-party/gmock:gtest", + ":graphics", + ], + ) diff --git a/ReactCommon/fabric/graphics/tests/GraphicsTest.cpp b/ReactCommon/fabric/graphics/tests/GraphicsTest.cpp new file mode 100644 index 000000000..3b88ac8a4 --- /dev/null +++ b/ReactCommon/fabric/graphics/tests/GraphicsTest.cpp @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#include + +#include +#include + +using namespace facebook::react; + +TEST(GraphicsTest, testSomething) { + // TODO +} diff --git a/ReactCommon/fabric/uimanager/BUCK b/ReactCommon/fabric/uimanager/BUCK index dc7939377..ca7700e5c 100644 --- a/ReactCommon/fabric/uimanager/BUCK +++ b/ReactCommon/fabric/uimanager/BUCK @@ -10,14 +10,12 @@ if not IS_OSS_BUILD: rn_xplat_cxx_library( name = "uimanager", srcs = glob( - [ - "**/*.cpp", - ], + ["**/*.cpp"], + excludes = glob(["tests/**/*.cpp"]), ), headers = glob( - [ - "**/*.h", - ], + ["**/*.h"], + excludes = glob(["tests/**/*.h"]), ), header_namespace = "", exported_headers = subdir_glob( @@ -39,6 +37,9 @@ rn_xplat_cxx_library( "-DLOG_TAG=\"ReactNative\"", "-DWITH_FBSYSTRACE=1", ], + tests = [ + ":tests", + ], visibility = ["PUBLIC"], deps = [ "xplat//fbsystrace:fbsystrace", @@ -51,3 +52,25 @@ rn_xplat_cxx_library( react_native_xplat_target("fabric/view:view"), ], ) + +if not IS_OSS_BUILD: + load("@xplat//configurations/buck:default_platform_defs.bzl", "APPLE") + + cxx_test( + name = "tests", + srcs = glob(["tests/**/*.cpp"]), + headers = glob(["tests/**/*.h"]), + contacts = ["oncall+react_native@xmail.facebook.com"], + compiler_flags = [ + "-fexceptions", + "-frtti", + "-std=c++14", + "-Wall", + ], + platforms = APPLE, + deps = [ + "xplat//folly:molly", + "xplat//third-party/gmock:gtest", + ":uimanager", + ], + ) diff --git a/ReactCommon/fabric/uimanager/tests/FabricUIManagerTest.cpp b/ReactCommon/fabric/uimanager/tests/FabricUIManagerTest.cpp new file mode 100644 index 000000000..d22ed7f94 --- /dev/null +++ b/ReactCommon/fabric/uimanager/tests/FabricUIManagerTest.cpp @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#include + +#include +#include + +using namespace facebook::react; + +TEST(FabricUIManagerTest, testSomething) { + // TODO +} diff --git a/ReactCommon/fabric/view/BUCK b/ReactCommon/fabric/view/BUCK index 3db0dd82b..5716485f7 100644 --- a/ReactCommon/fabric/view/BUCK +++ b/ReactCommon/fabric/view/BUCK @@ -2,22 +2,21 @@ load("//configurations/buck/apple:flag_defs.bzl", "get_application_ios_flags", " load("//ReactNative:DEFS.bzl", "IS_OSS_BUILD", "rn_xplat_cxx_library", "APPLE_INSPECTOR_FLAGS") load("//ReactNative:DEFS.bzl", "react_native_xplat_target") -CXX_LIBRARY_COMPILER_FLAGS = [ - "-std=c++14", - "-Wall", -] +APPLE_COMPILER_FLAGS = [] + +if not IS_OSS_BUILD: + load("@xplat//configurations/buck/apple:flag_defs.bzl", "get_static_library_ios_flags", "flags") + APPLE_COMPILER_FLAGS = flags.get_flag_value(get_static_library_ios_flags(), 'compiler_flags') rn_xplat_cxx_library( name = "view", srcs = glob( - [ - "**/*.cpp", - ], + ["**/*.cpp"], + excludes = glob(["tests/**/*.cpp"]), ), headers = glob( - [ - "**/*.h", - ], + ["**/*.h"], + excludes = glob(["tests/**/*.h"]), ), header_namespace = "", exported_headers = subdir_glob( @@ -28,15 +27,22 @@ rn_xplat_cxx_library( ], prefix = "fabric/view", ), - compiler_flags = CXX_LIBRARY_COMPILER_FLAGS + [ + compiler_flags = [ "-fexceptions", "-frtti", + "-std=c++14", + "-Wall", ], + fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, + fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + APPLE_INSPECTOR_FLAGS, force_static = True, preprocessor_flags = [ "-DLOG_TAG=\"ReactNative\"", "-DWITH_FBSYSTRACE=1", ], + tests = [ + ":tests", + ], visibility = ["PUBLIC"], deps = [ "xplat//fbsystrace:fbsystrace", @@ -50,3 +56,25 @@ rn_xplat_cxx_library( react_native_xplat_target("fabric/graphics:graphics"), ], ) + +if not IS_OSS_BUILD: + load("@xplat//configurations/buck:default_platform_defs.bzl", "APPLE") + + cxx_test( + name = "tests", + srcs = glob(["tests/**/*.cpp"]), + headers = glob(["tests/**/*.h"]), + contacts = ["oncall+react_native@xmail.facebook.com"], + compiler_flags = [ + "-fexceptions", + "-frtti", + "-std=c++14", + "-Wall", + ], + platforms = APPLE, + deps = [ + "xplat//folly:molly", + "xplat//third-party/gmock:gtest", + ":view", + ], + ) diff --git a/ReactCommon/fabric/view/tests/ViewTest.cpp b/ReactCommon/fabric/view/tests/ViewTest.cpp new file mode 100644 index 000000000..6ea577d8f --- /dev/null +++ b/ReactCommon/fabric/view/tests/ViewTest.cpp @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#include + +#include +#include + +using namespace facebook::react; + +TEST(ViewTest, testSomething) { + // TODO +}