Espresso support for make based builds.

Wallet's instrument management library (used in Phonesky)
would like to write espresso based tests and are currently
using make based builds. No plans to change to gradle for
at least a few months and would like to use make in the interim.

Change-Id: Ibd9d9b69acf447702027f1a11944816f088bf3f5
diff --git a/espresso/Android.mk b/espresso/Android.mk
new file mode 100644
index 0000000..a58b123
--- /dev/null
+++ b/espresso/Android.mk
@@ -0,0 +1,17 @@
+#
+# 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.
+#
+
+include $(call all-subdir-makefiles)
diff --git a/espresso/espresso-contrib/Android.mk b/espresso/espresso-contrib/Android.mk
new file mode 100644
index 0000000..bbbb118
--- /dev/null
+++ b/espresso/espresso-contrib/Android.mk
@@ -0,0 +1,31 @@
+#
+# 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.
+#
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := espresso-contrib
+
+LOCAL_SDK_VERSION := 19
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_STATIC_JAVA_LIBRARIES := \
+    android-support-v4 \
+    espresso-lib
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/espresso/espresso-lib/Android.mk b/espresso/espresso-lib/Android.mk
new file mode 100644
index 0000000..2b98b1b
--- /dev/null
+++ b/espresso/espresso-lib/Android.mk
@@ -0,0 +1,63 @@
+#
+# 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.
+#
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := espresso-lib
+
+LOCAL_SDK_VERSION := 19
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_STATIC_JAVA_LIBRARIES := \
+    espresso-idling-resource \
+    espresso-dagger-1.2.1 \
+    espresso-dagger-compiler-1.2.1 \
+    espresso-guava \
+    hamcrest \
+    hamcrest-integration \
+    hamcrest-library \
+    espresso-javawriter-2.1.1 \
+    espresso-javax-inject-1 \
+    jsr305 \
+    espresso-testrunner-1.1 \
+    espresso-testrunner-runtime-1.1
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+#############################################################
+# Pre-built dependency jars
+#############################################################
+
+include $(CLEAR_VARS)
+
+repo_prebuilts_dir := ../../../../prebuilts
+
+LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := \
+    espresso-dagger-1.2.1:../libs/dagger-1.2.1.jar  \
+    espresso-dagger-compiler-1.2.1:../libs/dagger-compiler-1.2.1.jar \
+    espresso-guava:$(repo_prebuilts_dir)/tools/common/m2/repository/com/google/guava/guava/15.0/guava-15.0.jar \
+    espresso-javawriter-2.1.1:$(repo_prebuilts_dir)/tools/common/m2/repository/com/squareup/javawriter/2.1.1/javawriter-2.1.1.jar \
+    espresso-javax-inject-1:$(repo_prebuilts_dir)/tools/common/m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar \
+    espresso-testrunner-1.1:../libs/testrunner-1.1.jar \
+    espresso-testrunner-runtime-1.1:../libs/testrunner-runtime-1.1.jar
+
+include $(BUILD_MULTI_PREBUILT)
+
+# Clean up locally defined vars
+repo_prebuilts_dir :=
diff --git a/espresso/espresso-sample/Android.mk b/espresso/espresso-sample/Android.mk
new file mode 100644
index 0000000..a58b123
--- /dev/null
+++ b/espresso/espresso-sample/Android.mk
@@ -0,0 +1,17 @@
+#
+# 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.
+#
+
+include $(call all-subdir-makefiles)
diff --git a/espresso/espresso-sample/src/Android.mk b/espresso/espresso-sample/src/Android.mk
new file mode 100644
index 0000000..a58b123
--- /dev/null
+++ b/espresso/espresso-sample/src/Android.mk
@@ -0,0 +1,17 @@
+#
+# 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.
+#
+
+include $(call all-subdir-makefiles)
diff --git a/espresso/espresso-sample/src/main/Android.mk b/espresso/espresso-sample/src/main/Android.mk
new file mode 100644
index 0000000..cbd6837
--- /dev/null
+++ b/espresso/espresso-sample/src/main/Android.mk
@@ -0,0 +1,43 @@
+#
+# 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.
+#
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_PACKAGE_NAME := espresso-sample
+LOCAL_MODULE_TAGS := tests # used to avoid lint errors for string errors
+LOCAL_PROGUARD_ENABLED := disabled
+
+LOCAL_SDK_VERSION := current
+
+LOCAL_SRC_FILES := $(call all-java-files-under, java)
+
+LOCAL_RESOURCE_DIR := \
+    $(LOCAL_PATH)/res \
+    prebuilts/sdk/current/support/v7/appcompat/res
+
+LOCAL_STATIC_JAVA_LIBRARIES := \
+    android-support-v4 \
+    android-support-v7-appcompat \
+    espresso-guava \
+    jsr305
+
+LOCAL_AAPT_FLAGS := \
+    --auto-add-overlay \
+    --extra-packages android.support.v7.appcompat
+
+include $(BUILD_PACKAGE)
diff --git a/espresso/idling-resource-interface/Android.mk b/espresso/idling-resource-interface/Android.mk
new file mode 100644
index 0000000..5e1bd42
--- /dev/null
+++ b/espresso/idling-resource-interface/Android.mk
@@ -0,0 +1,27 @@
+#
+# 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.
+#
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := espresso-idling-resource
+
+LOCAL_SDK_VERSION := 9
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+include $(BUILD_STATIC_JAVA_LIBRARY)