Last active
December 14, 2020 06:02
-
-
Save eric100lin/75ce0511eb6835c5fddaff5aa72816af to your computer and use it in GitHub Desktop.
Define a custom Android SDK addon with java sources, aidl, JNI part and droiddoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LOCAL_PATH := $(call my-dir) | |
# ============================================================ | |
# Build the library | |
# ============================================================ | |
include $(CLEAR_VARS) | |
LOCAL_SRC_FILES := \ | |
$(call all-java-files-under,src) \ | |
$(call all-subdir-Iaidl-files) | |
LOCAL_AIDL_INCLUDES += $(LOCAL_PATH)/src/ | |
LOCAL_MODULE_TAGS := optional | |
LOCAL_MODULE:= com.example.hello | |
LOCAL_DEX_PREOPT := false | |
LOCAL_JAVA_LIBRARIES := \ | |
services | |
include $(BUILD_JAVA_LIBRARY) | |
# ============================================================ | |
# Generate offline docs (build/make/core/droiddoc.mk) | |
# ============================================================ | |
include $(CLEAR_VARS) | |
LOCAL_SRC_FILES := $(call all-java-files-under, src) | |
LOCAL_MODULE:= com.example.hello-docs | |
LOCAL_MODULE_CLASS := JAVA_LIBRARIES | |
LOCAL_JAVA_LIBRARIES := \ | |
services | |
# Specifies the search paths for intermediates (Ex: *.java files generated by *.aidl) | |
LOCAL_ADDITIONAL_JAVA_DIR := \ | |
$(call intermediates-dir-for,JAVA_LIBRARIES,com.example.hello,,COMMON) | |
# Use Standard Doclet instead of Doclava (a new javadoc doclet written by Google for Android Developer Docs) | |
LOCAL_DROIDDOC_USE_STANDARD_DOCLET := true | |
include $(BUILD_DROIDDOC) | |
# ============================================================ | |
# The JNI component | |
# Also build all of the sub-targets under this one: the library's | |
# associated JNI code, and a sample client of the library. | |
# ============================================================ | |
include $(CLEAR_VARS) | |
include $(call all-makefiles-under,$(LOCAL_PATH)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ============================================================ | |
# SDK Add-On (build/make/core/tasks/sdk-addon.mk) | |
# ============================================================ | |
ifeq (,$(ONE_SHOT_MAKEFILE)) | |
# Real name of the add-on. This is the name used to build the add-on. | |
# Use 'make PRODUCT-<PRODUCT_NAME>-sdk_addon' to build the add-on. | |
# If they didn't define PRODUCT_SDK_ADDON_NAME, then we won't define | |
# any of sdk_addon rules. | |
PRODUCT_SDK_ADDON_NAME := hello_my_addon | |
endif ##end of ifeq (,$(ONE_SHOT_MAKEFILE)) | |
# Copy the manifest and hardware files for the SDK add-on. | |
PRODUCT_SDK_ADDON_COPY_FILES := \ | |
vendor/hello/your/path/sdk_addon/manifest.ini:manifest.ini \ | |
another/path/source.properties:source.properties | |
# Rules for public APIs | |
PRODUCT_SDK_ADDON_STUB_DEFS := \ | |
another/path/addon_stub_defs | |
# Copy the jar files for the optional libraries that are exposed as APIs. | |
PRODUCT_SDK_ADDON_COPY_MODULES := \ | |
com.example.hello:libs/com.example.hello.jar | |
# Name of the doc to generate and put in the add-on. | |
# This must match the name defined in the optional library with the tag | |
PRODUCT_SDK_ADDON_DOC_MODULES := \ | |
com.example.hello-docs | |
PRODUCT_SDK_ADDON_SYS_IMG_SOURCE_PROP := \ | |
another/path/source.properties | |
############################################################################ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment