Android.bp以及相关支持,从Android Nougat开始加入,从Android Oreo(8.0)开始默认开启。
推荐个源码查看网址:http://aospxref.com/
可以在http://aospxref.com/android-10.0.0_r2/xref/build/soong/androidmk/cmd/androidmk/android.go网页上看到Android.bp和Android.mk的对应关系
func init() {
91 addStandardProperties(bpparser.StringType,
92 map[string]string{
93 "LOCAL_MODULE": "name",
94 "LOCAL_CXX_STL": "stl",
95 "LOCAL_MULTILIB": "compile_multilib",
96 "LOCAL_ARM_MODE_HACK": "instruction_set",
97 "LOCAL_SDK_VERSION": "sdk_version",
98 "LOCAL_MIN_SDK_VERSION": "min_sdk_version",
99 "LOCAL_NDK_STL_VARIANT": "stl",
100 "LOCAL_JAR_MANIFEST": "manifest",
101 "LOCAL_CERTIFICATE": "certificate",
102 "LOCAL_PACKAGE_NAME": "name",
103 "LOCAL_MODULE_RELATIVE_PATH": "relative_install_path",
104 "LOCAL_PROTOC_OPTIMIZE_TYPE": "proto.type",
105 "LOCAL_MODULE_OWNER": "owner",
106 "LOCAL_RENDERSCRIPT_TARGET_API": "renderscript.target_api",
107 "LOCAL_NOTICE_FILE": "notice",
108 "LOCAL_JAVA_LANGUAGE_VERSION": "java_version",
109 "LOCAL_INSTRUMENTATION_FOR": "instrumentation_for",
110 "LOCAL_MANIFEST_FILE": "manifest",
111
112 "LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING": "dex_preopt.profile",
113 "LOCAL_TEST_CONFIG": "test_config",
114 })
115 addStandardProperties(bpparser.ListType,
116 map[string]string{
117 "LOCAL_SRC_FILES": "srcs",
118 "LOCAL_SRC_FILES_EXCLUDE": "exclude_srcs",
119 "LOCAL_HEADER_LIBRARIES": "header_libs",
120 "LOCAL_SHARED_LIBRARIES": "shared_libs",
121 "LOCAL_STATIC_LIBRARIES": "static_libs",
122 "LOCAL_WHOLE_STATIC_LIBRARIES": "whole_static_libs",
123 "LOCAL_SYSTEM_SHARED_LIBRARIES": "system_shared_libs",
124 "LOCAL_ASFLAGS": "asflags",
125 "LOCAL_CLANG_ASFLAGS": "clang_asflags",
126 "LOCAL_CONLYFLAGS": "conlyflags",
127 "LOCAL_CPPFLAGS": "cppflags",
128 "LOCAL_REQUIRED_MODULES": "required",
129 "LOCAL_OVERRIDES_MODULES": "overrides",
130 "LOCAL_LDLIBS": "host_ldlibs",
131 "LOCAL_CLANG_CFLAGS": "clang_cflags",
132 "LOCAL_YACCFLAGS": "yaccflags",
133 "LOCAL_SANITIZE_RECOVER": "sanitize.recover",
134 "LOCAL_LOGTAGS_FILES": "logtags",
135 "LOCAL_EXPORT_HEADER_LIBRARY_HEADERS": "export_header_lib_headers",
136 "LOCAL_EXPORT_SHARED_LIBRARY_HEADERS": "export_shared_lib_headers",
137 "LOCAL_EXPORT_STATIC_LIBRARY_HEADERS": "export_static_lib_headers",
138 "LOCAL_INIT_RC": "init_rc",
139 "LOCAL_VINTF_FRAGMENTS": "vintf_fragments",
140 "LOCAL_TIDY_FLAGS": "tidy_flags",
141 // TODO: This is comma-separated, not space-separated
142 "LOCAL_TIDY_CHECKS": "tidy_checks",
143 "LOCAL_RENDERSCRIPT_INCLUDES": "renderscript.include_dirs",
144 "LOCAL_RENDERSCRIPT_FLAGS": "renderscript.flags",
145
146 "LOCAL_JAVA_RESOURCE_DIRS": "java_resource_dirs",
147 "LOCAL_JAVACFLAGS": "javacflags",
148 "LOCAL_ERROR_PRONE_FLAGS": "errorprone.javacflags",
149 "LOCAL_DX_FLAGS": "dxflags",
150 "LOCAL_JAVA_LIBRARIES": "libs",
151 "LOCAL_STATIC_JAVA_LIBRARIES": "static_libs",
152 "LOCAL_JNI_SHARED_LIBRARIES": "jni_libs",
153 "LOCAL_AAPT_FLAGS": "aaptflags",
154 "LOCAL_PACKAGE_SPLITS": "package_splits",
155 "LOCAL_COMPATIBILITY_SUITE": "test_suites",
156 "LOCAL_OVERRIDES_PACKAGES": "overrides",
157
158 "LOCAL_ANNOTATION_PROCESSORS": "plugins",
159
160 "LOCAL_PROGUARD_FLAGS": "optimize.proguard_flags",
161 "LOCAL_PROGUARD_FLAG_FILES": "optimize.proguard_flags_files",
162
163 // These will be rewritten to libs/static_libs by bpfix, after their presence is used to convert
164 // java_library_static to android_library.
165 "LOCAL_SHARED_ANDROID_LIBRARIES": "android_libs",
166 "LOCAL_STATIC_ANDROID_LIBRARIES": "android_static_libs",
167 "LOCAL_ADDITIONAL_CERTIFICATES": "additional_certificates",
168
169 // Jacoco filters:
170 "LOCAL_JACK_COVERAGE_INCLUDE_FILTER": "jacoco.include_filter",
171 "LOCAL_JACK_COVERAGE_EXCLUDE_FILTER": "jacoco.exclude_filter",
172 })
173
174 addStandardProperties(bpparser.BoolType,
175 map[string]string{
176 // Bool properties
177 "LOCAL_IS_HOST_MODULE": "host",
178 "LOCAL_CLANG": "clang",
179 "LOCAL_FORCE_STATIC_EXECUTABLE": "static_executable",
180 "LOCAL_NATIVE_COVERAGE": "native_coverage",
181 "LOCAL_NO_CRT": "nocrt",
182 "LOCAL_ALLOW_UNDEFINED_SYMBOLS": "allow_undefined_symbols",
183 "LOCAL_RTTI_FLAG": "rtti",
184 "LOCAL_NO_STANDARD_LIBRARIES": "no_standard_libs",
185 "LOCAL_PACK_MODULE_RELOCATIONS": "pack_relocations",
186 "LOCAL_TIDY": "tidy",
187 "LOCAL_USE_CLANG_LLD": "use_clang_lld",
188 "LOCAL_PROPRIETARY_MODULE": "proprietary",
189 "LOCAL_VENDOR_MODULE": "vendor",
190 "LOCAL_ODM_MODULE": "device_specific",
191 "LOCAL_PRODUCT_MODULE": "product_specific",
192 "LOCAL_PRODUCT_SERVICES_MODULE": "product_services_specific",
193 "LOCAL_EXPORT_PACKAGE_RESOURCES": "export_package_resources",
194 "LOCAL_PRIVILEGED_MODULE": "privileged",
195 "LOCAL_AAPT_INCLUDE_ALL_RESOURCES": "aapt_include_all_resources",
196 "LOCAL_USE_EMBEDDED_NATIVE_LIBS": "use_embedded_native_libs",
197 "LOCAL_USE_EMBEDDED_DEX": "use_embedded_dex",
198
199 "LOCAL_DEX_PREOPT": "dex_preopt.enabled",
200 "LOCAL_DEX_PREOPT_APP_IMAGE": "dex_preopt.app_image",
201 "LOCAL_DEX_PREOPT_GENERATE_PROFILE": "dex_preopt.profile_guided",
202
203 "LOCAL_PRIVATE_PLATFORM_APIS": "platform_apis",
204 "LOCAL_JETIFIER_ENABLED": "jetifier",
205 })
206 }
5 var moduleTypes = map[string]string{
906 "BUILD_SHARED_LIBRARY": "cc_library_shared",
907 "BUILD_STATIC_LIBRARY": "cc_library_static",
908 "BUILD_HOST_SHARED_LIBRARY": "cc_library_host_shared",
909 "BUILD_HOST_STATIC_LIBRARY": "cc_library_host_static",
910 "BUILD_HEADER_LIBRARY": "cc_library_headers",
911 "BUILD_EXECUTABLE": "cc_binary",
912 "BUILD_HOST_EXECUTABLE": "cc_binary_host",
913 "BUILD_NATIVE_TEST": "cc_test",
914 "BUILD_HOST_NATIVE_TEST": "cc_test_host",
915 "BUILD_NATIVE_BENCHMARK": "cc_benchmark",
916 "BUILD_HOST_NATIVE_BENCHMARK": "cc_benchmark_host",
917
918 "BUILD_JAVA_LIBRARY": "java_library_installable", // will be rewritten to java_library by bpfix
919 "BUILD_STATIC_JAVA_LIBRARY": "java_library",
920 "BUILD_HOST_JAVA_LIBRARY": "java_library_host",
921 "BUILD_HOST_DALVIK_JAVA_LIBRARY": "java_library_host_dalvik",
922 "BUILD_PACKAGE": "android_app",
923
924 "BUILD_CTS_EXECUTABLE": "cc_binary", // will be further massaged by bpfix depending on the output path
925 "BUILD_CTS_SUPPORT_PACKAGE": "cts_support_package", // will be rewritten to android_test by bpfix
926 "BUILD_CTS_PACKAGE": "cts_package", // will be rewritten to android_test by bpfix
927 "BUILD_CTS_TARGET_JAVA_LIBRARY": "cts_target_java_library", // will be rewritten to java_library by bpfix
928 "BUILD_CTS_HOST_JAVA_LIBRARY": "cts_host_java_library", // will be rewritten to java_library_host by bpfix
929 }
930
931 var prebuiltTypes = map[string]string{
932 "SHARED_LIBRARIES": "cc_prebuilt_library_shared",
933 "STATIC_LIBRARIES": "cc_prebuilt_library_static",
934 "EXECUTABLES": "cc_prebuilt_binary",
935 "JAVA_LIBRARIES": "java_import",
936 "ETC": "prebuilt_etc",
937 }