diff options
| -rw-r--r-- | tools/aapt2/jni/Aapt2.java | 44 | ||||
| -rw-r--r-- | tools/aapt2/jni/Makefile | 25 | ||||
| -rw-r--r-- | tools/aapt2/jni/aapt2_jni.cpp | 9 | ||||
| -rw-r--r-- | tools/aapt2/jni/com_android_tools_aapt2_Aapt2.h | 8 | 
4 files changed, 15 insertions, 71 deletions
diff --git a/tools/aapt2/jni/Aapt2.java b/tools/aapt2/jni/Aapt2.java deleted file mode 100644 index aed23de92fba..000000000000 --- a/tools/aapt2/jni/Aapt2.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.android.tools.aapt2; - -import java.util.List; - -/** - * {@code aapt2} JNI interface. To use the {@code aapt2} native interface, the - * shared library must first be loaded and then a new instance of this class can - * be used to access the library. - */ -public class Aapt2 { - -  /** -   * Invokes {@code aapt2} to perform resource compilation. -   * -   * @param arguments arguments for compilation (see {@code Compile.cpp}) -   */ -  public static void compile(List<String> arguments) { -    nativeCompile(arguments); -  } - -  /** -   * Invokes {@code aapt2} to perform linking. -   * -   * @param arguments arguments for linking (see {@code Link.cpp}) -   */ -  public static void link(List<String> arguments) { -    nativeLink(arguments); -  } - -  /** -   * JNI call. -   * -   * @param arguments arguments for compilation (see {@code Compile.cpp}) -   */ -  private static native void nativeCompile(List<String> arguments); - -  /** -   * JNI call. -   * -   * @param arguments arguments for linking (see {@code Link.cpp}) -   */ -  private static native void nativeLink(List<String> arguments); -} - diff --git a/tools/aapt2/jni/Makefile b/tools/aapt2/jni/Makefile deleted file mode 100644 index a9e628f45ce5..000000000000 --- a/tools/aapt2/jni/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -# -# This Makefile will generate the JNI headers for the Aapt2 class. -# - -AAPT2_PKG=com.android.tools.aapt2 -AAPT2_DIR=$(shell echo -n com/android/tools/aapt2 | tr . /) -OUT=out -OUT_CLASSES=$(OUT)/classes -OUT_HEADERS=. - -AAPT2_JAVA=Aapt2.java -AAPT2_CLASSES=$(OUT_CLASSES)/$(AAPT2_DIR)/Aapt2.class - -AAPT2_HEADERS=$(OUT_HEADERS)/Aapt2.h - -all: $(AAPT2_HEADERS) - -$(AAPT2_HEADERS): $(AAPT2_JAVA) $(AAPT2_CLASSES) -	mkdir -p $(OUT_HEADERS) -	$(JAVA_HOME)/bin/javah -d $(OUT_HEADERS) -cp $(OUT_CLASSES) $(AAPT2_PKG).Aapt2 - -$(AAPT2_CLASSES): $(AAPT2_JAVA) -	mkdir -p $(OUT_CLASSES) -	javac -d $(OUT_CLASSES) $(AAPT2_JAVA) - diff --git a/tools/aapt2/jni/aapt2_jni.cpp b/tools/aapt2/jni/aapt2_jni.cpp index 211ada8db078..a5e09a2c9d57 100644 --- a/tools/aapt2/jni/aapt2_jni.cpp +++ b/tools/aapt2/jni/aapt2_jni.cpp @@ -46,8 +46,8 @@ static std::vector<ScopedUtfChars> list_to_utfchars(JNIEnv *env, jobject obj) {    // Now, iterate all strings in the list    // (note: generic erasure means get() return an Object) -  jmethodID get_method_id = -      env->GetMethodID(list_cls, "get", "()Ljava/lang/Object;"); +  jmethodID get_method_id = env->GetMethodID(list_cls, "get", "(I)Ljava/lang/Object;"); +  CHECK(get_method_id != 0);    for (jint i = 0; i < size; i++) {      // Call get(i) to get the string in the ith position.      jobject string_obj_uncast = env->CallObjectMethod(obj, get_method_id, i); @@ -92,3 +92,8 @@ JNIEXPORT void JNICALL Java_com_android_tools_aapt2_Aapt2_nativeLink(    std::vector<aapt::StringPiece> link_args = extract_pieces(link_args_jni);    aapt::Link(link_args);  } + +JNIEXPORT void JNICALL Java_com_android_tools_aapt2_Aapt2_ping( +        JNIEnv *env, jclass aapt_obj) { +  // This is just a dummy method to see if the library has been loaded. +} diff --git a/tools/aapt2/jni/com_android_tools_aapt2_Aapt2.h b/tools/aapt2/jni/com_android_tools_aapt2_Aapt2.h index 443b98f2590d..26dc52db8695 100644 --- a/tools/aapt2/jni/com_android_tools_aapt2_Aapt2.h +++ b/tools/aapt2/jni/com_android_tools_aapt2_Aapt2.h @@ -9,6 +9,14 @@ extern "C" {  #endif  /*   * Class:     com_android_tools_aapt2_Aapt2 + * Method:    ping + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_com_android_tools_aapt2_Aapt2_ping +  (JNIEnv *, jclass); + +/* + * Class:     com_android_tools_aapt2_Aapt2   * Method:    nativeCompile   * Signature: (Ljava/util/List;)V   */  |