diff --git a/java/build.gradle b/java/build.gradle
index 8cded209..e4494ddc 100644
--- a/java/build.gradle
+++ b/java/build.gradle
@@ -60,8 +60,10 @@ android {
dependencies {
compileOnly 'com.google.code.findbugs:jsr305:3.0.1'
compileOnly project(':yoga:proguard-annotations')
+ compile project(':libfb')
implementation 'com.facebook.soloader:soloader:0.5.1'
testImplementation 'junit:junit:4.12'
+ testCompile project(':testutil')
}
task sourcesJar(type: Jar) {
diff --git a/settings.gradle b/settings.gradle
index 1c136f10..573bc583 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -5,8 +5,9 @@
* LICENSE file in the root directory of this source tree.
*/
-include ':yoga', ':yogacore', ':yoga-layout', ':yoga:proguard-annotations', ':libfb'
+include ':yoga', ':yogacore', ':yoga-layout', ':yoga:proguard-annotations', ':libfb', ':testutil'
project(':yoga').projectDir = file('java')
project(':yoga:proguard-annotations').projectDir = file('java/proguard-annotations')
project(':yoga-layout').projectDir = file('android')
project(':libfb').projectDir = file('lib/fb')
+project(':testutil').projectDir = file('testutil')
diff --git a/testutil/BUCK b/testutil/BUCK
index 421ffb30..56ee97fe 100644
--- a/testutil/BUCK
+++ b/testutil/BUCK
@@ -1,10 +1,10 @@
-load("//tools/build_defs/oss:yoga_defs.bzl", "ANDROID", "FBJNI_TARGET", "LIBRARY_COMPILER_FLAGS", "SOLOADER_TARGET", "yoga_cxx_library", "yoga_dep", "yoga_java_library")
+load("//tools/build_defs/oss:yoga_defs.bzl", "ANDROID", "FBJNI_TARGET", "LIBRARY_COMPILER_FLAGS", "SOLOADER_TARGET", "subdir_glob", "yoga_cxx_library", "yoga_dep", "yoga_java_library")
yoga_cxx_library(
name = "testutil",
- srcs = ["testutil.cpp"],
- header_namespace = "yoga/testutil",
- exported_headers = ["testutil.h"],
+ srcs = ["src/main/cpp/testutil/testutil.cpp"],
+ header_namespace = "",
+ exported_headers = subdir_glob([("src/main/cpp/include", "yoga/testutil/testutil.h")]),
compiler_flags = LIBRARY_COMPILER_FLAGS,
soname = "libyoga_testutil.$(ext)",
visibility = ["PUBLIC"],
@@ -13,7 +13,7 @@ yoga_cxx_library(
yoga_java_library(
name = "java",
- srcs = ["TestUtil.java"],
+ srcs = ["src/main/java/com/facebook/yoga/TestUtil.java"],
source = "1.7",
target = "1.7",
visibility = ["PUBLIC"],
@@ -25,7 +25,7 @@ yoga_java_library(
yoga_cxx_library(
name = "jni",
- srcs = ["jni.cpp"],
+ srcs = ["src/main/cpp/jni/jni.cpp"],
allow_jni_merging = False,
compiler_flags = LIBRARY_COMPILER_FLAGS,
platforms = ANDROID,
diff --git a/testutil/build.gradle b/testutil/build.gradle
new file mode 100644
index 00000000..47074284
--- /dev/null
+++ b/testutil/build.gradle
@@ -0,0 +1,38 @@
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+apply plugin: 'com.android.library'
+
+android {
+ compileSdkVersion rootProject.compileSdkVersion
+ buildToolsVersion rootProject.buildToolsVersion
+
+ defaultConfig {
+ minSdkVersion rootProject.minSdkVersion
+ targetSdkVersion rootProject.targetSdkVersion
+
+ ndk {
+ abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
+ }
+
+ externalNativeBuild {
+ cmake {
+ arguments '-DANDROID_TOOLCHAIN=clang', '-DANDROID_STL=c++_static'
+ }
+ }
+ }
+
+ externalNativeBuild {
+ cmake {
+ path 'src/main/cpp/CMakeLists.txt'
+ }
+ }
+
+ dependencies {
+ implementation 'com.facebook.soloader:soloader:0.5.1'
+ }
+}
diff --git a/testutil/src/main/AndroidManifest.xml b/testutil/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..7d6f3e5c
--- /dev/null
+++ b/testutil/src/main/AndroidManifest.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
diff --git a/testutil/src/main/cpp/CMakeLists.txt b/testutil/src/main/cpp/CMakeLists.txt
new file mode 100644
index 00000000..2330f8e3
--- /dev/null
+++ b/testutil/src/main/cpp/CMakeLists.txt
@@ -0,0 +1,30 @@
+#
+# Copyright (c) Facebook, Inc. and its affiliates.
+#
+# This source code is licensed under the MIT license found in the
+# LICENSE file in the root directory of this source tree.
+#
+
+cmake_minimum_required(VERSION 3.4.1)
+
+set(CMAKE_VERBOSE_MAKEFILE on)
+
+add_compile_options(
+ -fno-omit-frame-pointer
+ -fexceptions
+ -Wall
+ -std=c++11
+ -DDISABLE_CPUCAP
+ -DDISABLE_XPLAT)
+
+file(GLOB testutil_SRC
+ jni/*.cpp
+ testutil/*.cpp)
+
+add_library(testutil SHARED
+ ${testutil_SRC})
+
+target_include_directories(testutil PRIVATE
+ include)
+
+target_link_libraries(testutil android log)
diff --git a/testutil/testutil.h b/testutil/src/main/cpp/include/yoga/testutil/testutil.h
similarity index 100%
rename from testutil/testutil.h
rename to testutil/src/main/cpp/include/yoga/testutil/testutil.h
diff --git a/testutil/jni.cpp b/testutil/src/main/cpp/jni/jni.cpp
similarity index 100%
rename from testutil/jni.cpp
rename to testutil/src/main/cpp/jni/jni.cpp
diff --git a/testutil/testutil.cpp b/testutil/src/main/cpp/testutil/testutil.cpp
similarity index 97%
rename from testutil/testutil.cpp
rename to testutil/src/main/cpp/testutil/testutil.cpp
index c8f9e32c..09061fb7 100644
--- a/testutil/testutil.cpp
+++ b/testutil/src/main/cpp/testutil/testutil.cpp
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*/
-#include "testutil.h"
+#include
#include
#include
diff --git a/testutil/TestUtil.java b/testutil/src/main/java/com/facebook/yoga/TestUtil.java
similarity index 100%
rename from testutil/TestUtil.java
rename to testutil/src/main/java/com/facebook/yoga/TestUtil.java