From 1acef4597747cc3068ae25bd22c26d500a228f3b Mon Sep 17 00:00:00 2001 From: Kevin Gozali Date: Fri, 23 Mar 2018 22:09:11 -0700 Subject: [PATCH] iOS: added placeholder test setup for fabric graphics/uimanager/view targets Reviewed By: shergin Differential Revision: D7390366 fbshipit-source-id: d49fcc335fc03d52402676341f1da24177c6084b --- ReactCommon/fabric/debug/BUCK | 11 ++-- ReactCommon/fabric/graphics/BUCK | 35 ++++++++++--- .../fabric/graphics/tests/GraphicsTest.cpp | 17 +++++++ ReactCommon/fabric/uimanager/BUCK | 35 ++++++++++--- .../uimanager/tests/FabricUIManagerTest.cpp | 17 +++++++ ReactCommon/fabric/view/BUCK | 50 +++++++++++++++---- ReactCommon/fabric/view/tests/ViewTest.cpp | 17 +++++++ 7 files changed, 153 insertions(+), 29 deletions(-) create mode 100644 ReactCommon/fabric/graphics/tests/GraphicsTest.cpp create mode 100644 ReactCommon/fabric/uimanager/tests/FabricUIManagerTest.cpp create mode 100644 ReactCommon/fabric/view/tests/ViewTest.cpp diff --git a/ReactCommon/fabric/debug/BUCK b/ReactCommon/fabric/debug/BUCK index 6ce9e7f29e..d22caf8f95 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 e1a020d730..967f33aafc 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 0000000000..3b88ac8a42 --- /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 dc7939377d..ca7700e5c4 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 0000000000..d22ed7f946 --- /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 3db0dd82bf..5716485f77 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 0000000000..6ea577d8fa --- /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 +}