diff options
author | Maurice Lam <yukl@google.com> | 2018-02-02 22:56:12 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-02-02 22:56:12 +0000 |
commit | 4fa0783158ac1f85b546c658f0d13c02fe3463ee (patch) | |
tree | 2c669b8c9f756bd20c9559caecd8d1ca46be6b03 | |
parent | 3034ef412053237c9955d0ecc3edc7b0324b8227 (diff) | |
parent | 5a7eccf7de2737b29387406eb084a5a98121bbd3 (diff) | |
download | misc-4fa0783158ac1f85b546c658f0d13c02fe3463ee.tar.gz |
Merge changes from topic "jacoco-asm"
* changes:
Run Robolectric -jacoco builds with JDK8
Depend on asm in m2 directory
-rw-r--r-- | common/jacoco/Android.mk | 7 | ||||
-rw-r--r-- | common/jacoco/lib/asm-debug-all-5.0.1.jar | bin | 380292 -> 0 bytes | |||
-rw-r--r-- | common/robolectric/3.5.1/run_robotests.mk | 17 | ||||
-rw-r--r-- | common/robolectric/3.6.1/robotest-internal.mk | 3 | ||||
-rw-r--r-- | common/robolectric/3.6.1/run_robotests.mk | 19 |
5 files changed, 40 insertions, 6 deletions
diff --git a/common/jacoco/Android.mk b/common/jacoco/Android.mk index a39886dd..d94ead38 100644 --- a/common/jacoco/Android.mk +++ b/common/jacoco/Android.mk @@ -8,9 +8,13 @@ LOCAL_SRC_FILES := \ $(call all-java-files-under, src/main/java) \ LOCAL_STATIC_JAVA_LIBRARIES := \ + asm-analysis-prebuilt-host-jar \ + asm-commons-prebuilt-host-jar \ + asm-prebuilt-host-jar \ + asm-tree-prebuilt-host-jar \ + asm-util-prebuilt-host-jar \ jvm-jacoco-core \ jvm-jacoco-report \ - jvm-jacoco-asm \ commons-cli-1.2 LOCAL_MODULE := jvm-jacoco-reporter @@ -21,7 +25,6 @@ include $(CLEAR_VARS) LOCAL_PREBUILT_JAVA_LIBRARIES := \ jvm-jacoco-agent:lib/jacocoagent.jar \ - jvm-jacoco-asm:lib/asm-debug-all-5.0.1.jar \ jvm-jacoco-core:lib/org.jacoco.core-$(my_jacoco_version).jar \ jvm-jacoco-report:lib/org.jacoco.report-$(my_jacoco_version).jar diff --git a/common/jacoco/lib/asm-debug-all-5.0.1.jar b/common/jacoco/lib/asm-debug-all-5.0.1.jar Binary files differdeleted file mode 100644 index 76d4b6a7..00000000 --- a/common/jacoco/lib/asm-debug-all-5.0.1.jar +++ /dev/null diff --git a/common/robolectric/3.5.1/run_robotests.mk b/common/robolectric/3.5.1/run_robotests.mk index df81a309..8076f6f1 100644 --- a/common/robolectric/3.5.1/run_robotests.mk +++ b/common/robolectric/3.5.1/run_robotests.mk @@ -160,15 +160,28 @@ my_coverage_file := $(my_coverage_dir)/jacoco.exec # List of packages to exclude jacoco from running my_jacoco_excludes := \ - org.robolectric.*:org.mockito.*:org.junit.*:org.objectweb.*:com.thoughtworks.xstream.* + org.robolectric.* \ + org.mockito.* \ + org.junit.* \ + org.objectweb.* \ + com.thoughtworks.xstream.* # The Jacoco agent JAR. my_jacoco_agent_jar := $(call java-lib-files,jvm-jacoco-agent,true) +# Using Jacoco with Robolectric is broken in 0.7.3 <= version < 0.7.6. +# In 0.7.6 or above, the parameter "inclnolocationclasses" is needed. +# See https://github.com/jacoco/jacoco/pull/288 for more +my_jacoco_agent_args = \ + destfile=$(my_coverage_file) \ + excludes=$(call normalize-path-list, $(my_jacoco_excludes)) \ + inclnolocationclasses=true \ + append=false my_java_args := \ - -javaagent:$(my_jacoco_agent_jar)=destfile=$(my_coverage_file),excludes=$(my_jacoco_excludes) + -javaagent:$(my_jacoco_agent_jar)=$(call normalize-comma-list, $(my_jacoco_agent_args)) include $(my_robolectric_script_path)/robotest-internal.mk # Clear temporary variables my_failure_fatal := my_jacoco_agent_jar := +my_jacoco_agent_args := my_jacoco_excludes := my_java_args := my_robolectric_jars := diff --git a/common/robolectric/3.6.1/robotest-internal.mk b/common/robolectric/3.6.1/robotest-internal.mk index 4bc83b46..dfb85cec 100644 --- a/common/robolectric/3.6.1/robotest-internal.mk +++ b/common/robolectric/3.6.1/robotest-internal.mk @@ -25,6 +25,7 @@ $(my_target_output): PRIVATE_TARGET_MESSAGE := $(my_target_message) $(my_target_output): PRIVATE_TARGET_OUTPUT := $(my_target_output) $(my_target_output): PRIVATE_TARGET_RETVAL := $(my_target_retval) $(my_target_output): PRIVATE_TIMEOUT := $(my_timeout) +$(my_target_output): PRIVATE_JAVA_PATH := $(if $(my_use_java8),$(ANDROID_JAVA8_HOME)/bin:,) $(my_target_output): PRIVATE_XML_OUTPUT_FILE := $(my_target_xml) # Runs the Robolectric tests and saves the output and return value. $(my_target_output): $(my_jars) @@ -44,6 +45,7 @@ $(my_target_output): $(my_jars) PRIVATE_TESTS="$(PRIVATE_TESTS)" \ XML_OUTPUT_FILE="$(PRIVATE_XML_OUTPUT_FILE)" \ TEST_WORKSPACE="$(PRIVATE_MODULE)" \ + PATH=$(PRIVATE_JAVA_PATH)$${PATH} \ $(PRIVATE_ROBOLECTRIC_SCRIPT_PATH)/wrapper.sh \ "$(PRIVATE_MODULE)" \ "$(PRIVATE_TARGET_OUTPUT)" \ @@ -87,3 +89,4 @@ my_target_output := my_target_retval := my_target_xml := my_filename_stem := +my_use_java8 := diff --git a/common/robolectric/3.6.1/run_robotests.mk b/common/robolectric/3.6.1/run_robotests.mk index df81a309..d25b8fe5 100644 --- a/common/robolectric/3.6.1/run_robotests.mk +++ b/common/robolectric/3.6.1/run_robotests.mk @@ -160,15 +160,30 @@ my_coverage_file := $(my_coverage_dir)/jacoco.exec # List of packages to exclude jacoco from running my_jacoco_excludes := \ - org.robolectric.*:org.mockito.*:org.junit.*:org.objectweb.*:com.thoughtworks.xstream.* + org.robolectric.* \ + org.mockito.* \ + org.junit.* \ + org.objectweb.* \ + com.thoughtworks.xstream.* # The Jacoco agent JAR. my_jacoco_agent_jar := $(call java-lib-files,jvm-jacoco-agent,true) +# Using Jacoco with Robolectric is broken in 0.7.3 <= version < 0.7.6. +# In 0.7.6 or above, the parameter "inclnolocationclasses" is needed. +# See https://github.com/jacoco/jacoco/pull/288 for more +my_jacoco_agent_args = \ + destfile=$(my_coverage_file) \ + excludes=$(call normalize-path-list, $(my_jacoco_excludes)) \ + inclnolocationclasses=true \ + append=false my_java_args := \ - -javaagent:$(my_jacoco_agent_jar)=destfile=$(my_coverage_file),excludes=$(my_jacoco_excludes) + -javaagent:$(my_jacoco_agent_jar)=$(call normalize-comma-list, $(my_jacoco_agent_args)) +# JDK9 and jacoco agent doesn't seem to play well together: b/72149122 +my_use_java8 := true include $(my_robolectric_script_path)/robotest-internal.mk # Clear temporary variables my_failure_fatal := my_jacoco_agent_jar := +my_jacoco_agent_args := my_jacoco_excludes := my_java_args := my_robolectric_jars := |