aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Dorokhine <adorokhine@google.com>2020-06-09 16:11:53 -0700
committerAlexander Dorokhine <adorokhine@google.com>2020-06-09 16:26:06 -0700
commit0647e788dc0efee9fcdabfe54fce00119f119ca0 (patch)
tree9864474a9da94de20a2b370b1abe0518137c49f9
parent770e599cf02866bb87e497c62bbe87a45e05cc79 (diff)
parent42a60e1b4c64f439e85928123dff4a79d1ca1a2f (diff)
downloadicing-0647e788dc0efee9fcdabfe54fce00119f119ca0.tar.gz
Merge remote-tracking branch 'aosp/upstream-master' into androidx-master-dev
* aosp/upstream-master: Update from upstream, including proto location changes. Bug: 158587690 Change-Id: Ib6134a09fa8832e980daa3c795775a32a8430c30
-rw-r--r--CMakeLists.txt8
-rw-r--r--icing/jni/jni.lds10
-rw-r--r--icing/text_classifier/lib3/utils/java/jni-helper.cc9
-rw-r--r--icing/text_classifier/lib3/utils/java/jni-helper.h3
-rw-r--r--java/build.gradle2
-rw-r--r--nativeLib/build.gradle3
-rw-r--r--proto/icing/legacy/index/proto/icing-dynamic-trie-header.proto (renamed from icing/legacy/index/proto/icing-dynamic-trie-header.proto)0
-rw-r--r--proto/icing/proto/document.proto (renamed from icing/proto/document.proto)0
-rw-r--r--proto/icing/proto/document_wrapper.proto (renamed from icing/proto/document_wrapper.proto)0
-rw-r--r--proto/icing/proto/initialize.proto (renamed from icing/proto/initialize.proto)0
-rw-r--r--proto/icing/proto/optimize.proto (renamed from icing/proto/optimize.proto)0
-rw-r--r--proto/icing/proto/persist.proto (renamed from icing/proto/persist.proto)0
-rw-r--r--proto/icing/proto/reset.proto (renamed from icing/proto/reset.proto)0
-rw-r--r--proto/icing/proto/schema.proto (renamed from icing/proto/schema.proto)0
-rw-r--r--proto/icing/proto/scoring.proto (renamed from icing/proto/scoring.proto)0
-rw-r--r--proto/icing/proto/search.proto (renamed from icing/proto/search.proto)0
-rw-r--r--proto/icing/proto/status.proto (renamed from icing/proto/status.proto)0
-rw-r--r--proto/icing/proto/term.proto (renamed from icing/proto/term.proto)0
18 files changed, 17 insertions, 18 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c002af0..119b086 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,6 +19,7 @@ set(
"${CMAKE_CURRENT_SOURCE_DIR}/../../prebuilts/protobuf")
set(Protobuf_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../protobuf")
set(Protobuf_TARGET_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/protobuf-target")
+set(Icing_PROTO_GEN_DIR "${CMAKE_CURRENT_BINARY_DIR}/icing-protobuf-gen")
## Configure libprotobuf ##
# Find the right protoc to compile our proto files
@@ -48,12 +49,11 @@ add_subdirectory(${ICU_SOURCE_DIR} ${ICU_TARGET_BINARY_DIR})
file(
GLOB_RECURSE
Icing_PROTO_FILES
- RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
- "icing/*.proto")
+ RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/proto"
+ "*.proto")
message(STATUS "Icing_PROTO_FILES=${Icing_PROTO_FILES}")
# Run protoc on Icing_PROTO_FILES to generate pb.cc and pb.h files
-set(Icing_PROTO_GEN_DIR "${PROTO_GENERATED_FILES_BASE_DIR}/cpp")
file(MAKE_DIRECTORY ${Icing_PROTO_GEN_DIR})
foreach(FILE ${Icing_PROTO_FILES})
# Find the name of the proto file without the .proto extension
@@ -65,7 +65,7 @@ foreach(FILE ${Icing_PROTO_FILES})
OUTPUT "${Icing_PROTO_GEN_DIR}/${FILE_NOEXT}.pb.cc"
"${Icing_PROTO_GEN_DIR}/${FILE_NOEXT}.pb.h"
COMMAND ${Protobuf_PROTOC_PATH}
- --proto_path ${CMAKE_CURRENT_SOURCE_DIR}
+ --proto_path "${CMAKE_CURRENT_SOURCE_DIR}/proto"
--cpp_out ${Icing_PROTO_GEN_DIR}
${FILE}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
diff --git a/icing/jni/jni.lds b/icing/jni/jni.lds
deleted file mode 100644
index 401682a..0000000
--- a/icing/jni/jni.lds
+++ /dev/null
@@ -1,10 +0,0 @@
-VERS_1.0 {
- # Export JNI symbols.
- global:
- Java_*;
- JNI_OnLoad;
-
- # Hide everything else
- local:
- *;
-};
diff --git a/icing/text_classifier/lib3/utils/java/jni-helper.cc b/icing/text_classifier/lib3/utils/java/jni-helper.cc
index 0d9b0a0..3f63a45 100644
--- a/icing/text_classifier/lib3/utils/java/jni-helper.cc
+++ b/icing/text_classifier/lib3/utils/java/jni-helper.cc
@@ -25,6 +25,15 @@ StatusOr<ScopedLocalRef<jclass>> JniHelper::FindClass(JNIEnv* env,
return result;
}
+StatusOr<ScopedLocalRef<jclass>> JniHelper::GetObjectClass(JNIEnv* env,
+ jobject object) {
+ TC3_ENSURE_LOCAL_CAPACITY_OR_RETURN;
+ ScopedLocalRef<jclass> result(env->GetObjectClass(object), env);
+ TC3_NO_EXCEPTION_OR_RETURN;
+ TC3_NOT_NULL_OR_RETURN;
+ return result;
+}
+
StatusOr<jmethodID> JniHelper::GetMethodID(JNIEnv* env, jclass clazz,
const char* method_name,
const char* return_type) {
diff --git a/icing/text_classifier/lib3/utils/java/jni-helper.h b/icing/text_classifier/lib3/utils/java/jni-helper.h
index ea4ba3b..fe989a0 100644
--- a/icing/text_classifier/lib3/utils/java/jni-helper.h
+++ b/icing/text_classifier/lib3/utils/java/jni-helper.h
@@ -72,6 +72,9 @@ class JniHelper {
static StatusOr<ScopedLocalRef<jclass>> FindClass(JNIEnv* env,
const char* class_name);
+ static StatusOr<ScopedLocalRef<jclass>> GetObjectClass(JNIEnv* env,
+ jobject object);
+
template <typename T = jobject>
static StatusOr<ScopedLocalRef<T>> GetObjectArrayElement(JNIEnv* env,
jobjectArray array,
diff --git a/java/build.gradle b/java/build.gradle
index caaa116..206c74f 100644
--- a/java/build.gradle
+++ b/java/build.gradle
@@ -36,7 +36,7 @@ apply plugin: 'idea'
sourceSets {
main {
proto {
- srcDir '..'
+ srcDir '../proto'
include '**/*.proto'
}
}
diff --git a/nativeLib/build.gradle b/nativeLib/build.gradle
index 2cd686a..0a068d3 100644
--- a/nativeLib/build.gradle
+++ b/nativeLib/build.gradle
@@ -30,13 +30,10 @@ buildscript {
apply plugin: 'AndroidXPlugin'
apply plugin: 'com.android.library'
-def protoGeneratedFilesBaseDir = "${project.buildDir}/generated/source/proto"
-
android {
defaultConfig {
externalNativeBuild {
cmake {
- arguments "-DPROTO_GENERATED_FILES_BASE_DIR=${protoGeneratedFilesBaseDir}"
cppFlags "-std=c++17"
arguments "-DCMAKE_VERBOSE_MAKEFILE=ON"
targets "icing"
diff --git a/icing/legacy/index/proto/icing-dynamic-trie-header.proto b/proto/icing/legacy/index/proto/icing-dynamic-trie-header.proto
index 0e59832..0e59832 100644
--- a/icing/legacy/index/proto/icing-dynamic-trie-header.proto
+++ b/proto/icing/legacy/index/proto/icing-dynamic-trie-header.proto
diff --git a/icing/proto/document.proto b/proto/icing/proto/document.proto
index bed33b0..bed33b0 100644
--- a/icing/proto/document.proto
+++ b/proto/icing/proto/document.proto
diff --git a/icing/proto/document_wrapper.proto b/proto/icing/proto/document_wrapper.proto
index e8eb992..e8eb992 100644
--- a/icing/proto/document_wrapper.proto
+++ b/proto/icing/proto/document_wrapper.proto
diff --git a/icing/proto/initialize.proto b/proto/icing/proto/initialize.proto
index eac88e6..eac88e6 100644
--- a/icing/proto/initialize.proto
+++ b/proto/icing/proto/initialize.proto
diff --git a/icing/proto/optimize.proto b/proto/icing/proto/optimize.proto
index 1baa64c..1baa64c 100644
--- a/icing/proto/optimize.proto
+++ b/proto/icing/proto/optimize.proto
diff --git a/icing/proto/persist.proto b/proto/icing/proto/persist.proto
index 77cf987..77cf987 100644
--- a/icing/proto/persist.proto
+++ b/proto/icing/proto/persist.proto
diff --git a/icing/proto/reset.proto b/proto/icing/proto/reset.proto
index 5e8b9f5..5e8b9f5 100644
--- a/icing/proto/reset.proto
+++ b/proto/icing/proto/reset.proto
diff --git a/icing/proto/schema.proto b/proto/icing/proto/schema.proto
index 3a7ee5d..3a7ee5d 100644
--- a/icing/proto/schema.proto
+++ b/proto/icing/proto/schema.proto
diff --git a/icing/proto/scoring.proto b/proto/icing/proto/scoring.proto
index 667ff4f..667ff4f 100644
--- a/icing/proto/scoring.proto
+++ b/proto/icing/proto/scoring.proto
diff --git a/icing/proto/search.proto b/proto/icing/proto/search.proto
index 8ea5036..8ea5036 100644
--- a/icing/proto/search.proto
+++ b/proto/icing/proto/search.proto
diff --git a/icing/proto/status.proto b/proto/icing/proto/status.proto
index 2733a15..2733a15 100644
--- a/icing/proto/status.proto
+++ b/proto/icing/proto/status.proto
diff --git a/icing/proto/term.proto b/proto/icing/proto/term.proto
index adf2ad6..adf2ad6 100644
--- a/icing/proto/term.proto
+++ b/proto/icing/proto/term.proto