Merge "Convert libphonenumber to Android.bp"
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..83801dd
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,56 @@
+//
+// Copyright (C) 2014 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// For the platform, compile everything except the carrier to phone number
+// which isn't used.
+java_defaults {
+    name: "libphonenumber-platform-defaults",
+    java_resource_dirs: [
+        "libphonenumber/src",
+        "geocoder/src",
+        "internal/prefixmapper/src",
+    ],
+
+    srcs: [
+        "libphonenumber/src/**/*.java",
+        "geocoder/src/**/*.java",
+        "internal/prefixmapper/src/**/*.java",
+    ],
+}
+
+// For platform use, builds directly against core-libart to avoid circular
+// dependencies. *NOT* for unbundled use.
+java_library_static {
+    name: "libphonenumber-platform",
+    defaults: ["libphonenumber-platform-defaults"],
+
+    jarjar_rules: "jarjar-rules.txt",
+
+    no_framework_libs: true,
+    java_version: "1.7",
+}
+
+// For unbundled use, supports gingerbread and up.
+java_library_static {
+    name: "libphonenumber",
+    defaults: ["libphonenumber-platform-defaults"],
+
+    srcs: ["carrier/src/**/*.java"],
+    java_resource_dirs: ["carrier/src"],
+
+    sdk_version: "9",
+    java_version: "1.7",
+}
+
diff --git a/Android.mk b/Android.mk
index 157fbd1..eabff58 100644
--- a/Android.mk
+++ b/Android.mk
@@ -15,26 +15,6 @@
 
 LOCAL_PATH := $(call my-dir)
 
-# For the platform, compile everything except the carrier to phone number
-# which isn't used.
-libphonenumber_platform_resource_dirs := \
-    libphonenumber/src \
-    geocoder/src \
-    internal/prefixmapper/src
-
-libphonenumber_platform_src_files := \
-    $(call all-java-files-under, libphonenumber/src) \
-    $(call all-java-files-under, geocoder/src) \
-    $(call all-java-files-under, internal/prefixmapper/src) \
-
-libphonenumber_src_files := \
-    $(libphonenumber_platform_src_files) \
-    $(call all-java-files-under, carrier/src)
-
-libphonenumber_resource_dirs := \
-    $(libphonenumber_platform_resource_dirs) \
-    carrier/src
-
 libphonenumber_test_files := \
     $(call all-java-files-under, carrier/test) \
     $(call all-java-files-under, geocoder/test) \
@@ -46,31 +26,6 @@
     geocoder/test \
     libphonenumber/test
 
-# For platform use, builds directly against core-libart to avoid circular
-# dependencies. *NOT* for unbundled use.
-include $(CLEAR_VARS)
-LOCAL_MODULE := libphonenumber-platform
-LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := $(libphonenumber_platform_src_files)
-LOCAL_JAVA_RESOURCE_DIRS := $(libphonenumber_platform_resource_dirs)
-LOCAL_JARJAR_RULES := $(LOCAL_PATH)/jarjar-rules.txt
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-LOCAL_NO_STANDARD_LIBRARIES := true
-LOCAL_JAVA_LIBRARIES := core-oj core-libart
-LOCAL_JAVA_LANGUAGE_VERSION := 1.7
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-# For unbundled use, supports gingerbread and up.
-include $(CLEAR_VARS)
-LOCAL_MODULE := libphonenumber
-LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := $(libphonenumber_src_files)
-LOCAL_JAVA_RESOURCE_DIRS := $(libphonenumber_resource_dirs)
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-LOCAL_SDK_VERSION := 9
-LOCAL_JAVA_LANGUAGE_VERSION := 1.7
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
 # Tests for unbundled use.
 # vogar --timeout 0 \
     --classpath out/target/common/obj/JAVA_LIBRARIES/libphonenumber-test_intermediates/classes.jack \