aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2018-10-08 14:12:03 -0700
committerColin Cross <ccross@android.com>2018-10-08 15:02:18 -0700
commit09eaefffa4e25e34cbed79a89129756247cb92a8 (patch)
tree846a1a324214b2d96a21ee15f23a53479a041aa8
parent16d638123f1c28383a08a4dc59db3062daa1569d (diff)
downloadplatform_external_robolectric-shadows-master-cuttlefish-testing-release.tar.gz
platform_external_robolectric-shadows-master-cuttlefish-testing-release.tar.bz2
platform_external_robolectric-shadows-master-cuttlefish-testing-release.zip
Fix OUT_DIR=$PWD/out-abs m checkbuildmaster-cuttlefish-testing-release
BUILD_MULTI_PREBUILT/BUILD_HOST_PREBUILT take paths relative to LOCAL_PATH. Hacking LOCAL_PATH to point to the top of the tree works for a relative OUT_DIR, but fails for an absolute OUT_DIR when it concatentates external/robolectric-shadows/robolectric/../../../ and: /abs/path which produces: external/robolectric-shadows/robolectric/../../..//abs/path and canoncializes to: abs/path Use BUILD_PREBUILT instead, which can take a full path with LOCAL_PREBUILT_MODULE_FILE. Bug: 74532538 Test: m checkbuild Change-Id: Id5776d14c08f8d85af7cbd386067a05e435fb2d7
-rw-r--r--Android.mk10
-rw-r--r--robolectric/Android.mk26
2 files changed, 24 insertions, 12 deletions
diff --git a/Android.mk b/Android.mk
index c8aae1cfb..1212f7c3b 100644
--- a/Android.mk
+++ b/Android.mk
@@ -98,10 +98,12 @@ include $(BUILD_HOST_PREBUILT)
###########################################
# HACK: specify these *HOST* jars needed to execute robolectric as though they are prebuilt *TARGET* java libraries
###########################################
-LOCAL_PATH := $(LOCAL_PATH)/../../../
include $(CLEAR_VARS)
-LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := \
- Robolectric_all-target:$(call java-lib-files, Robolectric_all, HOST)
+LOCAL_MODULE := Robolectric_all-target
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+LOCAL_UNINSTALLABLE_MODULE := true
+LOCAL_BUILT_MODULE_STEM := javalib.jar
+LOCAL_PREBUILT_MODULE_FILE := $(call java-lib-files, Robolectric_all, HOST)
-include $(BUILD_MULTI_PREBUILT)
+include $(BUILD_PREBUILT)
diff --git a/robolectric/Android.mk b/robolectric/Android.mk
index e0ef397a1..07602c937 100644
--- a/robolectric/Android.mk
+++ b/robolectric/Android.mk
@@ -122,20 +122,30 @@ include external/robolectric-shadows/run_robolectric_module_tests.mk
###########################################
# HACK: specify these *TARGET* jars needed to compile robolectric as though they are prebuilt *HOST* java libraries
###########################################
-LOCAL_PATH := $(LOCAL_PATH)/../../../
include $(CLEAR_VARS)
-# Add this line to LOCAL_PREBUILT_JAVA_LIBRARIES below to compile robolectric against the latest SDK
-# robolectric-host-android_all:$(call java-lib-files, robolectric_android-all)
-# Add this line to LOCAL_PREBUILT_JAVA_LIBRARIES below to compile robolectric against the O SDK
-# robolectric-host-android_all:prebuilts/misc/common/robolectric/android-all/android-all-o-preview-4-robolectric-0.jar
-
-LOCAL_PREBUILT_JAVA_LIBRARIES := \
+robolectric_target_to_host_jars := \
robolectric-host-android_all:$(call intermediates-dir-for, JAVA_LIBRARIES, robolectric_android-all-stub,,COMMON)/classes-with-res.jar \
robolectric-host-android-support-v4:$(call java-lib-files, android-support-v4) \
robolectric-host-android-support-multidex:$(call java-lib-files, android-support-multidex) \
robolectric-host-org_apache_http_legacy:$(call java-lib-files, org.apache.http.legacy.stubs) \
robolectric-host-monitor-1.0.2-alpha1:$(call java-lib-files, robolectric-monitor-1.0.2-alpha1)
-include $(BUILD_HOST_PREBUILT)
+# Uncomment the line below to compile robolectric against the latest SDK
+#robolectric_target_to_host_jars += robolectric-host-android_all:$(call java-lib-files, robolectric_android-all)
+
+# Uncomment the line below to compile robolectric against the O SDK
+#robolectric_target_to_host_jars += robolectric-host-android_all:prebuilts/misc/common/robolectric/android-all/android-all-o-preview-4-robolectric-0.jar
+
+$(foreach p,$(robolectric_target_to_host_jars),\
+ $(eval include $(CLEAR_VARS)) \
+ $(eval LOCAL_MODULE := $(call word-colon,1,$(p))-prebuilt) \
+ $(eval LOCAL_MODULE_CLASS := JAVA_LIBRARIES) \
+ $(eval LOCAL_IS_HOST_MODULE := true) \
+ $(eval LOCAL_PREBUILT_MODULE_FILE := $(call word-colon,2,$(p))) \
+ $(eval include $(BUILD_PREBUILT)) \
+ $(eval include $(CLEAR_VARS)) \
+ $(eval LOCAL_MODULE := $(call word-colon,1,$(p))) \
+ $(eval LOCAL_STATIC_JAVA_LIBRARIES := $(call word-colon,1,$(p))-prebuilt) \
+ $(eval include $(BUILD_HOST_JAVA_LIBRARY)))