1 LOCAL_PATH
:= $(call my-dir
)
3 # The source files for this library are _all_ generated, something we don't do
4 # anywhere else, and the rules don't support. Aditionally, the depenencies on
5 # these files don't really matter, because they are all generated as part of
6 # building the docs. So for the dependency, we just use the
7 # api-stubs-timestamp file, which is the $@ of the droiddoc rule.
8 # We also need to depend on framework-res.apk, in order to pull the
9 # resource files out of there for aapt.
11 # Normally the package rule runs aapt, which includes the resource,
12 # but we're not running that in our package rule so just copy in the
13 # resource files here.
14 intermediates
:= $(TARGET_OUT_COMMON_INTERMEDIATES
)/JAVA_LIBRARIES
/android_stubs_current_intermediates
15 full_target
:= $(intermediates
)/classes.jar
16 src_dir
:= $(intermediates
)/src
17 classes_dir
:= $(intermediates
)/classes
18 framework_res_package
:= $(call intermediates-dir-for
,APPS
,framework-res
,,COMMON
)/package-export.apk
20 $(full_target
): PRIVATE_SRC_DIR
:= $(src_dir
)
21 $(full_target
): PRIVATE_INTERMEDIATES_DIR
:= $(intermediates
)
22 $(full_target
): PRIVATE_CLASS_INTERMEDIATES_DIR
:= $(classes_dir
)
23 $(full_target
): PRIVATE_FRAMEWORK_RES_PACKAGE
:= $(framework_res_package
)
25 $(full_target
): $(OUT_DOCS
)/api-stubs-timestamp
$(framework_res_package
)
26 @echo Compiling SDK Stubs
: $@
27 $(hide
) rm -rf
$(PRIVATE_CLASS_INTERMEDIATES_DIR
)
28 $(hide
) mkdir
-p
$(PRIVATE_CLASS_INTERMEDIATES_DIR
)
29 $(hide
) find
$(PRIVATE_SRC_DIR
) -name
"*.java" > \
30 $(PRIVATE_INTERMEDIATES_DIR
)/java-source-list
31 $(hide
) $(TARGET_JAVAC
) -encoding ascii
-bootclasspath
"" \
32 -g
$(xlint_unchecked
) \
33 -extdirs
"" -d
$(PRIVATE_CLASS_INTERMEDIATES_DIR
) \
34 \@
$(PRIVATE_INTERMEDIATES_DIR
)/java-source-list \
35 ||
( rm -rf
$(PRIVATE_CLASS_INTERMEDIATES_DIR
) ; exit
41 )
36 $(hide
) if
[ ! -f
$(PRIVATE_FRAMEWORK_RES_PACKAGE
) ]; then \
37 echo Missing file
$(PRIVATE_FRAMEWORK_RES_PACKAGE
); \
38 rm -rf
$(PRIVATE_CLASS_INTERMEDIATES_DIR
); \
41 $(hide
) unzip
-qo
$(PRIVATE_FRAMEWORK_RES_PACKAGE
) -d
$(PRIVATE_CLASS_INTERMEDIATES_DIR
)
42 $(hide
) (cd
$(PRIVATE_CLASS_INTERMEDIATES_DIR
) && rm -rf classes.dex META-INF
)
43 $(hide
) mkdir
-p
$(dir $@
)
44 $(hide
) jar
-cf
$@
-C
$(PRIVATE_CLASS_INTERMEDIATES_DIR
) .
45 $(hide
) jar
-u0f
$@
-C
$(PRIVATE_CLASS_INTERMEDIATES_DIR
) resources.arsc
48 android_stubs
: $(full_target
)
50 # The real rules create a javalib.jar that contains a classes.dex file. This
51 # code is never going to be run anywhere, so just make a copy of the file.
52 # The package installation stuff doesn't know about this file, so nobody will
53 # ever be able to write a rule that installs it to a device.
54 $(dir $(full_target
))javalib.jar
: $(full_target
)
58 android_jar_intermediates
:= $(TARGET_OUT_COMMON_INTERMEDIATES
)/PACKAGING
/android_jar_intermediates
59 android_jar_full_target
:= $(android_jar_intermediates
)/android.jar
61 $(android_jar_full_target
): $(full_target
)
62 @echo Package SDK Stubs
: $@
63 $(hide
)mkdir
-p
$(dir $@
)
66 ALL_SDK_FILES
+= $(android_jar_full_target
)
69 # $(1): the Java library name
70 define _package_sdk_library
71 $(eval _psm_build_module
:= $(TARGET_OUT_COMMON_INTERMEDIATES
)/JAVA_LIBRARIES
/$(1)_intermediates
/javalib.jar
)
72 $(eval _psm_packaging_target
:= $(TARGET_OUT_COMMON_INTERMEDIATES
)/PACKAGING
/$(1)_intermediates
/$(1).jar
)
73 $(_psm_packaging_target
) : $(_psm_build_module
) |
$(ACP
)
74 @echo
"Package $(1).jar: $$@"
75 $(hide
) mkdir
-p
$$(dir $$@
)
76 $(hide
) $(ACP
) $$< $$@
78 ALL_SDK_FILES
+= $(_psm_packaging_target
)
79 $(eval _psm_build_module
:=)
80 $(eval _psm_packaging_target
:=)
83 ANDROID_SUPPORT_LIBRARIES
:= android-support-v4 android-support-v13
85 $(foreach lib
, $(ANDROID_SUPPORT_LIBRARIES
), $(eval
$(call _package_sdk_library
,$(lib
))))