Merge pi-platform-release to stage-aosp-master - DO NOT MERGE

Change-Id: Id1397644a75d796243b0ab065f0b1504ed29acb3
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..8590039
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,124 @@
+// Copyright (C) 2015 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.
+
+// build caliper host jar
+// ============================================================
+
+java_library_host {
+    name: "caliper",
+
+    srcs: ["caliper/src/main/java/**/*.java"],
+    java_resource_dirs: ["caliper/src/main/resources"],
+    // Required for use of javax.annotation.Generated per http://b/62050818
+    javacflags: ["-J--add-modules=java.xml.ws.annotation"],
+
+    static_libs: [
+        "apache-commons-math",
+        "caliper-prebuilts",
+        "dagger2",
+        "dagger2-inject",
+        "guava",
+    ],
+
+    // Use Dagger2 annotation processor
+    annotation_processors: ["dagger2-compiler"],
+    annotation_processor_classes: ["dagger.internal.codegen.ComponentProcessor"],
+
+    java_version: "1.7",
+}
+
+// build caliper target api jar
+// ============================================================
+// This contains just those classes needed for benchmarks to compile.
+
+java_library {
+    name: "caliper-api-target",
+    installable: true,
+
+    srcs: [
+        "caliper/src/main/java/com/google/caliper/AfterExperiment.java",
+        "caliper/src/main/java/com/google/caliper/BeforeExperiment.java",
+        "caliper/src/main/java/com/google/caliper/Param.java",
+        "caliper/src/main/java/com/google/caliper/All.java",
+        "caliper/src/main/java/com/google/caliper/Benchmark.java",
+    ],
+    sdk_version: "core_current",
+
+    java_version: "1.7",
+}
+
+// build caliper tests
+// ============================================================
+// vogar --expectations $ANDROID_BUILD_TOP/external/caliper/expectations/knownfailures.txt \
+//        --test-only \
+//        --classpath $ANDROID_BUILD_TOP/out/host/common/obj/JAVA_LIBRARIES/caliper-tests_intermediates/javalib.jar \
+//        com.google.caliper
+
+java_test_host {
+    name: "caliper-tests",
+
+    srcs: ["caliper/src/test/java/**/*.java"],
+    java_resource_dirs: ["caliper/src/test/resources"],
+    // Required for use of javax.annotation.Generated per http://b/62050818
+    javacflags: ["-J--add-modules=java.xml.ws.annotation"],
+
+    static_libs: [
+        "caliper",
+        "junit",
+        "mockito",
+    ],
+
+    // Use Dagger2 annotation processor
+    annotation_processors: ["dagger2-compiler"],
+    annotation_processor_classes: ["dagger.internal.codegen.ComponentProcessor"],
+
+    java_version: "1.7",
+}
+
+// build caliper examples
+// ============================================================
+
+java_library_host {
+    name: "caliper-examples",
+
+    srcs: ["examples/src/main/java/**/*.java"],
+
+    static_libs: [
+        "caliper",
+        "junit",
+        "mockito",
+    ],
+
+    java_version: "1.7",
+}
+
+// Build host dependencies.
+// ============================================================
+
+java_import_host {
+    name: "caliper-gson",
+    jars: ["lib/gson-2.2.2.jar"],
+}
+
+java_import_host {
+    name: "caliper-prebuilts",
+    jars: [
+        "lib/gson-2.2.2.jar",
+        "lib/java-allocation-instrumenter-2.0.jar",
+        "lib/jersey-client-1.11.jar",
+        "lib/jersey-core-1.11.jar",
+        "lib/joda-time-2.1.jar",
+        "lib/jsr311-api-1.1.1.jar",
+    ],
+}
diff --git a/Android.mk b/Android.mk
deleted file mode 100644
index f07f534..0000000
--- a/Android.mk
+++ /dev/null
@@ -1,130 +0,0 @@
-# Copyright (C) 2015 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)
-
-# build caliper host jar
-# ============================================================
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := caliper-host
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-LOCAL_SRC_FILES := $(call all-java-files-under, caliper/src/main/java/)
-LOCAL_JAVA_RESOURCE_DIRS := caliper/src/main/resources
-# Required for use of javax.annotation.Generated per http://b/62050818
-LOCAL_JAVACFLAGS := $(if $(USE_OPENJDK9),-J--add-modules=java.xml.ws.annotation)
-LOCAL_IS_HOST_MODULE := true
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-  apache-commons-math-host \
-  caliper-gson-host \
-  caliper-java-allocation-instrumenter-host \
-  caliper-jersey-client-host \
-  caliper-jersey-core-host \
-  caliper-joda-time-host \
-  caliper-jsr311-api-host \
-  dagger2-host \
-  dagger2-inject-host \
-  guavalib
-
-# Use Dagger2 annotation processor
-LOCAL_ANNOTATION_PROCESSORS := dagger2-compiler-host
-LOCAL_ANNOTATION_PROCESSOR_CLASSES := dagger.internal.codegen.ComponentProcessor
-
-LOCAL_JAVA_LANGUAGE_VERSION := 1.7
-include $(BUILD_HOST_JAVA_LIBRARY)
-
-# build caliper target api jar
-# ============================================================
-# This contains just those classes needed for benchmarks to compile.
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := caliper-api-target
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-LOCAL_SRC_FILES := \
-  caliper/src/main/java/com/google/caliper/AfterExperiment.java \
-  caliper/src/main/java/com/google/caliper/BeforeExperiment.java \
-  caliper/src/main/java/com/google/caliper/Param.java \
-  caliper/src/main/java/com/google/caliper/All.java \
-  caliper/src/main/java/com/google/caliper/Benchmark.java
-
-LOCAL_JAVA_LANGUAGE_VERSION := 1.7
-include $(BUILD_JAVA_LIBRARY)
-
-# build caliper tests
-# ============================================================
-# vogar --expectations $ANDROID_BUILD_TOP/external/caliper/expectations/knownfailures.txt \
-        --test-only \
-        --classpath $ANDROID_BUILD_TOP/out/host/common/obj/JAVA_LIBRARIES/caliper-tests_intermediates/javalib.jar \
-        com.google.caliper
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := caliper-tests
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-LOCAL_SRC_FILES := $(call all-java-files-under, caliper/src/test/java/)
-LOCAL_JAVA_RESOURCE_DIRS := caliper/src/test/resources
-# Required for use of javax.annotation.Generated per http://b/62050818
-LOCAL_JAVACFLAGS := $(if $(USE_OPENJDK9),-J--add-modules=java.xml.ws.annotation,)
-LOCAL_IS_HOST_MODULE := true
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-  caliper-host \
-  junit-host \
-  mockito-host
-
-# Use Dagger2 annotation processor
-LOCAL_ANNOTATION_PROCESSORS := dagger2-compiler-host
-LOCAL_ANNOTATION_PROCESSOR_CLASSES := dagger.internal.codegen.ComponentProcessor
-
-LOCAL_JAVA_LANGUAGE_VERSION := 1.7
-include $(BUILD_HOST_JAVA_LIBRARY)
-
-# build caliper examples
-# ============================================================
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := caliper-examples
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-LOCAL_SRC_FILES := $(call all-java-files-under, examples/src/main/java/)
-LOCAL_IS_HOST_MODULE := true
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-  caliper-host \
-  junit-host \
-  mockito-host
-
-LOCAL_JAVA_LANGUAGE_VERSION := 1.7
-include $(BUILD_HOST_JAVA_LIBRARY)
-
-# Build host dependencies.
-# ============================================================
-include $(CLEAR_VARS)
-
-LOCAL_PREBUILT_JAVA_LIBRARIES := \
-    caliper-gson-host:lib/gson-2.2.2$(COMMON_JAVA_PACKAGE_SUFFIX) \
-    caliper-java-allocation-instrumenter-host:lib/java-allocation-instrumenter-2.0$(COMMON_JAVA_PACKAGE_SUFFIX) \
-    caliper-jersey-client-host:lib/jersey-client-1.11$(COMMON_JAVA_PACKAGE_SUFFIX) \
-    caliper-jersey-core-host:lib/jersey-core-1.11$(COMMON_JAVA_PACKAGE_SUFFIX) \
-    caliper-joda-time-host:lib/joda-time-2.1$(COMMON_JAVA_PACKAGE_SUFFIX) \
-    caliper-jsr311-api-host:lib/jsr311-api-1.1.1$(COMMON_JAVA_PACKAGE_SUFFIX)
-
-include $(BUILD_HOST_PREBUILT)
diff --git a/METADATA b/METADATA
new file mode 100644
index 0000000..0e79ebf
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,19 @@
+name: "caliper"
+description: "Caliper is a tool for measuring Java code performance, primarily focused on microbenchmarks."
+
+third_party {
+  url {
+    type: HOMEPAGE
+    value: "https://github.com/google/caliper"
+  }
+  url {
+    type: ARCHIVE
+    value: "https://github.com/google/caliper/archive/73efbe138dafba57d6a890257961ba83f41b89f2.zip"
+  }
+  version: "73efbe138dafba57d6a890257961ba83f41b89f2"
+  last_upgrade_date {
+    year: 2015
+    month: 11
+    day: 30
+  }
+}
diff --git a/README.android b/README.android
index 850d2ee..046a566 100644
--- a/README.android
+++ b/README.android
@@ -4,12 +4,5 @@
 
 Version: 73efbe138dafba57d6a890257961ba83f41b89f2
 
-This uses the Dagger2 dependency injection framework which runs as an annotation
-processor and generates the dependency injecting code. At the moment the
-generated code for the caliper-host target can be found at:
-  out/host/common/gen/JAVA_LIBRARIES/caliper-host_intermediates/annotation_processor_output/
-For the caliper-tests target it can be found at:
-  out/host/common/gen/JAVA_LIBRARIES/caliper-tests_intermediates/annotation_processor_output/
-
 Local Patches:
     None