fix gradle compliation #925

Closed
amir-shalem wants to merge 1 commits from export-D17274226 into master
10 changed files with 91 additions and 8 deletions

View File

@@ -60,8 +60,10 @@ android {
dependencies { dependencies {
compileOnly 'com.google.code.findbugs:jsr305:3.0.1' compileOnly 'com.google.code.findbugs:jsr305:3.0.1'
compileOnly project(':yoga:proguard-annotations') compileOnly project(':yoga:proguard-annotations')
compile project(':libfb')
implementation 'com.facebook.soloader:soloader:0.5.1' implementation 'com.facebook.soloader:soloader:0.5.1'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
testCompile project(':testutil')
} }
task sourcesJar(type: Jar) { task sourcesJar(type: Jar) {

View File

@@ -5,8 +5,9 @@
* LICENSE file in the root directory of this source tree. * 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').projectDir = file('java')
project(':yoga:proguard-annotations').projectDir = file('java/proguard-annotations') project(':yoga:proguard-annotations').projectDir = file('java/proguard-annotations')
project(':yoga-layout').projectDir = file('android') project(':yoga-layout').projectDir = file('android')
project(':libfb').projectDir = file('lib/fb') project(':libfb').projectDir = file('lib/fb')
project(':testutil').projectDir = file('testutil')

View File

@@ -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( yoga_cxx_library(
name = "testutil", name = "testutil",
srcs = ["testutil.cpp"], srcs = ["src/main/cpp/testutil/testutil.cpp"],
header_namespace = "yoga/testutil", header_namespace = "",
exported_headers = ["testutil.h"], exported_headers = subdir_glob([("src/main/cpp/include", "yoga/testutil/testutil.h")]),
compiler_flags = LIBRARY_COMPILER_FLAGS, compiler_flags = LIBRARY_COMPILER_FLAGS,
soname = "libyoga_testutil.$(ext)", soname = "libyoga_testutil.$(ext)",
visibility = ["PUBLIC"], visibility = ["PUBLIC"],
@@ -13,7 +13,7 @@ yoga_cxx_library(
yoga_java_library( yoga_java_library(
name = "java", name = "java",
srcs = ["TestUtil.java"], srcs = ["src/main/java/com/facebook/yoga/TestUtil.java"],
source = "1.7", source = "1.7",
target = "1.7", target = "1.7",
visibility = ["PUBLIC"], visibility = ["PUBLIC"],
@@ -25,7 +25,7 @@ yoga_java_library(
yoga_cxx_library( yoga_cxx_library(
name = "jni", name = "jni",
srcs = ["jni.cpp"], srcs = ["src/main/cpp/jni/jni.cpp"],
allow_jni_merging = False, allow_jni_merging = False,
compiler_flags = LIBRARY_COMPILER_FLAGS, compiler_flags = LIBRARY_COMPILER_FLAGS,
platforms = ANDROID, platforms = ANDROID,

38
testutil/build.gradle Normal file
View File

@@ -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'
}
}

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
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.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.facebook.yoga.testutil">
</manifest>

View File

@@ -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)

View File

@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the LICENSE * This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree. * file in the root directory of this source tree.
*/ */
#include "testutil.h" #include <yoga/testutil/testutil.h>
#include <yoga/YGNode.h> #include <yoga/YGNode.h>
#include <yoga/event/event.h> #include <yoga/event/event.h>