Build android.test.* with java_sdk_library

android.test.* are built with java_sdk_library and api files are added
by running "make update-api".

android.test.base_static is created for allowing to use
android.test.base as a static library.

Bug:77577799
Test: make -j
Test: make checkapi
Test: make checkapi fails with a random change in the txt file
Test: adb shell cmd package list libraries |\
      grep android.test.*
      And check the android.test.* libraries

Merged-In: Ia27612657532e50b077a9c55dbef59ee3ec04b8a
Change-Id: Ia27612657532e50b077a9c55dbef59ee3ec04b8a
This commit is contained in:
Sundong Ahn
2018-07-31 16:54:41 +09:00
parent c96760f4f3
commit e933cedf83
31 changed files with 74 additions and 432 deletions

View File

@@ -16,23 +16,32 @@
// Build the android.test.runner library
// =====================================
java_library {
java_sdk_library {
name: "android.test.runner",
installable: true,
// Needs to be consistent with the repackaged version of this make target.
java_version: "1.8",
srcs: ["src/**/*.java"],
errorprone: {
javacflags: ["-Xep:DepAnn:ERROR"],
},
sdk_version: "current",
libs: [
"android.test.base",
"android.test.mock.stubs",
"android.test.mock",
],
stub_only_libs: [
"android.test.base",
"android.test.mock",
],
api_packages: [
"android.test",
"android.test.suitebuilder",
"junit.runner",
"junit.textui",
],
droiddoc_options: ["stubsourceonly"],
compile_dex: true
}
// Build the android.test.runner-minus-junit library
@@ -46,8 +55,8 @@ java_library {
sdk_version: "current",
libs: [
"android.test.base",
"android.test.mock.stubs",
"android.test.base_static",
"android.test.mock",
"junit",
],
}
@@ -70,7 +79,7 @@ java_library_static {
sdk_version: "current",
libs: [
"android.test.base",
"android.test.base_static",
],
jarjar_rules: "jarjar-rules.txt",
@@ -78,48 +87,3 @@ java_library_static {
java_version: "1.8",
}
droiddoc {
name: "android-test-runner-api-stubs-gen-docs",
srcs: [
"src/**/*.java",
],
libs: [
"core-oj",
"core-libart",
"framework",
"android.test.base",
"android.test.mock",
],
custom_template: "droiddoc-templates-sdk",
installable: false,
args: "-stubpackages android.test:" +
"android.test.suitebuilder:" +
"junit.runner:" +
"junit.textui -stubsourceonly -nodocs",
api_tag_name: "ANDROID_TEST_RUNNER",
api_filename: "android-test-runner-current.txt",
removed_api_filename: "android-test-runner-removed.txt",
}
// Build the android.test.runner.stubs library
// =========================================
java_library_static {
name: "android.test.runner.stubs",
srcs: [
":android-test-runner-api-stubs-gen-docs",
],
libs: [
"android.test.base.stubs",
"android.test.mock.stubs",
],
product_variables: {
pdk: {
enabled: false,
},
unbundled_build: {
enabled: false,
},
},
sdk_version: "current",
compile_dex: true,
}

View File

@@ -16,49 +16,5 @@
LOCAL_PATH:= $(call my-dir)
# For unbundled build we'll use the prebuilt jar from prebuilts/sdk.
ifeq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)))
ANDROID_TEST_RUNNER_API_FILE := $(LOCAL_PATH)/api/android-test-runner-current.txt
ANDROID_TEST_RUNNER_REMOVED_API_FILE := $(LOCAL_PATH)/api/android-test-runner-removed.txt
full_classes_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,android.test.runner.stubs,,COMMON)/classes.jar
# Archive a copy of the classes.jar in SDK build.
$(call dist-for-goals,sdk win_sdk,$(full_classes_jar):android.test.runner.stubs.jar)
# Check that the android.test.runner.stubs library has not changed
# ================================================================
# Check that the API we're building hasn't changed from the not-yet-released
# SDK version.
$(eval $(call check-api, \
check-android-test-runner-api-current, \
$(ANDROID_TEST_RUNNER_API_FILE), \
$(INTERNAL_PLATFORM_ANDROID_TEST_RUNNER_API_FILE), \
$(ANDROID_TEST_RUNNER_REMOVED_API_FILE), \
$(INTERNAL_PLATFORM_ANDROID_TEST_RUNNER_REMOVED_API_FILE), \
-error 2 -error 3 -error 4 -error 5 -error 6 \
-error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \
-error 16 -error 17 -error 18 -error 19 -error 20 -error 21 -error 23 -error 24 \
-error 25 -error 26 -error 27, \
cat $(LOCAL_PATH)/api/apicheck_msg_android_test_runner.txt, \
check-android-test-runner-api, \
$(OUT_DOCS)/android-test-runner-api-stubs-gen-docs-stubs.srcjar \
))
.PHONY: check-android-test-runner-api
checkapi: check-android-test-runner-api
.PHONY: update-android-test-runner-api
update-api: update-android-test-runner-api
update-android-test-runner-api: $(INTERNAL_PLATFORM_ANDROID_TEST_RUNNER_API_FILE) | $(ACP)
@echo Copying current.txt
$(hide) $(ACP) $(INTERNAL_PLATFORM_ANDROID_TEST_RUNNER_API_FILE) $(ANDROID_TEST_RUNNER_API_FILE)
@echo Copying removed.txt
$(hide) $(ACP) $(INTERNAL_PLATFORM_ANDROID_TEST_RUNNER_REMOVED_API_FILE) $(ANDROID_TEST_RUNNER_REMOVED_API_FILE)
endif # not TARGET_BUILD_APPS not TARGET_BUILD_PDK=true
# additionally, build unit tests in a separate .apk
include $(call all-makefiles-under,$(LOCAL_PATH))

View File

@@ -1,17 +0,0 @@
******************************
You have tried to change the API from what has been previously approved.
To make these errors go away, you have two choices:
1) You can add "@hide" javadoc comments to the methods, etc. listed in the
errors above.
2) You can update android-test-runner-current.txt by executing the following command:
make update-android-test-runner-api
To submit the revised android-test-runner-current.txt to the main Android repository,
you will need approval.
******************************

View File

View File

View File

View File