blob: 41f135c6526ccc8ffede65dcb6d3392feb7f9480 [file] [log] [blame]
Joe Onorato64d85d02009-04-09 19:31:12 -07001#
2# Copyright (C) 2008 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
The Android Open Source Project88b60792009-03-03 19:28:42 -080016
Joe Onorato64d85d02009-04-09 19:31:12 -070017##
18##
19## Common to both droiddoc and javadoc
20##
21##
22
23LOCAL_IS_HOST_MODULE := $(call true-or-empty,$(LOCAL_IS_HOST_MODULE))
24ifeq ($(LOCAL_IS_HOST_MODULE),true)
Ying Wang13d69502012-11-01 17:22:33 -070025my_prefix := HOST_
The Android Open Source Project88b60792009-03-03 19:28:42 -080026else
Ying Wang13d69502012-11-01 17:22:33 -070027my_prefix := TARGET_
The Android Open Source Project88b60792009-03-03 19:28:42 -080028endif
29
30LOCAL_MODULE_CLASS := $(strip $(LOCAL_MODULE_CLASS))
31ifndef LOCAL_MODULE_CLASS
32$(error $(LOCAL_PATH): LOCAL_MODULE_CLASS not defined)
33endif
34
35full_src_files := $(patsubst %,$(LOCAL_PATH)/%,$(LOCAL_SRC_FILES))
36out_dir := $(OUT_DOCS)/$(LOCAL_MODULE)
Joe Onorato64d85d02009-04-09 19:31:12 -070037full_target := $(call doc-timestamp-for,$(LOCAL_MODULE))
The Android Open Source Project88b60792009-03-03 19:28:42 -080038
39ifeq ($(LOCAL_DROIDDOC_SOURCE_PATH),)
40LOCAL_DROIDDOC_SOURCE_PATH := $(LOCAL_PATH)
41endif
42
The Android Open Source Project88b60792009-03-03 19:28:42 -080043ifeq ($(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR),)
Dirk Doughertyd77248a2010-08-25 15:07:39 -070044LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR := $(SRC_DROIDDOC_DIR)/$(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR)
The Android Open Source Project88b60792009-03-03 19:28:42 -080045endif
46
47ifeq ($(LOCAL_DROIDDOC_ASSET_DIR),)
48LOCAL_DROIDDOC_ASSET_DIR := assets
49endif
50ifeq ($(LOCAL_DROIDDOC_CUSTOM_ASSET_DIR),)
51LOCAL_DROIDDOC_CUSTOM_ASSET_DIR := assets
52endif
53
Ying Wang584d8ad2014-04-07 15:14:50 -070054ifeq ($(LOCAL_IS_HOST_MODULE),true)
55$(full_target): PRIVATE_BOOTCLASSPATH :=
Ying Wangad7809b2014-07-07 16:43:49 -070056full_java_libs := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/,\
57 $(addsuffix $(COMMON_JAVA_PACKAGE_SUFFIX),$(LOCAL_JAVA_LIBRARIES)))
58full_java_lib_deps := $(full_java_libs)
59
Ying Wang584d8ad2014-04-07 15:14:50 -070060else
The Android Open Source Project88b60792009-03-03 19:28:42 -080061
Ying Wang3f45b3c2012-04-02 18:21:36 -070062ifneq ($(LOCAL_SDK_VERSION),)
Ying Wang0ec188f2012-05-10 17:25:51 -070063 ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current)
64 # Use android_stubs_current if LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS.
Ying Wang3f45b3c2012-04-02 18:21:36 -070065 LOCAL_JAVA_LIBRARIES := android_stubs_current $(LOCAL_JAVA_LIBRARIES)
Ying Wang584d8ad2014-04-07 15:14:50 -070066 $(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, android_stubs_current)
Ying Wangefb93582014-07-19 17:00:50 -070067 else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current)
68 LOCAL_JAVA_LIBRARIES := android_system_stubs_current $(LOCAL_JAVA_LIBRARIES)
69 $(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, android_system_stubs_current)
Ying Wang3f45b3c2012-04-02 18:21:36 -070070 else
71 LOCAL_JAVA_LIBRARIES := sdk_v$(LOCAL_SDK_VERSION) $(LOCAL_JAVA_LIBRARIES)
Ying Wang584d8ad2014-04-07 15:14:50 -070072 $(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, sdk_v$(LOCAL_SDK_VERSION))
Ying Wang3f45b3c2012-04-02 18:21:36 -070073 endif
74else
Ying Wang14c975b2014-07-21 14:42:29 -070075 LOCAL_JAVA_LIBRARIES := core-libart ext framework $(LOCAL_JAVA_LIBRARIES)
Brian Carlstromb1dafb12014-06-18 15:11:01 -070076 $(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, core-libart)
Ying Wang3f45b3c2012-04-02 18:21:36 -070077endif # LOCAL_SDK_VERSION
78LOCAL_JAVA_LIBRARIES := $(sort $(LOCAL_JAVA_LIBRARIES))
79
Ying Wangad7809b2014-07-07 16:43:49 -070080full_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES)) $(LOCAL_CLASSPATH)
81full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES)) $(LOCAL_CLASSPATH)
Ying Wang8578cab2013-06-25 12:34:11 -070082endif # !LOCAL_IS_HOST_MODULE
The Android Open Source Project88b60792009-03-03 19:28:42 -080083
The Android Open Source Project88b60792009-03-03 19:28:42 -080084$(full_target): PRIVATE_CLASSPATH := $(subst $(space),:,$(full_java_libs))
85
The Android Open Source Project88b60792009-03-03 19:28:42 -080086
Ying Wangfb790872011-05-17 14:48:10 -070087intermediates.COMMON := $(call local-intermediates-dir,COMMON)
Joe Onorato64d85d02009-04-09 19:31:12 -070088
89$(full_target): PRIVATE_SOURCE_PATH := $(call normalize-path-list,$(LOCAL_DROIDDOC_SOURCE_PATH))
The Android Open Source Project88b60792009-03-03 19:28:42 -080090$(full_target): PRIVATE_JAVA_FILES := $(filter %.java,$(full_src_files))
91$(full_target): PRIVATE_JAVA_FILES += $(addprefix $($(my_prefix)OUT_COMMON_INTERMEDIATES)/, $(filter %.java,$(LOCAL_INTERMEDIATE_SOURCES)))
Ying Wangfb790872011-05-17 14:48:10 -070092$(full_target): PRIVATE_SOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/src
93$(full_target): PRIVATE_SRC_LIST_FILE := $(intermediates.COMMON)/droiddoc-src-list
Joe Onorato64d85d02009-04-09 19:31:12 -070094
95ifneq ($(strip $(LOCAL_ADDITIONAL_JAVA_DIR)),)
96$(full_target): PRIVATE_ADDITIONAL_JAVA_DIR := $(LOCAL_ADDITIONAL_JAVA_DIR)
97endif
98
The Android Open Source Project88b60792009-03-03 19:28:42 -080099$(full_target): PRIVATE_OUT_DIR := $(out_dir)
100$(full_target): PRIVATE_DROIDDOC_OPTIONS := $(LOCAL_DROIDDOC_OPTIONS)
Joe Onorato64d85d02009-04-09 19:31:12 -0700101
102# Lists the input files for the doc build into a text file
103# suitable for the @ syntax of javadoc.
104# $(1): the file to create
105# $(2): files to include
106# $(3): list of directories to search for java files in
107define prepare-doc-source-list
108$(hide) mkdir -p $(dir $(1))
Joe Onorato64d85d02009-04-09 19:31:12 -0700109$(call dump-words-to-file, $(2), $(1))
110$(hide) for d in $(3) ; do find $$d -name '*.java' >> $(1) 2> /dev/null ; done ; true
111endef
112
113ifeq (a,b)
114$(full_target): PRIVATE_PROFILING_OPTIONS := \
115 -J-agentlib:jprofilerti=port=8849 -J-Xbootclasspath/a:/Applications/jprofiler5/bin/agent.jar
116endif
117
118
119ifneq ($(strip $(LOCAL_DROIDDOC_USE_STANDARD_DOCLET)),true)
120##
121##
122## droiddoc only
123##
124##
125
126droiddoc_templates := \
Joe Onorato64d85d02009-04-09 19:31:12 -0700127 $(shell find $(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR) -type f)
128
129droiddoc := \
130 $(HOST_JDK_TOOLS_JAR) \
Ben Dodson10344552010-08-05 15:42:37 -0700131 $(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX)
Joe Onorato64d85d02009-04-09 19:31:12 -0700132
Ben Dodson10344552010-08-05 15:42:37 -0700133$(full_target): PRIVATE_DOCLETPATH := $(HOST_OUT_JAVA_LIBRARIES)/jsilver$(COMMON_JAVA_PACKAGE_SUFFIX):$(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX)
Joe Onorato64d85d02009-04-09 19:31:12 -0700134$(full_target): PRIVATE_CURRENT_BUILD := -hdf page.build $(BUILD_ID)-$(BUILD_NUMBER)
135$(full_target): PRIVATE_CURRENT_TIME := -hdf page.now "$(shell date "+%d %b %Y %k:%M")"
The Android Open Source Project88b60792009-03-03 19:28:42 -0800136$(full_target): PRIVATE_CUSTOM_TEMPLATE_DIR := $(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800137$(full_target): PRIVATE_IN_CUSTOM_ASSET_DIR := $(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR)/$(LOCAL_DROIDDOC_CUSTOM_ASSET_DIR)
138$(full_target): PRIVATE_OUT_ASSET_DIR := $(out_dir)/$(LOCAL_DROIDDOC_ASSET_DIR)
139$(full_target): PRIVATE_OUT_CUSTOM_ASSET_DIR := $(out_dir)/$(LOCAL_DROIDDOC_CUSTOM_ASSET_DIR)
Ying Wang3bb5d8b2014-04-16 11:25:31 -0700140
141html_dir_files :=
The Android Open Source Project88b60792009-03-03 19:28:42 -0800142ifneq ($(strip $(LOCAL_DROIDDOC_HTML_DIR)),)
Bill Napier9a0e98a2010-08-27 09:58:29 -0700143$(full_target): PRIVATE_DROIDDOC_HTML_DIR := -htmldir $(LOCAL_PATH)/$(LOCAL_DROIDDOC_HTML_DIR)
Ying Wang3bb5d8b2014-04-16 11:25:31 -0700144html_dir_files := $(shell find $(LOCAL_PATH)/$(LOCAL_DROIDDOC_HTML_DIR) -type f)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800145else
Ying Wang3bb5d8b2014-04-16 11:25:31 -0700146$(full_target): PRIVATE_DROIDDOC_HTML_DIR :=
Dirk Dougherty1151ef42013-02-05 16:45:05 -0800147endif
148ifneq ($(strip $(LOCAL_ADDITIONAL_HTML_DIR)),)
149$(full_target): PRIVATE_ADDITIONAL_HTML_DIR := -htmldir2 $(LOCAL_PATH)/$(LOCAL_ADDITIONAL_HTML_DIR)
Dirk Dougherty9c2336e2013-01-28 18:57:30 -0800150else
151$(full_target): PRIVATE_ADDITIONAL_HTML_DIR :=
152endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800153
Joe Onorato64d85d02009-04-09 19:31:12 -0700154# TODO: not clear if this is used any more
155$(full_target): PRIVATE_LOCAL_PATH := $(LOCAL_PATH)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800156
Dan Albert954b5bd2014-11-08 22:20:03 -0800157$(full_target): \
158 $(full_src_files) \
159 $(droiddoc_templates) \
160 $(droiddoc) \
161 $(html_dir_files) \
162 $(full_java_lib_deps) \
163 $(LOCAL_MODULE_MAKEFILE) \
164 $(LOCAL_ADDITIONAL_DEPENDENCIES)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800165 @echo Docs droiddoc: $(PRIVATE_OUT_DIR)
Ying Wangb8a256a2013-02-22 09:59:17 -0800166 $(hide) mkdir -p $(dir $@)
Joe Onorato64d85d02009-04-09 19:31:12 -0700167 $(call prepare-doc-source-list,$(PRIVATE_SRC_LIST_FILE),$(PRIVATE_JAVA_FILES), \
168 $(PRIVATE_SOURCE_INTERMEDIATES_DIR) $(PRIVATE_ADDITIONAL_JAVA_DIR))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800169 $(hide) ( \
Joe Onorato64d85d02009-04-09 19:31:12 -0700170 javadoc \
Ying Wang34e3e172013-12-10 11:29:25 -0800171 -encoding UTF-8 \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800172 \@$(PRIVATE_SRC_LIST_FILE) \
Dominic Binks86175d22011-03-09 12:11:19 -0800173 -J-Xmx1280m \
Ying Wang5b6b4642014-04-07 15:19:33 -0700174 -XDignore.symbol.file \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800175 $(PRIVATE_PROFILING_OPTIONS) \
176 -quiet \
Ben Dodson10344552010-08-05 15:42:37 -0700177 -doclet com.google.doclava.Doclava \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800178 -docletpath $(PRIVATE_DOCLETPATH) \
179 -templatedir $(PRIVATE_CUSTOM_TEMPLATE_DIR) \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800180 $(PRIVATE_DROIDDOC_HTML_DIR) \
Dirk Dougherty9c2336e2013-01-28 18:57:30 -0800181 $(PRIVATE_ADDITIONAL_HTML_DIR) \
Ying Wang7b142da2010-06-23 20:59:22 -0700182 $(addprefix -bootclasspath ,$(PRIVATE_BOOTCLASSPATH)) \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800183 $(addprefix -classpath ,$(PRIVATE_CLASSPATH)) \
184 -sourcepath $(PRIVATE_SOURCE_PATH)$(addprefix :,$(PRIVATE_CLASSPATH)) \
185 -d $(PRIVATE_OUT_DIR) \
186 $(PRIVATE_CURRENT_BUILD) $(PRIVATE_CURRENT_TIME) \
187 $(PRIVATE_DROIDDOC_OPTIONS) \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800188 && touch -f $@ \
189 ) || (rm -rf $(PRIVATE_OUT_DIR) $(PRIVATE_SRC_LIST_FILE); exit 45)
190
Joe Onorato64d85d02009-04-09 19:31:12 -0700191
192
193else
194##
195##
196## standard doclet only
197##
198##
199$(full_target): $(full_src_files) $(full_java_lib_deps)
200 @echo Docs javadoc: $(PRIVATE_OUT_DIR)
Ying Wangb8a256a2013-02-22 09:59:17 -0800201 @mkdir -p $(dir $@)
Joe Onorato64d85d02009-04-09 19:31:12 -0700202 $(call prepare-doc-source-list,$(PRIVATE_SRC_LIST_FILE),$(PRIVATE_JAVA_FILES), \
203 $(PRIVATE_SOURCE_INTERMEDIATES_DIR) $(PRIVATE_ADDITIONAL_JAVA_DIR))
204 $(hide) ( \
205 javadoc \
Ying Wang34e3e172013-12-10 11:29:25 -0800206 -encoding UTF-8 \
Joe Onorato64d85d02009-04-09 19:31:12 -0700207 $(PRIVATE_DROIDDOC_OPTIONS) \
208 \@$(PRIVATE_SRC_LIST_FILE) \
Ying Wang24de9702010-06-18 13:18:05 -0700209 -J-Xmx1024m \
Ying Wang5b6b4642014-04-07 15:19:33 -0700210 -XDignore.symbol.file \
Joe Onorato64d85d02009-04-09 19:31:12 -0700211 $(PRIVATE_PROFILING_OPTIONS) \
212 $(addprefix -classpath ,$(PRIVATE_CLASSPATH)) \
Narayan Kamathf122d412013-10-25 15:55:46 +0100213 $(addprefix -bootclasspath ,$(PRIVATE_BOOTCLASSPATH)) \
Joe Onorato64d85d02009-04-09 19:31:12 -0700214 -sourcepath $(PRIVATE_SOURCE_PATH)$(addprefix :,$(PRIVATE_CLASSPATH)) \
215 -d $(PRIVATE_OUT_DIR) \
216 -quiet \
217 && touch -f $@ \
218 ) || (rm -rf $(PRIVATE_OUT_DIR) $(PRIVATE_SRC_LIST_FILE); exit 45)
219
220
221endif
222##
223##
224## Common to both droiddoc and javadoc
225##
226##
227
228
The Android Open Source Project88b60792009-03-03 19:28:42 -0800229ALL_DOCS += $(full_target)
230
231.PHONY: $(LOCAL_MODULE)-docs
232$(LOCAL_MODULE)-docs : $(full_target)
233
Joe Onoratoaaa5d112010-09-01 10:39:50 -0700234ifeq ($(strip $(LOCAL_UNINSTALLABLE_MODULE)),)
235
The Android Open Source Project88b60792009-03-03 19:28:42 -0800236# Define a rule to create a zip of these docs.
237out_zip := $(OUT_DOCS)/$(LOCAL_MODULE)-docs.zip
238$(out_zip): PRIVATE_DOCS_DIR := $(out_dir)
239$(out_zip): $(full_target)
240 @echo Package docs: $@
241 @rm -f $@
242 @mkdir -p $(dir $@)
243 $(hide) ( F=$$(pwd)/$@ ; cd $(PRIVATE_DOCS_DIR) && zip -rq $$F * )
244
Joe Onorato36b89ff2013-12-04 02:31:18 -0800245$(LOCAL_MODULE)-docs.zip : $(out_zip)
246
The Android Open Source Project88b60792009-03-03 19:28:42 -0800247$(call dist-for-goals,docs,$(out_zip))
Joe Onoratoaaa5d112010-09-01 10:39:50 -0700248
249endif