Migrate core.current.stubs generation to Soong.
Since Soong now supports droiddoc generation. Move this to Soong.
Test: Generated old jar; Generated new jar;
find /tmp/new -type f -name "*.class" -exec md5sum {} \+ | ( cd /tmp/old; md5sum -c --quiet )
Bug: b/70351683
Change-Id: I9cef9ca40dea32c7cb6087dae18340f4b23142fa
diff --git a/JavaLibrary.bp b/JavaLibrary.bp
index 95607f4..f185573 100644
--- a/JavaLibrary.bp
+++ b/JavaLibrary.bp
@@ -319,3 +319,34 @@
"known_oj_tags.txt",
],
}
+
+droiddoc {
+ name: "core-current-stubs-gen-docs",
+ srcs: [
+ ":openjdk_javadoc_files",
+ ":non_openjdk_javadoc_files",
+ ":android_icu4j_src_files_for_docs",
+ ":gen-ojluni-jaif-annotated-srcs",
+ ],
+ exclude_srcs: [
+ ":annotated_ojluni_files",
+ ],
+ custom_template: "droiddoc-templates-sdk",
+ installable: false,
+ no_framework_libs: true,
+ args: "-nodocs",
+}
+
+java_library_static {
+ name: "core.current.stubs",
+ srcs: [
+ ":core-current-stubs-gen-docs",
+ ],
+ errorprone: {
+ javacflags: [
+ "-Xep:MissingOverride:OFF",
+ ],
+ },
+ no_standard_libs: true,
+ system_modules: "none",
+}
diff --git a/JavaLibrary.mk b/JavaLibrary.mk
index 8222ff6..caf7034 100644
--- a/JavaLibrary.mk
+++ b/JavaLibrary.mk
@@ -313,53 +313,6 @@
endif # HOST_OS == linux
-# for shared defintion of libcore_to_document
-include $(LOCAL_PATH)/Docs.mk
-# For unbundled build we'll use the prebuilt jar from prebuilts/sdk.
-ifeq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)))
-
-# Generate the stub source files for core.current.stubs
-# =====================================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(addprefix ../, $(libcore_to_document))
-LOCAL_GENERATED_SOURCES := $(libcore_to_document_generated)
-
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-
-LOCAL_DROIDDOC_OPTIONS:= \
- -stubs $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/core.current.stubs_intermediates/src \
- -nodocs \
-
-LOCAL_UNINSTALLABLE_MODULE := true
-LOCAL_NO_STANDARD_LIBRARIES := true
-LOCAL_MODULE := core-current-stubs-gen
-
-include $(BUILD_DROIDDOC)
-
-# Remember the target that will trigger the code generation.
-core_current_gen_stamp := $(full_target)
-
-# Build the core.current.stubs library
-# ====================================
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := core.current.stubs
-
-LOCAL_SOURCE_FILES_ALL_GENERATED := true
-
-# Make sure to run droiddoc first to generate the stub source files.
-LOCAL_ADDITIONAL_DEPENDENCIES := $(core_current_gen_stamp)
-core_current_gen_stamp :=
-
-# Because javac refuses to compile these stubs with --system=none, ( http://b/72206056#comment31 ),
-# just patch them into java.base at compile time.
-LOCAL_PATCH_MODULE := java.base
-LOCAL_NO_STANDARD_LIBRARIES := true
-LOCAL_ERROR_PRONE_FLAGS := -Xep:MissingOverride:OFF
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
# Archive a copy of the classes.jar in SDK build.
+full_classes_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,core.current.stubs,,COMMON)/classes.jar
$(call dist-for-goals,sdk win_sdk,$(full_classes_jar):core.current.stubs.jar)
-
-endif # not TARGET_BUILD_APPS not TARGET_BUILD_PDK=true