Break the sqlite JDBC driver out from our JDBC implementation.
The JDBC driver is from a different source
(http://www.ch-werner.de/javasqlite/overview-summary.html) and is only
really needed for testing.
Bug 2468870 asks that we don't eagerly register the native methods for
these classes. That bug is fixed by this change.
Bug 2198667 asks that we stop shipping this JDBC driver as part of the
base system. That bug is not addressed by this change: the classes and
native code are now in their own, separate, .jar and .so files -- so
they'll be easier to remove in future -- but for now those files are
still in /system/framework and /system/lib respectively.
Bug: 2468870
Bug: 2198667
diff --git a/JavaLibrary.mk b/JavaLibrary.mk
index c9fe3e2..f9468a8 100644
--- a/JavaLibrary.mk
+++ b/JavaLibrary.mk
@@ -21,26 +21,36 @@
# Common definitions for host and target.
#
-# The core library is divided into modules. Each module has a separate
-# Java source directory, and some (hopefully eventually all) also have
-# a directory for tests.
+# dalvik/libcore is divided into modules.
+#
+# The structure of each module is:
+#
+# src/
+# main/ # To be shipped on every device.
+# java/ # Java source for library code.
+# native/ # C++ source for library code.
+# resources/ # Support files.
+# test/ # Built only on demand, for testing.
+# java/ # Java source for tests.
+# native/ # C++ source for tests (rare).
+# resources/ # Support files.
+#
+# All subdirectories are optional (hence the "2> /dev/null"s below).
-define all-core-java-files
-$(patsubst ./%,%,$(shell cd $(LOCAL_PATH) && find */src/main/java -name "*.java"))
+define all-main-java-files-under
+$(foreach dir,$(1),$(patsubst ./%,%,$(shell cd $(LOCAL_PATH) && find $(dir)/src/main/java -name "*.java" 2> /dev/null)))
endef
define all-test-java-files-under
-$(patsubst ./%,%,$(shell cd $(LOCAL_PATH) && find $(1)/src/test/java -name "*.java"))
+$(patsubst ./%,%,$(shell cd $(LOCAL_PATH) && find $(1)/src/test/java -name "*.java" 2> /dev/null))
endef
-# Redirect ls stderr to /dev/null because the corresponding resources
-# directories don't always exist.
define all-core-resource-dirs
$(shell cd $(LOCAL_PATH) && ls -d */src/$(1)/{java,resources} 2> /dev/null)
endef
# The Java files and their associated resources.
-core_src_files := $(call all-core-java-files)
+core_src_files := $(call all-main-java-files-under,annotation archive auth awt-kernel concurrent crypto dalvik dom icu json junit logging luni luni-kernel math nio nio_char openssl prefs regex security security-kernel sql suncompat support text x-net xml)
core_resource_dirs := $(call all-core-resource-dirs,main)
test_resource_dirs := $(call all-core-resource-dirs,test)
@@ -70,6 +80,15 @@
+# Definitions to make the sqlite JDBC driver.
+
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := $(call all-main-java-files-under,sqlite-jdbc)
+LOCAL_NO_STANDARD_LIBRARIES := true
+LOCAL_JAVA_LIBRARIES := core
+LOCAL_MODULE := sqlite-jdbc
+include $(BUILD_JAVA_LIBRARY)
+
# Definitions to make the core-tests libraries.
#
@@ -269,7 +288,7 @@
LOCAL_SRC_FILES := $(call all-test-java-files-under,sql)
LOCAL_JAVA_RESOURCE_DIRS := $(test_resource_dirs)
LOCAL_NO_STANDARD_LIBRARIES := true
-LOCAL_JAVA_LIBRARIES := core core-tests-support
+LOCAL_JAVA_LIBRARIES := core core-tests-support sqlite-jdbc
LOCAL_DX_FLAGS := --core-library
LOCAL_MODULE_TAGS := tests
LOCAL_MODULE := core-tests-sql