aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.mk9
-rw-r--r--Changes.md116
-rw-r--r--CleanSpec.mk60
-rw-r--r--OWNERS7
-rw-r--r--README.md23
-rw-r--r--Usage.txt85
-rw-r--r--core/Makefile712
-rw-r--r--core/aapt2.mk89
-rw-r--r--core/aapt_flags.mk15
-rw-r--r--core/allowed_ndk_types.mk84
-rw-r--r--core/android_manifest.mk4
-rw-r--r--core/apidiff.mk181
-rw-r--r--core/autogen_test_config.mk64
-rw-r--r--core/aux_config.mk14
-rw-r--r--core/base_rules.mk172
-rw-r--r--core/binary.mk248
-rw-r--r--core/build-system.html13
-rw-r--r--core/build_id.mk2
-rw-r--r--core/clang/HOST_CROSS_x86.mk2
-rw-r--r--core/clang/HOST_x86.mk2
-rw-r--r--core/clang/config.mk1
-rw-r--r--core/clang/versions.mk4
-rw-r--r--core/cleanbuild.mk91
-rw-r--r--core/cleanspec.mk2
-rw-r--r--core/clear_vars.mk45
-rw-r--r--core/combo/TARGET_linux-arm.mk22
-rw-r--r--core/combo/arch/arm/armv5te-vfp.mk7
-rw-r--r--core/combo/arch/arm/armv5te.mk4
-rw-r--r--core/combo/arch/arm/armv8-a.mk9
-rw-r--r--core/combo/arch/arm64/armv8-2a.mk0
-rw-r--r--core/combo/arch/x86/atom.mk2
-rw-r--r--core/combo/arch/x86/silvermont.mk2
-rw-r--r--core/combo/arch/x86_64/silvermont.mk2
-rw-r--r--core/combo/javac.mk54
-rw-r--r--core/combo/select.mk2
-rw-r--r--core/config.mk581
-rw-r--r--core/config_sanitizers.mk127
-rw-r--r--core/configure_local_jack.mk44
-rwxr-xr-xcore/construct_context.sh54
-rw-r--r--core/cxx_stl_setup.mk11
-rw-r--r--core/definitions.mk830
-rw-r--r--core/dex_preopt.mk55
-rw-r--r--core/dex_preopt_libart.mk60
-rw-r--r--core/dex_preopt_libart_boot.mk47
-rw-r--r--core/dex_preopt_odex_install.mk218
-rw-r--r--core/distdir.mk3
-rw-r--r--core/dpi_specific_apk.mk14
-rw-r--r--core/droiddoc.mk246
-rw-r--r--core/dumpvar.mk101
-rw-r--r--core/dynamic_binary.mk9
-rw-r--r--core/empty_test_config.xml19
-rw-r--r--core/envsetup.mk175
-rw-r--r--core/executable_internal.mk37
-rwxr-xr-xcore/find-jdk-tools-jar.sh20
-rw-r--r--core/fuzz_test.mk48
-rw-r--r--core/generate_enforce_rro.mk8
-rw-r--r--core/help.mk35
-rw-r--r--core/host_dalvik_java_library.mk214
-rw-r--r--core/host_executable_internal.mk2
-rw-r--r--core/host_fuzz_test.mk2
-rw-r--r--core/host_java_library.mk63
-rw-r--r--core/host_java_library_common.mk5
-rw-r--r--core/host_shared_library_internal.mk4
-rw-r--r--core/host_test_config.mk (renamed from target/product/generic_armv5.mk)16
-rw-r--r--core/host_test_internal.mk2
-rw-r--r--core/install_jni_libs.mk16
-rw-r--r--core/install_jni_libs_internal.mk19
-rw-r--r--core/instrumentation_test_config_template.xml29
-rw-r--r--core/jack-default.args9
-rw-r--r--core/jacoco.mk60
-rw-r--r--core/java.mk674
-rw-r--r--core/java_common.mk398
-rw-r--r--core/java_library.mk54
-rw-r--r--core/java_renderscript.mk155
-rw-r--r--core/jetifier.mk34
-rw-r--r--core/local_systemsdk.mk61
-rw-r--r--core/local_vndk.mk6
-rw-r--r--core/main.mk226
-rw-r--r--core/math.mk75
-rw-r--r--core/native_test_config_template.xml27
l---------core/no_java_path/jar1
l---------core/no_java_path/jarsigner1
-rwxr-xr-xcore/no_java_path/java4
l---------core/no_java_path/javac1
l---------core/no_java_path/keytool1
-rw-r--r--core/notice_files.mk2
-rw-r--r--core/package_internal.mk317
-rw-r--r--core/pdk_config.mk181
-rw-r--r--core/pdk_fusion_modules.mk6
-rw-r--r--core/prebuilt_internal.mk127
-rw-r--r--core/product-graph.mk10
-rw-r--r--core/product.mk22
-rw-r--r--core/product_config.mk75
-rw-r--r--core/proguard.emma.flags4
-rw-r--r--core/proguard_tests.flags26
-rw-r--r--core/project_definitions.mk (renamed from target/board/generic_armv5/device.mk)11
-rw-r--r--core/root.mk2
-rw-r--r--core/sdk_check.mk37
-rw-r--r--core/setup_one_odex.mk76
-rw-r--r--core/shared_library_internal.mk2
-rw-r--r--core/soong_app_prebuilt.mk104
-rw-r--r--core/soong_config.mk215
-rw-r--r--core/soong_java_prebuilt.mk145
-rw-r--r--core/static_java_library.mk119
-rw-r--r--core/support_libraries.mk53
-rw-r--r--core/target_test_config.mk (renamed from target/board/generic_armv5/BoardConfig.mk)12
-rw-r--r--core/target_test_internal.mk12
-rw-r--r--core/tasks/apicheck.mk4
-rw-r--r--core/tasks/apidiff.mk (renamed from target/board/generic_armv5/AndroidBoard.mk)10
-rw-r--r--core/tasks/boot_jars_package_check.mk4
-rw-r--r--core/tasks/check_boot_jars/package_whitelist.txt6
-rw-r--r--core/tasks/check_emu_boot.mk23
-rw-r--r--core/tasks/collect_gpl_sources.mk18
-rw-r--r--core/tasks/cts.mk5
-rw-r--r--core/tasks/cts_instant.mk25
-rw-r--r--core/tasks/device-tests.mk19
-rw-r--r--core/tasks/general-tests.mk19
-rw-r--r--core/tasks/module-info.mk2
-rw-r--r--core/tasks/oem_image.mk2
-rw-r--r--core/tasks/sdk-addon.mk10
-rw-r--r--core/tasks/test_mapping.mk34
-rw-r--r--core/tasks/tools/build_custom_image.mk28
-rw-r--r--core/tasks/tools/compatibility.mk6
-rw-r--r--core/tasks/tools/package-modules.mk7
-rw-r--r--core/tasks/tradefed-tests-list.mk38
-rw-r--r--core/tasks/vendor_module_check.mk1
-rw-r--r--core/tasks/vndk.mk264
-rw-r--r--core/test_config_common.mk56
-rwxr-xr-xcore/verify_uses_libraries.sh45
-rw-r--r--core/version_defaults.mk118
-rw-r--r--envsetup.sh169
-rwxr-xr-xhelp.sh55
-rw-r--r--navbar.md4
-rwxr-xr-xtapasHelp.sh23
-rw-r--r--target/Android.mk23
-rw-r--r--target/board/Android.mk112
-rw-r--r--target/board/generic/BoardConfig.mk88
-rw-r--r--target/board/generic/device.mk29
-rw-r--r--target/board/generic/sepolicy/adbd.te1
-rw-r--r--target/board/generic/sepolicy/audioserver.te1
-rw-r--r--target/board/generic/sepolicy/bootanim.te5
-rw-r--r--target/board/generic/sepolicy/cameraserver.te2
-rw-r--r--target/board/generic/sepolicy/device.te1
-rw-r--r--target/board/generic/sepolicy/domain.te6
-rw-r--r--target/board/generic/sepolicy/file.te1
-rw-r--r--target/board/generic/sepolicy/file_contexts35
-rw-r--r--target/board/generic/sepolicy/goldfish_setup.te12
-rw-r--r--target/board/generic/sepolicy/hal_camera_default.te3
-rw-r--r--target/board/generic/sepolicy/hal_cas_default.te1
-rw-r--r--target/board/generic/sepolicy/hal_drm_default.te2
-rw-r--r--target/board/generic/sepolicy/hal_drm_widevine.te12
-rw-r--r--target/board/generic/sepolicy/hal_gnss_default.te3
-rw-r--r--target/board/generic/sepolicy/hal_graphics_composer_default.te3
-rw-r--r--target/board/generic/sepolicy/init.te2
-rw-r--r--target/board/generic/sepolicy/logpersist.te13
-rw-r--r--target/board/generic/sepolicy/mediacodec.te1
-rw-r--r--target/board/generic/sepolicy/netd.te3
-rw-r--r--target/board/generic/sepolicy/priv_app.te5
-rw-r--r--target/board/generic/sepolicy/property.te4
-rw-r--r--target/board/generic/sepolicy/property_contexts6
-rw-r--r--target/board/generic/sepolicy/qemu_props.te9
-rw-r--r--target/board/generic/sepolicy/shell.te1
-rw-r--r--target/board/generic/sepolicy/surfaceflinger.te4
-rw-r--r--target/board/generic/sepolicy/system_server.te2
-rw-r--r--target/board/generic/sepolicy/vold.te1
-rw-r--r--target/board/generic/sepolicy/zygote.te4
-rw-r--r--target/board/generic_arm64/BoardConfig.mk81
-rw-r--r--target/board/generic_arm64/device.mk28
-rw-r--r--target/board/generic_arm64_a/BoardConfig.mk4
-rw-r--r--target/board/generic_arm64_ab/BoardConfig.mk9
-rw-r--r--target/board/generic_arm64_ab/sepolicy/OWNERS4
-rw-r--r--target/board/generic_arm_a/BoardConfig.mk2
-rw-r--r--target/board/generic_arm_ab/BoardConfig.mk15
-rw-r--r--target/board/generic_armv5/README.txt5
-rw-r--r--target/board/generic_armv5/system.prop6
-rw-r--r--target/board/generic_mips/BoardConfig.mk6
-rw-r--r--target/board/generic_mips64/BoardConfig.mk6
-rw-r--r--target/board/generic_x86/BoardConfig.mk54
-rw-r--r--target/board/generic_x86/device.mk32
-rw-r--r--target/board/generic_x86/sepolicy/domain.te1
-rw-r--r--target/board/generic_x86/sepolicy/healthd.te1
-rw-r--r--target/board/generic_x86/sepolicy/init.te1
-rw-r--r--target/board/generic_x86/sepolicy/installd.te1
-rw-r--r--target/board/generic_x86/sepolicy/zygote.te2
-rwxr-xr-xtarget/board/generic_x86_64/BoardConfig.mk47
-rwxr-xr-xtarget/board/generic_x86_64/device.mk32
-rw-r--r--target/board/generic_x86_64_ab/BoardConfig.mk5
-rw-r--r--target/board/generic_x86_ab/BoardConfig.mk5
-rw-r--r--target/board/generic_x86_arm/BoardConfig.mk2
-rw-r--r--target/board/gsi_system.prop8
-rw-r--r--target/board/treble_common.mk32
-rw-r--r--target/board/treble_system.prop3
-rw-r--r--target/product/AndroidProducts.mk1
-rw-r--r--target/product/aosp_arm.mk17
-rw-r--r--target/product/aosp_arm64.mk27
-rw-r--r--target/product/aosp_arm64_ab.mk6
-rw-r--r--target/product/aosp_arm_ab.mk6
-rw-r--r--target/product/aosp_mips.mk15
-rw-r--r--target/product/aosp_mips64.mk18
-rw-r--r--target/product/aosp_x86.mk17
-rw-r--r--target/product/aosp_x86_64.mk22
-rw-r--r--target/product/aosp_x86_64_ab.mk6
-rw-r--r--target/product/aosp_x86_ab.mk6
-rw-r--r--target/product/base.mk24
-rw-r--r--target/product/cfi-common.mk39
-rw-r--r--target/product/core.mk7
-rw-r--r--target/product/core_64_bit_only.mk30
-rw-r--r--target/product/core_base.mk5
-rw-r--r--target/product/core_minimal.mk31
-rw-r--r--target/product/core_tiny.mk21
-rw-r--r--target/product/embedded.mk39
-rw-r--r--target/product/empty-preloaded-classes1
-rw-r--r--target/product/empty-profile1
-rw-r--r--target/product/emulator.mk145
-rw-r--r--target/product/full.mk3
-rw-r--r--target/product/full_base.mk26
-rw-r--r--target/product/full_base_telephony.mk4
-rw-r--r--target/product/full_x86.mk3
-rw-r--r--target/product/generic_no_telephony.mk3
-rw-r--r--target/product/go_defaults_common.mk5
-rw-r--r--target/product/languages_full.mk2
-rw-r--r--target/product/locales_full.mk3
-rw-r--r--target/product/product_launched_with_k.mk2
-rw-r--r--target/product/product_launched_with_l.mk3
-rw-r--r--target/product/product_launched_with_l_mr1.mk2
-rw-r--r--target/product/product_launched_with_m.mk2
-rw-r--r--target/product/product_launched_with_n.mk2
-rw-r--r--target/product/product_launched_with_n_mr1.mk2
-rw-r--r--target/product/product_launched_with_o.mk2
-rw-r--r--target/product/product_launched_with_o_mr1.mk2
-rw-r--r--target/product/product_launched_with_p.mk2
-rw-r--r--target/product/profile_boot_common.mk45
-rw-r--r--target/product/runtime_libart.mk26
-rw-r--r--target/product/sdk_base.mk48
-rw-r--r--target/product/sdk_phone_arm64.mk29
-rw-r--r--target/product/sdk_phone_armv7.mk21
-rw-r--r--target/product/sdk_phone_x86.mk22
-rw-r--r--target/product/sdk_phone_x86_64.mk24
-rw-r--r--target/product/security/Android.mk13
-rw-r--r--target/product/security/README2
-rw-r--r--target/product/treble_common.mk52
-rw-r--r--target/product/verity.mk24
-rw-r--r--target/product/vndk/28.txt252
-rw-r--r--target/product/vndk/Android.mk92
-rw-r--r--target/product/vndk/current.txt252
-rw-r--r--target/product/vndk/init.gsi.rc2
-rw-r--r--target/product/vndk/init.vndk-27.rc3
-rw-r--r--tools/Android.mk4
-rw-r--r--tools/acp/Android.bp1
-rw-r--r--tools/acp/acp.c3
-rwxr-xr-xtools/adbs45
-rw-r--r--tools/apicheck/Android.mk2
-rw-r--r--tools/apicheck/etc/apicheck2
-rw-r--r--tools/atree/Android.bp14
-rw-r--r--tools/atree/Android.mk19
-rw-r--r--tools/atree/files.cpp2
-rwxr-xr-xtools/auto_gen_test_config.py89
-rw-r--r--tools/auto_gen_test_config_test.py173
-rwxr-xr-xtools/buildinfo.sh1
-rw-r--r--tools/check_builds.sh4
-rwxr-xr-xtools/checkowners.py4
-rw-r--r--tools/docker/.gitignore1
-rw-r--r--tools/docker/Dockerfile25
-rw-r--r--tools/docker/README.md18
-rw-r--r--tools/droiddoc/templates-sac/assets/GPL-LICENSE.txt278
-rw-r--r--tools/droiddoc/templates-sac/assets/LICENSE.txt20
-rw-r--r--tools/droiddoc/templates-sac/assets/android-developer-docs.css2768
-rw-r--r--tools/droiddoc/templates-sac/assets/css/default.css4662
-rw-r--r--tools/droiddoc/templates-sac/assets/css/fullscreen.css200
-rw-r--r--tools/droiddoc/templates-sac/assets/design/default.js188
-rw-r--r--tools/droiddoc/templates-sac/assets/images/android-developers-logo.pngbin3195 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/android_wrench.pngbin3633 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/arrow-left-develop.pngbin3036 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/arrow-left.pngbin3144 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/arrow-right-develop.pngbin2960 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/arrow-right.pngbin2757 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/arrow_bluelink_down.pngbin180 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/arrow_bluelink_up.pngbin181 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/arrow_left_off.jpgbin592 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/arrow_left_on.jpgbin692 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/arrow_right_off.jpgbin592 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/arrow_right_on.jpgbin692 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/arrows-up-down.pngbin162 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/bg_community_leftDiv.jpgbin10692 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/bg_fade.jpgbin300 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/bg_gradient.jpgbin1376 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/bg_images_sprite.pngbin2008 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/bg_logo.pngbin1525 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/blog-default.pngbin72570 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/body-gradient-tab.pngbin192 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/body-gradient.pngbin146 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/close.pngbin312 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/dac_logo.pngbin2170 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/developers-logo.pngbin10155 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/fullscreen.pngbin1154 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/grad-rule-qv.pngbin249 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/home/Android_Dev_Lab_l.pngbin16512 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/home/GDC2011.pngbin15892 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/home/GTV_icon_large.pngbin7553 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/home/GTV_icon_small.pngbin3576 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/home/IO-logo-2011.pngbin11210 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/home/IO-logo.pngbin3673 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/home/adc2_l.pngbin111790 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/home/adc2_s.pngbin27250 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/home/android_adc.pngbin1849 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/home/bg_home_announcement.pngbin2840 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/home/bg_home_bottom.jpgbin2180 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/home/bg_home_carousel.pngbin3654 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/home/bg_home_carousel_board.pngbin1902 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/home/bg_home_carousel_wheel.pngbin2041 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/home/carousel_buttons_sprite.pngbin3413 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/home/devphone-large.pngbin16630 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/home/devphone-small.pngbin1944 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/home/donut-android.pngbin9386 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/home/eclair-android.pngbin11311 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/home/froyo-android.pngbin17086 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/home/gdc-logo.pngbin2739 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/home/gingerdroid.pngbin11690 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/home/google-plus-small.pngbin5042 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/home/google-plus.pngbin21315 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/home/honeycomb-android.pngbin13716 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/home/icon-about.pngbin5573 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/home/icon-design.pngbin5739 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/home/icon-develop.pngbin5364 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/home/icon-distribute.pngbin4588 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/home/ics-android.pngbin15002 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/home/io-large.pngbin5522 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/home/io-small.pngbin1427 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/home/maps-large.pngbin39756 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/home/maps-small.pngbin3424 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/home/market-large.pngbin5752 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/home/market-small.pngbin3134 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/home/sdk-large.pngbin1616 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/home/sdk-small.pngbin2381 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/hr_gray_main.jpgbin378 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/hr_gray_side.jpgbin344 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/icon_contribute.jpgbin1021 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/icon_design.pngbin697 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/icon_download.jpgbin1192 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/icon_download2.jpgbin653 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/icon_guidelines_logo.pngbin44163 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/icon_market.jpgbin1022 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/icon_more.pngbin1098 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/icon_play.pngbin10201 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/icon_robot.jpgbin638 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/icon_search.pngbin1406 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/icon_world.jpgbin511 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/left_off.jpgbin592 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/left_on.jpgbin692 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/locale.pngbin393 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/logo_breadcrumbz.jpgbin3311 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/more_bottom.pngbin1055 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/more_check.pngbin1014 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/more_mid.pngbin958 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/more_top.pngbin1447 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/open_source.pngbin6340 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/preliminary.pngbin2251 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/quicknav_arrow.pngbin2951 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/quicknav_btn_bg.pngbin1024 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/resizable-e.gifbin2713 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/resizable-e2.gifbin2680 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/resizable-eg.gifbin3075 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/resizable-s.gifbin2617 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/resizable-s2.gifbin2618 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/resizable-s2.pngbin966 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/resizable-sg.gifbin3057 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/resource-article.pngbin889 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/resource-big-article.pngbin2095 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/resource-big-sample.pngbin2480 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/resource-big-tutorial.pngbin2544 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/resource-big-video.pngbin2155 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/resource-sample.pngbin972 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/resource-tutorial.pngbin1001 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/resource-video.pngbin835 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/right_off.jpgbin592 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/right_on.jpgbin692 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/sac_logo.pngbin2298 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/sac_logo@2x.pngbin4934 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/sidenav-rule.pngbin258 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/slide_1.jpgbin3060 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/slide_2.jpgbin3736 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/slide_3.jpgbin3151 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/slide_large_1.jpgbin19240 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/slide_large_2.jpgbin20188 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/slide_large_3.jpgbin20202 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/slide_off.jpgbin676 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/slide_on.jpgbin733 -> 0 bytes
-rwxr-xr-xtools/droiddoc/templates-sac/assets/images/spacer.gifbin96 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/styles/callout.pngbin1383 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/styles/device_galaxynexus_blank_land_span13.pngbin64431 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/styles/device_galaxynexus_blank_land_span8.pngbin30679 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/styles/device_galaxynexus_blank_port_span5.pngbin39994 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/styles/device_galaxynexus_blank_port_span9.pngbin75920 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/styles/disclosure_down.pngbin238 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/styles/disclosure_left.pngbin229 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/styles/disclosure_right.pngbin228 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/styles/disclosure_up.pngbin221 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/styles/gototop.pngbin262 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/styles/ico_action.pngbin415 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/styles/ico_good.pngbin318 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/styles/ico_movie_inline.pngbin1040 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/styles/ico_phone_tablet.pngbin302 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/styles/ico_use.pngbin437 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/styles/ico_web.pngbin1037 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/styles/ico_wrong.pngbin286 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/styles/open_new_page.pngbin980 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/triangle-closed-small.pngbin166 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/triangle-closed.pngbin3565 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/triangle-opened-small.pngbin170 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/triangle-opened.pngbin3567 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/uiguidelines1.pngbin5258 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/images/video-droid.pngbin1614 -> 0 bytes
-rw-r--r--tools/droiddoc/templates-sac/assets/js/android_3p-bundle.js2766
-rw-r--r--tools/droiddoc/templates-sac/assets/js/docs.js2609
-rw-r--r--tools/droiddoc/templates-sac/assets/js/prettify.js28
-rw-r--r--tools/droiddoc/templates-sac/class.cs658
-rw-r--r--tools/droiddoc/templates-sac/classes.cs47
-rw-r--r--tools/droiddoc/templates-sac/components/masthead.cs334
-rw-r--r--tools/droiddoc/templates-sac/customizations.cs471
-rw-r--r--tools/droiddoc/templates-sac/data.hdf4
-rw-r--r--tools/droiddoc/templates-sac/designpage.cs90
-rw-r--r--tools/droiddoc/templates-sac/docpage.cs164
-rw-r--r--tools/droiddoc/templates-sac/footer.cs12
-rw-r--r--tools/droiddoc/templates-sac/gcm_navtree_data.cs3
-rw-r--r--tools/droiddoc/templates-sac/gms_navtree_data.cs3
-rw-r--r--tools/droiddoc/templates-sac/head_tag.cs62
-rw-r--r--tools/droiddoc/templates-sac/header.cs7
-rw-r--r--tools/droiddoc/templates-sac/header_tabs.cs2
-rw-r--r--tools/droiddoc/templates-sac/jd_lists_unified.cs1
-rw-r--r--tools/droiddoc/templates-sac/navtree_data.cs3
-rw-r--r--tools/droiddoc/templates-sac/nosidenavpage.cs27
-rw-r--r--tools/droiddoc/templates-sac/package.cs62
-rw-r--r--tools/droiddoc/templates-sac/packages.cs43
-rw-r--r--tools/droiddoc/templates-sac/sampleindex.cs53
-rw-r--r--tools/droiddoc/templates-sac/sdkpage.cs491
-rw-r--r--tools/droiddoc/templates-sac/timestamp.cs1
-rw-r--r--tools/droiddoc/templates-sac/trailer.cs20
-rwxr-xr-xtools/droiddoc/test/stubs/run.sh2
-rw-r--r--tools/fs_config/Android.bp63
-rw-r--r--tools/fs_config/Android.mk60
-rw-r--r--tools/fs_config/README2
-rw-r--r--tools/fs_config/fs_config.c20
-rwxr-xr-xtools/fs_config/fs_config_generator.py38
-rw-r--r--tools/fs_get_stats/Android.bp9
-rw-r--r--tools/fs_get_stats/Android.mk11
-rwxr-xr-xtools/generate-notice-files.py3
-rw-r--r--tools/ijar/Android.bp18
-rw-r--r--tools/ijar/LICENSE203
-rw-r--r--tools/ijar/README.txt120
-rw-r--r--tools/ijar/classfile.cc1788
-rw-r--r--tools/ijar/common.h102
-rw-r--r--tools/ijar/ijar.cc182
-rw-r--r--tools/ijar/zip.cc1032
-rw-r--r--tools/ijar/zip.h173
-rw-r--r--tools/ijar/zip_main.cc312
-rwxr-xr-xtools/java-event-log-tags.py43
-rw-r--r--tools/libhost/Android.bp1
-rw-r--r--tools/libhost/CopyFile.c9
-rw-r--r--tools/makeparallel/Android.bp5
-rwxr-xr-xtools/post_process_props.py2
-rwxr-xr-xtools/releasetools/add_img_to_target_files.py552
-rw-r--r--tools/releasetools/blockimgdiff.py501
-rwxr-xr-xtools/releasetools/build_image.py365
-rwxr-xr-xtools/releasetools/check_ota_package_signature.py57
-rwxr-xr-xtools/releasetools/check_target_files_signatures.py98
-rw-r--r--tools/releasetools/common.py439
-rw-r--r--tools/releasetools/edify_generator.py6
-rwxr-xr-xtools/releasetools/img_from_target_files.py3
-rwxr-xr-xtools/releasetools/ota_from_target_files.py1938
-rw-r--r--tools/releasetools/pylintrc7
-rw-r--r--tools/releasetools/rangelib.py42
-rwxr-xr-xtools/releasetools/sign_target_files_apks.py348
-rw-r--r--tools/releasetools/sparse_img.py75
-rw-r--r--tools/releasetools/test_add_img_to_target_files.py339
-rw-r--r--tools/releasetools/test_blockimgdiff.py135
-rw-r--r--tools/releasetools/test_build_image.py94
-rw-r--r--tools/releasetools/test_common.py449
-rw-r--r--tools/releasetools/test_ota_from_target_files.py1336
-rw-r--r--tools/releasetools/test_sign_target_files_apks.py213
-rw-r--r--tools/releasetools/test_utils.py112
-rw-r--r--tools/releasetools/testdata/media.x509.pem27
-rwxr-xr-xtools/releasetools/testdata/payload_signer.sh4
-rw-r--r--tools/releasetools/testdata/platform.x509.pem27
-rw-r--r--tools/releasetools/testdata/sigfile.bin1
-rw-r--r--tools/releasetools/testdata/signed-sigfile.bin2
-rw-r--r--tools/releasetools/testdata/testkey.pk8bin0 -> 1216 bytes
-rw-r--r--tools/releasetools/testdata/testkey.pubkey.pem9
-rw-r--r--tools/releasetools/testdata/testkey.x509.pem24
-rw-r--r--tools/releasetools/testdata/testkey_with_passwd.pk8bin0 -> 1329 bytes
-rw-r--r--tools/releasetools/testdata/testkey_with_passwd.x509.pem24
-rw-r--r--tools/releasetools/testdata/verity.x509.pem24
-rwxr-xr-xtools/releasetools/validate_target_files.py78
-rw-r--r--tools/signapk/Android.bp31
-rw-r--r--tools/signapk/Android.mk16
-rw-r--r--tools/signapk/OWNERS2
-rw-r--r--tools/signapk/src/com/android/signapk/SignApk.java9
-rw-r--r--tools/signtos/Android.bp27
-rw-r--r--tools/signtos/Android.mk25
-rwxr-xr-xtools/soong_to_convert.py21
-rwxr-xr-xtools/vendor_buildinfo.sh10
-rwxr-xr-xtools/warn.py930
-rw-r--r--tools/zipalign/Android.bp36
-rw-r--r--tools/zipalign/Android.mk38
-rw-r--r--tools/zipalign/ZipFile.cpp67
-rw-r--r--tools/ziptime/Android.bp1
-rw-r--r--tools/ziptime/ZipEntry.cpp2
506 files changed, 15009 insertions, 26066 deletions
diff --git a/Android.mk b/Android.mk
index a1455d4..5053e7d 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,8 +1 @@
-LOCAL_PATH := $(call my-dir)
-
-# We're relocating the build project to a subdirectory, then using symlinks
-# to expose the subdirectories where they used to be. If the manifest hasn't
-# been updated, we need to include all the subdirectories.
-ifeq ($(LOCAL_PATH),build)
-include $(call first-makefiles-under,$(LOCAL_PATH))
-endif
+include $(call all-subdir-makefiles)
diff --git a/Changes.md b/Changes.md
new file mode 100644
index 0000000..37bbad0
--- /dev/null
+++ b/Changes.md
@@ -0,0 +1,116 @@
+# Build System Changes for Android.mk Writers
+
+## Deprecating / obsoleting envsetup.sh variables in Makefiles
+
+It is not required to source envsetup.sh before running a build. Many scripts,
+including a majority of our automated build systems, do not do so. Make will
+transparently make every environment variable available as a make variable.
+This means that relying on environment variables only set up in envsetup.sh will
+produce different output for local users and scripted users.
+
+Many of these variables also include absolute path names, which we'd like to
+keep out of the generated files, so that you don't need to do a full rebuild if
+you move the source tree.
+
+To fix this, we're marking the variables that are set in envsetup.sh as
+deprecated in the makefiles. This will trigger a warning every time one is read
+(or written) inside Kati. Once all the warnings have been removed for a
+particular variable, we'll switch it to obsolete, and any references will become
+errors.
+
+### envsetup.sh variables with make equivalents
+
+| instead of | use |
+|--------------------------------------------------------------|----------------------|
+| OUT {#OUT} | OUT_DIR |
+| ANDROID_HOST_OUT {#ANDROID_HOST_OUT} | HOST_OUT |
+| ANDROID_PRODUCT_OUT {#ANDROID_PRODUCT_OUT} | PRODUCT_OUT |
+| ANDROID_HOST_OUT_TESTCASES {#ANDROID_HOST_OUT_TESTCASES} | HOST_OUT_TESTCASES |
+| ANDROID_TARGET_OUT_TESTCASES {#ANDROID_TARGET_OUT_TESTCASES} | TARGET_OUT_TESTCASES |
+
+All of the make variables may be relative paths from the current directory, or
+absolute paths if the output directory was specified as an absolute path. If you
+need an absolute variable, convert it to absolute during a rule, so that it's
+not expanded into the generated ninja file:
+
+``` make
+$(PRODUCT_OUT)/gen.img: my/src/path/gen.sh
+ export PRODUCT_OUT=$$(cd $(PRODUCT_OUT); pwd); cd my/src/path; ./gen.sh -o $${PRODUCT_OUT}/gen.img
+```
+
+### ANDROID_BUILD_TOP {#ANDROID_BUILD_TOP}
+
+In Android.mk files, you can always assume that the current directory is the
+root of the source tree, so this can just be replaced with '.' (which is what
+$TOP is hardcoded to), or removed entirely. If you need an absolute path, see
+the instructions above.
+
+### Stop using PATH directly {#PATH}
+
+This isn't only set by envsetup.sh, but it is modified by it. Due to that it's
+rather easy for this to change between different shells, and it's not ideal to
+reread the makefiles every time this changes.
+
+In most cases, you shouldn't need to touch PATH at all. When you need to have a
+rule reference a particular binary that's part of the source tree or outputs,
+it's preferrable to just use the path to the file itself (since you should
+already be adding that as a dependency).
+
+Depending on the rule, passing the file path itself may not be feasible due to
+layers of unchangable scripts/binaries. In that case, be sure to add the
+dependency, but modify the PATH within the rule itself:
+
+``` make
+$(TARGET): myscript my/path/binary
+ PATH=my/path:$$PATH myscript -o $@
+```
+
+### Stop using PYTHONPATH directly {#PYTHONPATH}
+
+Like PATH, this isn't only set by envsetup.sh, but it is modified by it. Due to
+that it's rather easy for this to change between different shells, and it's not
+ideal to reread the makefiles every time.
+
+The best solution here is to start switching to Soong's python building support,
+which packages the python interpreter, libraries, and script all into one file
+that no longer needs PYTHONPATH. See fontchain_lint for examples of this:
+
+* [external/fonttools/Lib/fontTools/Android.bp] for python_library_host
+* [frameworks/base/Android.bp] for python_binary_host
+* [frameworks/base/data/fonts/Android.mk] to execute the python binary
+
+If you still need to use PYTHONPATH, do so within the rule itself, just like
+path:
+
+``` make
+$(TARGET): myscript.py $(sort $(shell find my/python/lib -name '*.py'))
+ PYTHONPATH=my/python/lib:$$PYTHONPATH myscript.py -o $@
+```
+### Stop using PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE directly {#PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE}
+
+Specify Framework Compatibility Matrix Version in device manifest by adding a `target-level`
+attribute to the root element `<manifest>`. If `PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE`
+is 26 or 27, you can add `"target-level"="1"` to your device manifest instead.
+
+### Stop using USE_CLANG_PLATFORM_BUILD {#USE_CLANG_PLATFORM_BUILD}
+
+Clang is the default and only supported Android compiler, so there is no reason
+for this option to exist.
+
+### Other envsetup.sh variables {#other_envsetup_variables}
+
+* ANDROID_TOOLCHAIN
+* ANDROID_TOOLCHAIN_2ND_ARCH
+* ANDROID_DEV_SCRIPTS
+* ANDROID_EMULATOR_PREBUILTS
+* ANDROID_PRE_BUILD_PATHS
+
+These are all exported from envsetup.sh, but don't have clear equivalents within
+the makefile system. If you need one of them, you'll have to set up your own
+version.
+
+
+[build/soong/Changes.md]: https://android.googlesource.com/platform/build/soong/+/master/Changes.md
+[external/fonttools/Lib/fontTools/Android.bp]: https://android.googlesource.com/platform/external/fonttools/+/master/Lib/fontTools/Android.bp
+[frameworks/base/Android.bp]: https://android.googlesource.com/platform/frameworks/base/+/master/Android.bp
+[frameworks/base/data/fonts/Android.mk]: https://android.googlesource.com/platform/frameworks/base/+/master/data/fonts/Android.mk
diff --git a/CleanSpec.mk b/CleanSpec.mk
index fff622f..7677261 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -424,10 +424,70 @@ $(call add-clean-step, rm -rf $(OUT_DIR)/versions_checked.mk)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/vendor/nativetest*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/nativetest*)
+# Jack is no longer the default compiler, remove the intermediates
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/*/*/classes*.jack)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/*/*/jack*)
+
# Move adbd from $(PRODUCT_OUT)/root/sbin to $(PRODUCT_OUT)/system/bin
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/sbin/adbd)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/symbols/sbin/adbd)
+# Soong linux -> linux_glibc rename
+$(call add-clean-step, find $(SOONG_OUT_DIR)/.intermediates -name 'linux_x86*' | xargs rm -rf)
+$(call add-clean-step, find $(SOONG_OUT_DIR)/.intermediates -name 'linux_common*' | xargs rm -rf)
+
+# Remove old aidl/logtags files that may be in the generated source directory
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/*/*_intermediates/src)
+$(call add-clean-step, rm -f $(OUT_DIR)/target/common/obj/*/*_intermediates/java-source-list)
+$(call add-clean-step, rm -rf $(OUT_DIR)/host/common/obj/*/*_intermediates/src)
+$(call add-clean-step, rm -f $(OUT_DIR)/host/common/obj/*/*_intermediates/java-source-list)
+
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/*/flat-res)
+
+# Remove old VNDK directories without version
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/vndk)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/vndk-sp)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib64/vndk)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib64/vndk-sp)
+
+# Remove old dex output directories
+$(call add-clean-step, rm -rf $(TARGET_OUT_COMMON_INTERMEDIATES)/*/*_intermediates/with-local/)
+$(call add-clean-step, rm -rf $(TARGET_OUT_COMMON_INTERMEDIATES)/*/*_intermediates/no-local/)
+$(call add-clean-step, rm -rf $(HOST_OUT_COMMON_INTERMEDIATES)/*/*_intermediates/with-local/)
+$(call add-clean-step, rm -rf $(HOST_OUT_COMMON_INTERMEDIATES)/*/*_intermediates/no-local/)
+
+# Remove legacy VINTF metadata files
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/manifest.xml)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/vendor/manifest.xml)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/manifest.xml)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/vendor/compatibility_matrix.xml)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/compatibility_matrix.xml)
+
+# Remove DisplayCutoutEmulation overlays
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/overlay/DisplayCutoutEmulationWide)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/overlay/DisplayCutoutEmulationNarrow)
+
+# Remove obsolete intermedates src files
+$(call add-clean-step, rm -rf $(TARGET_OUT_COMMON_INTERMEDIATES)/*/*_intermediates/src/RenderScript.stamp*)
+$(call add-clean-step, rm -rf $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS/*_intermediates/src)
+$(call add-clean-step, rm -rf $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/*_intermediates/src)
+$(call add-clean-step, rm -rf $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS/*_intermediates/java-source-list)
+$(call add-clean-step, rm -rf $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/*_intermediates/java-source-list)
+$(call add-clean-step, rm -rf $(OUT_DOCS)/*-timestamp)
+
+$(call add-clean-step, rm -rf $(TARGET_COMMON_OUT_ROOT)/obj_asan/APPS/*_intermediates/src)
+$(call add-clean-step, rm -rf $(TARGET_COMMON_OUT_ROOT)/obj_asan/JAVA_LIBRARIES/*_intermediates/src)
+$(call add-clean-step, rm -rf $(TARGET_COMMON_OUT_ROOT)/obj_asan/APPS/*_intermediates/java-source-list)
+$(call add-clean-step, rm -rf $(TARGET_COMMON_OUT_ROOT)/obj_asan/JAVA_LIBRARIES/*_intermediates/java-source-list)
+
+# Remove stale init.noenforce.rc
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/init/gsi/init.noenforce.rc)
+
+# Clean up Launcher3 which has been replaced with Launcher3QuickStep
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/Launcher3)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/priv-app/Launcher3)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/Launcher3_intermediates)
+
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
diff --git a/OWNERS b/OWNERS
index 89cea0d..1e9b763 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,6 +1,11 @@
ccross@android.com
dwillemsen@google.com
+nanzhang@google.com
+
+per-file * = ccross@android.com
+per-file * = dwillemsen@google.com
+per-file * = nanzhang@google.com
# for version updates
per-file version_defaults.mk = aseaton@google.com
-per-file version_defaults.mk = elisapascual@google.com \ No newline at end of file
+per-file version_defaults.mk = elisapascual@google.com
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..47809a9
--- /dev/null
+++ b/README.md
@@ -0,0 +1,23 @@
+# Android Make Build System
+
+This is the Makefile-based portion of the Android Build System.
+
+For documentation on how to run a build, see [Usage.txt](Usage.txt)
+
+For a list of behavioral changes useful for Android.mk writers see
+[Changes.md](Changes.md)
+
+For an outdated reference on Android.mk files, see
+[build-system.html](/core/build-system.html). Our Android.mk files look similar,
+but are entirely different from the Android.mk files used by the NDK build
+system. When searching for documentation elsewhere, ensure that it is for the
+platform build system -- most are not.
+
+This Makefile-based system is in the process of being replaced with [Soong], a
+new build system written in Go. During the transition, all of these makefiles
+are read by [Kati], and generate a ninja file instead of being executed
+directly. That's combined with a ninja file read by Soong so that the build
+graph of the two systems can be combined and run as one.
+
+[Kati]: https://github.com/google/kati
+[Soong]: https://android.googlesource.com/platform/build/soong/+/master
diff --git a/Usage.txt b/Usage.txt
new file mode 100644
index 0000000..004210b
--- /dev/null
+++ b/Usage.txt
@@ -0,0 +1,85 @@
+Android build system usage:
+
+m [-j] [<targets>] [<variable>=<value>...]
+
+
+Ways to specify what to build:
+ The common way to specify what to build is to set that information in the
+ environment via:
+
+ # Set up the shell environment.
+ source build/envsetup.sh # Run "hmm" after sourcing for more info
+ # Select the device and variant to target. If no argument is given, it
+ # will list choices and prompt.
+ lunch [<product>-<variant>] # Selects the device and variant to target.
+ # Invoke the configured build.
+ m [<options>] [<targets>] [<variable>=<value>...]
+
+ <product> is the device that the created image is intended to be run on.
+ This is saved in the shell environment as $TARGET_PRODUCT by `lunch`.
+ <variant> is one of "user", "userdebug", or "eng", and controls the
+ amount of debugging to be added into the generated image.
+ This gets saved in the shell environment as $TARGET_BUILD_VARIANT by
+ `lunch`.
+
+ Each of <options>, <targets>, and <variable>=<value> is optional.
+ If no targets are specified, the build system will build the images
+ for the configured product and variant.
+
+ An alternative to setting $TARGET_PRODUCT and $TARGET_BUILD_VARIANT,
+ which you may see in build servers, is to execute:
+
+ make PRODUCT-<product>-<variant>
+
+
+ A target may be a file path. For example, out/host/linux-x86/bin/adb .
+ Note that when giving a relative file path as a target, that path is
+ interpreted relative to the root of the source tree (rather than relative
+ to the current working directory).
+
+ A target may also be any other target defined within a Makefile. Run
+ `m help` to view the names of some common targets.
+
+ To view the modules and targets defined in a particular directory, look for:
+ files named *.mk (most commonly Android.mk)
+ these files are defined in Make syntax
+ files named Android.bp
+ these files are defined in Blueprint syntax
+
+ For now, the full (extremely large) compiled list of targets can be found
+ (after running the build once), split among these two files:
+
+ ${OUT}/build-<product>*.ninja
+ ${OUT}/soong/build.ninja
+
+ If you find yourself interacting with these files, you are encouraged to
+ provide a more convenient tool for browsing targets, and to mention the
+ tool here.
+
+Targets that adjust an existing build:
+ showcommands Display the individual commands run to implement
+ the build
+ dist Copy into ${DIST_DIR} the portion of the build
+ that must be distributed
+
+Flags
+ -j <N> Run <N> processes at once
+ -j Autodetect the number of processes to run at once,
+ and run that many
+
+Variables
+ Variables can either be set in the surrounding shell environment or can be
+ passed as command-line arguments. For example:
+ export I_AM_A_SHELL_VAR=1
+ I_AM_ANOTHER_SHELL_VAR=2 make droid I_AM_A_MAKE_VAR=3
+ Here are some common variables and their meanings:
+ TARGET_PRODUCT The <product> to build # as described above
+ TARGET_BUILD_VARIANT The <variant> to build # as described above
+ DIST_DIR The directory in which to place the distribution
+ artifacts.
+ OUT_DIR The directory in which to place non-distribution
+ artifacts.
+
+ There is not yet known a convenient method by which to discover the full
+ list of supported variables. Please mention it here when there is.
+
diff --git a/core/Makefile b/core/Makefile
index 618e983..0a2f6e3 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -4,15 +4,6 @@
# intermedites-dir-for
LOCAL_PATH := $(BUILD_SYSTEM)
-# Pick a reasonable string to use to identify files.
-ifneq (,$(filter eng.%,$(BUILD_NUMBER)))
- # BUILD_NUMBER has a timestamp in it, which means that
- # it will change every time. Pick a stable value.
- FILE_NAME_TAG := eng.$(USER)
-else
- FILE_NAME_TAG := $(BUILD_NUMBER)
-endif
-
# -----------------------------------------------------------------
# Define rules to copy PRODUCT_COPY_FILES defined by the product.
# PRODUCT_COPY_FILES contains words like <source file>:<dest file>[:<owner>].
@@ -21,9 +12,11 @@ endif
# The filter part means "only eval the copy-one-file rule if this
# src:dest pair is the first one to match the same dest"
#$(1): the src:dest pair
+#$(2): the dest
define check-product-copy-files
-$(if $(filter %.apk, $(call word-colon, 2, $(1))),$(error \
- Prebuilt apk found in PRODUCT_COPY_FILES: $(1), use BUILD_PREBUILT instead!))
+$(if $(filter-out $(TARGET_COPY_OUT_SYSTEM_OTHER)/%,$(2)), \
+ $(if $(filter %.apk, $(2)),$(error \
+ Prebuilt apk found in PRODUCT_COPY_FILES: $(1), use BUILD_PREBUILT instead!)))
endef
# filter out the duplicate <source file>:<dest file> pairs.
unique_product_copy_files_pairs :=
@@ -31,22 +24,46 @@ $(foreach cf,$(PRODUCT_COPY_FILES), \
$(if $(filter $(unique_product_copy_files_pairs),$(cf)),,\
$(eval unique_product_copy_files_pairs += $(cf))))
unique_product_copy_files_destinations :=
+product_copy_files_ignored :=
$(foreach cf,$(unique_product_copy_files_pairs), \
$(eval _src := $(call word-colon,1,$(cf))) \
$(eval _dest := $(call word-colon,2,$(cf))) \
- $(call check-product-copy-files,$(cf)) \
+ $(call check-product-copy-files,$(cf),$(_dest)) \
$(if $(filter $(unique_product_copy_files_destinations),$(_dest)), \
- $(info PRODUCT_COPY_FILES $(cf) ignored.), \
+ $(eval product_copy_files_ignored += $(cf)), \
$(eval _fulldest := $(call append-path,$(PRODUCT_OUT),$(_dest))) \
$(if $(filter %.xml,$(_dest)),\
$(eval $(call copy-xml-file-checked,$(_src),$(_fulldest))),\
- $(eval $(call copy-one-file,$(_src),$(_fulldest)))) \
+ $(if $(and $(filter %.jar,$(_dest)),$(filter $(basename $(notdir $(_dest))),$(PRODUCT_LOADED_BY_PRIVILEGED_MODULES))),\
+ $(eval $(call copy-and-uncompress-dexs,$(_src),$(_fulldest))), \
+ $(eval $(call copy-one-file,$(_src),$(_fulldest))))) \
$(eval ALL_DEFAULT_INSTALLED_MODULES += $(_fulldest)) \
$(eval unique_product_copy_files_destinations += $(_dest))))
+
+# Dump a list of overriden (and ignored PRODUCT_COPY_FILES entries)
+$(file >$(PRODUCT_OUT)/product_copy_files_ignored.txt,$(subst $(space),$(newline),$(strip $(product_copy_files_ignored))))
+ifdef dist_goal
+$(file >$(DIST_DIR)/logs/product_copy_files_ignored.txt,$(subst $(space),$(newline),$(strip $(product_copy_files_ignored))))
+endif
+
+product_copy_files_ignored :=
unique_product_copy_files_pairs :=
unique_product_copy_files_destinations :=
# -----------------------------------------------------------------
+# Returns the max allowed size for an image suitable for hash verification
+# (e.g., boot.img, recovery.img, etc).
+# The value 69632 derives from MAX_VBMETA_SIZE + MAX_FOOTER_SIZE in $(AVBTOOL).
+# $(1): partition size to flash the image
+define get-hash-image-max-size
+$(if $(1), \
+ $(if $(filter true,$(BOARD_AVB_ENABLE)), \
+ $(eval _hash_meta_size := 69632), \
+ $(eval _hash_meta_size := 0)) \
+ $(1)-$(_hash_meta_size))
+endef
+
+# -----------------------------------------------------------------
# Define rules to copy headers defined in copy_headers.mk
# If more than one makefile declared a header, print a warning,
# then copy the last one defined. This matches the previous make
@@ -70,6 +87,27 @@ $(gen): frameworks/base/docs/docs-redirect-index.html
@cp -f $< $@
endif
+ndk_doxygen_out := $(OUT_NDK_DOCS)
+ndk_headers := $(SOONG_OUT_DIR)/ndk/sysroot/usr/include
+ndk_docs_src_dir := frameworks/native/docs
+ndk_doxyfile := $(ndk_docs_src_dir)/Doxyfile
+ifneq ($(wildcard $(ndk_docs_src_dir)),)
+ndk_docs_srcs := $(addprefix $(ndk_docs_src_dir)/,\
+ $(call find-files-in-subdirs,$(ndk_docs_src_dir),"*",.))
+$(ndk_doxygen_out)/index.html: $(ndk_docs_srcs) $(SOONG_OUT_DIR)/ndk.timestamp
+ @mkdir -p $(ndk_doxygen_out)
+ @echo "Generating NDK docs to $(ndk_doxygen_out)"
+ @( cat $(ndk_doxyfile); \
+ echo "INPUT=$(ndk_headers)"; \
+ echo "HTML_OUTPUT=$(ndk_doxygen_out)" \
+ ) | doxygen -
+
+# Note: Not a part of the docs target because we don't have doxygen available.
+# You can run this target locally if you have doxygen installed.
+ndk-docs: $(ndk_doxygen_out)/index.html
+.PHONY: ndk-docs
+endif
+
# -----------------------------------------------------------------
# property_overrides_split_enabled
property_overrides_split_enabled :=
@@ -78,6 +116,28 @@ ifeq ($(BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED), true)
endif
# -----------------------------------------------------------------
+# FINAL_VENDOR_DEFAULT_PROPERTIES will be installed in vendor/default.prop if
+# property_overrides_split_enabled is true. Otherwise it will be installed in
+# ROOT/default.prop.
+ifdef BOARD_VNDK_VERSION
+ ifeq ($(BOARD_VNDK_VERSION),current)
+ FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION)
+ else
+ FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(BOARD_VNDK_VERSION)
+ endif
+ ifdef BOARD_VNDK_RUNTIME_DISABLE
+ FINAL_VENDOR_DEFAULT_PROPERTIES += ro.vndk.lite=true
+ endif
+else
+ FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION)
+ FINAL_VENDOR_DEFAULT_PROPERTIES += ro.vndk.lite=true
+endif
+FINAL_VENDOR_DEFAULT_PROPERTIES += \
+ $(call collapse-pairs, $(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))
+FINAL_VENDOR_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \
+ $(FINAL_VENDOR_DEFAULT_PROPERTIES),=)
+
+# -----------------------------------------------------------------
# prop.default
ifdef property_overrides_split_enabled
INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_OUT)/etc/prop.default
@@ -90,10 +150,11 @@ INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_ROOT_OUT)/default.prop
endif
ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_TARGET)
FINAL_DEFAULT_PROPERTIES := \
- $(call collapse-pairs, $(ADDITIONAL_DEFAULT_PROPERTIES))
+ $(call collapse-pairs, $(ADDITIONAL_DEFAULT_PROPERTIES)) \
+ $(call collapse-pairs, $(PRODUCT_SYSTEM_DEFAULT_PROPERTIES))
ifndef property_overrides_split_enabled
FINAL_DEFAULT_PROPERTIES += \
- $(call collapse-pairs, $(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))
+ $(call collapse-pairs, $(FINAL_VENDOR_DEFAULT_PROPERTIES))
endif
FINAL_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \
$(FINAL_DEFAULT_PROPERTIES),=)
@@ -115,7 +176,7 @@ $(INSTALLED_DEFAULT_PROP_TARGET): $(intermediate_system_build_prop)
$(hide) echo ro.bootimage.build.date=`$(DATE_FROM_FILE)`>>$@
$(hide) echo ro.bootimage.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@
$(hide) echo ro.bootimage.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@
- $(hide) build/tools/post_process_props.py $@
+ $(hide) build/make/tools/post_process_props.py $@
ifdef property_overrides_split_enabled
$(hide) mkdir -p $(TARGET_ROOT_OUT)
$(hide) ln -sf system/etc/prop.default $(INSTALLED_DEFAULT_PROP_OLD_TARGET)
@@ -128,11 +189,6 @@ ifdef property_overrides_split_enabled
INSTALLED_VENDOR_DEFAULT_PROP_TARGET := $(TARGET_OUT_VENDOR)/default.prop
ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET)
-FINAL_VENDOR_DEFAULT_PROPERTIES += \
- $(call collapse-pairs, $(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))
-FINAL_VENDOR_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \
- $(FINAL_VENDOR_DEFAULT_PROPERTIES),=)
-
$(INSTALLED_VENDOR_DEFAULT_PROP_TARGET): $(INSTALLED_DEFAULT_PROP_TARGET)
@echo Target buildinfo: $@
@mkdir -p $(dir $@)
@@ -141,7 +197,7 @@ $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET): $(INSTALLED_DEFAULT_PROP_TARGET)
echo "#" >> $@;
$(hide) $(foreach line,$(FINAL_VENDOR_DEFAULT_PROPERTIES), \
echo "$(line)" >> $@;)
- $(hide) build/tools/post_process_props.py $@
+ $(hide) build/make/tools/post_process_props.py $@
endif # property_overrides_split_enabled
@@ -179,30 +235,37 @@ $(intermediate_system_build_prop): PRIVATE_BUILD_DESC := $(build_desc)
# The string used to uniquely identify the combined build and product; used by the OTA server.
ifeq (,$(strip $(BUILD_FINGERPRINT)))
- ifneq ($(filter eng.%,$(BUILD_NUMBER)),)
- # Trim down BUILD_FINGERPRINT: the default BUILD_NUMBER makes it easily exceed
- # the Android system property length limit (PROPERTY_VALUE_MAX=92).
- BF_BUILD_NUMBER := $(shell echo $${USER:0:6})$(shell $(DATE) +%m%d%H%M)
+ ifeq ($(strip $(HAS_BUILD_NUMBER)),false)
+ BF_BUILD_NUMBER := $(USER)$$($(DATE_FROM_FILE) +%m%d%H%M)
else
- BF_BUILD_NUMBER := $(BUILD_NUMBER)
+ BF_BUILD_NUMBER := $(file <$(BUILD_NUMBER_FILE))
endif
BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BF_BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
endif
-ifneq ($(words $(BUILD_FINGERPRINT)),1)
- $(error BUILD_FINGERPRINT cannot contain spaces: "$(BUILD_FINGERPRINT)")
-endif
+# unset it for safety.
+BF_BUILD_NUMBER :=
-$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_FINGERPRINT) > $(PRODUCT_OUT)/build_fingerprint.txt)
-BUILD_FINGERPRINT_FROM_FILE := $$(cat $(PRODUCT_OUT)/build_fingerprint.txt)
+BUILD_FINGERPRINT_FILE := $(PRODUCT_OUT)/build_fingerprint.txt
+ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_FINGERPRINT) >$(BUILD_FINGERPRINT_FILE) && grep " " $(BUILD_FINGERPRINT_FILE)))
+ $(error BUILD_FINGERPRINT cannot contain spaces: "$(file <$(BUILD_FINGERPRINT_FILE))")
+endif
+BUILD_FINGERPRINT_FROM_FILE := $$(cat $(BUILD_FINGERPRINT_FILE))
+# unset it for safety.
+BUILD_FINGERPRINT :=
# The string used to uniquely identify the system build; used by the OTA server.
# This purposefully excludes any product-specific variables.
ifeq (,$(strip $(BUILD_THUMBPRINT)))
- BUILD_THUMBPRINT := $(PLATFORM_VERSION)/$(BUILD_ID)/$(BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
+ BUILD_THUMBPRINT := $(PLATFORM_VERSION)/$(BUILD_ID)/$(BUILD_NUMBER_FROM_FILE):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
endif
-ifneq ($(words $(BUILD_THUMBPRINT)),1)
- $(error BUILD_THUMBPRINT cannot contain spaces: "$(BUILD_THUMBPRINT)")
+
+BUILD_THUMBPRINT_FILE := $(PRODUCT_OUT)/build_thumbprint.txt
+ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_THUMBPRINT) >$(BUILD_THUMBPRINT_FILE) && grep " " $(BUILD_THUMBPRINT_FILE)))
+ $(error BUILD_THUMBPRINT cannot contain spaces: "$(file <$(BUILD_THUMBPRINT_FILE))")
endif
+BUILD_THUMBPRINT_FROM_FILE := $$(cat $(BUILD_THUMBPRINT_FILE))
+# unset it for safety.
+BUILD_THUMBPRINT :=
KNOWN_OEM_THUMBPRINT_PROPERTIES := \
ro.product.brand \
@@ -235,15 +298,15 @@ define get-default-product-locale
$(strip $(subst _,-, $(firstword $(1))))
endef
-BUILDINFO_SH := build/tools/buildinfo.sh
-VENDOR_BUILDINFO_SH := build/tools/vendor_buildinfo.sh
+BUILDINFO_SH := build/make/tools/buildinfo.sh
+VENDOR_BUILDINFO_SH := build/make/tools/vendor_buildinfo.sh
# TARGET_BUILD_FLAVOR and ro.build.flavor are used only by the test
# harness to distinguish builds. Only add _asan for a sanitized build
# if it isn't already a part of the flavor (via a dedicated lunch
# config for example).
TARGET_BUILD_FLAVOR := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)
-ifdef SANITIZE_TARGET
+ifneq (, $(filter address, $(SANITIZE_TARGET)))
ifeq (,$(findstring _asan,$(TARGET_BUILD_FLAVOR)))
TARGET_BUILD_FLAVOR := $(TARGET_BUILD_FLAVOR)_asan
endif
@@ -254,7 +317,7 @@ system_prop_file := $(TARGET_SYSTEM_PROP)
else
system_prop_file := $(wildcard $(TARGET_DEVICE_DIR)/system.prop)
endif
-$(intermediate_system_build_prop): $(VENDOR_BUILDINFO_SH) $(BUILDINFO_SH) $(INTERNAL_BUILD_ID_MAKEFILE) $(BUILD_SYSTEM)/version_defaults.mk $(system_prop_file) $(INSTALLED_ANDROID_INFO_TXT_TARGET)
+$(intermediate_system_build_prop): $(BUILDINFO_SH) $(INTERNAL_BUILD_ID_MAKEFILE) $(BUILD_SYSTEM)/version_defaults.mk $(system_prop_file) $(INSTALLED_ANDROID_INFO_TXT_TARGET)
@echo Target buildinfo: $@
@mkdir -p $(dir $@)
$(hide) echo > $@
@@ -288,9 +351,10 @@ endif
PLATFORM_PREVIEW_SDK_VERSION="$(PLATFORM_PREVIEW_SDK_VERSION)" \
PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \
PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \
+ PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION="$(PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION)" \
BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
BUILD_FINGERPRINT="$(BUILD_FINGERPRINT_FROM_FILE)" \
- $(if $(OEM_THUMBPRINT_PROPERTIES),BUILD_THUMBPRINT="$(BUILD_THUMBPRINT)") \
+ $(if $(OEM_THUMBPRINT_PROPERTIES),BUILD_THUMBPRINT="$(BUILD_THUMBPRINT_FROM_FILE)") \
TARGET_CPU_ABI_LIST="$(TARGET_CPU_ABI_LIST)" \
TARGET_CPU_ABI_LIST_32_BIT="$(TARGET_CPU_ABI_LIST_32_BIT)" \
TARGET_CPU_ABI_LIST_64_BIT="$(TARGET_CPU_ABI_LIST_64_BIT)" \
@@ -298,16 +362,6 @@ endif
TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \
TARGET_AAPT_CHARACTERISTICS="$(TARGET_AAPT_CHARACTERISTICS)" \
bash $(BUILDINFO_SH) >> $@
-ifndef property_overrides_split_enabled
- $(hide) TARGET_DEVICE="$(TARGET_DEVICE)" \
- PRODUCT_NAME="$(TARGET_PRODUCT)" \
- PRODUCT_BRAND="$(PRODUCT_BRAND)" \
- PRODUCT_MODEL="$(PRODUCT_MODEL)" \
- PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \
- TARGET_BOOTLOADER_BOARD_NAME="$(TARGET_BOOTLOADER_BOARD_NAME)" \
- TARGET_BOARD_PLATFORM="$(TARGET_BOARD_PLATFORM)" \
- bash $(VENDOR_BUILDINFO_SH) >> $@
-endif
$(hide) $(foreach file,$(system_prop_file), \
if [ -f "$(file)" ]; then \
echo "#" >> $@; \
@@ -324,7 +378,7 @@ endif
$(hide) $(foreach line,$(FINAL_BUILD_PROPERTIES), \
echo "$(line)" >> $@;)
$(hide) cat $(INSTALLED_ANDROID_INFO_TXT_TARGET) | grep 'require version-' | sed -e 's/require version-/ro.build.expect./g' >> $@
- $(hide) build/tools/post_process_props.py $@ $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_PROPERTY_BLACKLIST)
+ $(hide) build/make/tools/post_process_props.py $@ $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_PROPERTY_BLACKLIST)
build_desc :=
@@ -336,11 +390,7 @@ endif
$(INSTALLED_BUILD_PROP_TARGET): $(intermediate_system_build_prop) $(INSTALLED_RECOVERYIMAGE_TARGET)
@echo "Target build info: $@"
-ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
$(hide) grep -v 'ro.product.first_api_level' $(intermediate_system_build_prop) > $@
-else
- $(hide) cat $(intermediate_system_build_prop) > $@
-endif
ifdef INSTALLED_RECOVERYIMAGE_TARGET
$(hide) echo ro.expect.recovery_id=`cat $(RECOVERYIMAGE_ID_FILE)` >> $@
endif
@@ -349,7 +399,6 @@ endif
# vendor build.prop
#
# For verifying that the vendor build is what we think it is
-ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
INSTALLED_VENDOR_BUILD_PROP_TARGET := $(TARGET_OUT_VENDOR)/build.prop
ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_VENDOR_BUILD_PROP_TARGET)
@@ -368,7 +417,10 @@ $(INSTALLED_VENDOR_BUILD_PROP_TARGET): $(VENDOR_BUILDINFO_SH) $(intermediate_sys
$(hide) echo ro.vendor.build.date=`$(DATE_FROM_FILE)`>>$@
$(hide) echo ro.vendor.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@
$(hide) echo ro.vendor.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@
-ifdef property_overrides_split_enabled
+ $(hide) echo ro.vendor.build.security_patch="$(VENDOR_SECURITY_PATCH)">>$@
+ $(hide) echo ro.vendor.product.cpu.abilist="$(TARGET_CPU_ABI_LIST)">>$@
+ $(hide) echo ro.vendor.product.cpu.abilist32="$(TARGET_CPU_ABI_LIST_32_BIT)">>$@
+ $(hide) echo ro.vendor.product.cpu.abilist64="$(TARGET_CPU_ABI_LIST_64_BIT)">>$@
$(hide) TARGET_DEVICE="$(TARGET_DEVICE)" \
PRODUCT_NAME="$(TARGET_PRODUCT)" \
PRODUCT_BRAND="$(PRODUCT_BRAND)" \
@@ -377,14 +429,40 @@ ifdef property_overrides_split_enabled
TARGET_BOOTLOADER_BOARD_NAME="$(TARGET_BOOTLOADER_BOARD_NAME)" \
TARGET_BOARD_PLATFORM="$(TARGET_BOARD_PLATFORM)" \
bash $(VENDOR_BUILDINFO_SH) >> $@
+ifdef property_overrides_split_enabled
$(hide) echo "#" >> $@; \
echo "# ADDITIONAL VENDOR BUILD PROPERTIES" >> $@; \
echo "#" >> $@;
$(hide) $(foreach line,$(FINAL_VENDOR_BUILD_PROPERTIES), \
echo "$(line)" >> $@;)
- $(hide) build/tools/post_process_props.py $@
endif # property_overrides_split_enabled
-endif # BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
+ $(hide) build/make/tools/post_process_props.py $@ $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_PROPERTY_BLACKLIST)
+
+# -----------------------------------------------------------------
+# product build.prop
+INSTALLED_PRODUCT_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT)/build.prop
+ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PRODUCT_BUILD_PROP_TARGET)
+
+FINAL_PRODUCT_PROPERTIES += \
+ $(call collapse-pairs, $(PRODUCT_PRODUCT_PROPERTIES))
+FINAL_PRODUCT_PROPERTIES := $(call uniq-pairs-by-first-component, \
+ $(FINAL_PRODUCT_PROPERTIES),=)
+
+$(INSTALLED_PRODUCT_BUILD_PROP_TARGET):
+ @echo Target product buildinfo: $@
+ @mkdir -p $(dir $@)
+ $(hide) echo > $@
+ifdef BOARD_USES_PRODUCTIMAGE
+ $(hide) echo ro.product.build.date=`$(DATE_FROM_FILE)`>>$@
+ $(hide) echo ro.product.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@
+ $(hide) echo ro.product.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@
+endif # BOARD_USES_PRODUCTIMAGE
+ $(hide) echo "#" >> $@; \
+ echo "# ADDITIONAL PRODUCT PROPERTIES" >> $@; \
+ echo "#" >> $@;
+ $(hide) $(foreach line,$(FINAL_PRODUCT_PROPERTIES), \
+ echo "$(line)" >> $@;)
+ $(hide) build/make/tools/post_process_props.py $@
# ----------------------------------------------------------------
@@ -428,7 +506,7 @@ ifeq ($(PACKAGES_TO_STAT),)
# Create empty package stats file if target builds no jar(s) or apk(s).
$(hide) touch $@
else
- $(hide) build/tools/dump-package-stats $^ > $@
+ $(hide) build/make/tools/dump-package-stats $^ > $@
endif
.PHONY: package-stats
@@ -488,9 +566,9 @@ SOONG_CONV := $(sort $(SOONG_CONV))
SOONG_CONV_DATA := $(call intermediates-dir-for,PACKAGING,soong_conversion)/soong_conv_data
$(SOONG_CONV_DATA):
@rm -f $@
- @$(foreach s,$(SOONG_CONV),echo "$(s),$(sort $(SOONG_CONV.$(s).PROBLEMS)),$(sort $(filter-out $(SOONG_ALREADY_CONV),$(SOONG_CONV.$(s).DEPS)))" >>$@;)
+ @$(foreach s,$(SOONG_CONV),echo "$(s),$(SOONG_CONV.$(s).TYPE),$(sort $(SOONG_CONV.$(s).PROBLEMS)),$(sort $(filter-out $(SOONG_ALREADY_CONV),$(SOONG_CONV.$(s).DEPS)))" >>$@;)
-SOONG_TO_CONVERT_SCRIPT := build/tools/soong_to_convert.py
+SOONG_TO_CONVERT_SCRIPT := build/make/tools/soong_to_convert.py
SOONG_TO_CONVERT := $(PRODUCT_OUT)/soong_to_convert.txt
$(SOONG_TO_CONVERT): $(SOONG_CONV_DATA) $(SOONG_TO_CONVERT_SCRIPT)
@rm -f $@
@@ -498,6 +576,28 @@ $(SOONG_TO_CONVERT): $(SOONG_CONV_DATA) $(SOONG_TO_CONVERT_SCRIPT)
$(call dist-for-goals,droidcore,$(SOONG_TO_CONVERT))
# -----------------------------------------------------------------
+# Modules use -Wno-error, or added default -Wall -Werror
+WALL_WERROR := $(PRODUCT_OUT)/wall_werror.txt
+$(WALL_WERROR):
+ @rm -f $@
+ echo "# Modules using -Wno-error" >> $@
+ for m in $(sort $(SOONG_MODULES_USING_WNO_ERROR) $(MODULES_USING_WNO_ERROR)); do echo $$m >> $@; done
+ echo "# Modules added default -Wall" >> $@
+ for m in $(sort $(SOONG_MODULES_ADDED_WALL) $(MODULES_ADDED_WALL)); do echo $$m >> $@; done
+
+$(call dist-for-goals,droidcore,$(WALL_WERROR))
+
+# -----------------------------------------------------------------
+# Modules missing profile files
+PGO_PROFILE_MISSING := $(PRODUCT_OUT)/pgo_profile_file_missing.txt
+$(PGO_PROFILE_MISSING):
+ @rm -f $@
+ echo "# Modules missing PGO profile files" >> $@
+ for m in $(SOONG_MODULES_MISSING_PGO_PROFILE_FILE); do echo $$m >> $@; done
+
+$(call dist-for-goals,droidcore,$(PGO_PROFILE_MISSING))
+
+# -----------------------------------------------------------------
# The dev key is used to sign this package, and as the key required
# for future OTA packages installed by this system. Actual product
# deliverables will be re-signed by hand. We expect this file to
@@ -531,7 +631,7 @@ all_event_log_tags_src := \
pdk_fusion_log_tags_file := $(patsubst $(PRODUCT_OUT)/%,$(_pdk_fusion_intermediates)/%,$(filter $(event_log_tags_file),$(ALL_PDK_FUSION_FILES)))
$(all_event_log_tags_file): PRIVATE_SRC_FILES := $(all_event_log_tags_src) $(pdk_fusion_log_tags_file)
-$(all_event_log_tags_file): $(all_event_log_tags_src) $(pdk_fusion_log_tags_file) $(MERGETAGS) build/tools/event_log_tags.py
+$(all_event_log_tags_file): $(all_event_log_tags_src) $(pdk_fusion_log_tags_file) $(MERGETAGS) build/make/tools/event_log_tags.py
$(hide) mkdir -p $(dir $@)
$(hide) $(MERGETAGS) -o $@ $(PRIVATE_SRC_FILES)
@@ -547,7 +647,7 @@ event_log_tags_src := \
$(event_log_tags_file): PRIVATE_SRC_FILES := $(event_log_tags_src) $(pdk_fusion_log_tags_file)
$(event_log_tags_file): PRIVATE_MERGED_FILE := $(all_event_log_tags_file)
-$(event_log_tags_file): $(event_log_tags_src) $(all_event_log_tags_file) $(pdk_fusion_log_tags_file) $(MERGETAGS) build/tools/event_log_tags.py
+$(event_log_tags_file): $(event_log_tags_src) $(all_event_log_tags_file) $(pdk_fusion_log_tags_file) $(MERGETAGS) build/make/tools/event_log_tags.py
$(hide) mkdir -p $(dir $@)
$(hide) $(MERGETAGS) -o $@ -m $(PRIVATE_MERGED_FILE) $(PRIVATE_SRC_FILES)
@@ -595,6 +695,8 @@ ramdisk-nodeps: $(MKBOOTFS) | $(MINIGZIP)
@echo "make $@: ignoring dependencies"
$(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_ROOT_OUT) | $(MINIGZIP) > $(INSTALLED_RAMDISK_TARGET)
+INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
+
ifneq ($(strip $(TARGET_NO_KERNEL)),true)
# -----------------------------------------------------------------
@@ -633,8 +735,6 @@ INTERNAL_MKBOOTIMG_VERSION_ARGS := \
--os_version $(PLATFORM_VERSION) \
--os_patch_level $(PLATFORM_SECURITY_PATCH)
-INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
-
# BOARD_USES_RECOVERY_AS_BOOT = true must have BOARD_BUILD_SYSTEM_ROOT_IMAGE = true.
ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
@@ -652,7 +752,7 @@ else ifeq (true,$(BOARD_AVB_ENABLE)) # TARGET_BOOTIMAGE_USE_EXT2 != true
$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(AVBTOOL) $(INTERNAL_BOOTIMAGE_FILES) $(BOARD_AVB_BOOT_KEY_PATH)
$(call pretty,"Target boot image: $@")
$(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
- $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
+ $(hide) $(call assert-max-image-size,$@,$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE)))
$(hide) $(AVBTOOL) add_hash_footer \
--image $@ \
--partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
@@ -663,9 +763,9 @@ $(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(AVBTOOL) $(INTERNAL_BOOTIMAGE_FILE
bootimage-nodeps: $(MKBOOTIMG) $(AVBTOOL) $(BOARD_AVB_BOOT_KEY_PATH)
@echo "make $@: ignoring dependencies"
$(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
- $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
+ $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE)))
$(hide) $(AVBTOOL) add_hash_footer \
- --image $@ \
+ --image $(INSTALLED_BOOTIMAGE_TARGET) \
--partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
--partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) \
$(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)
@@ -717,6 +817,13 @@ endif # TARGET_BOOTIMAGE_USE_EXT2
endif # BOARD_USES_RECOVERY_AS_BOOT
else # TARGET_NO_KERNEL
+ifdef BOARD_PREBUILT_BOOTIMAGE
+ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
+# Remove when b/63676296 is resolved.
+$(error Prebuilt bootimage is only supported for AB targets)
+endif
+$(eval $(call copy-one-file,$(BOARD_PREBUILT_BOOTIMAGE),$(INSTALLED_BOOTIMAGE_TARGET)))
+else
INTERNAL_KERNEL_CMDLINE := $(strip $(BOARD_KERNEL_CMDLINE))
# HACK: The top-level targets depend on the bootimage. Not all targets
# can produce a bootimage, though, and emulator targets need the ramdisk
@@ -725,6 +832,7 @@ INTERNAL_KERNEL_CMDLINE := $(strip $(BOARD_KERNEL_CMDLINE))
# kernel-less inputs.
INSTALLED_BOOTIMAGE_TARGET := $(INSTALLED_RAMDISK_TARGET)
endif
+endif
# -----------------------------------------------------------------
# NOTICE files
@@ -764,8 +872,8 @@ define combine-notice-files
$(2) $(3): PRIVATE_MESSAGE := $(4)
$(2) $(3): PRIVATE_DIR := $(5)
$(2) : $(3)
-$(3) : $(6) $(BUILD_SYSTEM)/Makefile build/tools/generate-notice-files.py
- build/tools/generate-notice-files.py --text-output $(2) \
+$(3) : $(6) $(BUILD_SYSTEM)/Makefile build/make/tools/generate-notice-files.py
+ build/make/tools/generate-notice-files.py --text-output $(2) \
$(if $(filter $(1),xml_excluded_vendor),-e vendor --xml-output, \
$(if $(filter $(1),xml_vendor),-i vendor --xml-output, \
--html-output)) $(3) \
@@ -784,7 +892,8 @@ installed_notice_html_or_xml_gz := $(TARGET_OUT)/etc/NOTICE.html.gz
tools_notice_file_txt := $(HOST_OUT_INTERMEDIATES)/NOTICE.txt
tools_notice_file_html := $(HOST_OUT_INTERMEDIATES)/NOTICE.html
-ifeq ($(PRODUCT_FULL_TREBLE),true)
+# TODO(b/69865032): Make PRODUCT_NOTICE_SPLIT the default behavior.
+ifeq ($(PRODUCT_NOTICE_SPLIT),true)
target_notice_file_html_or_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE.xml
target_notice_file_html_or_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.xml.gz
installed_notice_html_or_xml_gz := $(TARGET_OUT)/etc/NOTICE.xml.gz
@@ -955,7 +1064,7 @@ endif
ifneq (true,$(TARGET_USERIMAGES_SPARSE_SQUASHFS_DISABLED))
INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG := -s
endif
-ifneq ($(filter $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE) $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),squashfs),)
+ifneq ($(filter $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE) $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE) $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),squashfs),)
INTERNAL_USERIMAGES_DEPS += $(MAKE_SQUASHFS) $(MKSQUASHFSUSERIMG) $(IMG2SIMG)
endif
@@ -985,8 +1094,9 @@ $(if $(INTERNAL_USERIMAGES_EXT_VARIANT),$(hide) echo "fs_type=$(INTERNAL_USERIMA
$(if $(BOARD_SYSTEMIMAGE_PARTITION_SIZE),$(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(1))
$(if $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "system_fs_type=$(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
$(if $(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "system_extfs_inode_count=$(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
+$(if $(BOARD_SYSTEMIMAGE_EXTFS_RSV_PCT),$(hide) echo "system_extfs_rsv_pct=$(BOARD_SYSTEMIMAGE_EXTFS_RSV_PCT)" >> $(1))
$(if $(BOARD_SYSTEMIMAGE_JOURNAL_SIZE),$(hide) echo "system_journal_size=$(BOARD_SYSTEMIMAGE_JOURNAL_SIZE)" >> $(1))
-$(if $(BOARD_HAS_EXT4_RESERVED_BLOCKS),$(hide) echo "has_ext4_reserved_blocks=$(BOARD_HAS_EXT4_RESERVED_BLOCKS)" >> $(1))
+$(if $(BOARD_EXT4_SHARE_DUP_BLOCKS),$(hide) echo "ext4_share_dup_blocks=$(BOARD_EXT4_SHARE_DUP_BLOCKS)" >> $(1))
$(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "system_squashfs_compressor=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
$(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "system_squashfs_compressor_opt=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
$(if $(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "system_squashfs_block_size=$(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
@@ -1001,6 +1111,7 @@ $(if $(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "cache_fs_type=$(BOARD_CA
$(if $(BOARD_CACHEIMAGE_PARTITION_SIZE),$(hide) echo "cache_size=$(BOARD_CACHEIMAGE_PARTITION_SIZE)" >> $(1))
$(if $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "vendor_fs_type=$(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
$(if $(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT),$(hide) echo "vendor_extfs_inode_count=$(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT)" >> $(1))
+$(if $(BOARD_VENDORIMAGE_EXTFS_RSV_PCT),$(hide) echo "vendor_extfs_rsv_pct=$(BOARD_VENDORIMAGE_EXTFS_RSV_PCT)" >> $(1))
$(if $(BOARD_VENDORIMAGE_PARTITION_SIZE),$(hide) echo "vendor_size=$(BOARD_VENDORIMAGE_PARTITION_SIZE)" >> $(1))
$(if $(BOARD_VENDORIMAGE_JOURNAL_SIZE),$(hide) echo "vendor_journal_size=$(BOARD_VENDORIMAGE_JOURNAL_SIZE)" >> $(1))
$(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "vendor_squashfs_compressor=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
@@ -1008,9 +1119,20 @@ $(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "vendor_squashfs_
$(if $(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "vendor_squashfs_block_size=$(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
$(if $(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "vendor_squashfs_disable_4k_align=$(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH),$(hide) echo "vendor_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH)" >> $(1))
+$(if $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "product_fs_type=$(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
+$(if $(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT),$(hide) echo "product_extfs_inode_count=$(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT)" >> $(1))
+$(if $(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT),$(hide) echo "product_extfs_rsv_pct=$(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT)" >> $(1))
+$(if $(BOARD_PRODUCTIMAGE_PARTITION_SIZE),$(hide) echo "product_size=$(BOARD_PRODUCTIMAGE_PARTITION_SIZE)" >> $(1))
+$(if $(BOARD_PRODUCTIMAGE_JOURNAL_SIZE),$(hide) echo "product_journal_size=$(BOARD_PRODUCTIMAGE_JOURNAL_SIZE)" >> $(1))
+$(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "product_squashfs_compressor=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
+$(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "product_squashfs_compressor_opt=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
+$(if $(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "product_squashfs_block_size=$(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
+$(if $(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "product_squashfs_disable_4k_align=$(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
+$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH),$(hide) echo "product_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH)" >> $(1))
$(if $(BOARD_OEMIMAGE_PARTITION_SIZE),$(hide) echo "oem_size=$(BOARD_OEMIMAGE_PARTITION_SIZE)" >> $(1))
$(if $(BOARD_OEMIMAGE_JOURNAL_SIZE),$(hide) echo "oem_journal_size=$(BOARD_OEMIMAGE_JOURNAL_SIZE)" >> $(1))
$(if $(BOARD_OEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "oem_extfs_inode_count=$(BOARD_OEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
+$(if $(BOARD_OEMIMAGE_EXTFS_RSV_PCT),$(hide) echo "oem_extfs_rsv_pct=$(BOARD_OEMIMAGE_EXTFS_RSV_PCT)" >> $(1))
$(if $(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG),$(hide) echo "extfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG)" >> $(1))
$(if $(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG),$(hide) echo "squashfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG)" >> $(1))
$(hide) echo "selinux_fc=$(SELINUX_FC)" >> $(1)
@@ -1019,8 +1141,10 @@ $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),$(hide) echo "verit
$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity_key=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY)" >> $(1))
$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity_signer_cmd=$(notdir $(VERITY_SIGNER))" >> $(1))
$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY_FEC),$(hide) echo "verity_fec=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY_FEC)" >> $(1))
+$(if $(filter eng, $(TARGET_BUILD_VARIANT)),$(hide) echo "verity_disable=true" >> $(1))
$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_VERITY_PARTITION),$(hide) echo "system_verity_block_device=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_VERITY_PARTITION)" >> $(1))
$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_VERITY_PARTITION),$(hide) echo "vendor_verity_block_device=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_VERITY_PARTITION)" >> $(1))
+$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_VERITY_PARTITION),$(hide) echo "product_verity_block_device=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_VERITY_PARTITION)" >> $(1))
$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)" >> $(1))
$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_key=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY)" >> $(1))
$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_subkey=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_SUBKEY)" >> $(1))
@@ -1041,6 +1165,13 @@ $(if $(BOARD_AVB_ENABLE),\
$(hide) echo "avb_vendor_key_path=$(BOARD_AVB_VENDOR_KEY_PATH)" >> $(1)
$(hide) echo "avb_vendor_algorithm=$(BOARD_AVB_VENDOR_ALGORITHM)" >> $(1)
$(hide) echo "avb_vendor_rollback_index_location=$(BOARD_AVB_VENDOR_ROLLBACK_INDEX_LOCATION)" >> $(1)))
+$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
+$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_add_hashtree_footer_args=$(BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
+$(if $(BOARD_AVB_ENABLE),\
+ $(if $(BOARD_AVB_PRODUCT_KEY_PATH),\
+ $(hide) echo "avb_product_key_path=$(BOARD_AVB_PRODUCT_KEY_PATH)" >> $(1)
+ $(hide) echo "avb_product_algorithm=$(BOARD_AVB_PRODUCT_ALGORITHM)" >> $(1)
+ $(hide) echo "avb_product_rollback_index_location=$(BOARD_AVB_PRODUCT_ROLLBACK_INDEX_LOCATION)" >> $(1)))
$(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
$(hide) echo "recovery_as_boot=true" >> $(1))
$(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),\
@@ -1049,6 +1180,23 @@ $(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),\
$(if $(2),$(hide) $(foreach kv,$(2),echo "$(kv)" >> $(1);))
endef
+# $(1): modules list
+# $(2): output dir
+# $(3): mount point
+# $(4): staging dir
+# Depmod requires a well-formed kernel version so 0.0 is used as a placeholder.
+define build-image-kernel-modules
+ $(hide) rm -rf $(2)/lib/modules
+ $(hide) mkdir -p $(2)/lib/modules
+ $(hide) cp $(1) $(2)/lib/modules/
+ $(hide) rm -rf $(4)
+ $(hide) mkdir -p $(4)/lib/modules/0.0/$(3)lib/modules
+ $(hide) cp $(1) $(4)/lib/modules/0.0/$(3)lib/modules
+ $(hide) $(DEPMOD) -b $(4) 0.0
+ $(hide) sed -e 's/\(.*modules.*\):/\/\1:/g' -e 's/ \([^ ]*modules[^ ]*\)/ \/\1/g' $(4)/lib/modules/0.0/modules.dep > $(2)/lib/modules/modules.dep
+ $(hide) cp $(4)/lib/modules/0.0/modules.alias $(2)/lib/modules
+endef
+
# -----------------------------------------------------------------
# Recovery image
@@ -1062,9 +1210,16 @@ recovery_initrc := $(call include-path-for, recovery)/etc/init.rc
recovery_sepolicy := \
$(TARGET_RECOVERY_ROOT_OUT)/sepolicy \
$(TARGET_RECOVERY_ROOT_OUT)/plat_file_contexts \
- $(TARGET_RECOVERY_ROOT_OUT)/nonplat_file_contexts \
+ $(TARGET_RECOVERY_ROOT_OUT)/vendor_file_contexts \
$(TARGET_RECOVERY_ROOT_OUT)/plat_property_contexts \
- $(TARGET_RECOVERY_ROOT_OUT)/nonplat_property_contexts
+ $(TARGET_RECOVERY_ROOT_OUT)/vendor_property_contexts
+
+ifdef BOARD_ODM_SEPOLICY_DIRS
+recovery_sepolicy += \
+ $(TARGET_RECOVERY_ROOT_OUT)/odm_file_contexts \
+ $(TARGET_RECOVERY_ROOT_OUT)/odm_property_contexts
+endif
+
# Passed into rsync from non-recovery root to recovery root, to avoid overwriting recovery-specific
# SELinux files
IGNORE_RECOVERY_SEPOLICY := $(patsubst $(TARGET_RECOVERY_OUT)/%,--exclude=/%,$(recovery_sepolicy))
@@ -1075,6 +1230,9 @@ recovery_build_props := $(intermediate_system_build_prop)
ifdef property_overrides_split_enabled
recovery_build_props += $(INSTALLED_VENDOR_BUILD_PROP_TARGET)
endif
+ifdef BOARD_USES_PRODUCTIMAGE
+recovery_build_props += $(INSTALLED_PRODUCT_BUILD_PROP_TARGET)
+endif
recovery_resources_common := $(call include-path-for, recovery)/res
# Set recovery_density to the density bucket of the device.
@@ -1120,33 +1278,33 @@ else
recovery_wipe :=
endif
-# Prior to A/B update, we used to have:
+# Traditionally with non-A/B OTA we have:
# boot.img + recovery-from-boot.p + recovery-resource.dat = recovery.img.
-# recovery-resource.dat is needed only if we carry a patch of the boot and
-# recovery images and invoke install-recovery.sh on the first boot post an
-# OTA update.
+# recovery-resource.dat is needed only if we carry an imgdiff patch of the boot and recovery images
+# and invoke install-recovery.sh on the first boot post an OTA update.
#
# We no longer need that if one of the following conditions holds:
-# a) We carry a full copy of the recovery image
+# a) We carry a full copy of the recovery image - no patching needed
# (BOARD_USES_FULL_RECOVERY_IMAGE = true);
-# b) We build a single image that contains boot and recovery both
-# (BOARD_USES_RECOVERY_AS_BOOT = true).
-
-ifeq (,$(filter true, $(BOARD_USES_FULL_RECOVERY_IMAGE) $(BOARD_USES_RECOVERY_AS_BOOT)))
+# b) We build a single image that contains boot and recovery both - no recovery image to install
+# (BOARD_USES_RECOVERY_AS_BOOT = true);
+# c) We build the root into system image - not needing the resource file as we do bsdiff
+# (BOARD_BUILD_SYSTEM_ROOT_IMAGE = true).
+# d) We include the recovery DTBO image within recovery - not needing the resource file as we
+# do bsdiff because boot and recovery will contain different number of entries
+# (BOARD_INCLUDE_RECOVERY_DTBO = true).
+# Note that condition b) implies condition c), because of the earlier check in this file:
+# "BOARD_USES_RECOVERY_AS_BOOT = true must have BOARD_BUILD_SYSTEM_ROOT_IMAGE = true" (not vice
+# versa though).
+
+ifeq (,$(filter true, $(BOARD_USES_FULL_RECOVERY_IMAGE) $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) \
+ $(BOARD_INCLUDE_RECOVERY_DTBO)))
# Named '.dat' so we don't attempt to use imgdiff for patching it.
RECOVERY_RESOURCE_ZIP := $(TARGET_OUT)/etc/recovery-resource.dat
else
RECOVERY_RESOURCE_ZIP :=
endif
-ifeq ($(TARGET_PRIVATE_RES_DIRS),)
- $(info No private recovery resources for TARGET_DEVICE $(TARGET_DEVICE))
-endif
-
-ifeq ($(recovery_fstab),)
- $(info No recovery.fstab for TARGET_DEVICE $(TARGET_DEVICE))
-endif
-
INTERNAL_RECOVERYIMAGE_ARGS := \
$(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
--kernel $(recovery_kernel) \
@@ -1162,6 +1320,9 @@ endif
ifdef BOARD_KERNEL_PAGESIZE
INTERNAL_RECOVERYIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
endif
+ifdef BOARD_INCLUDE_RECOVERY_DTBO
+ INTERNAL_RECOVERYIMAGE_ARGS += --recovery_dtbo $(BOARD_PREBUILT_DTBOIMAGE)
+endif
# Keys authorized to sign OTA packages this build will accept. The
# build always uses dev-keys for this; release packaging tools will
@@ -1183,37 +1344,21 @@ $(RECOVERY_INSTALL_OTA_KEYS): $(OTA_PUBLIC_KEYS) $(DUMPKEY_JAR) $(extra_keys)
RECOVERYIMAGE_ID_FILE := $(PRODUCT_OUT)/recovery.id
-# $(1): modules list
-# $(2): output dir
-# $(3): mount point
-# $(4): staging dir
-# Depmod requires a well-formed kernel version so 0.0 is used as a placeholder.
-define build-image-kernel-modules
- $(hide) rm -rf $(2)/lib/modules
- $(hide) mkdir -p $(2)/lib/modules
- $(hide) cp $(1) $(2)/lib/modules/
- $(hide) rm -rf $(4)
- $(hide) mkdir -p $(4)/lib/modules/0.0/$(3)lib/modules
- $(hide) cp $(1) $(4)/lib/modules/0.0/$(3)lib/modules
- $(hide) $(DEPMOD) -b $(4) 0.0
- $(hide) sed -e 's/\(.*modules.*\):/\/\1:/g' -e 's/ \([^ ]*modules[^ ]*\)/ \/\1/g' $(4)/lib/modules/0.0/modules.dep > $(2)/lib/modules/modules.dep
- $(hide) cp $(4)/lib/modules/0.0/modules.alias $(2)/lib/modules
-endef
-
# $(1): output file
define build-recoveryimage-target
- @echo ----- Making recovery image ------
+ # Making recovery image
$(hide) mkdir -p $(TARGET_RECOVERY_OUT)
$(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/etc $(TARGET_RECOVERY_ROOT_OUT)/sdcard $(TARGET_RECOVERY_ROOT_OUT)/tmp
- @echo Copying baseline ramdisk...
+ # Copying baseline ramdisk...
# Use rsync because "cp -Rf" fails to overwrite broken symlinks on Mac.
$(hide) rsync -a --exclude=etc --exclude=sdcard $(IGNORE_RECOVERY_SEPOLICY) $(IGNORE_CACHE_LINK) $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT)
# Copy adbd from system/bin to recovery/root/sbin
$(hide) cp -f $(TARGET_OUT_EXECUTABLES)/adbd $(TARGET_RECOVERY_ROOT_OUT)/sbin/adbd
- @echo Modifying ramdisk contents...
+ # Modifying ramdisk contents...
$(if $(BOARD_RECOVERY_KERNEL_MODULES), \
$(call build-image-kernel-modules,$(BOARD_RECOVERY_KERNEL_MODULES),$(TARGET_RECOVERY_ROOT_OUT),,$(call intermediates-dir-for,PACKAGING,depmod_recovery)))
- $(hide) rm -f $(TARGET_RECOVERY_ROOT_OUT)/init*.rc
+ # Removes $(TARGET_RECOVERY_ROOT_OUT)/init*.rc EXCEPT init.recovery*.rc.
+ $(hide) find $(TARGET_RECOVERY_ROOT_OUT) -maxdepth 1 -name 'init*.rc' -type f -not -name "init.recovery.*.rc" | xargs rm -f
$(hide) cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/
$(hide) cp $(TARGET_ROOT_OUT)/init.recovery.*.rc $(TARGET_RECOVERY_ROOT_OUT)/ || true # Ignore error when the src file doesn't exist.
$(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/res
@@ -1252,16 +1397,13 @@ define build-recoveryimage-target
)
$(if $(filter true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)), \
$(VBOOT_SIGNER) $(FUTILITY) $(1).unsigned $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY).vbprivk $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_SUBKEY).vbprivk $(1).keyblock $(1))
- $(if $(and $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),$(filter true,$(BOARD_AVB_ENABLE))), \
- $(hide) $(AVBTOOL) add_hash_footer \
- --image $(1) \
- --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
- --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) \
- $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS))
$(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)), \
- $(hide) $(call assert-max-image-size,$(1),$(BOARD_BOOTIMAGE_PARTITION_SIZE)), \
- $(hide) $(call assert-max-image-size,$(1),$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)))
- @echo ----- Made recovery image: $(1) --------
+ $(hide) $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE))), \
+ $(hide) $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE))))
+ $(if $(filter true,$(BOARD_AVB_ENABLE)), \
+ $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)), \
+ $(hide) $(AVBTOOL) add_hash_footer --image $(1) --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS),\
+ $(hide) $(AVBTOOL) add_hash_footer --image $(1) --partition_size $(BOARD_RECOVERYIMAGE_PARTITION_SIZE) --partition_name recovery $(INTERNAL_AVB_RECOVERY_SIGNING_ARGS) $(BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS)))
endef
ADBD := $(TARGET_OUT_EXECUTABLES)/adbd
@@ -1324,12 +1466,12 @@ endif
.PHONY: recoveryimage
recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET) $(RECOVERY_RESOURCE_ZIP)
-ifeq ($(BOARD_NAND_PAGE_SIZE),)
-BOARD_NAND_PAGE_SIZE := 2048
+ifneq ($(BOARD_NAND_PAGE_SIZE),)
+$(error MTD device is no longer supported and thus BOARD_NAND_PAGE_SIZE is deprecated.)
endif
-ifeq ($(BOARD_NAND_SPARE_SIZE),)
-BOARD_NAND_SPARE_SIZE := 64
+ifneq ($(BOARD_NAND_SPARE_SIZE),)
+$(error MTD device is no longer supported and thus BOARD_NAND_SPARE_SIZE is deprecated.)
endif
# -----------------------------------------------------------------
@@ -1344,7 +1486,8 @@ INTERNAL_SYSTEMIMAGE_FILES := $(filter $(TARGET_OUT)/%, \
$(ALL_GENERATED_SOURCES) \
$(ALL_DEFAULT_INSTALLED_MODULES) \
$(PDK_FUSION_SYSIMG_FILES) \
- $(RECOVERY_RESOURCE_ZIP))
+ $(RECOVERY_RESOURCE_ZIP)) \
+ $(PDK_FUSION_SYMLINK_STAMP)
FULL_SYSTEMIMAGE_DEPS := $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_USERIMAGES_DEPS)
@@ -1368,7 +1511,7 @@ $(INSTALLED_FILES_FILE): $(FULL_SYSTEMIMAGE_DEPS) $(FILESLIST)
@mkdir -p $(dir $@)
@rm -f $@
$(hide) $(FILESLIST) $(TARGET_OUT) > $(@:.txt=.json)
- $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
+ $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
.PHONY: installed-file-list
installed-file-list: $(INSTALLED_FILES_FILE)
@@ -1394,23 +1537,36 @@ define create-system-vendor-symlink
endef
endif
+# Create symlink /system/product to /product if necessary.
+ifdef BOARD_USES_PRODUCTIMAGE
+define create-system-product-symlink
+$(hide) if [ -d $(TARGET_OUT)/product ] && [ ! -h $(TARGET_OUT)/product ]; then \
+ echo 'Non-symlink $(TARGET_OUT)/product detected!' 1>&2; \
+ echo 'You cannot install files to $(TARGET_OUT)/product while building a separate product.img!' 1>&2; \
+ exit 1; \
+fi
+$(hide) ln -sf /product $(TARGET_OUT)/product
+endef
+else
+define create-system-product-symlink
+endef
+endif
+
# $(1): output file
define build-systemimage-target
@echo "Target system fs image: $(1)"
$(call create-system-vendor-symlink)
+ $(call create-system-product-symlink)
@mkdir -p $(dir $(1)) $(systemimage_intermediates) && rm -rf $(systemimage_intermediates)/system_image_info.txt
$(call generate-userimage-prop-dictionary, $(systemimage_intermediates)/system_image_info.txt, \
skip_fsck=true)
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
- ./build/tools/releasetools/build_image.py \
+ build/make/tools/releasetools/build_image.py \
$(TARGET_OUT) $(systemimage_intermediates)/system_image_info.txt $(1) $(TARGET_OUT) \
|| ( echo "Out of space? the tree size of $(TARGET_OUT) is (MB): " 1>&2 ;\
du -sm $(TARGET_OUT) 1>&2;\
if [ "$(INTERNAL_USERIMAGES_EXT_VARIANT)" == "ext4" ]; then \
maxsize=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE); \
- if [ "$(BOARD_HAS_EXT4_RESERVED_BLOCKS)" == "true" ]; then \
- maxsize=$$((maxsize - 4096 * 4096)); \
- fi; \
echo "The max is $$(( maxsize / 1048576 )) MB." 1>&2 ;\
else \
echo "The max is $$(( $(BOARD_SYSTEMIMAGE_PARTITION_SIZE) / 1048576 )) MB." 1>&2 ;\
@@ -1432,15 +1588,21 @@ SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT)
# image size check calculation.
ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
ifneq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
+ifneq (,$(filter true, $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO)))
+diff_tool := $(HOST_OUT_EXECUTABLES)/bsdiff
+else
+diff_tool := $(HOST_OUT_EXECUTABLES)/imgdiff
+endif
intermediates := $(call intermediates-dir-for,PACKAGING,recovery_patch)
RECOVERY_FROM_BOOT_PATCH := $(intermediates)/recovery_from_boot.p
-$(RECOVERY_FROM_BOOT_PATCH): $(INSTALLED_RECOVERYIMAGE_TARGET) \
- $(INSTALLED_BOOTIMAGE_TARGET) \
- $(HOST_OUT_EXECUTABLES)/imgdiff \
- $(HOST_OUT_EXECUTABLES)/bsdiff
+$(RECOVERY_FROM_BOOT_PATCH): PRIVATE_DIFF_TOOL := $(diff_tool)
+$(RECOVERY_FROM_BOOT_PATCH): \
+ $(INSTALLED_RECOVERYIMAGE_TARGET) \
+ $(INSTALLED_BOOTIMAGE_TARGET) \
+ $(diff_tool)
@echo "Construct recovery from boot"
mkdir -p $(dir $@)
- PATH=$(HOST_OUT_EXECUTABLES):$$PATH $(HOST_OUT_EXECUTABLES)/imgdiff $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_RECOVERYIMAGE_TARGET) $@
+ $(PRIVATE_DIFF_TOOL) $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_RECOVERYIMAGE_TARGET) $@
else # $(BOARD_USES_FULL_RECOVERY_IMAGE) == true
RECOVERY_FROM_BOOT_PATCH := $(INSTALLED_RECOVERYIMAGE_TARGET)
endif
@@ -1475,6 +1637,7 @@ sync: $(INTERNAL_SYSTEMIMAGE_FILES)
define build-systemtarball-target
$(call pretty,"Target system fs tarball: $(INSTALLED_SYSTEMTARBALL_TARGET)")
$(call create-system-vendor-symlink)
+ $(call create-system-product-symlink)
$(MKTARBALL) $(FS_GET_STATS) \
$(PRODUCT_OUT) system $(PRIVATE_SYSTEM_TAR) \
$(INSTALLED_SYSTEMTARBALL_TARGET) $(TARGET_OUT)
@@ -1555,6 +1718,10 @@ ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
$(hide) cd $(dir $@) && zip -qryX $(notdir $@) \
$(TARGET_COPY_OUT_VENDOR)
endif
+ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
+ $(hide) cd $(dir $@) && zip -qryX $(notdir $@) \
+ $(TARGET_COPY_OUT_PRODUCT)
+endif
ifneq ($(PDK_PLATFORM_JAVA_ZIP_CONTENTS),)
$(hide) cd $(OUT_DIR) && zip -qryX $(patsubst $(OUT_DIR)/%,%,$@) $(PDK_PLATFORM_JAVA_ZIP_CONTENTS)
endif
@@ -1563,7 +1730,8 @@ ifneq ($(PDK_PLATFORM_ZIP_PRODUCT_BINARIES),)
endif
@# Add dex-preopt files and config.
$(if $(PRIVATE_DEX_FILES),$(hide) cd $(OUT_DIR) && zip -qryX $(patsubst $(OUT_DIR)/%,%,$@ $(PRIVATE_DEX_FILES)))
- $(hide) zip -qryXj $@ $(PRIVATE_ODEX_CONFIG)
+ $(hide) touch $(PRODUCT_OUT)/pdk.mk
+ $(hide) zip -qryXj $@ $(PRIVATE_ODEX_CONFIG) $(PRODUCT_OUT)/pdk.mk
.PHONY: platform
platform: $(INSTALLED_PLATFORM_ZIP)
@@ -1628,7 +1796,7 @@ define build-userdataimage-target
@mkdir -p $(userdataimage_intermediates) && rm -rf $(userdataimage_intermediates)/userdata_image_info.txt
$(call generate-userimage-prop-dictionary, $(userdataimage_intermediates)/userdata_image_info.txt, skip_fsck=true)
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
- ./build/tools/releasetools/build_image.py \
+ build/make/tools/releasetools/build_image.py \
$(TARGET_OUT_DATA) $(userdataimage_intermediates)/userdata_image_info.txt $(INSTALLED_USERDATAIMAGE_TARGET) $(TARGET_OUT)
$(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE))
endef
@@ -1735,7 +1903,7 @@ define build-cacheimage-target
@mkdir -p $(cacheimage_intermediates) && rm -rf $(cacheimage_intermediates)/cache_image_info.txt
$(call generate-userimage-prop-dictionary, $(cacheimage_intermediates)/cache_image_info.txt, skip_fsck=true)
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
- ./build/tools/releasetools/build_image.py \
+ build/make/tools/releasetools/build_image.py \
$(TARGET_OUT_CACHE) $(cacheimage_intermediates)/cache_image_info.txt $(INSTALLED_CACHEIMAGE_TARGET) $(TARGET_OUT)
$(hide) $(call assert-max-image-size,$(INSTALLED_CACHEIMAGE_TARGET),$(BOARD_CACHEIMAGE_PARTITION_SIZE))
endef
@@ -1770,7 +1938,8 @@ ifdef BOARD_USES_SYSTEM_OTHER
INTERNAL_SYSTEMOTHERIMAGE_FILES := \
$(filter $(TARGET_OUT_SYSTEM_OTHER)/%,\
$(ALL_DEFAULT_INSTALLED_MODULES)\
- $(ALL_PDK_FUSION_FILES))
+ $(ALL_PDK_FUSION_FILES)) \
+ $(PDK_FUSION_SYMLINK_STAMP)
INSTALLED_FILES_FILE_SYSTEMOTHER := $(PRODUCT_OUT)/installed-files-system-other.txt
$(INSTALLED_FILES_FILE_SYSTEMOTHER) : $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(FILESLIST)
@@ -1778,7 +1947,7 @@ $(INSTALLED_FILES_FILE_SYSTEMOTHER) : $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(FILES
@mkdir -p $(dir $@)
@rm -f $@
$(hide) $(FILESLIST) $(TARGET_OUT_SYSTEM_OTHER) > $(@:.txt=.json)
- $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
+ $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
systemotherimage_intermediates := \
$(call intermediates-dir-for,PACKAGING,system_other)
@@ -1791,15 +1960,18 @@ define build-systemotherimage-target
@mkdir -p $(systemotherimage_intermediates) && rm -rf $(systemotherimage_intermediates)/system_other_image_info.txt
$(call generate-userimage-prop-dictionary, $(systemotherimage_intermediates)/system_other_image_info.txt, skip_fsck=true)
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
- ./build/tools/releasetools/build_image.py \
+ build/make/tools/releasetools/build_image.py \
$(TARGET_OUT_SYSTEM_OTHER) $(systemotherimage_intermediates)/system_other_image_info.txt $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) $(TARGET_OUT)
$(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMOTHERIMAGE_TARGET),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))
endef
# We just build this directly to the install location.
INSTALLED_SYSTEMOTHERIMAGE_TARGET := $(BUILT_SYSTEMOTHERIMAGE_TARGET)
+ifneq (true,$(SANITIZE_LITE))
+# Only create system_other when not building the second stage of a SANITIZE_LITE build.
$(INSTALLED_SYSTEMOTHERIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(INSTALLED_FILES_FILE_SYSTEMOTHER)
$(build-systemotherimage-target)
+endif
.PHONY: systemotherimage-nodeps
systemotherimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
@@ -1814,7 +1986,8 @@ ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
INTERNAL_VENDORIMAGE_FILES := \
$(filter $(TARGET_OUT_VENDOR)/%,\
$(ALL_DEFAULT_INSTALLED_MODULES)\
- $(ALL_PDK_FUSION_FILES))
+ $(ALL_PDK_FUSION_FILES)) \
+ $(PDK_FUSION_SYMLINK_STAMP)
# platform.zip depends on $(INTERNAL_VENDORIMAGE_FILES).
$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_VENDORIMAGE_FILES)
@@ -1825,7 +1998,7 @@ $(INSTALLED_FILES_FILE_VENDOR) : $(INTERNAL_VENDORIMAGE_FILES) $(FILESLIST)
@mkdir -p $(dir $@)
@rm -f $@
$(hide) $(FILESLIST) $(TARGET_OUT_VENDOR) > $(@:.txt=.json)
- $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
+ $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
vendorimage_intermediates := \
$(call intermediates-dir-for,PACKAGING,vendor)
@@ -1838,7 +2011,7 @@ define build-vendorimage-target
$(if $(BOARD_VENDOR_KERNEL_MODULES), \
$(call build-image-kernel-modules,$(BOARD_VENDOR_KERNEL_MODULES),$(TARGET_OUT_VENDOR),vendor/,$(call intermediates-dir-for,PACKAGING,depmod_vendor)))
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
- ./build/tools/releasetools/build_image.py \
+ build/make/tools/releasetools/build_image.py \
$(TARGET_OUT_VENDOR) $(vendorimage_intermediates)/vendor_image_info.txt $(INSTALLED_VENDORIMAGE_TARGET) $(TARGET_OUT)
$(hide) $(call assert-max-image-size,$(INSTALLED_VENDORIMAGE_TARGET),$(BOARD_VENDORIMAGE_PARTITION_SIZE))
endef
@@ -1860,6 +2033,56 @@ $(eval $(call copy-one-file,$(BOARD_PREBUILT_VENDORIMAGE),$(INSTALLED_VENDORIMAG
endif
# -----------------------------------------------------------------
+# product partition image
+ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
+INTERNAL_PRODUCTIMAGE_FILES := \
+ $(filter $(TARGET_OUT_PRODUCT)/%,\
+ $(ALL_DEFAULT_INSTALLED_MODULES)\
+ $(ALL_PDK_FUSION_FILES)) \
+ $(PDK_FUSION_SYMLINK_STAMP)
+
+# platform.zip depends on $(INTERNAL_PRODUCTIMAGE_FILES).
+$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_PRODUCTIMAGE_FILES)
+
+INSTALLED_FILES_FILE_PRODUCT := $(PRODUCT_OUT)/installed-files-product.txt
+$(INSTALLED_FILES_FILE_PRODUCT) : $(INTERNAL_PRODUCTIMAGE_FILES) $(FILESLIST)
+ @echo Installed file list: $@
+ @mkdir -p $(dir $@)
+ @rm -f $@
+ $(hide) $(FILESLIST) $(TARGET_OUT_PRODUCT) > $(@:.txt=.json)
+ $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
+
+productimage_intermediates := \
+ $(call intermediates-dir-for,PACKAGING,product)
+BUILT_PRODUCTIMAGE_TARGET := $(PRODUCT_OUT)/product.img
+define build-productimage-target
+ $(call pretty,"Target product fs image: $(INSTALLED_PRODUCTIMAGE_TARGET)")
+ @mkdir -p $(TARGET_OUT_PRODUCT)
+ @mkdir -p $(productimage_intermediates) && rm -rf $(productimage_intermediates)/product_image_info.txt
+ $(call generate-userimage-prop-dictionary, $(productimage_intermediates)/product_image_info.txt, skip_fsck=true)
+ $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
+ ./build/tools/releasetools/build_image.py \
+ $(TARGET_OUT_PRODUCT) $(productimage_intermediates)/product_image_info.txt $(INSTALLED_PRODUCTIMAGE_TARGET) $(TARGET_OUT)
+ $(hide) $(call assert-max-image-size,$(INSTALLED_PRODUCTIMAGE_TARGET),$(BOARD_PRODUCTIMAGE_PARTITION_SIZE))
+endef
+
+# We just build this directly to the install location.
+INSTALLED_PRODUCTIMAGE_TARGET := $(BUILT_PRODUCTIMAGE_TARGET)
+$(INSTALLED_PRODUCTIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_PRODUCTIMAGE_FILES) $(INSTALLED_FILES_FILE_PRODUCT) $(BUILD_IMAGE_SRCS)
+ $(build-productimage-target)
+
+.PHONY: productimage-nodeps pnod
+productimage-nodeps pnod: | $(INTERNAL_USERIMAGES_DEPS)
+ $(build-productimage-target)
+
+sync: $(INTERNAL_PRODUCTIMAGE_FILES)
+
+else ifdef BOARD_PREBUILT_PRODUCTIMAGE
+INSTALLED_PRODUCTIMAGE_TARGET := $(PRODUCT_OUT)/product.img
+$(eval $(call copy-one-file,$(BOARD_PREBUILT_PRODUCTIMAGE),$(INSTALLED_PRODUCTIMAGE_TARGET)))
+endif
+
+# -----------------------------------------------------------------
# dtbo image
ifdef BOARD_PREBUILT_DTBOIMAGE
INSTALLED_DTBOIMAGE_TARGET := $(PRODUCT_OUT)/dtbo.img
@@ -1879,17 +2102,6 @@ endif
endif
-# Convert to lower case without requiring a shell, which isn't cacheable.
-to-lower = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,\
-$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,\
-$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,\
-$(subst X,x,$(subst Y,y,$(subst Z,z,$1))))))))))))))))))))))))))
-# Convert to upper case without requiring a shell, which isn't cacheable.
-to-upper=$(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,$(subst g,G,\
-$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,$(subst m,M,$(subst n,N,$(subst o,O,\
-$(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,\
-$(subst x,X,$(subst y,Y,$(subst z,Z,$1))))))))))))))))))))))))))
-
# -----------------------------------------------------------------
# vbmeta image
ifeq ($(BOARD_AVB_ENABLE),true)
@@ -1912,6 +2124,8 @@ BOOT_FOOTER_ARGS := BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS
DTBO_FOOTER_ARGS := BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS
SYSTEM_FOOTER_ARGS := BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS
VENDOR_FOOTER_ARGS := BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS
+RECOVERY_FOOTER_ARGS := BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS
+PRODUCT_FOOTER_ARGS := BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS
# Check and set required build variables for a chain partition.
# $(1): the partition to enable AVB chain, e.g., BOOT or SYSTEM.
@@ -1964,6 +2178,15 @@ INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
endif
endif
+ifdef INSTALLED_PRODUCTIMAGE_TARGET
+ifdef BOARD_AVB_PRODUCT_KEY_PATH
+$(eval $(call check-and-set-avb-chain-args,PRODUCT))
+else
+INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
+ --include_descriptors_from_image $(INSTALLED_PRODUCTIMAGE_TARGET)
+endif
+endif
+
ifdef INSTALLED_DTBOIMAGE_TARGET
ifdef BOARD_AVB_DTBO_KEY_PATH
$(eval $(call check-and-set-avb-chain-args,DTBO))
@@ -1973,6 +2196,15 @@ INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
endif
endif
+ifdef INSTALLED_RECOVERYIMAGE_TARGET
+ifdef BOARD_AVB_RECOVERY_KEY_PATH
+$(eval $(call check-and-set-avb-chain-args,RECOVERY))
+else
+INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
+ --include_descriptors_from_image $(INSTALLED_RECOVERYIMAGE_TARGET)
+endif
+endif
+
BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --padding_size 4096
# Add kernel cmdline descriptor for kernel to mount system.img as root with
@@ -2008,9 +2240,15 @@ define extract-avb-chain-public-keys
$(if $(BOARD_AVB_VENDOR_KEY_PATH),\
$(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VENDOR_KEY_PATH) \
--output $(1)/vendor.avbpubkey)
+ $(if $(BOARD_AVB_PRODUCT_KEY_PATH),\
+ $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_PRODUCT_KEY_PATH) \
+ --output $(1)/product.avbpubkey)
$(if $(BOARD_AVB_DTBO_KEY_PATH),\
$(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_DTBO_KEY_PATH) \
--output $(1)/dtbo.avbpubkey)
+ $(if $(BOARD_AVB_RECOVERY_KEY_PATH),\
+ $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_RECOVERY_KEY_PATH) \
+ --output $(1)/recovery.avbpubkey)
endef
define build-vbmetaimage-target
@@ -2026,7 +2264,15 @@ define build-vbmetaimage-target
endef
INSTALLED_VBMETAIMAGE_TARGET := $(BUILT_VBMETAIMAGE_TARGET)
-$(INSTALLED_VBMETAIMAGE_TARGET): $(AVBTOOL) $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_SYSTEMIMAGE) $(INSTALLED_VENDORIMAGE_TARGET) $(INSTALLED_DTBOIMAGE_TARGET) $(BOARD_AVB_KEY_PATH)
+$(INSTALLED_VBMETAIMAGE_TARGET): \
+ $(AVBTOOL) \
+ $(INSTALLED_BOOTIMAGE_TARGET) \
+ $(INSTALLED_SYSTEMIMAGE) \
+ $(INSTALLED_VENDORIMAGE_TARGET) \
+ $(INSTALLED_PRODUCTIMAGE_TARGET) \
+ $(INSTALLED_DTBOIMAGE_TARGET) \
+ $(INSTALLED_RECOVERYIMAGE_TARGET) \
+ $(BOARD_AVB_KEY_PATH)
$(build-vbmetaimage-target)
.PHONY: vbmetaimage-nodeps
@@ -2081,6 +2327,7 @@ endif
ifeq ($(build_ota_package),true)
OTATOOLS := $(HOST_OUT_EXECUTABLES)/minigzip \
$(HOST_OUT_EXECUTABLES)/aapt \
+ $(HOST_OUT_EXECUTABLES)/checkvintf \
$(HOST_OUT_EXECUTABLES)/mkbootfs \
$(HOST_OUT_EXECUTABLES)/mkbootimg \
$(HOST_OUT_EXECUTABLES)/fs_config \
@@ -2091,8 +2338,6 @@ OTATOOLS := $(HOST_OUT_EXECUTABLES)/minigzip \
$(HOST_OUT_JAVA_LIBRARIES)/signapk.jar \
$(HOST_OUT_JAVA_LIBRARIES)/BootSignature.jar \
$(HOST_OUT_JAVA_LIBRARIES)/VeritySigner.jar \
- $(HOST_OUT_EXECUTABLES)/make_ext4fs \
- $(HOST_OUT_EXECUTABLES)/mkuserimg.sh \
$(HOST_OUT_EXECUTABLES)/mke2fs \
$(HOST_OUT_EXECUTABLES)/mkuserimg_mke2fs.sh \
$(HOST_OUT_EXECUTABLES)/e2fsdroid \
@@ -2100,9 +2345,11 @@ OTATOOLS := $(HOST_OUT_EXECUTABLES)/minigzip \
$(HOST_OUT_EXECUTABLES)/mksquashfs \
$(HOST_OUT_EXECUTABLES)/mkf2fsuserimg.sh \
$(HOST_OUT_EXECUTABLES)/make_f2fs \
+ $(HOST_OUT_EXECUTABLES)/sload_f2fs \
$(HOST_OUT_EXECUTABLES)/simg2img \
$(HOST_OUT_EXECUTABLES)/e2fsck \
$(HOST_OUT_EXECUTABLES)/build_verity_tree \
+ $(HOST_OUT_EXECUTABLES)/generate_verity_key \
$(HOST_OUT_EXECUTABLES)/verity_signer \
$(HOST_OUT_EXECUTABLES)/verity_verifier \
$(HOST_OUT_EXECUTABLES)/append2simg \
@@ -2114,7 +2361,7 @@ OTATOOLS := $(HOST_OUT_EXECUTABLES)/minigzip \
$(HOST_OUT_EXECUTABLES)/delta_generator \
$(AVBTOOL) \
$(BLK_ALLOC_TO_BASE_FS) \
- $(BRO)
+ $(BROTLI)
ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT))
OTATOOLS += \
@@ -2128,6 +2375,7 @@ OTATOOLS += \
$(HOST_LIBRARY_PATH)/liblog$(HOST_SHLIB_SUFFIX) \
$(HOST_LIBRARY_PATH)/libcutils$(HOST_SHLIB_SUFFIX) \
$(HOST_LIBRARY_PATH)/libselinux$(HOST_SHLIB_SUFFIX) \
+ $(HOST_LIBRARY_PATH)/libcrypto_utils$(HOST_SHLIB_SUFFIX) \
$(HOST_LIBRARY_PATH)/libcrypto-host$(HOST_SHLIB_SUFFIX) \
$(HOST_LIBRARY_PATH)/libext2fs-host$(HOST_SHLIB_SUFFIX) \
$(HOST_LIBRARY_PATH)/libext2_blkid-host$(HOST_SHLIB_SUFFIX) \
@@ -2161,18 +2409,20 @@ $(BUILT_OTATOOLS_PACKAGE): zip_root := $(call intermediates-dir-for,PACKAGING,ot
OTATOOLS_DEPS := \
system/extras/verity/build_verity_metadata.py \
system/extras/ext4_utils/mke2fs.conf \
- external/avb/test/data/testkey_rsa4096.pem \
- $(shell find build/target/product/security -type f -name \*.x509.pem -o -name \*.pk8 -o \
- -name verity_key | sort) \
- $(shell find device vendor -type f -name \*.pk8 -o -name verifiedboot\* -o \
- -name \*.x509.pem -o -name oem\*.prop | sort)
+ $(sort $(shell find external/avb/test/data -type f -name "testkey_*.pem" -o \
+ -name "atx_metadata.bin")) \
+ $(sort $(shell find system/update_engine/scripts -name \*.pyc -prune -o -type f -print)) \
+ $(sort $(shell find build/target/product/security -type f -name \*.x509.pem -o -name \*.pk8 -o \
+ -name verity_key)) \
+ $(sort $(shell find device $(wildcard vendor) -type f -name \*.pk8 -o -name verifiedboot\* -o \
+ -name \*.x509.pem -o -name oem\*.prop))
OTATOOLS_RELEASETOOLS := \
- $(shell find build/tools/releasetools -name \*.pyc -prune -o -type f | sort)
+ $(sort $(shell find build/make/tools/releasetools -name \*.pyc -prune -o -type f))
ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT))
OTATOOLS_DEPS += \
- $(shell find external/vboot_reference/tests/devkeys -type f | sort)
+ $(sort $(shell find external/vboot_reference/tests/devkeys -type f))
endif
$(BUILT_OTATOOLS_PACKAGE): $(OTATOOLS) $(OTATOOLS_DEPS) $(OTATOOLS_RELEASETOOLS) | $(ACP)
@@ -2180,7 +2430,7 @@ $(BUILT_OTATOOLS_PACKAGE): $(OTATOOLS) $(OTATOOLS_DEPS) $(OTATOOLS_RELEASETOOLS)
$(hide) rm -rf $@ $(zip_root)
$(hide) mkdir -p $(dir $@) $(zip_root)/bin $(zip_root)/framework $(zip_root)/releasetools
$(call copy-files-with-structure,$(OTATOOLS),$(HOST_OUT)/,$(zip_root))
- $(hide) $(ACP) -r -d -p build/tools/releasetools/* $(zip_root)/releasetools
+ $(hide) $(ACP) -r -d -p build/make/tools/releasetools/* $(zip_root)/releasetools
$(hide) rm -rf $@ $(zip_root)/releasetools/*.pyc
$(hide) (cd $(zip_root) && zip -qryX $(abspath $@) *)
$(hide) echo $(OTATOOLS_DEPS) | xargs zip -qryX $(abspath $@)>/dev/null || true
@@ -2241,9 +2491,7 @@ $(BUILT_TARGET_FILES_PACKAGE): PRIVATE_TOOL_EXTENSIONS := $(tool_extensions)
$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_TOOL_EXTENSION := $(tool_extension)
ifeq ($(AB_OTA_UPDATER),true)
-# Build zlib fingerprint if using the AB Updater.
-updater_dep := $(TARGET_OUT_COMMON_GEN)/zlib_fingerprint
-updater_dep += system/update_engine/update_engine.conf
+updater_dep := system/update_engine/update_engine.conf
else
# Build OTA tools if not using the AB Updater.
updater_dep := $(built_ota_tools)
@@ -2273,7 +2521,7 @@ endif
# $1: root directory
# $2: add prefix
define fs_config
-(cd $(1); find . -type d | sed 's,$$,/,'; find . \! -type d) | cut -c 3- | sort | sed 's,^,$(2),' | $(HOST_OUT_EXECUTABLES)/fs_config -C -D $(TARGET_OUT) -S $(SELINUX_FC)
+(cd $(1); find . -type d | sed 's,$$,/,'; find . \! -type d) | cut -c 3- | sort | sed 's,^,$(2),' | $(HOST_OUT_EXECUTABLES)/fs_config -C -D $(TARGET_OUT) -S $(SELINUX_FC) -R "$(2)"
endef
# Depending on the various images guarantees that the underlying
@@ -2286,6 +2534,7 @@ $(BUILT_TARGET_FILES_PACKAGE): \
$(INSTALLED_USERDATAIMAGE_TARGET) \
$(INSTALLED_CACHEIMAGE_TARGET) \
$(INSTALLED_VENDORIMAGE_TARGET) \
+ $(INSTALLED_PRODUCTIMAGE_TARGET) \
$(INSTALLED_VBMETAIMAGE_TARGET) \
$(INSTALLED_DTBOIMAGE_TARGET) \
$(INTERNAL_SYSTEMOTHERIMAGE_FILES) \
@@ -2294,6 +2543,7 @@ $(BUILT_TARGET_FILES_PACKAGE): \
$(INSTALLED_2NDBOOTLOADER_TARGET) \
$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH) \
$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH) \
+ $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH) \
$(SELINUX_FC) \
$(APKCERTS_FILE) \
$(SOONG_ZIP) \
@@ -2301,11 +2551,12 @@ $(BUILT_TARGET_FILES_PACKAGE): \
$(HOST_OUT_EXECUTABLES)/imgdiff \
$(HOST_OUT_EXECUTABLES)/bsdiff \
$(BUILD_IMAGE_SRCS) \
- $(INSTALLED_VENDOR_MANIFEST) \
- $(INSTALLED_VENDOR_MATRIX) \
+ $(BUILT_VENDOR_MANIFEST) \
+ $(BUILT_VENDOR_MATRIX) \
| $(ACP)
@echo "Package target files: $@"
$(call create-system-vendor-symlink)
+ $(call create-system-product-symlink)
$(hide) rm -rf $@ $@.list $(zip_root)
$(hide) mkdir -p $(dir $@) $(zip_root)
ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)))
@@ -2319,6 +2570,9 @@ endif
ifdef INSTALLED_2NDBOOTLOADER_TARGET
$(hide) cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/second
endif
+ifdef BOARD_INCLUDE_RECOVERY_DTBO
+ $(hide) cp $(INSTALLED_DTBOIMAGE_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_dtbo
+endif
ifdef INTERNAL_KERNEL_CMDLINE
$(hide) echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/cmdline
endif
@@ -2371,6 +2625,11 @@ ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
$(hide) $(call package_files-copy-root, \
$(TARGET_OUT_VENDOR),$(zip_root)/VENDOR)
endif
+ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
+ @# Contents of the product image
+ $(hide) $(call package_files-copy-root, \
+ $(TARGET_OUT_PRODUCT),$(zip_root)/PRODUCT)
+endif
ifdef INSTALLED_SYSTEMOTHERIMAGE_TARGET
@# Contents of the system_other image
$(hide) $(call package_files-copy-root, \
@@ -2402,18 +2661,15 @@ endif
ifdef BOARD_BOOTIMAGE_PARTITION_SIZE
$(hide) echo "boot_size=$(BOARD_BOOTIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
endif
-ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),)
- $(hide) echo "recovery_as_boot=$(BOARD_USES_RECOVERY_AS_BOOT)" >> $(zip_root)/META/misc_info.txt
-endif
ifeq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
$(hide) echo "no_recovery=true" >> $(zip_root)/META/misc_info.txt
endif
+ifdef BOARD_INCLUDE_RECOVERY_DTBO
+ $(hide) echo "include_recovery_dtbo=true" >> $(zip_root)/META/misc_info.txt
+endif
ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE
$(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
endif
-ifdef BOARD_HAS_EXT4_RESERVED_BLOCKS
- $(hide) echo "has_ext4_reserved_blocks=$(BOARD_HAS_EXT4_RESERVED_BLOCKS)" >> $(zip_root)/META/misc_info.txt
-endif
ifdef TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS
@# TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS can be empty to indicate that nothing but defaults should be used.
$(hide) echo "recovery_mount_options=$(TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $(zip_root)/META/misc_info.txt
@@ -2441,6 +2697,10 @@ ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH),)
$(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH) \
$(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH))
endif
+ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH),)
+ $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH) \
+ $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH))
+endif
ifneq ($(strip $(SANITIZE_TARGET)),)
# We need to create userdata.img with real data because the instrumented libraries are in userdata.img.
$(hide) echo "userdata_img_with_data=true" >> $(zip_root)/META/misc_info.txt
@@ -2459,6 +2719,12 @@ ifdef BOARD_AVB_BOOT_KEY_PATH
$(hide) echo "avb_boot_algorithm=$(BOARD_AVB_BOOT_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
$(hide) echo "avb_boot_rollback_index_location=$(BOARD_AVB_BOOT_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
endif # BOARD_AVB_BOOT_KEY_PATH
+ $(hide) echo "avb_recovery_add_hash_footer_args=$(BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
+ifdef BOARD_AVB_RECOVERY_KEY_PATH
+ $(hide) echo "avb_recovery_key_path=$(BOARD_AVB_RECOVERY_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
+ $(hide) echo "avb_recovery_algorithm=$(BOARD_AVB_RECOVERY_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
+ $(hide) echo "avb_recovery_rollback_index_location=$(BOARD_AVB_RECOVERY_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
+endif # BOARD_AVB_RECOVERY_KEY_PATH
endif # BOARD_AVB_ENABLE
ifdef BOARD_BPT_INPUT_FILES
$(hide) echo "board_bpt_enable=true" >> $(zip_root)/META/misc_info.txt
@@ -2471,12 +2737,11 @@ endif
$(call generate-userimage-prop-dictionary, $(zip_root)/META/misc_info.txt)
ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
- ./build/tools/releasetools/make_recovery_patch $(zip_root) $(zip_root)
+ build/make/tools/releasetools/make_recovery_patch $(zip_root) $(zip_root)
endif
ifeq ($(AB_OTA_UPDATER),true)
@# When using the A/B updater, include the updater config files in the zip.
$(hide) cp $(TOPDIR)system/update_engine/update_engine.conf $(zip_root)/META/update_engine_config.txt
- $(hide) cp $(TARGET_OUT_COMMON_GEN)/zlib_fingerprint $(zip_root)/META/zlib_fingerprint.txt
$(hide) for part in $(AB_OTA_PARTITIONS); do \
echo "$${part}" >> $(zip_root)/META/ab_partitions.txt; \
done
@@ -2519,6 +2784,14 @@ ifdef BOARD_PREBUILT_VENDORIMAGE
$(hide) mkdir -p $(zip_root)/IMAGES
$(hide) cp $(INSTALLED_VENDORIMAGE_TARGET) $(zip_root)/IMAGES/
endif
+ifdef BOARD_PREBUILT_PRODUCTIMAGE
+ $(hide) mkdir -p $(zip_root)/IMAGES
+ $(hide) cp $(INSTALLED_PRODUCTIMAGE_TARGET) $(zip_root)/IMAGES/
+endif
+ifdef BOARD_PREBUILT_BOOTIMAGE
+ $(hide) mkdir -p $(zip_root)/IMAGES
+ $(hide) cp $(INSTALLED_BOOTIMAGE_TARGET) $(zip_root)/IMAGES/
+endif
ifdef BOARD_PREBUILT_DTBOIMAGE
$(hide) mkdir -p $(zip_root)/PREBUILT_IMAGES
$(hide) cp $(INSTALLED_DTBOIMAGE_TARGET) $(zip_root)/PREBUILT_IMAGES/
@@ -2545,18 +2818,25 @@ endif # BOARD_PREBUILT_DTBOIMAGE
ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
$(hide) $(call fs_config,$(zip_root)/VENDOR,vendor/) > $(zip_root)/META/vendor_filesystem_config.txt
endif
+ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
+ $(hide) $(call fs_config,$(zip_root)/PRODUCT,product/) > $(zip_root)/META/product_filesystem_config.txt
+endif
ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
+ @# When using BOARD_BUILD_SYSTEM_ROOT_IMAGE, ROOT always contains the files for the root under
+ @# normal boot. BOOT/RAMDISK exists only if additionally using BOARD_USES_RECOVERY_AS_BOOT.
$(hide) $(call fs_config,$(zip_root)/ROOT,) > $(zip_root)/META/root_filesystem_config.txt
+ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
+ $(hide) $(call fs_config,$(zip_root)/BOOT/RAMDISK,) > $(zip_root)/META/boot_filesystem_config.txt
endif
+else # BOARD_BUILD_SYSTEM_ROOT_IMAGE != true
$(hide) $(call fs_config,$(zip_root)/BOOT/RAMDISK,) > $(zip_root)/META/boot_filesystem_config.txt
+endif
ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
$(hide) $(call fs_config,$(zip_root)/RECOVERY/RAMDISK,) > $(zip_root)/META/recovery_filesystem_config.txt
endif
ifdef INSTALLED_SYSTEMOTHERIMAGE_TARGET
$(hide) $(call fs_config,$(zip_root)/SYSTEM_OTHER,system/) > $(zip_root)/META/system_other_filesystem_config.txt
endif
-
-ifeq ($(PRODUCT_FULL_TREBLE),true)
@# Metadata for compatibility verification.
$(hide) cp $(BUILT_SYSTEM_MANIFEST) $(zip_root)/META/system_manifest.xml
$(hide) cp $(BUILT_SYSTEM_COMPATIBILITY_MATRIX) $(zip_root)/META/system_matrix.xml
@@ -2566,10 +2846,9 @@ endif
ifdef BUILT_VENDOR_MATRIX
$(hide) cp $(BUILT_VENDOR_MATRIX) $(zip_root)/META/vendor_matrix.xml
endif
-endif
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
- ./build/tools/releasetools/add_img_to_target_files -a -v -p $(HOST_OUT) $(zip_root)
+ build/make/tools/releasetools/add_img_to_target_files -a -v -p $(HOST_OUT) $(zip_root)
@# Zip everything up, preserving symlinks and placing META/ files first to
@# help early validation of the .zip file while uploading it.
$(hide) find $(zip_root)/META | sort >$@.list
@@ -2609,14 +2888,14 @@ $(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
ifeq ($(AB_OTA_UPDATER),true)
$(INTERNAL_OTA_PACKAGE_TARGET): $(BRILLO_UPDATE_PAYLOAD)
else
-$(INTERNAL_OTA_PACKAGE_TARGET): $(BRO)
+$(INTERNAL_OTA_PACKAGE_TARGET): $(BROTLI)
endif
$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) \
- build/tools/releasetools/ota_from_target_files
+ build/make/tools/releasetools/ota_from_target_files
@echo "Package OTA: $@"
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
- ./build/tools/releasetools/ota_from_target_files -v \
+ build/make/tools/releasetools/ota_from_target_files -v \
--block \
--extracted_input_target_files $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE)) \
-p $(HOST_OUT) \
@@ -2659,12 +2938,13 @@ endif
name := $(name)-symbols-$(FILE_NAME_TAG)
SYMBOLS_ZIP := $(PRODUCT_OUT)/$(name).zip
-# For apps_only build we'll establish the dependency later in build/core/main.mk.
+# For apps_only build we'll establish the dependency later in build/make/core/main.mk.
ifndef TARGET_BUILD_APPS
$(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE) \
$(INSTALLED_BOOTIMAGE_TARGET) \
$(INSTALLED_USERDATAIMAGE_TARGET) \
$(INSTALLED_VENDORIMAGE_TARGET) \
+ $(INSTALLED_PRODUCTIMAGE_TARGET) \
$(updater_dep)
endif
$(SYMBOLS_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,symbols)/filelist
@@ -2687,7 +2967,8 @@ ifndef TARGET_BUILD_APPS
$(COVERAGE_ZIP): $(INSTALLED_SYSTEMIMAGE) \
$(INSTALLED_BOOTIMAGE_TARGET) \
$(INSTALLED_USERDATAIMAGE_TARGET) \
- $(INSTALLED_VENDORIMAGE_TARGET)
+ $(INSTALLED_VENDORIMAGE_TARGET) \
+ $(INSTALLED_PRODUCTIMAGE_TARGET)
endif
$(COVERAGE_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,coverage)/filelist
$(COVERAGE_ZIP): $(SOONG_ZIP)
@@ -2721,14 +3002,13 @@ $(APPS_ZIP): $(INSTALLED_SYSTEMIMAGE)
fi
ifeq (true,$(EMMA_INSTRUMENT))
- #------------------------------------------------------------------
- # An archive of classes for use in generating code-coverage reports
- # These are the uninstrumented versions of any classes that were
- # to be instrumented.
- # Any dependencies are set up later in build/core/main.mk.
-
- ifeq ($(ANDROID_COMPILE_WITH_JACK),false)
- JACOCO_REPORT_CLASSES_ALL := $(PRODUCT_OUT)/jacoco-report-classes-all.jar
+#------------------------------------------------------------------
+# An archive of classes for use in generating code-coverage reports
+# These are the uninstrumented versions of any classes that were
+# to be instrumented.
+# Any dependencies are set up later in build/make/core/main.mk.
+
+JACOCO_REPORT_CLASSES_ALL := $(PRODUCT_OUT)/jacoco-report-classes-all.jar
$(JACOCO_REPORT_CLASSES_ALL) :
@echo "Collecting uninstrumented classes"
$(hide) find $(TARGET_COMMON_OUT_ROOT) $(HOST_COMMON_OUT_ROOT) -name "jacoco-report-classes.jar" | \
@@ -2739,14 +3019,6 @@ $(JACOCO_REPORT_CLASSES_ALL) :
# -q supress most output
# -X skip storing extended file attributes
- else
- EMMA_META_ZIP := $(PRODUCT_OUT)/emma_meta.zip
-$(EMMA_META_ZIP) :
- @echo "Collecting Emma coverage meta files."
- $(hide) find $(TARGET_COMMON_OUT_ROOT) $(HOST_COMMON_OUT_ROOT) -name "coverage.em" | \
- zip -@ -qX $@
-endif
-
endif # EMMA_INSTRUMENT=true
@@ -2756,10 +3028,10 @@ endif # EMMA_INSTRUMENT=true
#
ifdef TARGET_BUILD_APPS
PROGUARD_DICT_ZIP := $(PRODUCT_OUT)/$(TARGET_PRODUCT)-proguard-dict-$(FILE_NAME_TAG).zip
-# the dependency will be set up later in build/core/main.mk.
+# the dependency will be set up later in build/make/core/main.mk.
$(PROGUARD_DICT_ZIP) :
@echo "Packaging Proguard obfuscation dictionary files."
- $(hide) dict_files=`find $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS -name proguard_dictionary -o -name jack_dictionary`; \
+ $(hide) dict_files=`find $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS -name proguard_dictionary`; \
if [ -n "$$dict_files" ]; then \
unobfuscated_jars=$${dict_files//proguard_dictionary/classes.jar}; \
zip -qX $@ $$dict_files $$unobfuscated_jars; \
@@ -2796,6 +3068,15 @@ $(INSTALLED_QEMU_VENDORIMAGE): $(INSTALLED_VENDORIMAGE_TARGET) $(MK_QEMU_IMAGE_S
vendorimage: $(INSTALLED_QEMU_VENDORIMAGE)
droidcore: $(INSTALLED_QEMU_VENDORIMAGE)
endif
+ifeq ($(BOARD_USES_PRODUCTIMAGE),true)
+INSTALLED_QEMU_PRODUCTIMAGE := $(PRODUCT_OUT)/product-qemu.img
+$(INSTALLED_QEMU_PRODUCTIMAGE): $(INSTALLED_PRODUCTIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST)
+ @echo Create product-qemu.img
+ (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) ${PRODUCT_OUT}/product.img)
+
+productimage: $(INSTALLED_QEMU_PRODUCTIMAGE)
+droidcore: $(INSTALLED_QEMU_PRODUCTIMAGE)
+endif
endif
# -----------------------------------------------------------------
# The emulator package
@@ -2942,7 +3223,6 @@ $(INTERNAL_SDK_TARGET): $(deps)
-v "TARGET_CPU_ABI=$(TARGET_CPU_ABI)" \
-v "DLL_EXTENSION=$(HOST_SHLIB_SUFFIX)" \
-v "FONT_OUT=$(SDK_FONT_TEMP)" \
- -v "JACK_SDKTOOL_VERSION=$(JACK_SDKTOOL_VERSION)" \
-o $(PRIVATE_DIR) && \
cp -f $(target_notice_file_txt) \
$(PRIVATE_DIR)/system-images/android-$(PLATFORM_VERSION)/$(TARGET_CPU_ABI)/NOTICE.txt && \
@@ -3003,3 +3283,9 @@ include $(BUILD_SYSTEM)/product-graph.mk
ifneq ($(sdk_repo_goal),)
include $(TOPDIR)development/build/tools/sdk_repo.mk
endif
+
+#------------------------------------------------------------------
+# Find lsdump paths
+FIND_LSDUMPS_FILE := $(PRODUCT_OUT)/lsdump_paths.txt
+$(FIND_LSDUMPS_FILE) : $(LSDUMP_PATHS)
+ $(hide) rm -rf $@ && echo "$^" > $@
diff --git a/core/aapt2.mk b/core/aapt2.mk
index 287f933..b3a7c93 100644
--- a/core/aapt2.mk
+++ b/core/aapt2.mk
@@ -12,6 +12,7 @@
# - proguard_options_file
# - my_generated_res_dirs: Resources generated during the build process and we have to compile them in a single run of aapt2.
# - my_generated_res_dirs_deps: the dependency to use for my_generated_res_dirs.
+# - my_generated_res_zips: Zip files containing resources
# - my_apk_split_configs: The configurations for which to generate splits.
# - built_apk_splits: The paths where AAPT should generate the splits.
#
@@ -35,7 +36,7 @@ my_overlay_resources_flat := \
$(eval $(call aapt2-compile-one-resource-file-rule,$(r),$(o)))\
$(o))
-my_generated_resources_flata :=
+my_resources_flata :=
# Compile generated resources
ifneq ($(my_generated_res_dirs),)
my_generated_resources_flata := $(my_compiled_res_base_dir)/gen_res.flata
@@ -44,14 +45,29 @@ $(my_generated_resources_flata) : $(my_generated_res_dirs_deps) $(AAPT2)
@echo "AAPT2 compile $@ <- $(PRIVATE_SOURCE_RES_DIRS)"
$(call aapt2-compile-resource-dirs)
-my_generated_resources_flata += $(my_generated_resources_flata)
+my_resources_flata += $(my_generated_resources_flata)
endif
-$(my_res_resources_flat) $(my_overlay_resources_flat) $(my_generated_resources_flata): \
- PRIVATE_AAPT2_CFLAGS := $(PRODUCT_AAPT2_CFLAGS)
+# Compile zipped resources
+ifneq ($(my_generated_res_zips),)
+my_zipped_resources_flata := $(my_compiled_res_base_dir)/zip_res.flata
+$(my_zipped_resources_flata): PRIVATE_SOURCE_RES_ZIPS := $(my_generated_res_zips)
+$(my_zipped_resources_flata) : $(my_generated_res_zips) $(AAPT2) $(ZIPSYNC)
+ @echo "AAPT2 compile $@ <- $(PRIVATE_SOURCE_RES_ZIPS)"
+ $(call aapt2-compile-resource-zips)
+
+my_resources_flata += $(my_zipped_resources_flata)
+endif
+
+# Always set --pseudo-localize, it will be stripped out later for release
+# builds that don't want it.
+$(my_res_resources_flat) $(my_overlay_resources_flat) $(my_resources_flata): \
+ PRIVATE_AAPT2_CFLAGS := --pseudo-localize
my_static_library_resources := $(foreach l, $(call reverse-list,$(LOCAL_STATIC_ANDROID_LIBRARIES)),\
$(call intermediates-dir-for,JAVA_LIBRARIES,$(l),,COMMON)/package-res.apk)
+my_static_library_extra_packages := $(foreach l, $(call reverse-list,$(LOCAL_STATIC_ANDROID_LIBRARIES)),\
+ $(call intermediates-dir-for,JAVA_LIBRARIES,$(l),,COMMON)/extra_packages)
my_shared_library_resources := $(foreach l, $(LOCAL_SHARED_ANDROID_LIBRARIES),\
$(call intermediates-dir-for,JAVA_LIBRARIES,$(l),,COMMON)/package-res.apk)
@@ -64,28 +80,25 @@ ifneq ($(my_apk_split_configs),)
$(my_res_package): PRIVATE_AAPT_FLAGS += $(addprefix --split ,$(join $(built_apk_splits),$(addprefix :,$(my_apk_split_configs))))
endif
+my_srcjar := $(intermediates.COMMON)/aapt2.srcjar
+LOCAL_SRCJARS += $(my_srcjar)
+
+aapt_extra_packages := $(intermediates.COMMON)/extra_packages
+
$(my_res_package): PRIVATE_RES_FLAT := $(my_res_resources_flat)
-$(my_res_package): PRIVATE_OVERLAY_FLAT := $(my_static_library_resources) $(my_generated_resources_flata) $(my_overlay_resources_flat)
+$(my_res_package): PRIVATE_OVERLAY_FLAT := $(my_static_library_resources) $(my_resources_flata) $(my_overlay_resources_flat)
$(my_res_package): PRIVATE_SHARED_ANDROID_LIBRARIES := $(my_shared_library_resources)
$(my_res_package): PRIVATE_PROGUARD_OPTIONS_FILE := $(proguard_options_file)
$(my_res_package): PRIVATE_ASSET_DIRS := $(my_asset_dirs)
-$(my_res_package): $(full_android_manifest) $(my_static_library_resources) $(my_shared_library_resources)
-$(my_res_package): $(my_full_asset_paths)
-$(my_res_package): $(my_res_resources_flat) $(my_overlay_resources_flat) \
- $(my_generated_resources_flata) $(my_static_library_resources) \
- $(AAPT2)
- @echo "AAPT2 link $@"
- $(call aapt2-link)
+$(my_res_package): PRIVATE_JAVA_GEN_DIR := $(intermediates.COMMON)/aapt2
+$(my_res_package): PRIVATE_SRCJAR := $(my_srcjar)
+$(my_res_package): PRIVATE_STATIC_LIBRARY_EXTRA_PACKAGES := $(my_static_library_extra_packages)
+$(my_res_package): PRIVATE_AAPT_EXTRA_PACKAGES := $(aapt_extra_packages)
+$(my_res_package): .KATI_IMPLICIT_OUTPUTS := $(my_srcjar) $(aapt_extra_packages)
ifdef R_file_stamp
-$(R_file_stamp) : $(my_res_package) | $(ACP)
- @echo "target R.java/Manifest.java: $(PRIVATE_MODULE) ($@)"
- @rm -rf $@ && mkdir -p $(dir $@)
- $(call find-generated-R.java)
-endif
-
-ifdef proguard_options_file
-$(proguard_options_file) : $(my_res_package)
+$(my_res_package): PRIVATE_R_FILE_STAMP := $(R_file_stamp)
+$(my_res_package): .KATI_IMPLICIT_OUTPUTS += $(R_file_stamp)
endif
resource_export_package :=
@@ -94,10 +107,38 @@ ifdef LOCAL_EXPORT_PACKAGE_RESOURCES
# other packages can use to build their own PRODUCT-agnostic R.java (etc.)
# files.
resource_export_package := $(intermediates.COMMON)/package-export.apk
-$(R_file_stamp) : $(resource_export_package)
+$(my_res_package): PRIVATE_RESOURCE_EXPORT_PACKAGE := $(resource_export_package)
+$(my_res_package): .KATI_IMPLICIT_OUTPUTS += $(resource_export_package)
+endif
-$(resource_export_package) : $(my_res_package) | $(ACP)
- @echo "target Export Resources: $(PRIVATE_MODULE) $(@)"
- $(copy-file-to-new-target)
+ifdef proguard_options_file
+$(my_res_package): .KATI_IMPLICIT_OUTPUTS += $(proguard_options_file)
+endif
+$(my_res_package): $(full_android_manifest) $(my_static_library_resources) $(my_shared_library_resources)
+$(my_res_package): $(my_full_asset_paths)
+$(my_res_package): $(my_res_resources_flat) $(my_overlay_resources_flat) \
+ $(my_resources_flata) $(my_static_library_resources) $(my_static_library_extra_packages) \
+ $(AAPT2) $(SOONG_ZIP) $(EXTRACT_JAR_PACKAGES)
+ @echo "AAPT2 link $@"
+ $(call aapt2-link)
+ifdef R_file_stamp
+ @rm -f $(PRIVATE_R_FILE_STAMP)
+ $(call find-generated-R.java,$(PRIVATE_JAVA_GEN_DIR),$(PRIVATE_R_FILE_STAMP))
+endif
+ifdef LOCAL_EXPORT_PACKAGE_RESOURCES
+ @rm -f $(PRIVATE_RESOURCE_EXPORT_PACKAGE)
+
+ cp $@ $(PRIVATE_RESOURCE_EXPORT_PACKAGE)
endif
+
+# Clear inputs only used in this file, so that they're not re-used during the next build
+my_res_resources :=
+my_overlay_resources :=
+my_compiled_res_base_dir :=
+my_asset_dirs :=
+my_full_asset_paths :=
+my_apk_split_configs :=
+my_generated_res_dirs :=
+my_generated_res_dirs_deps :=
+my_generated_res_zips :=
diff --git a/core/aapt_flags.mk b/core/aapt_flags.mk
new file mode 100644
index 0000000..13d4817
--- /dev/null
+++ b/core/aapt_flags.mk
@@ -0,0 +1,15 @@
+## AAPT Flags
+# aapt doesn't accept multiple --extra-packages flags.
+# We have to collapse them into a single --extra-packages flag here.
+LOCAL_AAPT_FLAGS := $(strip $(LOCAL_AAPT_FLAGS))
+ifdef LOCAL_AAPT_FLAGS
+ ifeq ($(filter 0 1,$(words $(filter --extra-packages,$(LOCAL_AAPT_FLAGS)))),)
+ aapt_flags := $(subst --extra-packages$(space),--extra-packages@,$(LOCAL_AAPT_FLAGS))
+ aapt_flags_extra_packages := $(patsubst --extra-packages@%,%,$(filter --extra-packages@%,$(aapt_flags)))
+ aapt_flags_extra_packages := $(sort $(subst :,$(space),$(aapt_flags_extra_packages)))
+ LOCAL_AAPT_FLAGS := $(filter-out --extra-packages@%,$(aapt_flags)) \
+ --extra-packages $(subst $(space),:,$(aapt_flags_extra_packages))
+ aapt_flags_extra_packages :=
+ aapt_flags :=
+ endif
+endif
diff --git a/core/allowed_ndk_types.mk b/core/allowed_ndk_types.mk
new file mode 100644
index 0000000..b88b9e8
--- /dev/null
+++ b/core/allowed_ndk_types.mk
@@ -0,0 +1,84 @@
+# Determines the types of NDK modules the current module is allowed to link to.
+# Input variables:
+# LOCAL_MODULE
+# LOCAL_MODULE_CLASS
+# LOCAL_NDK_STL_VARIANT
+# LOCAL_SDK_VERSION
+# Output variables:
+# my_ndk_stl_family: Family of the NDK STL.
+# my_ndk_stl_link_type: STL link type, static or shared.
+# my_allowed_ndk_types: Types of NDK modules that may be linked.
+# my_warn_ndk_types: Types of NDK modules that shouldn't be linked, but are.
+
+my_allowed_ndk_types :=
+my_warn_ndk_types :=
+my_ndk_stl_family :=
+my_ndk_stl_link_type :=
+
+ifdef LOCAL_SDK_VERSION
+ ifeq ($(LOCAL_NDK_STL_VARIANT),)
+ my_ndk_stl_family := system
+ my_ndk_stl_link_type := shared
+ else ifeq ($(LOCAL_NDK_STL_VARIANT),system)
+ my_ndk_stl_family := system
+ my_ndk_stl_link_type := shared
+ else ifeq ($(LOCAL_NDK_STL_VARIANT),c++_shared)
+ my_ndk_stl_family := libc++
+ my_ndk_stl_link_type := shared
+ else ifeq ($(LOCAL_NDK_STL_VARIANT),c++_static)
+ my_ndk_stl_family := libc++
+ my_ndk_stl_link_type := static
+ else ifeq ($(LOCAL_NDK_STL_VARIANT),none)
+ my_ndk_stl_family := none
+ my_ndk_stl_link_type := none
+ else
+ $(call pretty-error,invalid LOCAL_NDK_STL_VARIANT: $(LOCAL_NDK_STL_VARIANT))
+ endif
+
+ ifeq ($(LOCAL_MODULE_CLASS),STATIC_LIBRARIES)
+ # The "none" link type indicates that nothing is actually linked. Since
+ # this is a static library, it's still up to the final use of the
+ # library whether a static or shared STL should be used.
+ my_ndk_stl_link_type := none
+ endif
+
+ # The system STL is only the C++ ABI layer, so it's compatible with any STL.
+ my_allowed_ndk_types += native:ndk:system:shared
+ my_allowed_ndk_types += native:ndk:system:none
+
+ # Libaries that don't use the STL can be linked to anything.
+ my_allowed_ndk_types += native:ndk:none:none
+
+ # And it's always okay to link a static library that uses your own STL type.
+ # Since nothing was actually linked for the static library, it is up to the
+ # first linked library in the dependency chain which gets used.
+ my_allowed_ndk_types += native:ndk:$(my_ndk_stl_family):none
+
+ ifeq ($(LOCAL_MODULE_CLASS),APPS)
+ # For an app package, it's actually okay to depend on any set of STLs.
+ # If any of the individual libraries depend on each other they've
+ # already been checked for consistency, and if they don't they'll be
+ # kept isolated by RTLD_LOCAL anyway.
+ my_allowed_ndk_types += \
+ native:ndk:libc++:shared native:ndk:libc++:static
+
+ # The "none" link type that used by static libraries is intentionally
+ # omitted here. We should only be dealing with shared libraries in
+ # LOCAL_JNI_SHARED_LIBRARIES.
+ else ifeq ($(my_ndk_stl_link_type),shared)
+ # Modules linked to a shared STL can only use another shared STL.
+ my_allowed_ndk_types += native:ndk:$(my_ndk_stl_family):shared
+ endif
+ # Else we are a non-static library that uses a static STL, and are
+ # incompatible with all other shared libraries that use an STL.
+else
+ my_allowed_ndk_types := \
+ native:ndk:none:none \
+ native:ndk:system:none \
+ native:ndk:system:shared \
+
+ ifeq ($(LOCAL_MODULE_CLASS),APPS)
+ # CTS is bad and it should feel bad: http://b/13249737
+ my_warn_ndk_types += native:ndk:libc++:static
+ endif
+endif
diff --git a/core/android_manifest.mk b/core/android_manifest.mk
index 0093e02..7d573d3 100644
--- a/core/android_manifest.mk
+++ b/core/android_manifest.mk
@@ -34,10 +34,12 @@ ifdef my_full_libs_manifest_files
main_android_manifest := $(full_android_manifest)
full_android_manifest := $(intermediates.COMMON)/AndroidManifest.xml
$(full_android_manifest): PRIVATE_LIBS_MANIFESTS := $(my_full_libs_manifest_files)
+$(full_android_manifest): $(ANDROID_MANIFEST_MERGER_CLASSPATH)
$(full_android_manifest) : $(main_android_manifest) $(my_full_libs_manifest_deps)
@echo "Merge android manifest files: $@ <-- $< $(PRIVATE_LIBS_MANIFESTS)"
@mkdir -p $(dir $@)
- $(hide) $(ANDROID_MANIFEST_MERGER) --main $< --libs $(PRIVATE_LIBS_MANIFESTS) \
+ $(hide) $(ANDROID_MANIFEST_MERGER) --main $< \
+ --libs $(call normalize-path-list,$(PRIVATE_LIBS_MANIFESTS)) \
--out $@
endif
diff --git a/core/apidiff.mk b/core/apidiff.mk
new file mode 100644
index 0000000..36d75fe
--- /dev/null
+++ b/core/apidiff.mk
@@ -0,0 +1,181 @@
+#
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##
+##
+## Common to both jdiff and javadoc
+##
+##
+
+LOCAL_IS_HOST_MODULE := $(call true-or-empty,$(LOCAL_IS_HOST_MODULE))
+ifeq ($(LOCAL_IS_HOST_MODULE),true)
+my_prefix := HOST_
+LOCAL_HOST_PREFIX :=
+else
+my_prefix := TARGET_
+endif
+
+LOCAL_MODULE_CLASS := $(strip $(LOCAL_MODULE_CLASS))
+ifndef LOCAL_MODULE_CLASS
+$(error $(LOCAL_PATH): LOCAL_MODULE_CLASS not defined)
+endif
+
+full_src_files := $(patsubst %,$(LOCAL_PATH)/%,$(LOCAL_SRC_FILES))
+out_dir := $(OUT_DOCS)/$(LOCAL_MODULE)/api_diff/current
+full_target := $(call doc-timestamp-for,$(LOCAL_MODULE)-diff)
+
+ifeq ($(LOCAL_IS_HOST_MODULE),true)
+$(full_target): PRIVATE_BOOTCLASSPATH :=
+full_java_libs := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/,\
+ $(addsuffix $(COMMON_JAVA_PACKAGE_SUFFIX),$(LOCAL_JAVA_LIBRARIES)))
+full_java_lib_deps := $(full_java_libs)
+
+else
+
+ifneq ($(LOCAL_SDK_VERSION),)
+ ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current)
+ # Use android_stubs_current if LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS.
+ LOCAL_JAVA_LIBRARIES := android_stubs_current $(LOCAL_JAVA_LIBRARIES)
+ $(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, android_stubs_current)
+ else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current)
+ LOCAL_JAVA_LIBRARIES := android_system_stubs_current $(LOCAL_JAVA_LIBRARIES)
+ $(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, android_system_stubs_current)
+ else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),test_current)
+ LOCAL_JAVA_LIBRARIES := android_test_stubs_current $(LOCAL_JAVA_LIBRARIES)
+ $(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, android_test_stubs_current)
+ else
+ # core_<ver> is subset of <ver>. Instead of defining a prebuilt lib for core_<ver>,
+ # use the stub for <ver> when building for apps.
+ _version := $(patsubst core_%,%,$(LOCAL_SDK_VERSION))
+ LOCAL_JAVA_LIBRARIES := sdk_v$(_version) $(LOCAL_JAVA_LIBRARIES)
+ $(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, sdk_v$(_version))
+ _version :=
+ endif
+else
+ LOCAL_JAVA_LIBRARIES := core-oj core-libart ext framework $(LOCAL_JAVA_LIBRARIES)
+ $(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, core-oj):$(call java-lib-files, core-libart)
+endif # LOCAL_SDK_VERSION
+LOCAL_JAVA_LIBRARIES := $(sort $(LOCAL_JAVA_LIBRARIES))
+
+full_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES)) $(LOCAL_CLASSPATH)
+full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES)) $(LOCAL_CLASSPATH)
+endif # !LOCAL_IS_HOST_MODULE
+
+$(full_target): PRIVATE_CLASSPATH := $(subst $(space),:,$(full_java_libs))
+$(full_target): PRIVATE_DOCLAVA_CLASSPATH := $(HOST_OUT_JAVA_LIBRARIES)/jsilver$(COMMON_JAVA_PACKAGE_SUFFIX):$(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX)
+
+intermediates.COMMON := $(call local-intermediates-dir,COMMON)
+
+$(full_target): PRIVATE_SOURCE_PATH := $(call normalize-path-list,$(LOCAL_DROIDDOC_SOURCE_PATH))
+$(full_target): PRIVATE_JAVA_FILES := $(filter %.java,$(full_src_files))
+$(full_target): PRIVATE_JAVA_FILES += $(addprefix $($(my_prefix)OUT_COMMON_INTERMEDIATES)/, $(filter %.java,$(LOCAL_INTERMEDIATE_SOURCES)))
+$(full_target): PRIVATE_SOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/src
+$(full_target): PRIVATE_SRC_LIST_FILE := $(intermediates.COMMON)/droiddoc-src-list
+
+ifneq ($(strip $(LOCAL_ADDITIONAL_JAVA_DIR)),)
+$(full_target): PRIVATE_ADDITIONAL_JAVA_DIR := $(LOCAL_ADDITIONAL_JAVA_DIR)
+endif
+
+# Lists the input files for the doc build into a text file
+# suitable for the @ syntax of javadoc.
+# $(1): the file to create
+# $(2): files to include
+# $(3): list of directories to search for java files in
+define prepare-doc-source-list
+$(hide) mkdir -p $(dir $(1))
+$(call dump-words-to-file, $(2), $(1))
+$(hide) for d in $(3) ; do find $$d -name '*.java' -and -not -name '.*' >> $(1) 2> /dev/null ; done ; true
+endef
+
+##
+##
+## jdiff only
+##
+##
+
+jdiff := \
+ $(HOST_JDK_TOOLS_JAR) \
+ $(HOST_OUT_JAVA_LIBRARIES)/jdiff$(COMMON_JAVA_PACKAGE_SUFFIX)
+
+doclava := \
+ $(HOST_JDK_TOOLS_JAR) \
+ $(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX)
+
+$(full_target): PRIVATE_NEWAPI := $(LOCAL_APIDIFF_NEWAPI)
+$(full_target): PRIVATE_OLDAPI := $(LOCAL_APIDIFF_OLDAPI)
+$(full_target): PRIVATE_OUT_DIR := $(out_dir)
+$(full_target): PRIVATE_OUT_NEWAPI := $(out_dir)/current.xml
+$(full_target): PRIVATE_OUT_OLDAPI := $(out_dir)/$(notdir $(basename $(LOCAL_APIDIFF_OLDAPI))).xml
+$(full_target): PRIVATE_DOCLETPATH := $(HOST_OUT_JAVA_LIBRARIES)/jdiff$(COMMON_JAVA_PACKAGE_SUFFIX)
+$(full_target): \
+ $(full_src_files) \
+ $(full_java_lib_deps) \
+ $(jdiff) \
+ $(doclava) \
+ $(LOCAL_MODULE)-docs \
+ $(LOCAL_ADDITIONAL_DEPENDENCIES)
+ @echo Generating API diff: $(PRIVATE_OUT_DIR)
+ @echo Old API: $(PRIVATE_OLDAPI)
+ @echo New API: $(PRIVATE_NEWAPI)
+ @echo Old XML: $(PRIVATE_OUT_OLDAPI)
+ @echo New XML: $(PRIVATE_OUT_NEWAPI)
+ $(hide) mkdir -p $(dir $@)
+ @echo Converting API files to XML...
+ $(hide) mkdir -p $(PRIVATE_OUT_DIR)
+ $(hide) ( \
+ $(JAVA) \
+ $(addprefix -classpath ,$(PRIVATE_CLASSPATH):$(PRIVATE_DOCLAVA_CLASSPATH):$(PRIVATE_BOOTCLASSPATH):$(HOST_JDK_TOOLS_JAR)) \
+ com.google.doclava.apicheck.ApiCheck \
+ -convert2xml \
+ $(basename $(PRIVATE_NEWAPI)).txt \
+ $(basename $(PRIVATE_OUT_NEWAPI)).xml \
+ ) || (rm -rf $(PRIVATE_OUT_DIR) $(PRIVATE_SRC_LIST_FILE); exit 45)
+ $(hide) ( \
+ $(JAVA) \
+ $(addprefix -classpath ,$(PRIVATE_CLASSPATH):$(PRIVATE_DOCLAVA_CLASSPATH):$(PRIVATE_BOOTCLASSPATH):$(HOST_JDK_TOOLS_JAR)) \
+ com.google.doclava.apicheck.ApiCheck \
+ -convert2xml \
+ $(basename $(PRIVATE_OLDAPI)).txt \
+ $(basename $(PRIVATE_OUT_OLDAPI)).xml \
+ ) || (rm -rf $(PRIVATE_OUT_DIR) $(PRIVATE_SRC_LIST_FILE); exit 45)
+ @echo Running JDiff...
+ $(call prepare-doc-source-list,$(PRIVATE_SRC_LIST_FILE),$(PRIVATE_JAVA_FILES), \
+ $(PRIVATE_SOURCE_INTERMEDIATES_DIR) $(PRIVATE_ADDITIONAL_JAVA_DIR))
+ $(hide) ( \
+ $(JAVADOC) \
+ -encoding UTF-8 \
+ \@$(PRIVATE_SRC_LIST_FILE) \
+ -J-Xmx1600m \
+ -XDignore.symbol.file \
+ -quiet \
+ -doclet jdiff.JDiff \
+ -docletpath $(PRIVATE_DOCLETPATH) \
+ $(addprefix -bootclasspath ,$(PRIVATE_BOOTCLASSPATH)) \
+ $(addprefix -classpath ,$(PRIVATE_CLASSPATH)) \
+ -sourcepath $(PRIVATE_SOURCE_PATH)$(addprefix :,$(PRIVATE_CLASSPATH)) \
+ -d $(PRIVATE_OUT_DIR) \
+ -newapi $(notdir $(basename $(PRIVATE_OUT_NEWAPI))) \
+ -newapidir $(dir $(PRIVATE_OUT_NEWAPI)) \
+ -oldapi $(notdir $(basename $(PRIVATE_OUT_OLDAPI))) \
+ -oldapidir $(dir $(PRIVATE_OUT_OLDAPI)) \
+ -javadocnew ../../../reference/ \
+ && touch -f $@ \
+ ) || (rm -rf $(PRIVATE_OUT_DIR) $(PRIVATE_SRC_LIST_FILE); exit 45)
+
+ALL_DOCS += $(full_target)
+
+.PHONY: $(LOCAL_MODULE)-diff
+$(LOCAL_MODULE)-diff : $(full_target)
diff --git a/core/autogen_test_config.mk b/core/autogen_test_config.mk
new file mode 100644
index 0000000..c359bac
--- /dev/null
+++ b/core/autogen_test_config.mk
@@ -0,0 +1,64 @@
+#
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This build rule allows TradeFed test config file to be created based on
+# following inputs:
+# is_native: If the test is a native test.
+# LOCAL_MANIFEST_FILE: Name of the AndroidManifest file for the test. If it's
+# not set, default value `AndroidManifest.xml` will be used.
+# Output:
+# autogen_test_config_file: Path to the test config file generated.
+
+autogen_test_config_file := $(dir $(LOCAL_BUILT_MODULE))$(LOCAL_MODULE).config
+ifeq (true,$(is_native))
+# Auto generating test config file for native test
+$(autogen_test_config_file) : $(NATIVE_TEST_CONFIG_TEMPLATE)
+ @echo "Auto generating test config $(notdir $@)"
+ $(hide) sed 's&{MODULE}&$(PRIVATE_MODULE)&g' $^ > $@
+my_auto_generate_config := true
+else
+# Auto generating test config file for instrumentation test
+ifeq ($(strip $(LOCAL_MANIFEST_FILE)),)
+ LOCAL_MANIFEST_FILE := AndroidManifest.xml
+endif
+ifdef LOCAL_FULL_MANIFEST_FILE
+ my_android_manifest := $(LOCAL_FULL_MANIFEST_FILE)
+else
+ my_android_manifest := $(LOCAL_PATH)/$(LOCAL_MANIFEST_FILE)
+endif
+ifneq (,$(wildcard $(my_android_manifest)))
+$(autogen_test_config_file): PRIVATE_AUTOGEN_TEST_CONFIG_SCRIPT := $(AUTOGEN_TEST_CONFIG_SCRIPT)
+$(autogen_test_config_file): PRIVATE_TEST_CONFIG_ANDROID_MANIFEST := $(my_android_manifest)
+$(autogen_test_config_file): PRIVATE_EMPTY_TEST_CONFIG := $(EMPTY_TEST_CONFIG)
+$(autogen_test_config_file): PRIVATE_TEMPLATE := $(INSTRUMENTATION_TEST_CONFIG_TEMPLATE)
+$(autogen_test_config_file) : $(my_android_manifest) $(EMPTY_TEST_CONFIG) $(INSTRUMENTATION_TEST_CONFIG_TEMPLATE) $(AUTOGEN_TEST_CONFIG_SCRIPT)
+ @echo "Auto generating test config $(notdir $@)"
+ @rm -f $@
+ $(hide) $(PRIVATE_AUTOGEN_TEST_CONFIG_SCRIPT) $@ $(PRIVATE_TEST_CONFIG_ANDROID_MANIFEST) $(PRIVATE_EMPTY_TEST_CONFIG) $(PRIVATE_TEMPLATE)
+my_auto_generate_config := true
+endif # ifeq (,$(wildcard $(my_android_manifest)))
+endif # ifneq (true,$(is_native))
+
+ifeq (true,$(my_auto_generate_config))
+ LOCAL_INTERMEDIATE_TARGETS += $(autogen_test_config_file)
+ $(LOCAL_BUILT_MODULE): $(autogen_test_config_file)
+ ALL_MODULES.$(my_register_name).auto_test_config := true
+else
+ autogen_test_config_file :=
+endif
+
+my_android_manifest :=
+my_auto_generate_config :=
diff --git a/core/aux_config.mk b/core/aux_config.mk
index c40b8cc..6a5cd63 100644
--- a/core/aux_config.mk
+++ b/core/aux_config.mk
@@ -32,7 +32,7 @@ endif
# setup AUX globals
AUX_SHLIB_SUFFIX := .so
-AUX_GLOBAL_ARFLAGS := crsPD
+AUX_GLOBAL_ARFLAGS := cqsD
AUX_STATIC_LIB_SUFFIX := .a
# Load ever-lasting "indexed" version of AUX variant environment; it is treated as READ-ONLY from this
@@ -102,10 +102,10 @@ $(eval include $(_path)/$(_name)$(2)) \
$(eval AUX_OS_VARIANT_LIST_$(AUX_OS_$(1)):=) \
$(call aux-variant-setup-paths,$(_name)) \
$(eval AUX_ALL_VARIANTS += $(_name)) \
-$(eval AUX_ALL_OSES := $(filterout $(AUX_OS_$(_name)),$(AUX_ALL_OSES)) $(AUX_OS_$(_name))) \
-$(eval AUX_ALL_CPUS := $(filterout $(AUX_CPU_$(_name)),$(AUX_ALL_CPUS)) $(AUX_CPU_$(_name))) \
-$(eval AUX_ALL_ARCHS := $(filterout $(AUX_ARCH_$(_name)),$(AUX_ALL_ARCHS)) $(AUX_ARCH_$(_name))) \
-$(eval AUX_ALL_SUBARCHS := $(filterout $(AUX_SUBARCH_$(_name)),$(AUX_ALL_SUBARCHS)) $(AUX_SUBARCH_$(_name)))
+$(eval AUX_ALL_OSES := $(filter-out $(AUX_OS_$(_name)),$(AUX_ALL_OSES)) $(AUX_OS_$(_name))) \
+$(eval AUX_ALL_CPUS := $(filter-out $(AUX_CPU_$(_name)),$(AUX_ALL_CPUS)) $(AUX_CPU_$(_name))) \
+$(eval AUX_ALL_ARCHS := $(filter-out $(AUX_ARCH_$(_name)),$(AUX_ALL_ARCHS)) $(AUX_ARCH_$(_name))) \
+$(eval AUX_ALL_SUBARCHS := $(filter-out $(AUX_SUBARCH_$(_name)),$(AUX_ALL_SUBARCHS)) $(AUX_SUBARCH_$(_name)))
endef
# Load system configuration referenced by AUX variant config;
@@ -138,7 +138,7 @@ define aux-variant-validate
$(eval _all:=) \
$(eval _req:=$(addsuffix _$(1),$(aux_env))) \
$(foreach var,$(_req),$(eval _all += $(var))) \
-$(eval _missing := $(filterout $(_all),$(_req))) \
+$(eval _missing := $(filter-out $(_all),$(_req))) \
$(if $(_missing),$(error AUX variant $(1) must define vars: $(_missing)))
endef
@@ -154,7 +154,7 @@ os_sfx :=_aux_os_config.mk
config_roots := $(wildcard device vendor)
all_configs :=
ifdef config_roots
-all_configs := $(shell find $(config_roots) -maxdepth 4 -name '*$(variant_sfx)' -o -name '*$(os_sfx)' | sort)
+all_configs := $(sort $(shell find $(config_roots) -maxdepth 4 -name '*$(variant_sfx)' -o -name '*$(os_sfx)'))
endif
all_os_configs := $(filter %$(os_sfx),$(all_configs))
all_variant_configs := $(filter %$(variant_sfx),$(all_configs))
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 07d1cd9..22e7aef 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -65,6 +65,18 @@ else
my_host_cross :=
endif
+_path := $(LOCAL_MODULE_PATH) $(LOCAL_MODULE_PATH_32) $(LOCAL_MODULE_PATH_64)
+ifneq ($(filter $(TARGET_OUT_VENDOR)%,$(_path)),)
+LOCAL_VENDOR_MODULE := true
+else ifneq ($(filter $(TARGET_OUT_OEM)/%,$(_path)),)
+LOCAL_OEM_MODULE := true
+else ifneq ($(filter $(TARGET_OUT_ODM)/%,$(_path)),)
+LOCAL_ODM_MODULE := true
+else ifneq ($(filter $(TARGET_OUT_PRODUCT)/%,$(_path)),)
+LOCAL_PRODUCT_MODULE := true
+endif
+_path :=
+
ifndef LOCAL_PROPRIETARY_MODULE
LOCAL_PROPRIETARY_MODULE := $(LOCAL_VENDOR_MODULE)
endif
@@ -76,6 +88,7 @@ $(call pretty-error,Only one of LOCAL_PROPRIETARY_MODULE[$(LOCAL_PROPRIETARY_MOD
endif
include $(BUILD_SYSTEM)/local_vndk.mk
+include $(BUILD_SYSTEM)/local_systemsdk.mk
my_module_tags := $(LOCAL_MODULE_TAGS)
ifeq ($(my_host_cross),true)
@@ -96,6 +109,13 @@ endif
# base_rules.mk, but it will fix the most common ones.
LOCAL_ADDITIONAL_DEPENDENCIES := $(filter-out %.mk,$(LOCAL_ADDITIONAL_DEPENDENCIES))
+my_bad_deps := $(strip $(foreach dep,$(filter-out | ||,$(LOCAL_ADDITIONAL_DEPENDENCIES)),\
+ $(if $(findstring /,$(dep)),,$(dep))))
+ifneq ($(my_bad_deps),)
+$(call pretty-warning,"Bad LOCAL_ADDITIONAL_DEPENDENCIES: $(my_bad_deps)")
+$(call pretty-error,"LOCAL_ADDITIONAL_DEPENDENCIES must only contain paths (not module names)")
+endif
+
###########################################################
## Validate and define fallbacks for input LOCAL_* variables.
###########################################################
@@ -131,7 +151,7 @@ endif
# makefiles. Anything else is either a typo or a source of unexpected
# behaviors.
ifneq ($(filter-out debug eng tests optional samples,$(my_module_tags)),)
-$(call pretty-warning,unusual tags $(my_module_tags))
+$(call pretty-error,unusual tags: $(filter-out debug eng tests optional samples,$(my_module_tags)))
endif
# Add implicit tags.
@@ -182,6 +202,8 @@ else ifeq (true,$(LOCAL_OEM_MODULE))
partition_tag := _OEM
else ifeq (true,$(LOCAL_ODM_MODULE))
partition_tag := _ODM
+else ifeq (true,$(LOCAL_PRODUCT_MODULE))
+ partition_tag := _PRODUCT
else ifeq (NATIVE_TESTS,$(LOCAL_MODULE_CLASS))
partition_tag := _DATA
else
@@ -443,6 +465,50 @@ endif
endif
###########################################################
+## Test Data
+###########################################################
+my_test_data_pairs :=
+my_installed_test_data :=
+# Source to relative dst file paths for reuse in LOCAL_COMPATIBILITY_SUITE.
+my_test_data_file_pairs :=
+
+ifneq ($(filter NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),)
+ifneq ($(strip $(LOCAL_TEST_DATA)),)
+ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
+
+my_test_data_pairs := $(strip $(foreach td,$(LOCAL_TEST_DATA), \
+ $(eval _file := $(call word-colon,2,$(td))) \
+ $(if $(_file), \
+ $(eval _src_base := $(call word-colon,1,$(td))), \
+ $(eval _src_base := $(LOCAL_PATH)) \
+ $(eval _file := $(call word-colon,1,$(td)))) \
+ $(if $(findstring ..,$(_file)),$(error $(LOCAL_MODULE_MAKEFILE): LOCAL_TEST_DATA may not include '..': $(_file))) \
+ $(if $(filter /%,$(_src_base) $(_file)),$(error $(LOCAL_MODULE_MAKEFILE): LOCAL_TEST_DATA may not include absolute paths: $(_src_base) $(_file))) \
+ $(eval my_test_data_file_pairs := $(my_test_data_file_pairs) $(call append-path,$(_src_base),$(_file)):$(_file)) \
+ $(call append-path,$(_src_base),$(_file)):$(call append-path,$(my_module_path),$(_file))))
+
+my_installed_test_data := $(call copy-many-files,$(my_test_data_pairs))
+$(LOCAL_INSTALLED_MODULE): $(my_installed_test_data)
+
+endif
+endif
+endif
+
+# For test modules that lack a suite tag, set null-suite as the default.
+# We only support adding a default suite to native tests, native benchmarks, and instrumentation tests.
+# This is because they are the only tests we currently auto-generate test configs for.
+ifndef LOCAL_COMPATIBILITY_SUITE
+ifneq ($(filter NATIVE_TESTS NATIVE_BENCHMARK, $(LOCAL_MODULE_CLASS)),)
+LOCAL_COMPATIBILITY_SUITE := null-suite
+endif
+ifneq ($(filter APPS, $(LOCAL_MODULE_CLASS)),)
+ifneq ($(filter $(my_module_tags),tests),)
+LOCAL_COMPATIBILITY_SUITE := null-suite
+endif
+endif
+endif
+
+###########################################################
## Compatibility suite files.
###########################################################
ifdef LOCAL_COMPATIBILITY_SUITE
@@ -451,19 +517,22 @@ ifdef LOCAL_COMPATIBILITY_SUITE
# separate the multiple architectures into subdirectories of the testcase folder.
arch_dir :=
is_native :=
+multi_arch :=
ifeq ($(LOCAL_MODULE_CLASS),NATIVE_TESTS)
is_native := true
+ multi_arch := true
endif
ifeq ($(LOCAL_MODULE_CLASS),NATIVE_BENCHMARK)
is_native := true
+ multi_arch := true
endif
ifdef LOCAL_MULTILIB
- is_native := true
+ multi_arch := true
endif
-ifdef is_native
+ifdef multi_arch
arch_dir := /$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
- is_native :=
endif
+multi_arch :=
# The module itself.
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
@@ -483,13 +552,44 @@ $(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
$(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
$(s):$(dir)/$(n)))))
+test_config := $(wildcard $(LOCAL_PATH)/AndroidTest.xml)
+ifeq (,$(test_config))
+ ifneq (true,$(is_native))
+ is_instrumentation_test := true
+ ifeq (true, $(LOCAL_IS_HOST_MODULE))
+ is_instrumentation_test := false
+ endif
+ # If LOCAL_MODULE_CLASS is not APPS, it's certainly not an instrumentation
+ # test. However, some packages for test data also have LOCAL_MODULE_CLASS
+ # set to APPS. These will require flag LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG
+ # to disable auto-generating test config file.
+ ifneq (APPS, $(LOCAL_MODULE_CLASS))
+ is_instrumentation_test := false
+ endif
+ endif
+ # CTS modules can be used for test data, so test config files must be
+ # explicitly created using AndroidTest.xml
+ ifeq (,$(filter cts, $(LOCAL_COMPATIBILITY_SUITE)))
+ ifneq (true, $(LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG))
+ ifeq (true, $(filter true,$(is_native) $(is_instrumentation_test)))
+ include $(BUILD_SYSTEM)/autogen_test_config.mk
+ test_config := $(autogen_test_config_file)
+ autogen_test_config_file :=
+ endif
+ endif
+ endif
+endif
+
+is_instrumentation_test :=
-ifneq (,$(wildcard $(LOCAL_PATH)/AndroidTest.xml))
+ifneq (,$(test_config))
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
$(eval my_compat_dist_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
- $(LOCAL_PATH)/AndroidTest.xml:$(dir)/$(LOCAL_MODULE).config)))
+ $(test_config):$(dir)/$(LOCAL_MODULE).config)))
endif
+test_config :=
+
ifneq (,$(wildcard $(LOCAL_PATH)/DynamicConfig.xml))
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
$(eval my_compat_dist_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
@@ -504,36 +604,22 @@ $(foreach extra_config, $(wildcard $(LOCAL_PATH)/$(LOCAL_MODULE)_*.config), \
endif
endif # $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_compat_files
-$(call create-suite-dependencies)
-
-endif # LOCAL_COMPATIBILITY_SUITE
-
-###########################################################
-## Test Data
-###########################################################
-my_test_data_pairs :=
-my_installed_test_data :=
-
-ifneq ($(filter NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),)
-ifneq ($(strip $(LOCAL_TEST_DATA)),)
-ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
+ifneq ($(my_test_data_file_pairs),)
+$(foreach pair, $(my_test_data_file_pairs), \
+ $(eval parts := $(subst :,$(space),$(pair))) \
+ $(eval src_path := $(word 1,$(parts))) \
+ $(eval file := $(word 2,$(parts))) \
+ $(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
+ $(eval my_compat_dist_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite),$(arch_dir)), \
+ $(src_path):$(call append-path,$(dir),$(file))))))
+endif
-my_test_data_pairs := $(strip $(foreach td,$(LOCAL_TEST_DATA), \
- $(eval _file := $(call word-colon,2,$(td))) \
- $(if $(_file), \
- $(eval _base := $(call word-colon,1,$(td))), \
- $(eval _base := $(LOCAL_PATH)) \
- $(eval _file := $(call word-colon,1,$(td)))) \
- $(if $(findstring ..,$(_file)),$(error $(LOCAL_MODULE_MAKEFILE): LOCAL_TEST_DATA may not include '..': $(_file))) \
- $(if $(filter /%,$(_base) $(_file)),$(error $(LOCAL_MODULE_MAKEFILE): LOCAL_TEST_DATA may not include absolute paths: $(_base) $(_file))) \
- $(call append-path,$(_base),$(_file)):$(call append-path,$(my_module_path),$(_file))))
+arch_dir :=
+is_native :=
-my_installed_test_data := $(call copy-many-files,$(my_test_data_pairs))
-$(LOCAL_INSTALLED_MODULE): $(my_installed_test_data)
+$(call create-suite-dependencies)
-endif
-endif
-endif
+endif # LOCAL_COMPATIBILITY_SUITE
###########################################################
## Register with ALL_MODULES
@@ -579,6 +665,12 @@ ALL_MODULES.$(my_register_name).REQUIRED := \
ALL_MODULES.$(my_register_name).EXPLICITLY_REQUIRED := \
$(strip $(ALL_MODULES.$(my_register_name).EXPLICITLY_REQUIRED)\
$(my_required_modules))
+ALL_MODULES.$(my_register_name).TARGET_REQUIRED := \
+ $(strip $(ALL_MODULES.$(my_register_name).TARGET_REQUIRED)\
+ $(LOCAL_TARGET_REQUIRED_MODULES))
+ALL_MODULES.$(my_register_name).HOST_REQUIRED := \
+ $(strip $(ALL_MODULES.$(my_register_name).HOST_REQUIRED)\
+ $(LOCAL_HOST_REQUIRED_MODULES))
ALL_MODULES.$(my_register_name).EVENT_LOG_TAGS := \
$(ALL_MODULES.$(my_register_name).EVENT_LOG_TAGS) $(event_log_tags)
ALL_MODULES.$(my_register_name).MAKEFILE := \
@@ -591,6 +683,7 @@ ifdef LOCAL_2ND_ARCH_VAR_PREFIX
ALL_MODULES.$(my_register_name).FOR_2ND_ARCH := true
endif
ALL_MODULES.$(my_register_name).FOR_HOST_CROSS := $(my_host_cross)
+ALL_MODULES.$(my_register_name).COMPATIBILITY_SUITES := $(LOCAL_COMPATIBILITY_SUITE)
INSTALLABLE_FILES.$(LOCAL_INSTALLED_MODULE).MODULE := $(my_register_name)
@@ -619,7 +712,7 @@ ALL_MODULE_TAGS := $(sort $(ALL_MODULE_TAGS) $(my_module_tags))
# Add this module name to the tag list of each specified tag.
$(foreach tag,$(my_module_tags),\
- $(eval ALL_MODULE_NAME_TAGS.$(tag) += $(my_register_name)))
+ $(eval ALL_MODULE_NAME_TAGS.$(tag) := $$(ALL_MODULE_NAME_TAGS.$(tag)) $(my_register_name)))
###########################################################
## umbrella targets used to verify builds
@@ -646,7 +739,7 @@ endif
ifdef j_or_n
-$(j_or_n) $(h_or_t) $(j_or_n)-$(h_or_t) : $(my_checked_module)
+$(j_or_n) $(h_or_t) $(j_or_n)-$(h_or_hc_or_t) : $(my_checked_module)
ifneq (,$(filter $(my_module_tags),tests))
$(j_or_n)-$(h_or_t)-tests $(j_or_n)-tests $(h_or_t)-tests : $(my_checked_module)
endif
@@ -657,6 +750,15 @@ endif
endif
###########################################################
+# Ensure privileged applications always have LOCAL_PRIVILEGED_MODULE
+###########################################################
+ifndef LOCAL_PRIVILEGED_MODULE
+ ifneq (,$(filter $(TARGET_OUT_APPS_PRIVILEGED)/% $(TARGET_OUT_VENDOR_APPS_PRIVILEGED)/%,$(my_module_path)))
+ LOCAL_PRIVILEGED_MODULE := true
+ endif
+endif
+
+###########################################################
## NOTICE files
###########################################################
diff --git a/core/binary.mk b/core/binary.mk
index 7dd9a13..61cd5cf 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -62,8 +62,8 @@ my_export_c_include_dirs := $(LOCAL_EXPORT_C_INCLUDE_DIRS)
my_export_c_include_deps := $(LOCAL_EXPORT_C_INCLUDE_DEPS)
my_arflags :=
-ifneq (,$(strip $(foreach dir,$(subst $(comma),$(space),$(COVERAGE_PATHS)),$(filter $(dir)%,$(LOCAL_PATH)))))
-ifeq (,$(strip $(foreach dir,$(subst $(comma),$(space),$(COVERAGE_EXCLUDE_PATHS)),$(filter $(dir)%,$(LOCAL_PATH)))))
+ifneq (,$(strip $(foreach dir,$(COVERAGE_PATHS),$(filter $(dir)%,$(LOCAL_PATH)))))
+ifeq (,$(strip $(foreach dir,$(COVERAGE_EXCLUDE_PATHS),$(filter $(dir)%,$(LOCAL_PATH)))))
my_native_coverage := true
else
my_native_coverage := false
@@ -88,7 +88,7 @@ ifneq ($(LOCAL_SDK_VERSION),)
endif
# Make sure we've built the NDK.
- my_additional_dependencies += $(SOONG_OUT_DIR)/ndk.timestamp
+ my_additional_dependencies += $(SOONG_OUT_DIR)/ndk_base.timestamp
# mips32r6 is not supported by the NDK. No released NDK contains these
# libraries, but the r10 in prebuilts/ndk had a local hack to add them :(
@@ -105,7 +105,7 @@ ifneq ($(LOCAL_SDK_VERSION),)
ifneq (,$(filter arm64 mips64 x86_64,$(my_arch)))
my_min_sdk_version := 21
else
- my_min_sdk_version := 9
+ my_min_sdk_version := $(MIN_SUPPORTED_SDK_VERSION)
endif
# Historically we've just set up a bunch of symlinks in prebuilts/ndk to map
@@ -180,7 +180,6 @@ ifneq ($(LOCAL_SDK_VERSION),)
my_ndk_stl_include_path :=
my_ndk_stl_shared_lib_fullpath :=
my_ndk_stl_static_lib :=
- my_ndk_cpp_std_version :=
my_cpu_variant := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)
ifeq (mips32r6,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH_VARIANT))
my_cpu_variant := mips32r6
@@ -189,89 +188,52 @@ ifneq ($(LOCAL_SDK_VERSION),)
ifeq (,$(LOCAL_NDK_STL_VARIANT))
LOCAL_NDK_STL_VARIANT := system
endif
- ifneq (1,$(words $(filter none system stlport_static stlport_shared c++_static c++_shared gnustl_static, $(LOCAL_NDK_STL_VARIANT))))
+ ifneq (1,$(words $(filter none system c++_static c++_shared, $(LOCAL_NDK_STL_VARIANT))))
$(error $(LOCAL_PATH): Unknown LOCAL_NDK_STL_VARIANT $(LOCAL_NDK_STL_VARIANT))
endif
+
ifeq (system,$(LOCAL_NDK_STL_VARIANT))
my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/system/include
my_system_shared_libraries += libstdc++
- else # LOCAL_NDK_STL_VARIANT is not system
- ifneq (,$(filter stlport_%, $(LOCAL_NDK_STL_VARIANT)))
- my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/stlport/stlport
- my_system_shared_libraries += libstdc++
- ifeq (stlport_static,$(LOCAL_NDK_STL_VARIANT))
- my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/stlport/libs/$(my_cpu_variant)/libstlport_static.a
- my_ldlibs += -ldl
- else
- my_ndk_stl_shared_lib_fullpath := $(my_ndk_source_root)/cxx-stl/stlport/libs/$(my_cpu_variant)/libstlport_shared.so
- endif
- else # LOCAL_NDK_STL_VARIANT is not stlport_* either
- ifneq (,$(filter c++_%, $(LOCAL_NDK_STL_VARIANT)))
- # Pre-r11 NDKs used libgabi++ for libc++'s C++ ABI, but r11 and later use
- # libc++abi.
- #
- # r13 no longer has the inner directory as a side effect of just using
- # external/libcxx.
- ifeq (r10,$(LOCAL_NDK_VERSION))
- my_ndk_stl_include_path := \
- $(my_ndk_source_root)/cxx-stl/llvm-libc++/libcxx/include
- my_ndk_stl_include_path += \
- $(my_ndk_source_root)/cxx-stl/llvm-libc++/gabi++/include
- else ifeq (r11,$(LOCAL_NDK_VERSION))
- my_ndk_stl_include_path := \
- $(my_ndk_source_root)/cxx-stl/llvm-libc++/libcxx/include
- my_ndk_stl_include_path += \
- $(my_ndk_source_root)/cxx-stl/llvm-libc++abi/libcxxabi/include
- else
- my_ndk_stl_include_path := \
- $(my_ndk_source_root)/cxx-stl/llvm-libc++/include
- my_ndk_stl_include_path += \
- $(my_ndk_source_root)/cxx-stl/llvm-libc++abi/include
- endif
+ else ifneq (,$(filter c++_%, $(LOCAL_NDK_STL_VARIANT)))
+ my_ndk_stl_include_path := \
+ $(my_ndk_source_root)/cxx-stl/llvm-libc++/include
+ my_ndk_stl_include_path += \
+ $(my_ndk_source_root)/cxx-stl/llvm-libc++abi/include
my_ndk_stl_include_path += $(my_ndk_source_root)/android/support/include
my_libcxx_libdir := \
$(my_ndk_source_root)/cxx-stl/llvm-libc++/libs/$(my_cpu_variant)
- ifneq (,$(filter r10 r11,$(LOCAL_NDK_VERSION)))
- ifeq (c++_static,$(LOCAL_NDK_STL_VARIANT))
- my_ndk_stl_static_lib := $(my_libcxx_libdir)/libc++_static.a
- else
- my_ndk_stl_shared_lib_fullpath := $(my_libcxx_libdir)/libc++_shared.so
- endif
+ ifeq (c++_static,$(LOCAL_NDK_STL_VARIANT))
+ my_ndk_stl_static_lib := \
+ $(my_libcxx_libdir)/libc++_static.a \
+ $(my_libcxx_libdir)/libc++abi.a
else
- ifeq (c++_static,$(LOCAL_NDK_STL_VARIANT))
- my_ndk_stl_static_lib := \
- $(my_libcxx_libdir)/libc++_static.a \
- $(my_libcxx_libdir)/libc++abi.a
- else
- my_ndk_stl_shared_lib_fullpath := $(my_libcxx_libdir)/libc++_shared.so
- endif
+ my_ndk_stl_shared_lib_fullpath := $(my_libcxx_libdir)/libc++_shared.so
+ endif
- my_ndk_stl_static_lib += $(my_libcxx_libdir)/libandroid_support.a
- ifneq (,$(filter armeabi armeabi-v7a,$(my_cpu_variant)))
- my_ndk_stl_static_lib += $(my_libcxx_libdir)/libunwind.a
- endif
+ my_ndk_stl_static_lib += $(my_libcxx_libdir)/libandroid_support.a
+ ifneq (,$(filter armeabi armeabi-v7a,$(my_cpu_variant)))
+ my_ndk_stl_static_lib += $(my_libcxx_libdir)/libunwind.a
endif
my_ldlibs += -ldl
-
- my_ndk_cpp_std_version := c++11
- else # LOCAL_NDK_STL_VARIANT is not c++_* either
- ifneq (,$(filter gnustl_%, $(LOCAL_NDK_STL_VARIANT)))
- my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/$($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NDK_GCC_VERSION)/libs/$(my_cpu_variant)/include \
- $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/$($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NDK_GCC_VERSION)/include
- my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/$($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NDK_GCC_VERSION)/libs/$(my_cpu_variant)/libgnustl_static.a
else # LOCAL_NDK_STL_VARIANT must be none
# Do nothing.
endif
- endif
- endif
- endif
endif
ifneq ($(LOCAL_USE_VNDK),)
- my_cflags += -D__ANDROID_API__=__ANDROID_API_FUTURE__ -D__ANDROID_VNDK__
+ # Required VNDK version for vendor modules is BOARD_VNDK_VERSION.
+ my_vndk_version := $(BOARD_VNDK_VERSION)
+ ifeq ($(my_vndk_version),current)
+ # Build with current PLATFORM_VNDK_VERSION.
+ # If PLATFORM_VNDK_VERSION has a CODENAME, it will return
+ # __ANDROID_API_FUTURE__.
+ my_vndk_version := $(call codename-or-sdk-to-sdk,$(PLATFORM_VNDK_VERSION))
+ endif
+ my_cflags += -D__ANDROID_API__=$(my_vndk_version) -D__ANDROID_VNDK__
endif
ifndef LOCAL_IS_HOST_MODULE
@@ -290,6 +252,15 @@ my_ldlib_flags :=
# Move other ldlibs back to shared libraries
my_shared_libraries += $(patsubst -l%,lib%,$(filter-out $(my_allowed_ldlibs),$(my_ldlibs)))
my_ldlibs := $(filter $(my_allowed_ldlibs),$(my_ldlibs))
+else # LOCAL_IS_HOST_MODULE
+ # Add -ldl, -lpthread, -lm and -lrt to host builds to match the default behavior of
+ # device builds
+ ifneq ($($(my_prefix)OS),windows)
+ my_ldlibs += -ldl -lpthread -lm
+ ifneq ($(HOST_OS),darwin)
+ my_ldlibs += -lrt
+ endif
+ endif
endif
ifneq ($(LOCAL_SDK_VERSION),)
@@ -378,9 +349,9 @@ endif
# clang is enabled by default for host builds
# enable it unless we've specifically disabled clang above
ifdef LOCAL_IS_HOST_MODULE
- ifeq ($($(my_prefix)OS),windows)
+ ifneq ($($(my_prefix)CLANG_SUPPORTED),true)
ifeq ($(my_clang),true)
- $(error $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): Clang is not yet supported for windows binaries)
+ $(call pretty-error,Clang is not yet supported for $($(my_prefix)OS) binaries)
endif
my_clang := false
else
@@ -388,11 +359,6 @@ ifdef LOCAL_IS_HOST_MODULE
my_clang := true
endif
endif
-# Add option to make gcc the default for device build
-else ifeq ($(USE_CLANG_PLATFORM_BUILD),false)
- ifeq ($(my_clang),)
- my_clang := false
- endif
else ifeq ($(my_clang),)
my_clang := true
endif
@@ -420,11 +386,6 @@ ifneq ($(my_clang),true)
my_cpp_std_version := $(DEFAULT_GCC_CPP_STD_VERSION)
endif
-ifdef LOCAL_SDK_VERSION
- # The NDK handles this itself.
- my_cpp_std_version := $(my_ndk_cpp_std_version)
-endif
-
ifdef LOCAL_IS_HOST_MODULE
ifneq ($(my_clang),true)
# The host GCC doesn't support C++14 (and is deprecated, so likely
@@ -656,6 +617,9 @@ ifeq ($(strip $(my_cc)),)
my_cc := $(my_cc_wrapper) $(my_cc)
endif
+SYNTAX_TOOLS_PREFIX := \
+ $(LLVM_PREBUILTS_BASE)/$(BUILD_OS)-x86/$(LLVM_PREBUILTS_VERSION)/libexec
+
ifneq ($(LOCAL_NO_STATIC_ANALYZER),true)
my_cc := CCC_CC=$(CLANG) CLANG=$(CLANG) \
$(SYNTAX_TOOLS_PREFIX)/ccc-analyzer
@@ -797,7 +761,7 @@ else
ifneq (,$(LOCAL_SDK_VERSION))
# Set target-api for LOCAL_SDK_VERSIONs other than current.
ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
-renderscript_target_api := $(LOCAL_SDK_VERSION)
+renderscript_target_api := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
endif
endif # LOCAL_SDK_VERSION is set
endif # LOCAL_RENDERSCRIPT_TARGET_API is set
@@ -861,6 +825,9 @@ endif
###########################################################
## Compile the .proto files to .cc (or .c) and then to .o
###########################################################
+ifeq ($(strip $(LOCAL_PROTOC_OPTIMIZE_TYPE)),)
+ LOCAL_PROTOC_OPTIMIZE_TYPE := lite
+endif
proto_sources := $(filter %.proto,$(my_src_files))
ifneq ($(proto_sources),)
proto_gen_dir := $(generated_sources_dir)/proto
@@ -882,7 +849,7 @@ my_rename_cpp_ext := true
endif
my_proto_c_includes := external/protobuf/src
my_cflags += -DGOOGLE_PROTOBUF_NO_RTTI
-my_protoc_flags := --cpp_out=$(proto_gen_dir)
+my_protoc_flags := --cpp_out=$(if $(filter lite lite-static,$(LOCAL_PROTOC_OPTIMIZE_TYPE)),lite:,)$(proto_gen_dir)
my_protoc_deps :=
endif
my_proto_c_includes += $(proto_gen_dir)
@@ -1321,6 +1288,22 @@ $(call track-src-file-obj,$(asm_sources_asm),$(asm_objects_asm))
asm_objects += $(asm_objects_asm)
endif
+###################################################################
+## When compiling a CFI enabled target, use the .cfi variant of any
+## static dependencies (where they exist).
+##################################################################
+define use_soong_cfi_static_libraries
+ $(foreach l,$(1),$(if $(filter $(l),$(SOONG_CFI_STATIC_LIBRARIES)),\
+ $(l).cfi,$(l)))
+endef
+
+ifneq ($(filter cfi,$(my_sanitize)),)
+ my_whole_static_libraries := $(call use_soong_cfi_static_libraries,\
+ $(my_whole_static_libraries))
+ my_static_libraries := $(call use_soong_cfi_static_libraries,\
+ $(my_static_libraries))
+endif
+
###########################################################
## When compiling against the VNDK, use LL-NDK libraries
###########################################################
@@ -1347,6 +1330,15 @@ ifneq ($(LOCAL_USE_VNDK),)
endif
endif
+# Platform can use vendor public libraries. If a required shared lib is one of
+# the vendor public libraries, the lib is switched to the stub version of the lib.
+ifeq ($(LOCAL_USE_VNDK),)
+ ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
+ my_shared_libraries := $(foreach l,$(my_shared_libraries),\
+ $(if $(filter $(l),$(VENDOR_PUBLIC_LIBRARIES)),$(l).vendorpublic,$(l)))
+ endif
+endif
+
##########################################################
## Set up installed module dependency
## We cannot compute the full path of the LOCAL_SHARED_LIBRARIES for
@@ -1401,18 +1393,33 @@ endif
## other NDK-built libraries
####################################################
+include $(BUILD_SYSTEM)/allowed_ndk_types.mk
+
ifdef LOCAL_SDK_VERSION
-my_link_type := native:ndk
-my_warn_types :=
-my_allowed_types := native:ndk
+my_link_type := native:ndk:$(my_ndk_stl_family):$(my_ndk_stl_link_type)
+my_warn_types := $(my_warn_ndk_types)
+my_allowed_types := $(my_allowed_ndk_types)
else ifdef LOCAL_USE_VNDK
-my_link_type := native:vendor
-my_warn_types :=
-my_allowed_types := native:vendor
+ _name := $(patsubst %.vendor,%,$(LOCAL_MODULE))
+ ifneq ($(filter $(_name),$(VNDK_CORE_LIBRARIES) $(VNDK_SAMEPROCESS_LIBRARIES) $(LLNDK_LIBRARIES)),)
+ ifeq ($(filter $(_name),$(VNDK_PRIVATE_LIBRARIES)),)
+ my_link_type := native:vndk
+ else
+ my_link_type := native:vndk_private
+ endif
+ my_warn_types :=
+ my_allowed_types := native:vndk native:vndk_private
+ else
+ # Modules installed to /vendor cannot directly depend on modules marked
+ # with vendor_available: false
+ my_link_type := native:vendor
+ my_warn_types :=
+ my_allowed_types := native:vendor native:vndk
+ endif
else
my_link_type := native:platform
-my_warn_types :=
-my_allowed_types := native:ndk native:platform
+my_warn_types := $(my_warn_ndk_types)
+my_allowed_types := $(my_allowed_ndk_types) native:platform
endif
my_link_deps := $(addprefix STATIC_LIBRARIES:,$(my_whole_static_libraries) $(my_static_libraries))
@@ -1580,6 +1587,9 @@ installed_static_library_notice_file_targets := \
$(foreach lib,$(my_static_libraries) $(my_whole_static_libraries), \
NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST,TARGET)-STATIC_LIBRARIES-$(lib))
+$(notice_target): | $(installed_static_library_notice_file_targets)
+$(LOCAL_INSTALLED_MODULE): | $(notice_target)
+
# Default is -fno-rtti.
ifeq ($(strip $(LOCAL_RTTI_FLAG)),)
LOCAL_RTTI_FLAG := -fno-rtti
@@ -1642,13 +1652,30 @@ ifeq ($(my_strict),true)
my_cflags += -DANDROID_STRICT
endif
-# Add -Werror if LOCAL_PATH is in the WARNING_DISALLOWED project list,
-# or not in the WARNING_ALLOWED project list.
-ifneq (,$(strip $(call find_warning_disallowed_projects,$(LOCAL_PATH))))
- my_cflags_no_override += -Werror
-else
- ifeq (,$(strip $(call find_warning_allowed_projects,$(LOCAL_PATH))))
- my_cflags_no_override += -Werror
+# Check if -Werror or -Wno-error is used in C compiler flags.
+# Modules defined in $(SOONG_ANDROID_MK) are checked in soong's cc.go.
+ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
+ # Header libraries do not need cflags.
+ ifneq (HEADER_LIBRARIES,$(LOCAL_MODULE_CLASS))
+ # Prebuilt modules do not need cflags.
+ ifeq (,$(LOCAL_PREBUILT_MODULE_FILE))
+ my_all_cflags := $(my_cflags) $(my_cppflags) $(my_cflags_no_override)
+ # Issue warning if -Wno-error is used.
+ ifneq (,$(filter -Wno-error,$(my_all_cflags)))
+ $(eval MODULES_USING_WNO_ERROR := $(MODULES_USING_WNO_ERROR) $(LOCAL_MODULE_MAKEFILE):$(LOCAL_MODULE))
+ else
+ # Issue warning if -Werror is not used. Add it.
+ ifeq (,$(filter -Werror,$(my_all_cflags)))
+ # Add -Wall -Werror unless the project is in the WARNING_ALLOWED project list.
+ ifeq (,$(strip $(call find_warning_allowed_projects,$(LOCAL_PATH))))
+ my_cflags := -Wall -Werror $(my_cflags)
+ else
+ $(eval MODULES_ADDED_WALL := $(MODULES_ADDED_WALL) $(LOCAL_MODULE_MAKEFILE):$(LOCAL_MODULE))
+ my_cflags := -Wall $(my_cflags)
+ endif
+ endif
+ endif
+ endif
endif
endif
@@ -1681,21 +1708,20 @@ ifneq (,$(filter 1 true,$(my_tidy_enabled)))
ifneq ($(LOCAL_TIDY_CHECKS),)
my_tidy_checks := $(my_tidy_checks),$(LOCAL_TIDY_CHECKS)
endif
- # Set up global default clang-tidy flags, which is none.
- my_tidy_flags := $(WITH_TIDY_FLAGS)
- # Use local clang-tidy flags if specified.
- ifneq ($(LOCAL_TIDY_FLAGS),)
- my_tidy_flags := $(LOCAL_TIDY_FLAGS)
- endif
+ my_tidy_flags += $(WITH_TIDY_FLAGS) $(LOCAL_TIDY_FLAGS)
# If tidy flags are not specified, default to check all header files.
ifeq ($(my_tidy_flags),)
my_tidy_flags := $(call default_tidy_header_filter,$(LOCAL_PATH))
endif
+ # If clang-tidy is not enabled globally, add the -quiet flag.
+ ifeq (,$(filter 1 true,$(WITH_TIDY)))
+ my_tidy_flags += -quiet -extra-arg-before=-fno-caret-diagnostics
+ endif
# We might be using the static analyzer through clang-tidy.
# https://bugs.llvm.org/show_bug.cgi?id=32914
ifneq ($(my_tidy_checks),)
- my_tidy_flags += "-extra-arg-before=-D__clang_analyzer__"
+ my_tidy_flags += -extra-arg-before=-D__clang_analyzer__
endif
endif
endif
@@ -1708,17 +1734,19 @@ my_ldlibs := $(filter -l%,$(my_ldlib_flags))
my_ldflags := $(filter-out -l%,$(my_ldlib_flags))
# One last verification check for ldlibs
-ifndef LOCAL_IS_HOST_MODULE
my_allowed_ldlibs :=
-ifneq ($(LOCAL_SDK_VERSION),)
- my_allowed_ldlibs := $(addprefix -l,$(NDK_PREBUILT_SHARED_LIBRARIES))
+ifndef LOCAL_IS_HOST_MODULE
+ ifneq ($(LOCAL_SDK_VERSION),)
+ my_allowed_ldlibs := $(addprefix -l,$(NDK_PREBUILT_SHARED_LIBRARIES))
+ endif
+else
+ my_allowed_ldlibs := $($(my_prefix)AVAILABLE_LIBRARIES)
endif
my_bad_ldlibs := $(filter-out $(my_allowed_ldlibs),$(my_ldlibs))
ifneq ($(my_bad_ldlibs),)
$(error $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): Bad LOCAL_LDLIBS entries: $(my_bad_ldlibs))
endif
-endif
# my_cxx_ldlibs may contain linker flags need to wrap certain libraries
# (start-group/end-group), so append after the check above.
@@ -1758,11 +1786,6 @@ all_libraries := \
$(built_static_libraries) \
$(built_whole_libraries)
-# Also depend on the notice files for any static libraries that
-# are linked into this module. This will force them to be installed
-# when this module is.
-$(LOCAL_INSTALLED_MODULE): | $(installed_static_library_notice_file_targets)
-
###########################################################
# Export includes
###########################################################
@@ -1832,6 +1855,7 @@ SOONG_CONV.$(LOCAL_MODULE).DEPS := \
$(my_whole_static_libraries) \
$(my_shared_libraries) \
$(my_system_shared_libraries))
+SOONG_CONV.$(LOCAL_MODULE).TYPE := native
SOONG_CONV := $(SOONG_CONV) $(LOCAL_MODULE)
endif
diff --git a/core/build-system.html b/core/build-system.html
index c7938cc..3d86e24 100644
--- a/core/build-system.html
+++ b/core/build-system.html
@@ -762,6 +762,19 @@ does this.</p>
Dialer, Contacts, etc. This will probably change or go away when we switch
to an ant-based build system for the apps.</p>
+<h4>LOCAL_PATCH_MODULE (experimental option)</h4>
+<p>As of January 2018, you almost certainly don't need this option, so please
+ask and only use it if you understand what you're doing. This feature is
+experimental and may go away in future.</p>
+<p>
+When compiling language level 9+ .java code in packages that are part of a
+a system module, <code>LOCAL_PATCH_MODULE</code> names the module that your
+sources and dependencies should be patched into. The Android runtime currently
+(Jan 2018) doesn't implement the JEP 261 module system so this option is only
+supported at compile time. It should only be needed to compile tests in packages
+that exist in libcore and which are inconvenient to move elsewhere.
+</p>
+
<h4>LOCAL_PATH</h4>
<p>The directory your Android.mk file is in. You can set it by putting the
following as the first line in your Android.mk:</p>
diff --git a/core/build_id.mk b/core/build_id.mk
index ff4d013..932e214 100644
--- a/core/build_id.mk
+++ b/core/build_id.mk
@@ -18,4 +18,4 @@
# (like "CRB01"). It must be a single word, and is
# capitalized by convention.
-export BUILD_ID=OC-MR1
+export BUILD_ID=PI
diff --git a/core/clang/HOST_CROSS_x86.mk b/core/clang/HOST_CROSS_x86.mk
index bf48f95..ffd7811 100644
--- a/core/clang/HOST_CROSS_x86.mk
+++ b/core/clang/HOST_CROSS_x86.mk
@@ -1 +1 @@
-$(clang_2nd_arch_prefix)HOST_CROSS_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-i686.a
+$(clang_2nd_arch_prefix)HOST_CROSS_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-i386.a
diff --git a/core/clang/HOST_x86.mk b/core/clang/HOST_x86.mk
index 0722b2a..2803517 100644
--- a/core/clang/HOST_x86.mk
+++ b/core/clang/HOST_x86.mk
@@ -1 +1 @@
-$(clang_2nd_arch_prefix)HOST_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-i686.a
+$(clang_2nd_arch_prefix)HOST_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-i386.a
diff --git a/core/clang/config.mk b/core/clang/config.mk
index 0e59930..408f688 100644
--- a/core/clang/config.mk
+++ b/core/clang/config.mk
@@ -72,6 +72,7 @@ COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES := libcompiler_rt-extras
# INTERNAL_LOCAL_CLANG_EXCEPTION_PROJECTS is defined later in other config.mk.
LOCAL_CLANG_EXCEPTION_PROJECTS = \
bionic/tests/ \
+ device/google/contexthub/ \
device/huawei/angler/ \
device/lge/bullhead/ \
external/gentoo/integration/ \
diff --git a/core/clang/versions.mk b/core/clang/versions.mk
deleted file mode 100644
index c2473cd..0000000
--- a/core/clang/versions.mk
+++ /dev/null
@@ -1,4 +0,0 @@
-## Clang/LLVM release versions.
-
-LLVM_PREBUILTS_VERSION ?= clang-4053586
-LLVM_PREBUILTS_BASE ?= prebuilts/clang/host
diff --git a/core/cleanbuild.mk b/core/cleanbuild.mk
index 0e1c88d..5576785 100644
--- a/core/cleanbuild.mk
+++ b/core/cleanbuild.mk
@@ -13,8 +13,32 @@
# limitations under the License.
#
-# Don't bother with the cleanspecs if you are running mm/mmm
-ifeq ($(ONE_SHOT_MAKEFILE)$(dont_bother)$(NO_ANDROID_CLEANSPEC),)
+# Absolute path of the present working direcotry.
+# This overrides the shell variable $PWD, which does not necessarily points to
+# the top of the source tree, for example when "make -C" is used in m/mm/mmm.
+PWD := $(shell pwd)
+
+TOP := .
+TOPDIR :=
+
+BUILD_SYSTEM := $(TOPDIR)build/make/core
+
+# Set up various standard variables based on configuration
+# and host information.
+include $(BUILD_SYSTEM)/config.mk
+
+include $(SOONG_MAKEVARS_MK)
+
+include $(BUILD_SYSTEM)/clang/config.mk
+
+# CTS-specific config.
+-include cts/build/config.mk
+# VTS-specific config.
+-include test/vts/tools/vts-tradefed/build/config.mk
+# device-tests-specific-config.
+-include tools/tradefederation/build/suites/device-tests/config.mk
+# general-tests-specific-config.
+-include tools/tradefederation/build/suites/general-tests/config.mk
INTERNAL_CLEAN_STEPS :=
@@ -24,7 +48,7 @@ INTERNAL_CLEAN_STEPS :=
#
# $(1): shell command to run
# $(2): indicate to not use makefile path as part of step id if not empty.
-# $(2) should only be used in build/core/cleanspec.mk: just for compatibility.
+# $(2) should only be used in build/make/core/cleanspec.mk: just for compatibility.
define _add-clean-step
$(if $(strip $(INTERNAL_CLEAN_BUILD_VERSION)),, \
$(error INTERNAL_CLEAN_BUILD_VERSION not set))
@@ -43,7 +67,7 @@ define _add-clean-step
$(eval _acs_makefile_prefix :=)
endef
define add-clean-step
-$(eval # for build/core/cleanspec.mk, dont use makefile path as part of step id) \
+$(eval # for build/make/core/cleanspec.mk, dont use makefile path as part of step id) \
$(if $(filter %/cleanspec.mk,$(lastword $(MAKEFILE_LIST))),\
$(eval $(call _add-clean-step,$(1),true)),\
$(eval $(call _add-clean-step,$(1))))
@@ -58,7 +82,7 @@ INTERNAL_CLEAN_STEPS := $(strip $(INTERNAL_CLEAN_STEPS))
# If the clean_steps.mk file is missing (usually after a clean build)
# then we won't do anything.
-CURRENT_CLEAN_BUILD_VERSION := $(INTERNAL_CLEAN_BUILD_VERSION)
+CURRENT_CLEAN_BUILD_VERSION := MISSING
CURRENT_CLEAN_STEPS := $(INTERNAL_CLEAN_STEPS)
# Read the current state from the file, if present.
@@ -67,7 +91,9 @@ CURRENT_CLEAN_STEPS := $(INTERNAL_CLEAN_STEPS)
clean_steps_file := $(PRODUCT_OUT)/clean_steps.mk
-include $(clean_steps_file)
-ifneq ($(CURRENT_CLEAN_BUILD_VERSION),$(INTERNAL_CLEAN_BUILD_VERSION))
+ifeq ($(CURRENT_CLEAN_BUILD_VERSION),MISSING)
+ # Do nothing
+else ifneq ($(CURRENT_CLEAN_BUILD_VERSION),$(INTERNAL_CLEAN_BUILD_VERSION))
# The major clean version is out-of-date. Do a full clean, and
# don't even bother with the clean steps.
$(info *** A clean build is required because of a recent change.)
@@ -109,57 +135,18 @@ endif
# Write the new state to the file.
#
-rewrite_clean_steps_file :=
ifneq ($(CURRENT_CLEAN_BUILD_VERSION)-$(CURRENT_CLEAN_STEPS),$(INTERNAL_CLEAN_BUILD_VERSION)-$(INTERNAL_CLEAN_STEPS))
-rewrite_clean_steps_file := true
-endif
-ifeq ($(wildcard $(clean_steps_file)),)
-# This is the first build.
-rewrite_clean_steps_file := true
-endif
-ifeq ($(rewrite_clean_steps_file),true)
-$(shell \
- mkdir -p $(dir $(clean_steps_file)) && \
- echo "CURRENT_CLEAN_BUILD_VERSION := $(INTERNAL_CLEAN_BUILD_VERSION)" > \
- $(clean_steps_file) ;\
- echo "CURRENT_CLEAN_STEPS := $(wordlist 1,500,$(INTERNAL_CLEAN_STEPS))" >> $(clean_steps_file) \
- )
-define -cs-write-clean-steps-if-arg1-not-empty
-$(if $(1),$(shell echo "CURRENT_CLEAN_STEPS += $(1)" >> $(clean_steps_file)))
-endef
-$(call -cs-write-clean-steps-if-arg1-not-empty,$(wordlist 501,1000,$(INTERNAL_CLEAN_STEPS)))
-$(call -cs-write-clean-steps-if-arg1-not-empty,$(wordlist 1001,1500,$(INTERNAL_CLEAN_STEPS)))
-$(call -cs-write-clean-steps-if-arg1-not-empty,$(wordlist 1501,2000,$(INTERNAL_CLEAN_STEPS)))
-$(call -cs-write-clean-steps-if-arg1-not-empty,$(wordlist 2001,2500,$(INTERNAL_CLEAN_STEPS)))
-$(call -cs-write-clean-steps-if-arg1-not-empty,$(wordlist 2501,3000,$(INTERNAL_CLEAN_STEPS)))
-$(call -cs-write-clean-steps-if-arg1-not-empty,$(wordlist 3001,99999,$(INTERNAL_CLEAN_STEPS)))
+$(shell mkdir -p $(dir $(clean_steps_file)))
+$(file >$(clean_steps_file).tmp,CURRENT_CLEAN_BUILD_VERSION := $(INTERNAL_CLEAN_BUILD_VERSION)$(newline)CURRENT_CLEAN_STEPS := $(INTERNAL_CLEAN_STEPS)$(newline))
+$(shell if ! cmp -s $(clean_steps_file).tmp $(clean_steps_file); then \
+ mv $(clean_steps_file).tmp $(clean_steps_file); \
+ else \
+ rm $(clean_steps_file).tmp; \
+ fi)
endif
CURRENT_CLEAN_BUILD_VERSION :=
CURRENT_CLEAN_STEPS :=
clean_steps_file :=
-rewrite_clean_steps_file :=
INTERNAL_CLEAN_STEPS :=
INTERNAL_CLEAN_BUILD_VERSION :=
-
-endif # if not ONE_SHOT_MAKEFILE dont_bother NO_ANDROID_CLEANSPEC
-
-###########################################################
-
-.PHONY: clean-jack-files
-clean-jack-files: clean-dex-files
- $(hide) find $(OUT_DIR) -name "*.jack" | xargs rm -f
- $(hide) find $(OUT_DIR) -type d -name "jack" | xargs rm -rf
- @echo "All jack files have been removed."
-
-.PHONY: clean-dex-files
-clean-dex-files:
- $(hide) find $(OUT_DIR) -name "*.dex" ! -path "*/jack-incremental/*" | xargs rm -f
- $(hide) for i in `find $(OUT_DIR) -name "*.jar" -o -name "*.apk"` ; do ((unzip -l $$i 2> /dev/null | \
- grep -q "\.dex$$" && rm -f $$i) || continue ) ; done
- @echo "All dex files and archives containing dex files have been removed."
-
-.PHONY: clean-jack-incremental
-clean-jack-incremental:
- $(hide) find $(OUT_DIR) -name "jack-incremental" -type d | xargs rm -rf
- @echo "All jack incremental dirs have been removed."
diff --git a/core/cleanspec.mk b/core/cleanspec.mk
index 4441e2a..af28954 100644
--- a/core/cleanspec.mk
+++ b/core/cleanspec.mk
@@ -64,6 +64,6 @@ INTERNAL_CLEAN_BUILD_VERSION := 6
# ************************************************
subdir_cleanspecs := \
- $(shell build/tools/findleaves.py $(FIND_LEAVES_EXCLUDES) . CleanSpec.mk)
+ $(file <$(OUT_DIR)/.module_paths/CleanSpec.mk.list)
include $(subdir_cleanspecs)
subdir_cleanspecs :=
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index a687866..bd86cfb 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -4,8 +4,10 @@
# '',true
LOCAL_32_BIT_ONLY:=
+LOCAL_AAPT2_ONLY:=
LOCAL_AAPT_FLAGS:=
LOCAL_AAPT_INCLUDE_ALL_RESOURCES:=
+LOCAL_AAPT_NAMESPACES:=
LOCAL_ADDITIONAL_CERTIFICATES:=
LOCAL_ADDITIONAL_DEPENDENCIES:=
LOCAL_ADDITIONAL_HTML_DIR:=
@@ -14,6 +16,8 @@ LOCAL_AIDL_INCLUDES:=
LOCAL_ALLOW_UNDEFINED_SYMBOLS:=
LOCAL_ANNOTATION_PROCESSORS:=
LOCAL_ANNOTATION_PROCESSOR_CLASSES:=
+LOCAL_APIDIFF_NEWAPI:=
+LOCAL_APIDIFF_OLDAPI:=
LOCAL_APK_LIBRARIES:=
LOCAL_ARM_MODE:=
LOCAL_ASFLAGS:=
@@ -54,6 +58,8 @@ LOCAL_DEX_PREOPT_GENERATE_PROFILE:=
LOCAL_DEX_PREOPT_IMAGE_LOCATION:=
LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING:=
LOCAL_DEX_PREOPT:= # '',true,false,nostripping
+LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG:=
+LOCAL_DISABLE_RESOLVE_SUPPORT_LIBRARIES:=
LOCAL_DONT_CHECK_MODULE:=
# Don't delete the META_INF dir when merging static Java libraries.
LOCAL_DONT_DELETE_JAR_META_INF:=
@@ -68,15 +74,22 @@ LOCAL_DROIDDOC_SOURCE_PATH:=
LOCAL_DROIDDOC_STUB_OUT_DIR:=
LOCAL_DROIDDOC_TEMPLATE_DIR:=
LOCAL_DROIDDOC_USE_STANDARD_DOCLET:=
+LOCAL_DROIDDOC_USE_METALAVA:=
+LOCAL_DROIDDOC_METALAVA_PREVIOUS_API:=
+LOCAL_DROIDDOC_METALAVA_ANNOTATIONS_ENABLED:=
+LOCAL_DROIDDOC_METALAVA_MERGE_ANNOTATIONS_DIR:=
+LOCAL_DROIDDOC_METALAVA_DOCS_STUB_OUT_DIR:=
LOCAL_DX_FLAGS:=
LOCAL_EMMA_COVERAGE_FILTER:=
LOCAL_EMMA_INSTRUMENT:=
+LOCAL_ENFORCE_USES_LIBRARIES:=
LOCAL_ERROR_PRONE_FLAGS:=
LOCAL_EXPORT_CFLAGS:=
LOCAL_EXPORT_C_INCLUDE_DEPS:=
LOCAL_EXPORT_C_INCLUDE_DIRS:=
LOCAL_EXPORT_HEADER_LIBRARY_HEADERS:=
LOCAL_EXPORT_PACKAGE_RESOURCES:=
+LOCAL_EXPORT_PROGUARD_FLAG_FILES:=
LOCAL_EXPORT_SHARED_LIBRARY_HEADERS:=
LOCAL_EXPORT_STATIC_LIBRARY_HEADERS:=
LOCAL_EXTRACT_APK:=
@@ -88,6 +101,7 @@ LOCAL_FULL_LIBS_MANIFEST_FILES:=
LOCAL_FULL_MANIFEST_FILE:=
LOCAL_FULL_CLASSES_JACOCO_JAR:=
LOCAL_FULL_CLASSES_PRE_JACOCO_JAR:=
+LOCAL_FUZZ_ENGINE:=
LOCAL_GCNO_FILES:=
LOCAL_GENERATED_SOURCES:=
# Group static libraries with "-Wl,--start-group" and "-Wl,--end-group" when linking.
@@ -95,6 +109,7 @@ LOCAL_GROUP_STATIC_LIBRARIES:=
LOCAL_GTEST:=true
LOCAL_HAL_STATIC_LIBRARIES:=
LOCAL_HEADER_LIBRARIES:=
+LOCAL_HOST_REQUIRED_MODULES:=
LOCAL_INIT_RC:=
LOCAL_INSTALLED_MODULE:=
LOCAL_INSTALLED_MODULE_STEM:=
@@ -126,6 +141,7 @@ LOCAL_JAVA_LAYERS_FILE:=
LOCAL_JAVA_LIBRARIES:=
LOCAL_JAVA_RESOURCE_DIRS:=
LOCAL_JAVA_RESOURCE_FILES:=
+LOCAL_JETIFIER_ENABLED:=
LOCAL_JNI_SHARED_LIBRARIES:=
LOCAL_JNI_SHARED_LIBRARIES_ABI:=
LOCAL_LDFLAGS:=
@@ -173,11 +189,13 @@ LOCAL_NO_STATIC_ANALYZER:=
LOCAL_NOTICE_FILE:=
LOCAL_ODM_MODULE:=
LOCAL_OEM_MODULE:=
+LOCAL_OPTIONAL_USES_LIBRARIES:=
LOCAL_OVERRIDES_PACKAGES:=
LOCAL_OVERRIDES_MODULES:=
LOCAL_PACKAGE_NAME:=
LOCAL_PACKAGE_SPLITS:=
LOCAL_PACK_MODULE_RELOCATIONS:=
+LOCAL_PATCH_MODULE:=
LOCAL_PICKUP_FILES:=
LOCAL_POST_INSTALL_CMD:=
LOCAL_POST_LINK_CMD:=
@@ -190,8 +208,10 @@ LOCAL_PREBUILT_MODULE_FILE:=
LOCAL_PREBUILT_OBJ_FILES:=
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES:=
LOCAL_PREBUILT_STRIP_COMMENTS:=
+LOCAL_PRIVATE_PLATFORM_APIS:=
LOCAL_PRIVILEGED_MODULE:=
-# '',full,custom,nosystem,disabled,obfuscation,optimization
+# '',full,custom,disabled,obfuscation,optimization
+LOCAL_PRODUCT_MODULE:=
LOCAL_PROGUARD_ENABLED:=
LOCAL_PROGUARD_FLAG_FILES:=
LOCAL_PROGUARD_FLAGS:=
@@ -200,6 +220,7 @@ LOCAL_PROTOC_FLAGS:=
# lite(default),micro,nano,stream,full,nanopb-c,nanopb-c-enable_malloc
LOCAL_PROTOC_OPTIMIZE_TYPE:=
LOCAL_PROTO_JAVA_OUTPUT_PARAMS:=
+LOCAL_R8_FLAG_FILES:=
LOCAL_RECORDED_MODULE_TYPE:=
LOCAL_RENDERSCRIPT_CC:=
LOCAL_RENDERSCRIPT_COMPATIBILITY:=
@@ -224,16 +245,30 @@ LOCAL_SDK_RES_VERSION:=
LOCAL_SDK_VERSION:=
LOCAL_SHARED_ANDROID_LIBRARIES:=
LOCAL_SHARED_LIBRARIES:=
+LOCAL_SOONG_CLASSES_JAR :=
+LOCAL_SOONG_DEX_JAR :=
+LOCAL_SOONG_EXPORT_PROGUARD_FLAGS :=
+LOCAL_SOONG_HEADER_JAR :=
+LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR :=
+LOCAL_SOONG_PROGUARD_DICT :=
+LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE :=
+LOCAL_SOONG_RRO_DIRS :=
+LOCAL_SOONG_STATIC_LIBRARY_EXTRA_PACKAGES :=
+LOCAL_DROIDDOC_STUBS_JAR :=
+LOCAL_DROIDDOC_DOC_ZIP :=
# '',true
LOCAL_SOURCE_FILES_ALL_GENERATED:=
LOCAL_SRC_FILES:=
LOCAL_SRC_FILES_EXCLUDE:=
+LOCAL_SRCJARS:=
LOCAL_STATIC_ANDROID_LIBRARIES:=
LOCAL_STATIC_JAVA_AAR_LIBRARIES:=
LOCAL_STATIC_JAVA_LIBRARIES:=
LOCAL_STATIC_LIBRARIES:=
LOCAL_STRIP_MODULE:=
LOCAL_SYSTEM_SHARED_LIBRARIES:=none
+LOCAL_TARGET_REQUIRED_MODULES:=
+LOCAL_TEST_CONFIG_OPTIONS:=
LOCAL_TEST_DATA:=
LOCAL_TEST_MODULE_TO_PROGUARD_WITH:=
LOCAL_TIDY:=
@@ -243,6 +278,7 @@ LOCAL_UNINSTALLABLE_MODULE:=
LOCAL_UNSTRIPPED_PATH:=
LOCAL_USE_AAPT2:=$(USE_AAPT2)
LOCAL_USE_VNDK:=
+LOCAL_USES_LIBRARIES:=
LOCAL_VENDOR_MODULE:=
LOCAL_VTSC_FLAGS:=
LOCAL_VTS_INCLUDES:=
@@ -418,6 +454,13 @@ LOCAL_STATIC_LIBRARIES_64:=
LOCAL_WHOLE_STATIC_LIBRARIES_32:=
LOCAL_WHOLE_STATIC_LIBRARIES_64:=
+# Robolectric variables
+LOCAL_INSTRUMENT_SOURCE_DIRS :=
+LOCAL_ROBOTEST_FAILURE_FATAL :=
+LOCAL_ROBOTEST_FILES :=
+LOCAL_ROBOTEST_TIMEOUT :=
+LOCAL_TEST_PACKAGE :=
+
# Aux specific variables
LOCAL_AUX_ARCH :=
LOCAL_AUX_CPU :=
diff --git a/core/combo/TARGET_linux-arm.mk b/core/combo/TARGET_linux-arm.mk
index 2e179f6..3ce64f9 100644
--- a/core/combo/TARGET_linux-arm.mk
+++ b/core/combo/TARGET_linux-arm.mk
@@ -29,8 +29,28 @@
# include defines, and compiler settings for the given architecture
# version.
#
+ifeq ($(strip $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)),)
+TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT := generic
+endif
+
+KNOWN_ARMv8_CORES := cortex-a53 cortex-a53.a57 cortex-a55 cortex-a73 cortex-a75
+KNOWN_ARMv8_CORES += kryo denver64 exynos-m1 exynos-m2
+
+# Many devices (incorrectly) use armv7-a-neon as the 2nd architecture variant
+# for cores that implement armv8-a ISAs. The following sets it to armv8-a.
+ifneq (,$(filter $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT), $(KNOWN_ARMv8_CORES)))
+ ifneq ($(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT),armv8-a)
+ $(warning $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT) is armv8-a.)
+ ifneq (,$(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT))
+ $(warning TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT, $(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT), ignored! Use armv8-a instead.)
+ endif
+ # Overwrite TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT
+ TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT := armv8-a
+ endif
+endif
+
ifeq ($(strip $(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT)),)
-TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT := armv5te
+$(error TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT must be set)
endif
TARGET_ARCH_SPECIFIC_MAKEFILE := $(BUILD_COMBOS)/arch/$(TARGET_$(combo_2nd_arch_prefix)ARCH)/$(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT).mk
diff --git a/core/combo/arch/arm/armv5te-vfp.mk b/core/combo/arch/arm/armv5te-vfp.mk
deleted file mode 100644
index 75299ac..0000000
--- a/core/combo/arch/arm/armv5te-vfp.mk
+++ /dev/null
@@ -1,7 +0,0 @@
-# At the moment, use the same settings than the one
-# for armv5te, since TARGET_ARCH_VARIANT := armv5te-vfp
-# will only be used to select an optimized VFP-capable assembly
-# interpreter loop for Dalvik.
-#
-include $(BUILD_COMBOS)/arch/arm/armv5te.mk
-
diff --git a/core/combo/arch/arm/armv5te.mk b/core/combo/arch/arm/armv5te.mk
deleted file mode 100644
index bd75695..0000000
--- a/core/combo/arch/arm/armv5te.mk
+++ /dev/null
@@ -1,4 +0,0 @@
-# Configuration for Linux on ARM.
-# Generating binaries for the ARMv5TE architecture and higher
-#
-
diff --git a/core/combo/arch/arm/armv8-a.mk b/core/combo/arch/arm/armv8-a.mk
new file mode 100644
index 0000000..9ef5c49
--- /dev/null
+++ b/core/combo/arch/arm/armv8-a.mk
@@ -0,0 +1,9 @@
+# Configuration for Linux on ARM.
+# Generating binaries for the ARMv8-a architecture
+#
+# Many libraries are not aware of armv8-a, and AArch32 is (almost) a superset
+# of armv7-a-neon. So just let them think we are just like v7.
+ARCH_ARM_HAVE_ARMV7A := true
+ARCH_ARM_HAVE_VFP := true
+ARCH_ARM_HAVE_VFP_D32 := true
+ARCH_ARM_HAVE_NEON := true
diff --git a/core/combo/arch/arm64/armv8-2a.mk b/core/combo/arch/arm64/armv8-2a.mk
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/core/combo/arch/arm64/armv8-2a.mk
diff --git a/core/combo/arch/x86/atom.mk b/core/combo/arch/x86/atom.mk
index d313a9a..43a170c 100644
--- a/core/combo/arch/x86/atom.mk
+++ b/core/combo/arch/x86/atom.mk
@@ -2,7 +2,7 @@
# 'x86-atom' arch variant. This is an extension of the 'x86' base variant
# that adds Atom-specific features.
#
-# See build/core/combo/arch/x86/x86.mk for differences.
+# See build/make/core/combo/arch/x86/x86.mk for differences.
#
ARCH_X86_HAVE_SSSE3 := true
ARCH_X86_HAVE_MOVBE := true
diff --git a/core/combo/arch/x86/silvermont.mk b/core/combo/arch/x86/silvermont.mk
index 70b718c..cba1079 100644
--- a/core/combo/arch/x86/silvermont.mk
+++ b/core/combo/arch/x86/silvermont.mk
@@ -1,7 +1,7 @@
# This file contains feature macro definitions specific to the
# silvermont arch variant.
#
-# See build/core/combo/arch/x86/x86-atom.mk for differences.
+# See build/make/core/combo/arch/x86/x86-atom.mk for differences.
#
ARCH_X86_HAVE_SSSE3 := true
diff --git a/core/combo/arch/x86_64/silvermont.mk b/core/combo/arch/x86_64/silvermont.mk
index 70b718c..cba1079 100644
--- a/core/combo/arch/x86_64/silvermont.mk
+++ b/core/combo/arch/x86_64/silvermont.mk
@@ -1,7 +1,7 @@
# This file contains feature macro definitions specific to the
# silvermont arch variant.
#
-# See build/core/combo/arch/x86/x86-atom.mk for differences.
+# See build/make/core/combo/arch/x86/x86-atom.mk for differences.
#
ARCH_X86_HAVE_SSSE3 := true
diff --git a/core/combo/javac.mk b/core/combo/javac.mk
index 5c2668c..dac2628 100644
--- a/core/combo/javac.mk
+++ b/core/combo/javac.mk
@@ -1,53 +1,19 @@
# Selects a Java compiler.
#
-# Inputs:
-# CUSTOM_JAVA_COMPILER -- "eclipse", "openjdk". or nothing for the system
-# default
-# ALTERNATE_JAVAC -- the alternate java compiler to use
-#
# Outputs:
-# COMMON_JAVAC -- Java compiler command with common arguments
+# ANDROID_JAVA_TOOLCHAIN -- Directory that contains javac and other java tools
#
-ifndef ANDROID_COMPILE_WITH_JACK
-# Defines if compilation with jack is enabled by default.
-ANDROID_COMPILE_WITH_JACK := true
-endif
-
-common_jdk_flags := -Xmaxerrs 9999999
-
-# Use the indexer wrapper to index the codebase instead of the javac compiler
-ifeq ($(ALTERNATE_JAVAC),)
-JAVACC := javac
-else
-JAVACC := $(ALTERNATE_JAVAC)
-endif
-
-JAVA := java
-JAVADOC := javadoc
-JAR := jar
+ANDROID_COMPILE_WITH_JACK := false
-# The actual compiler can be wrapped by setting the JAVAC_WRAPPER var.
-ifdef JAVAC_WRAPPER
- ifneq ($(JAVAC_WRAPPER),$(firstword $(JAVACC)))
- JAVACC := $(JAVAC_WRAPPER) $(JAVACC)
- endif
+ifdef TARGET_BUILD_APPS
+ ifndef TURBINE_ENABLED
+ TURBINE_ENABLED := false
+ endif
endif
-# Whatever compiler is on this system.
-COMMON_JAVAC := $(JAVACC) -J-Xmx2048M $(common_jdk_flags)
-
-# Eclipse.
-ifeq ($(CUSTOM_JAVA_COMPILER), eclipse)
- COMMON_JAVAC := java -Xmx256m -jar prebuilt/common/ecj/ecj.jar -5 \
- -maxProblems 9999999 -nowarn
- $(info CUSTOM_JAVA_COMPILER=eclipse)
-endif
-
-GLOBAL_JAVAC_DEBUG_FLAGS := -g
-
-HOST_JAVAC ?= $(COMMON_JAVAC)
-TARGET_JAVAC ?= $(COMMON_JAVAC)
+ANDROID_JAVA_TOOLCHAIN := $(ANDROID_JAVA_HOME)/bin
-#$(info HOST_JAVAC=$(HOST_JAVAC))
-#$(info TARGET_JAVAC=$(TARGET_JAVAC))
+# TODO(ccross): remove this, it is needed for now because it is used by
+# config.mk before makevars from soong are loaded
+JAVA := $(ANDROID_JAVA_TOOLCHAIN)/java
diff --git a/core/combo/select.mk b/core/combo/select.mk
index 5e181b9..eab4c72 100644
--- a/core/combo/select.mk
+++ b/core/combo/select.mk
@@ -28,7 +28,7 @@ combo_var_prefix := $(combo_2nd_arch_prefix)$(combo_target)
# Set reasonable defaults for the various variables
-$(combo_var_prefix)GLOBAL_ARFLAGS := crsPD
+$(combo_var_prefix)GLOBAL_ARFLAGS := cqsD -format=gnu
$(combo_var_prefix)STATIC_LIB_SUFFIX := .a
diff --git a/core/config.mk b/core/config.mk
index cc2b2af..d218408 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -3,6 +3,20 @@
# current configuration and platform, which
# are not specific to what is being built.
+ifndef KATI
+$(warning Directly using config.mk from make is no longer supported.)
+$(warning )
+$(warning If you are just attempting to build, you probably need to re-source envsetup.sh:)
+$(warning )
+$(warning $$ source build/envsetup.sh)
+$(warning )
+$(warning If you are attempting to emulate get_build_var, use one of the following:)
+$(warning $$ build/soong/soong_ui.bash --dumpvar-mode)
+$(warning $$ build/soong/soong_ui.bash --dumpvars-mode)
+$(warning )
+$(error done)
+endif
+
# Only use ANDROID_BUILD_SHELL to wrap around bash.
# DO NOT use other shells such as zsh.
ifdef ANDROID_BUILD_SHELL
@@ -44,17 +58,27 @@ backslash := $(patsubst %a,%,$(backslash))
# If a rule fails, delete $@.
.DELETE_ON_ERROR:
-# Check for broken versions of make.
-ifndef KATI
-ifneq (1,$(strip $(shell expr $(MAKE_VERSION) \>= 3.81)))
-$(warning ********************************************************************************)
-$(warning * You are using version $(MAKE_VERSION) of make.)
-$(warning * Android can only be built by versions 3.81 and higher.)
-$(warning * see https://source.android.com/source/download.html)
-$(warning ********************************************************************************)
-$(error stopping)
-endif
-endif
+# Mark variables deprecated/obsolete
+CHANGES_URL := https://android.googlesource.com/platform/build/+/master/Changes.md
+$(KATI_obsolete_var PATH,Do not use PATH directly. See $(CHANGES_URL)#PATH)
+$(KATI_obsolete_var PYTHONPATH,Do not use PYTHONPATH directly. See $(CHANGES_URL)#PYTHONPATH)
+$(KATI_obsolete_var OUT,Use OUT_DIR instead. See $(CHANGES_URL)#OUT)
+$(KATI_obsolete_var ANDROID_HOST_OUT,Use HOST_OUT instead. See $(CHANGES_URL)#ANDROID_HOST_OUT)
+$(KATI_obsolete_var ANDROID_PRODUCT_OUT,Use PRODUCT_OUT instead. See $(CHANGES_URL)#ANDROID_PRODUCT_OUT)
+$(KATI_obsolete_var ANDROID_HOST_OUT_TESTCASES,Use HOST_OUT_TESTCASES instead. See $(CHANGES_URL)#ANDROID_HOST_OUT_TESTCASES)
+$(KATI_obsolete_var ANDROID_TARGET_OUT_TESTCASES,Use TARGET_OUT_TESTCASES instead. See $(CHANGES_URL)#ANDROID_TARGET_OUT_TESTCASES)
+$(KATI_obsolete_var ANDROID_BUILD_TOP,Use '.' instead. See $(CHANGES_URL)#ANDROID_BUILD_TOP)
+$(KATI_obsolete_var \
+ ANDROID_TOOLCHAIN \
+ ANDROID_TOOLCHAIN_2ND_ARCH \
+ ANDROID_DEV_SCRIPTS \
+ ANDROID_EMULATOR_PREBUILTS \
+ ANDROID_PRE_BUILD_PATHS \
+ ,See $(CHANGES_URL)#other_envsetup_variables)
+$(KATI_obsolete_var PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE,Set FCM Version in device manifest instead. See $(CHANGES_URL)#PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE)
+$(KATI_obsolete_var USE_CLANG_PLATFORM_BUILD,Clang is the only supported Android compiler. See $(CHANGES_URL)#USE_CLANG_PLATFORM_BUILD)
+
+CHANGES_URL :=
# Used to force goals to build. Only use for conditionally defined goals.
.PHONY: FORCE
@@ -62,14 +86,10 @@ FORCE:
ORIGINAL_MAKECMDGOALS := $(MAKECMDGOALS)
-# Tell python not to spam the source tree with .pyc files. This
-# only has an effect on python 2.6 and above.
-export PYTHONDONTWRITEBYTECODE := 1
+dist_goal := $(strip $(filter dist,$(MAKECMDGOALS)))
+MAKECMDGOALS := $(strip $(filter-out dist,$(MAKECMDGOALS)))
-ifneq ($(filter --color=always, $(GREP_OPTIONS)),)
-$(warning The build system needs unmodified output of grep.)
-$(error Please remove --color=always from your $$GREP_OPTIONS)
-endif
+UNAME := $(shell uname -sm)
SRC_TARGET_DIR := $(TOPDIR)build/target
SRC_API_DIR := $(TOPDIR)prebuilts/sdk/api
@@ -77,7 +97,7 @@ SRC_SYSTEM_API_DIR := $(TOPDIR)prebuilts/sdk/system-api
SRC_TEST_API_DIR := $(TOPDIR)prebuilts/sdk/test-api
# Some specific paths to tools
-SRC_DROIDDOC_DIR := $(TOPDIR)build/tools/droiddoc
+SRC_DROIDDOC_DIR := $(TOPDIR)build/make/tools/droiddoc
# Set up efficient math functions which are used in make.
# Here since this file is included by envsetup as well as during build.
@@ -86,6 +106,9 @@ include $(BUILD_SYSTEM)/math.mk
# Various mappings to avoid hard-coding paths all over the place
include $(BUILD_SYSTEM)/pathmap.mk
+# Allow projects to define their own globally-available variables
+include $(BUILD_SYSTEM)/project_definitions.mk
+
# ###############################################################
# Build system internal files
# ###############################################################
@@ -112,6 +135,7 @@ BUILD_JAVA_LIBRARY:= $(BUILD_SYSTEM)/java_library.mk
BUILD_STATIC_JAVA_LIBRARY:= $(BUILD_SYSTEM)/static_java_library.mk
BUILD_HOST_JAVA_LIBRARY:= $(BUILD_SYSTEM)/host_java_library.mk
BUILD_DROIDDOC:= $(BUILD_SYSTEM)/droiddoc.mk
+BUILD_APIDIFF:= $(BUILD_SYSTEM)/apidiff.mk
BUILD_COPY_HEADERS := $(BUILD_SYSTEM)/copy_headers.mk
BUILD_NATIVE_TEST := $(BUILD_SYSTEM)/native_test.mk
BUILD_NATIVE_BENCHMARK := $(BUILD_SYSTEM)/native_benchmark.mk
@@ -128,6 +152,15 @@ BUILD_NOTICE_FILE := $(BUILD_SYSTEM)/notice_files.mk
BUILD_HOST_DALVIK_JAVA_LIBRARY := $(BUILD_SYSTEM)/host_dalvik_java_library.mk
BUILD_HOST_DALVIK_STATIC_JAVA_LIBRARY := $(BUILD_SYSTEM)/host_dalvik_static_java_library.mk
+BUILD_HOST_TEST_CONFIG := $(BUILD_SYSTEM)/host_test_config.mk
+BUILD_TARGET_TEST_CONFIG := $(BUILD_SYSTEM)/target_test_config.mk
+
+INSTRUMENTATION_TEST_CONFIG_TEMPLATE := $(BUILD_SYSTEM)/instrumentation_test_config_template.xml
+NATIVE_TEST_CONFIG_TEMPLATE := $(BUILD_SYSTEM)/native_test_config_template.xml
+EMPTY_TEST_CONFIG := $(BUILD_SYSTEM)/empty_test_config.xml
+
+# Tool to generate TradeFed test config file automatically.
+AUTOGEN_TEST_CONFIG_SCRIPT := build/make/tools/auto_gen_test_config.py
# ###############################################################
# Parse out any modifier targets.
@@ -138,7 +171,7 @@ hide := @
################################################################
# Tools needed in product configuration makefiles.
################################################################
-NORMALIZE_PATH := build/tools/normalize_path.py
+NORMALIZE_PATH := build/make/tools/normalize_path.py
# $(1): the paths to be normalized
define normalize-paths
@@ -149,6 +182,9 @@ endef
# Set common values
# ###############################################################
+# Initialize SOONG_CONFIG_NAMESPACES so that it isn't recursive.
+SOONG_CONFIG_NAMESPACES :=
+
# Set the extensions used for various packages
COMMON_PACKAGE_SUFFIX := .zip
COMMON_JAVA_PACKAGE_SUFFIX := .jar
@@ -160,6 +196,11 @@ else
JAVA_TMPDIR_ARG :=
endif
+# Default to remove the org.apache.http.legacy from bootclasspath
+ifeq ($(REMOVE_OAHL_FROM_BCP),)
+REMOVE_OAHL_FROM_BCP := true
+endif
+
# ###############################################################
# Include sub-configuration files
# ###############################################################
@@ -302,7 +343,7 @@ combo_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
include $(BUILD_SYSTEM)/combo/select.mk
endif
-ifndef KATI
+ifeq ($(CALLED_FROM_SETUP),true)
include $(BUILD_SYSTEM)/ccache.mk
include $(BUILD_SYSTEM)/goma.mk
@@ -375,33 +416,11 @@ ifeq ($(strip $(WITH_STATIC_ANALYZER)),0)
WITH_STATIC_ANALYZER :=
endif
-# define clang/llvm versions and base directory.
-include $(BUILD_SYSTEM)/clang/versions.mk
-
# Unset WITH_TIDY_ONLY if global WITH_TIDY_ONLY is not true nor 1.
ifeq (,$(filter 1 true,$(WITH_TIDY_ONLY)))
WITH_TIDY_ONLY :=
endif
-PATH_TO_CLANG_TIDY := \
- $(LLVM_PREBUILTS_BASE)/$(BUILD_OS)-x86/$(LLVM_PREBUILTS_VERSION)/bin/clang-tidy
-ifeq ($(wildcard $(PATH_TO_CLANG_TIDY)),)
- ifneq (,$(filter 1 true,$(WITH_TIDY)))
- $(warning *** Disable WITH_TIDY because $(PATH_TO_CLANG_TIDY) does not exist)
- endif
- PATH_TO_CLANG_TIDY :=
-endif
-
-# Disable WITH_STATIC_ANALYZER if tool can't be found
-SYNTAX_TOOLS_PREFIX := \
- $(LLVM_PREBUILTS_BASE)/$(BUILD_OS)-x86/$(LLVM_PREBUILTS_VERSION)/tools/scan-build/libexec
-ifneq ($(strip $(WITH_STATIC_ANALYZER)),)
- ifeq ($(wildcard $(SYNTAX_TOOLS_PREFIX)/ccc-analyzer),)
- $(warning *** Disable WITH_STATIC_ANALYZER because $(SYNTAX_TOOLS_PREFIX)/ccc-analyzer does not exist)
- WITH_STATIC_ANALYZER :=
- endif
-endif
-
# Pick a Java compiler.
include $(BUILD_SYSTEM)/combo/javac.mk
@@ -432,9 +451,9 @@ pdk fusion: $(DEFAULT_GOAL)
# What to build:
# pdk fusion if:
-# 1) PDK_FUSION_PLATFORM_ZIP is passed in from the environment
+# 1) PDK_FUSION_PLATFORM_ZIP / PDK_FUSION_PLATFORM_DIR is passed in from the environment
# or
-# 2) the platform.zip exists in the default location
+# 2) the platform.zip / pdk.mk exists in the default location
# or
# 3) fusion is a command line build goal,
# PDK_FUSION_PLATFORM_ZIP is needed anyway, then do we need the 'fusion' goal?
@@ -443,27 +462,44 @@ pdk fusion: $(DEFAULT_GOAL)
# or
# 2) TARGET_BUILD_PDK is passed in from the environment
-# if PDK_FUSION_PLATFORM_ZIP is specified, do not override.
-ifndef PDK_FUSION_PLATFORM_ZIP
-# Most PDK project paths should be using vendor/pdk/TARGET_DEVICE
-# but some legacy ones (e.g. mini_armv7a_neon generic PDK) were setup
-# with vendor/pdk/TARGET_PRODUCT.
-_pdk_fusion_default_platform_zip = $(strip \
- $(wildcard vendor/pdk/$(TARGET_DEVICE)/$(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)/platform/platform.zip) \
- $(wildcard vendor/pdk/$(TARGET_DEVICE)/$(patsubst aosp_%,full_%,$(TARGET_PRODUCT))-$(TARGET_BUILD_VARIANT)/platform/platform.zip) \
- $(wildcard vendor/pdk/$(TARGET_PRODUCT)/$(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)/platform/platform.zip) \
- $(wildcard vendor/pdk/$(TARGET_PRODUCT)/$(patsubst aosp_%,full_%,$(TARGET_PRODUCT))-$(TARGET_BUILD_VARIANT)/platform/platform.zip))
-ifneq (,$(_pdk_fusion_default_platform_zip))
-PDK_FUSION_PLATFORM_ZIP := $(word 1, $(_pdk_fusion_default_platform_zip))
-TARGET_BUILD_PDK := true
-endif # _pdk_fusion_default_platform_zip
-endif # !PDK_FUSION_PLATFORM_ZIP
+# if PDK_FUSION_PLATFORM_ZIP or PDK_FUSION_PLATFORM_DIR is specified, do not override.
+ifeq (,$(strip $(PDK_FUSION_PLATFORM_ZIP)$(PDK_FUSION_PLATFORM_DIR)))
+ # Most PDK project paths should be using vendor/pdk/TARGET_DEVICE
+ # but some legacy ones (e.g. mini_armv7a_neon generic PDK) were setup
+ # with vendor/pdk/TARGET_PRODUCT.
+ # Others are set up with vendor/pdk/TARGET_DEVICE/TARGET_DEVICE-userdebug
+ _pdk_fusion_search_paths := \
+ vendor/pdk/$(TARGET_DEVICE)/$(TARGET_DEVICE)-$(TARGET_BUILD_VARIANT)/platform \
+ vendor/pdk/$(TARGET_DEVICE)/$(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)/platform \
+ vendor/pdk/$(TARGET_DEVICE)/$(patsubst aosp_%,full_%,$(TARGET_PRODUCT))-$(TARGET_BUILD_VARIANT)/platform \
+ vendor/pdk/$(TARGET_PRODUCT)/$(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)/platform \
+ vendor/pdk/$(TARGET_PRODUCT)/$(patsubst aosp_%,full_%,$(TARGET_PRODUCT))-$(TARGET_BUILD_VARIANT)/platform
+
+ _pdk_fusion_default_platform_zip := $(strip $(foreach p,$(_pdk_fusion_search_paths),$(wildcard $(p)/platform.zip)))
+ ifneq (,$(_pdk_fusion_default_platform_zip))
+ PDK_FUSION_PLATFORM_ZIP := $(word 1, $(_pdk_fusion_default_platform_zip))
+ _pdk_fusion_default_platform_zip :=
+ else
+ _pdk_fusion_default_platform_mk := $(strip $(foreach p,$(_pdk_fusion_search_paths),$(wildcard $(p)/pdk.mk)))
+ ifneq (,$(_pdk_fusion_default_platform_mk))
+ PDK_FUSION_PLATFORM_DIR := $(dir $(word 1,$(_pdk_fusion_default_platform_mk)))
+ _pdk_fusion_default_platform_mk :=
+ endif
+ endif # _pdk_fusion_default_platform_zip
+ _pdk_fusion_search_paths :=
+endif # !PDK_FUSION_PLATFORM_ZIP && !PDK_FUSION_PLATFORM_DIR
+
+ifneq (,$(PDK_FUSION_PLATFORM_ZIP))
+ ifneq (,$(PDK_FUSION_PLATFORM_DIR))
+ $(error Only one of PDK_FUSION_PLATFORM_ZIP or PDK_FUSION_PLATFORM_DIR may be specified)
+ endif
+endif
ifneq (,$(filter pdk fusion, $(MAKECMDGOALS)))
TARGET_BUILD_PDK := true
ifneq (,$(filter fusion, $(MAKECMDGOALS)))
-ifndef PDK_FUSION_PLATFORM_ZIP
- $(error Specify PDK_FUSION_PLATFORM_ZIP to do a PDK fusion.)
+ifeq (,$(strip $(PDK_FUSION_PLATFORM_ZIP)$(PDK_FUSION_PLATFORM_DIR)))
+ $(error Specify PDK_FUSION_PLATFORM_ZIP or PDK_FUSION_PLATFORM_DIR to do a PDK fusion.)
endif
endif # fusion
endif # pdk or fusion
@@ -471,7 +507,19 @@ endif # pdk or fusion
ifdef PDK_FUSION_PLATFORM_ZIP
TARGET_BUILD_PDK := true
ifeq (,$(wildcard $(PDK_FUSION_PLATFORM_ZIP)))
- $(error Cannot find file $(PDK_FUSION_PLATFORM_ZIP).)
+ ifneq (,$(wildcard $(dir $(PDK_FUSION_PLATFORM_ZIP))/pdk.mk))
+ PDK_FUSION_PLATFORM_DIR := $(dir $(PDK_FUSION_PLATFORM_ZIP))
+ PDK_FUSION_PLATFORM_ZIP :=
+ else
+ $(error Cannot find file $(PDK_FUSION_PLATFORM_ZIP).)
+ endif
+endif
+endif
+
+ifdef PDK_FUSION_PLATFORM_DIR
+TARGET_BUILD_PDK := true
+ifeq (,$(wildcard $(PDK_FUSION_PLATFORM_DIR)/pdk.mk))
+ $(error Cannot find file $(PDK_FUSION_PLATFORM_DIR)/pdk.mk.)
endif
endif
@@ -497,8 +545,29 @@ endif
prebuilt_sdk_tools := prebuilts/sdk/tools
prebuilt_sdk_tools_bin := $(prebuilt_sdk_tools)/$(HOST_OS)/bin
+# Always use prebuilts for ckati and makeparallel
+prebuilt_build_tools := prebuilts/build-tools
+prebuilt_build_tools_wrappers := prebuilts/build-tools/common/bin
+prebuilt_build_tools_jars := prebuilts/build-tools/common/framework
+ifeq ($(filter address,$(SANITIZE_HOST)),)
+prebuilt_build_tools_bin := $(prebuilt_build_tools)/$(HOST_PREBUILT_TAG)/bin
+else
+prebuilt_build_tools_bin := $(prebuilt_build_tools)/$(HOST_PREBUILT_TAG)/asan/bin
+endif
+
USE_PREBUILT_SDK_TOOLS_IN_PLACE := true
+# Work around for b/68406220
+# This should match the soong version.
+ifndef USE_D8
+ USE_D8 := true
+endif
+
+# Default R8 behavior when USE_R8 is not specified.
+ifndef USE_R8
+ USE_R8 := false
+endif
+
#
# Tools that are prebuilts for TARGET_BUILD_APPS
#
@@ -506,28 +575,21 @@ ifeq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)))
AIDL := $(HOST_OUT_EXECUTABLES)/aidl
AAPT := $(HOST_OUT_EXECUTABLES)/aapt
AAPT2 := $(HOST_OUT_EXECUTABLES)/aapt2
+ DESUGAR := $(HOST_OUT_JAVA_LIBRARIES)/desugar.jar
MAINDEXCLASSES := $(HOST_OUT_EXECUTABLES)/mainDexClasses
SIGNAPK_JAR := $(HOST_OUT_JAVA_LIBRARIES)/signapk$(COMMON_JAVA_PACKAGE_SUFFIX)
SIGNAPK_JNI_LIBRARY_PATH := $(HOST_OUT_SHARED_LIBRARIES)
ZIPALIGN := $(HOST_OUT_EXECUTABLES)/zipalign
- ifndef DX_ALT_JAR
- DX := $(HOST_OUT_EXECUTABLES)/dx
- DX_COMMAND := $(DX) -JXms16M -JXmx2048M
- else
- DX := $(DX_ALT_JAR)
- DX_COMMAND := $(JAVA) -Xms16M -Xmx2048M -jar $(DX)
- endif
else # TARGET_BUILD_APPS || TARGET_BUILD_PDK
- AIDL := $(prebuilt_sdk_tools_bin)/aidl
+ AIDL := $(prebuilt_build_tools_bin)/aidl
AAPT := $(prebuilt_sdk_tools_bin)/aapt
AAPT2 := $(prebuilt_sdk_tools_bin)/aapt2
- DX := $(prebuilt_sdk_tools)/dx
- DX_COMMAND := $(DX) -JXms16M -JXmx2048M
+ DESUGAR := $(prebuilt_build_tools_jars)/desugar.jar
MAINDEXCLASSES := $(prebuilt_sdk_tools)/mainDexClasses
- ZIPALIGN := $(prebuilt_sdk_tools_bin)/zipalign
SIGNAPK_JAR := $(prebuilt_sdk_tools)/lib/signapk$(COMMON_JAVA_PACKAGE_SUFFIX)
SIGNAPK_JNI_LIBRARY_PATH := $(prebuilt_sdk_tools)/$(HOST_OS)/lib64
+ ZIPALIGN := $(prebuilt_build_tools_bin)/zipalign
endif # TARGET_BUILD_APPS || TARGET_BUILD_PDK
ifeq (,$(TARGET_BUILD_APPS))
@@ -542,38 +604,30 @@ endif # TARGET_BUILD_PDK
prebuilt_sdk_tools :=
prebuilt_sdk_tools_bin :=
-# Always use prebuilts for ckati and makeparallel
-prebuilt_build_tools := prebuilts/build-tools
-ifeq ($(filter address,$(SANITIZE_HOST)),)
-prebuilt_build_tools_bin := $(prebuilt_build_tools)/$(HOST_PREBUILT_TAG)/bin
-else
-prebuilt_build_tools_bin := $(prebuilt_build_tools)/$(HOST_PREBUILT_TAG)/asan/bin
-endif
-
ACP := $(prebuilt_build_tools_bin)/acp
CKATI := $(prebuilt_build_tools_bin)/ckati
DEPMOD := $(HOST_OUT_EXECUTABLES)/depmod
FILESLIST := $(SOONG_HOST_OUT_EXECUTABLES)/fileslist
-IJAR := $(prebuilt_build_tools_bin)/ijar
MAKEPARALLEL := $(prebuilt_build_tools_bin)/makeparallel
SOONG_JAVAC_WRAPPER := $(SOONG_HOST_OUT_EXECUTABLES)/soong_javac_wrapper
SOONG_ZIP := $(SOONG_HOST_OUT_EXECUTABLES)/soong_zip
+MERGE_ZIPS := $(SOONG_HOST_OUT_EXECUTABLES)/merge_zips
+XMLLINT := $(SOONG_HOST_OUT_EXECUTABLES)/xmllint
ZIP2ZIP := $(SOONG_HOST_OUT_EXECUTABLES)/zip2zip
ZIPTIME := $(prebuilt_build_tools_bin)/ziptime
# ---------------------------------------------------------------
# Generic tools.
-JACK := $(HOST_OUT_EXECUTABLES)/jack
LEX := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/flex/flex-2.5.39
# The default PKGDATADIR built in the prebuilt bison is a relative path
-# external/bison/data.
+# prebuilts/build-tools/common/bison.
# To run bison from elsewhere you need to set up enviromental variable
# BISON_PKGDATADIR.
-BISON_PKGDATADIR := $(PWD)/external/bison/data
-BISON := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/bison/bison
+BISON_PKGDATADIR := $(PWD)/prebuilts/build-tools/common/bison
+BISON := prebuilts/build-tools/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/bin/bison
YACC := $(BISON) -d
-BISON_DATA := $(wildcard external/bison/data/* external/bison/data/*/*)
+BISON_DATA := $(wildcard $(BISON_PKGDATADIR)/* $(BISON_PKGDATADIR)/*/*)
YASM := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/yasm/yasm
@@ -592,7 +646,7 @@ NANOPB_SRCS := external/nanopb-c/generator/protoc-gen-nanopb \
VTSC := $(HOST_OUT_EXECUTABLES)/vtsc$(HOST_EXECUTABLE_SUFFIX)
MKBOOTFS := $(HOST_OUT_EXECUTABLES)/mkbootfs$(HOST_EXECUTABLE_SUFFIX)
MINIGZIP := $(HOST_OUT_EXECUTABLES)/minigzip$(HOST_EXECUTABLE_SUFFIX)
-BRO := $(HOST_OUT_EXECUTABLES)/bro$(HOST_EXECUTABLE_SUFFIX)
+BROTLI := $(HOST_OUT_EXECUTABLES)/brotli$(HOST_EXECUTABLE_SUFFIX)
ifeq (,$(strip $(BOARD_CUSTOM_MKBOOTIMG)))
MKBOOTIMG := $(HOST_OUT_EXECUTABLES)/mkbootimg$(HOST_EXECUTABLE_SUFFIX)
else
@@ -610,15 +664,9 @@ AVBTOOL := $(BOARD_CUSTOM_AVBTOOL)
endif
APICHECK := $(HOST_OUT_EXECUTABLES)/apicheck$(HOST_EXECUTABLE_SUFFIX)
FS_GET_STATS := $(HOST_OUT_EXECUTABLES)/fs_get_stats$(HOST_EXECUTABLE_SUFFIX)
-ifeq ($(TARGET_USES_MKE2FS),true)
MAKE_EXT4FS := $(HOST_OUT_EXECUTABLES)/mke2fs$(HOST_EXECUTABLE_SUFFIX)
MKEXTUSERIMG := $(HOST_OUT_EXECUTABLES)/mkuserimg_mke2fs.sh
MKE2FS_CONF := system/extras/ext4_utils/mke2fs.conf
-else
-MAKE_EXT4FS := $(HOST_OUT_EXECUTABLES)/make_ext4fs$(HOST_EXECUTABLE_SUFFIX)
-MKEXTUSERIMG := $(HOST_OUT_EXECUTABLES)/mkuserimg.sh
-MKE2FS_CONF :=
-endif
BLK_ALLOC_TO_BASE_FS := $(HOST_OUT_EXECUTABLES)/blk_alloc_to_base_fs$(HOST_EXECUTABLE_SUFFIX)
MAKE_SQUASHFS := $(HOST_OUT_EXECUTABLES)/mksquashfs$(HOST_EXECUTABLE_SUFFIX)
MKSQUASHFSUSERIMG := $(HOST_OUT_EXECUTABLES)/mksquashfsimage.sh
@@ -627,31 +675,17 @@ MKF2FSUSERIMG := $(HOST_OUT_EXECUTABLES)/mkf2fsuserimg.sh
SIMG2IMG := $(HOST_OUT_EXECUTABLES)/simg2img$(HOST_EXECUTABLE_SUFFIX)
IMG2SIMG := $(HOST_OUT_EXECUTABLES)/img2simg$(HOST_EXECUTABLE_SUFFIX)
E2FSCK := $(HOST_OUT_EXECUTABLES)/e2fsck$(HOST_EXECUTABLE_SUFFIX)
-MKTARBALL := build/tools/mktarball.sh
+MKTARBALL := build/make/tools/mktarball.sh
TUNE2FS := $(HOST_OUT_EXECUTABLES)/tune2fs$(HOST_EXECUTABLE_SUFFIX)
JARJAR := $(HOST_OUT_JAVA_LIBRARIES)/jarjar.jar
-DESUGAR := $(HOST_OUT_JAVA_LIBRARIES)/desugar.jar
DATA_BINDING_COMPILER := $(HOST_OUT_JAVA_LIBRARIES)/databinding-compiler.jar
-FAT16COPY := build/tools/fat16copy.py
-CHECK_LINK_TYPE := build/tools/check_link_type.py
-
-ifeq ($(ANDROID_COMPILE_WITH_JACK),true)
-DEFAULT_JACK_ENABLED:=full
-else
-DEFAULT_JACK_ENABLED:=
-endif
-ifneq ($(ANDROID_JACK_EXTRA_ARGS),)
-JACK_DEFAULT_ARGS :=
-DEFAULT_JACK_EXTRA_ARGS := $(ANDROID_JACK_EXTRA_ARGS)
-else
-JACK_DEFAULT_ARGS := $(BUILD_SYSTEM)/jack-default.args
-DEFAULT_JACK_EXTRA_ARGS := @$(JACK_DEFAULT_ARGS)
-endif
+FAT16COPY := build/make/tools/fat16copy.py
+CHECK_LINK_TYPE := build/make/tools/check_link_type.py
PROGUARD := external/proguard/bin/proguard.sh
-JAVATAGS := build/tools/java-event-log-tags.py
-MERGETAGS := build/tools/merge-event-log-tags.py
-BUILD_IMAGE_SRCS := $(wildcard build/tools/releasetools/*.py)
+JAVATAGS := build/make/tools/java-event-log-tags.py
+MERGETAGS := build/make/tools/merge-event-log-tags.py
+BUILD_IMAGE_SRCS := $(wildcard build/make/tools/releasetools/*.py)
APPEND2SIMG := $(HOST_OUT_EXECUTABLES)/append2simg
VERITY_SIGNER := $(HOST_OUT_EXECUTABLES)/verity_signer
BUILD_VERITY_TREE := $(HOST_OUT_EXECUTABLES)/build_verity_tree
@@ -663,43 +697,48 @@ BRILLO_UPDATE_PAYLOAD := $(HOST_OUT_EXECUTABLES)/brillo_update_payload
DEXDUMP := $(HOST_OUT_EXECUTABLES)/dexdump2$(BUILD_EXECUTABLE_SUFFIX)
PROFMAN := $(HOST_OUT_EXECUTABLES)/profman
+HIDDENAPI := $(HOST_OUT_EXECUTABLES)/hiddenapi
# relocation packer
RELOCATION_PACKER := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/relocation_packer/relocation_packer
FINDBUGS_DIR := external/owasp/sanitizer/tools/findbugs/bin
FINDBUGS := $(FINDBUGS_DIR)/findbugs
-JACOCO_CLI_JAR := $(HOST_OUT_JAVA_LIBRARIES)/jacoco-cli$(COMMON_JAVA_PACKAGE_SUFFIX)
+
+JETIFIER := prebuilts/sdk/tools/jetifier/jetifier-standalone/bin/jetifier-standalone
# Tool to merge AndroidManifest.xmls
-ANDROID_MANIFEST_MERGER := $(JAVA) -classpath prebuilts/devtools/tools/lib/manifest-merger.jar com.android.manifmerger.Main merge
+ANDROID_MANIFEST_MERGER_CLASSPATH := \
+ prebuilts/gradle-plugin/com/android/tools/build/manifest-merger/26.0.0-beta2/manifest-merger-26.0.0-beta2.jar \
+ prebuilts/gradle-plugin/com/android/tools/sdk-common/26.0.0-beta2/sdk-common-26.0.0-beta2.jar \
+ prebuilts/gradle-plugin/com/android/tools/common/26.0.0-beta2/common-26.0.0-beta2.jar \
+ prebuilts/misc/common/guava/guava-21.0.jar
+ANDROID_MANIFEST_MERGER := $(JAVA) \
+ -classpath $(subst $(space),:,$(strip $(ANDROID_MANIFEST_MERGER_CLASSPATH))) \
+ com.android.manifmerger.Merger
COLUMN:= column
-# We may not have the right JAVA_HOME/PATH set up yet when this is run from envsetup.sh.
-ifneq ($(CALLED_FROM_SETUP),true)
-
-# Path to tools.jar, or empty if EXPERIMENTAL_USE_OPENJDK9 is set
-HOST_JDK_TOOLS_JAR :=
-# TODO: Remove HOST_JDK_TOOLS_JAR and all references to it once OpenJDK 8
-# toolchains are no longer supported (i.e. when what is now
-# EXPERIMENTAL_USE_OPENJDK9 becomes the standard). http://b/38418220
ifeq ($(EXPERIMENTAL_USE_OPENJDK9),)
-HOST_JDK_TOOLS_JAR := $(shell $(BUILD_SYSTEM)/find-jdk-tools-jar.sh)
-
-ifneq ($(HOST_JDK_TOOLS_JAR),)
-ifeq ($(wildcard $(HOST_JDK_TOOLS_JAR)),)
-$(error Error: could not find jdk tools.jar at $(HOST_JDK_TOOLS_JAR), please check if your JDK was installed correctly)
+ifeq ($(RUN_ERROR_PRONE),true)
+USE_OPENJDK9 :=
+else
+USE_OPENJDK9 := true
endif
+TARGET_OPENJDK9 :=
+else ifeq ($(EXPERIMENTAL_USE_OPENJDK9),false)
+USE_OPENJDK9 :=
+TARGET_OPENJDK9 :=
+else ifeq ($(EXPERIMENTAL_USE_OPENJDK9),1.8)
+USE_OPENJDK9 := true
+TARGET_OPENJDK9 :=
+else ifeq ($(EXPERIMENTAL_USE_OPENJDK9),true)
+USE_OPENJDK9 := true
+TARGET_OPENJDK9 := true
endif
-endif # ifeq ($(EXPERIMENTAL_USE_OPENJDK9),)
-# Is the host JDK 64-bit version?
-HOST_JDK_IS_64BIT_VERSION :=
-ifneq ($(filter 64-Bit, $(shell $(JAVA) -version 2>&1)),)
-HOST_JDK_IS_64BIT_VERSION := true
-endif
-endif # CALLED_FROM_SETUP not true
+# Path to tools.jar
+HOST_JDK_TOOLS_JAR := $(ANDROID_JAVA8_HOME)/lib/tools.jar
# It's called md5 on Mac OS and md5sum on Linux
ifeq ($(HOST_OS),darwin)
@@ -717,6 +756,19 @@ APICHECK_CLASSPATH := $(subst $(space),:,$(strip $(APICHECK_CLASSPATH_ENTRIES)))
APICHECK_COMMAND := $(APICHECK) -JXmx1024m -J"classpath $(APICHECK_CLASSPATH)"
+# Boolean variable determining if the whitelist for compatible properties is enabled
+PRODUCT_COMPATIBLE_PROPERTY := false
+ifneq ($(PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE),)
+ PRODUCT_COMPATIBLE_PROPERTY := $(PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE)
+else ifeq ($(PRODUCT_SHIPPING_API_LEVEL),)
+ #$(warning no product shipping level defined)
+else ifneq ($(call math_lt,27,$(PRODUCT_SHIPPING_API_LEVEL)),)
+ PRODUCT_COMPATIBLE_PROPERTY := true
+endif
+
+.KATI_READONLY := \
+ PRODUCT_COMPATIBLE_PROPERTY
+
# Boolean variable determining if Treble is fully enabled
PRODUCT_FULL_TREBLE := false
ifneq ($(PRODUCT_FULL_TREBLE_OVERRIDE),)
@@ -727,12 +779,103 @@ else ifneq ($(call math_gt_or_eq,$(PRODUCT_SHIPPING_API_LEVEL),26),)
PRODUCT_FULL_TREBLE := true
endif
+# TODO(b/69865032): Make PRODUCT_NOTICE_SPLIT the default behavior and remove
+# references to it here and below.
+ifdef PRODUCT_NOTICE_SPLIT_OVERRIDE
+ $(error PRODUCT_NOTICE_SPLIT_OVERRIDE cannot be set.)
+endif
+
+requirements := \
+ PRODUCT_TREBLE_LINKER_NAMESPACES \
+ PRODUCT_SEPOLICY_SPLIT \
+ PRODUCT_ENFORCE_VINTF_MANIFEST \
+ PRODUCT_NOTICE_SPLIT
+
+# If it is overriden, then the requirement override is taken, otherwise it's
+# PRODUCT_FULL_TREBLE
+$(foreach req,$(requirements),$(eval \
+ $(req) := $(if $($(req)_OVERRIDE),$($(req)_OVERRIDE),$(PRODUCT_FULL_TREBLE))))
+# If the requirement is false for any reason, then it's not PRODUCT_FULL_TREBLE
+$(foreach req,$(requirements),$(eval \
+ PRODUCT_FULL_TREBLE := $(if $(filter false,$($(req))),false,$(PRODUCT_FULL_TREBLE))))
+
+PRODUCT_FULL_TREBLE_OVERRIDE ?=
+$(foreach req,$(requirements),$(eval $(req)_OVERRIDE ?=))
+
+.KATI_READONLY := \
+ PRODUCT_FULL_TREBLE_OVERRIDE \
+ $(foreach req,$(requirements),$(req)_OVERRIDE) \
+ $(requirements) \
+ PRODUCT_FULL_TREBLE \
+
+requirements :=
+
+# BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED can be true only if early-mount of
+# partitions is supported. But the early-mount must be supported for full
+# treble products, and so BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED should be set
+# by default for full treble products.
+ifeq ($(PRODUCT_FULL_TREBLE),true)
+ BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED ?= true
+endif
+
+# If PRODUCT_USE_VNDK is true and BOARD_VNDK_VERSION is not defined yet,
+# BOARD_VNDK_VERSION will be set to "current" as default.
+# PRODUCT_USE_VNDK will be true in Android-P or later launching devices.
+PRODUCT_USE_VNDK := false
+ifneq ($(PRODUCT_USE_VNDK_OVERRIDE),)
+ PRODUCT_USE_VNDK := $(PRODUCT_USE_VNDK_OVERRIDE)
+else ifeq ($(PRODUCT_SHIPPING_API_LEVEL),)
+ # No shipping level defined
+else ifeq ($(call math_gt_or_eq,27,$(PRODUCT_SHIPPING_API_LEVEL)),)
+ PRODUCT_USE_VNDK := $(PRODUCT_FULL_TREBLE)
+endif
+
+ifeq ($(PRODUCT_USE_VNDK),true)
+ ifndef BOARD_VNDK_VERSION
+ BOARD_VNDK_VERSION := current
+ endif
+endif
+
+$(KATI_obsolete_var PRODUCT_USE_VNDK_OVERRIDE,Use PRODUCT_USE_VNDK instead)
+.KATI_READONLY := \
+ PRODUCT_USE_VNDK
+
+# Set BOARD_SYSTEMSDK_VERSIONS to the latest SystemSDK version starting from P-launching
+# devices if unset.
+ifndef BOARD_SYSTEMSDK_VERSIONS
+ ifdef PRODUCT_SHIPPING_API_LEVEL
+ ifneq ($(call math_gt_or_eq,$(PRODUCT_SHIPPING_API_LEVEL),28),)
+ ifeq (REL,$(PLATFORM_VERSION_CODENAME))
+ BOARD_SYSTEMSDK_VERSIONS := $(PLATFORM_SDK_VERSION)
+ else
+ BOARD_SYSTEMSDK_VERSIONS := $(PLATFORM_VERSION_CODENAME)
+ endif
+ endif
+ endif
+endif
+
+
ifdef PRODUCT_SHIPPING_API_LEVEL
ifneq ($(call math_gt_or_eq,$(PRODUCT_SHIPPING_API_LEVEL),27),)
ifneq ($(TARGET_USES_MKE2FS),true)
$(error When PRODUCT_SHIPPING_API_LEVEL >= 27, TARGET_USES_MKE2FS must be true)
endif
endif
+ ifneq ($(call numbers_less_than,$(PRODUCT_SHIPPING_API_LEVEL),$(BOARD_SYSTEMSDK_VERSIONS)),)
+ $(error BOARD_SYSTEMSDK_VERSIONS ($(BOARD_SYSTEMSDK_VERSIONS)) must all be greater than or equal to PRODUCT_SHIPPING_API_LEVEL ($(PRODUCT_SHIPPING_API_LEVEL)))
+ endif
+ ifneq ($(call math_gt_or_eq,$(PRODUCT_SHIPPING_API_LEVEL),28),)
+ ifneq ($(TARGET_IS_64_BIT), true)
+ ifneq ($(TARGET_USES_64_BIT_BINDER), true)
+ $(error When PRODUCT_SHIPPING_API_LEVEL >= 28, TARGET_USES_64_BIT_BINDER must be true)
+ endif
+ endif
+ ifeq ($(PRODUCT_FULL_TREBLE),true)
+ ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE), true)
+ $(error When PRODUCT_SHIPPING_API_LEVEL >= 28, BOARD_BUILD_SYSTEM_ROOT_IMAGE must be true)
+ endif
+ endif
+ endif
endif
# The default key if not set as LOCAL_CERTIFICATE
@@ -742,45 +885,46 @@ else
DEFAULT_SYSTEM_DEV_CERTIFICATE := build/target/product/security/testkey
endif
-FRAMEWORK_MANIFEST_FILE := system/libhidl/manifest.xml
-
-# Compatibility matrix versioning:
-# MATRIX_LEVEL_OVERRIDE defined: MATRIX_LEVEL = MATRIX_LEVEL_OVERRIDE
-# MATRIX_LEVEL_OVERRIDE undefined:
-# FULL_TREBLE != true: MATRIX_LEVEL = legacy
-# FULL_TREBLE == true:
-# SHIPPING_API_LEVEL defined: MATRIX_LEVEL = SHIPPING_API_LEVEL
-# SHIPPING_API_LEVEL undefined: MATRIX_LEVEL = PLATFORM_SDK_VERSION
-# MATRIX_LEVEL == legacy => legacy.xml
-# MATRIX_LEVEL <= 26 => 26.xml
-# MATRIX_LEVEL == 27 => 27.xml # define when 27 releases
-# MATRIX_LEVEL == 28 => 28.xml # define when 28 releases
-# ...
-# otherwise => current.xml
-
-ifneq ($(PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE),)
- PRODUCT_COMPATIBILITY_MATRIX_LEVEL := $(PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE)
-else ifneq ($(PRODUCT_FULL_TREBLE),true)
- PRODUCT_COMPATIBILITY_MATRIX_LEVEL := legacy
-else ifneq ($(PRODUCT_SHIPPING_API_LEVEL),)
- PRODUCT_COMPATIBILITY_MATRIX_LEVEL := $(PRODUCT_SHIPPING_API_LEVEL)
-else
- PRODUCT_COMPATIBILITY_MATRIX_LEVEL := $(PLATFORM_SDK_VERSION)
-endif
-
-ifeq ($(strip $(PRODUCT_COMPATIBILITY_MATRIX_LEVEL)),legacy)
- FRAMEWORK_COMPATIBILITY_MATRIX_FILE := hardware/interfaces/compatibility_matrix.legacy.xml
-else ifeq ($(call math_gt_or_eq,$(PRODUCT_COMPATIBILITY_MATRIX_LEVEL),26),)
- # All PRODUCT_FULL_TREBLE devices with shipping API levels < 26 get the level 26 manifest
- # as that is the first.
- FRAMEWORK_COMPATIBILITY_MATRIX_FILE := hardware/interfaces/compatibility_matrix.26.xml
-else ifeq ($(call math_gt_or_eq,$(PRODUCT_COMPATIBILITY_MATRIX_LEVEL),28),)
- # All shipping API levels with released compatibility matrices get the corresponding matrix.
- FRAMEWORK_COMPATIBILITY_MATRIX_FILE := \
- hardware/interfaces/compatibility_matrix.$(PRODUCT_COMPATIBILITY_MATRIX_LEVEL).xml
+BUILD_NUMBER_FROM_FILE := $$(cat $(OUT_DIR)/build_number.txt)
+BUILD_DATETIME_FROM_FILE := $$(cat $(BUILD_DATETIME_FILE))
+
+# SEPolicy versions
+
+# PLATFORM_SEPOLICY_VERSION is a number of the form "NN.m" with "NN" mapping to
+# PLATFORM_SDK_VERSION and "m" as a minor number which allows for SELinux
+# changes independent of PLATFORM_SDK_VERSION. This value will be set to
+# 10000.0 to represent tip-of-tree development that is inherently unstable and
+# thus designed not to work with any shipping vendor policy. This is similar in
+# spirit to how DEFAULT_APP_TARGET_SDK is set.
+# The minor version ('m' component) must be updated every time a platform release
+# is made which breaks compatibility with the previous platform sepolicy version,
+# not just on every increase in PLATFORM_SDK_VERSION. The minor version should
+# be reset to 0 on every bump of the PLATFORM_SDK_VERSION.
+sepolicy_major_vers := 28
+sepolicy_minor_vers := 0
+
+ifneq ($(sepolicy_major_vers), $(PLATFORM_SDK_VERSION))
+$(error sepolicy_major_version does not match PLATFORM_SDK_VERSION, please update.)
+endif
+
+TOT_SEPOLICY_VERSION := 10000.0
+ifneq (REL,$(PLATFORM_VERSION_CODENAME))
+ PLATFORM_SEPOLICY_VERSION := $(TOT_SEPOLICY_VERSION)
else
- FRAMEWORK_COMPATIBILITY_MATRIX_FILE := hardware/interfaces/compatibility_matrix.current.xml
+ PLATFORM_SEPOLICY_VERSION := $(join $(addsuffix .,$(sepolicy_major_vers)), $(sepolicy_minor_vers))
endif
+sepolicy_major_vers :=
+sepolicy_minor_vers :=
+
+# A list of SEPolicy versions, besides PLATFORM_SEPOLICY_VERSION, that the framework supports.
+PLATFORM_SEPOLICY_COMPAT_VERSIONS := \
+ 26.0 \
+ 27.0
+
+.KATI_READONLY := \
+ PLATFORM_SEPOLICY_COMPAT_VERSIONS \
+ PLATFORM_SEPOLICY_VERSION \
+ TOT_SEPOLICY_VERSION \
# ###############################################################
# Set up final options.
@@ -818,12 +962,6 @@ $(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT := $(call first_non_empt
$(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := default
endif
-# These will come from Soong, drop the environment versions
-unexport CLANG
-unexport CLANG_CXX
-unexport CCC_CC
-unexport CCC_CXX
-
# ###############################################################
# Collect a list of the SDK versions that we could compile against
# For use with the LOCAL_SDK_VERSION variable for include $(BUILD_PACKAGE)
@@ -859,18 +997,40 @@ TARGET_AVAILABLE_SDK_VERSIONS := $(call numerically_sort,\
$(patsubst $(HISTORICAL_SDK_VERSIONS_ROOT)/%/android.jar,%, \
$(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/*/android.jar)))
-# We don't have prebuilt test_current SDK yet.
-TARGET_AVAILABLE_SDK_VERSIONS := test_current $(TARGET_AVAILABLE_SDK_VERSIONS)
+TARGET_AVAILABLE_SDK_VERSIONS := $(addprefix system_,$(call numerically_sort,\
+ $(patsubst $(HISTORICAL_SDK_VERSIONS_ROOT)/%/android_system.jar,%, \
+ $(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/*/android_system.jar)))) \
+ $(TARGET_AVAILABLE_SDK_VERSIONS)
+
+# We don't have prebuilt test_current and core_current SDK yet.
+TARGET_AVAILABLE_SDK_VERSIONS := test_current core_current $(TARGET_AVAILABLE_SDK_VERSIONS)
+
+TARGET_SDK_VERSIONS_WITHOUT_JAVA_18_SUPPORT := $(call numbers_less_than,24,$(TARGET_AVAILABLE_SDK_VERSIONS))
+TARGET_SDK_VERSIONS_WITHOUT_JAVA_19_SUPPORT := $(call numbers_less_than,27,$(TARGET_AVAILABLE_SDK_VERSIONS))
INTERNAL_PLATFORM_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/public_api.txt
+INTERNAL_PLATFORM_DEX_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/public-dex.txt
+INTERNAL_PLATFORM_PRIVATE_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/private.txt
+INTERNAL_PLATFORM_PRIVATE_DEX_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/private-dex.txt
INTERNAL_PLATFORM_REMOVED_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/removed.txt
+INTERNAL_PLATFORM_REMOVED_DEX_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/removed-dex.txt
INTERNAL_PLATFORM_SYSTEM_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/system-api.txt
+INTERNAL_PLATFORM_SYSTEM_PRIVATE_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/system-private.txt
+INTERNAL_PLATFORM_SYSTEM_PRIVATE_DEX_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/system-private-dex.txt
INTERNAL_PLATFORM_SYSTEM_REMOVED_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/system-removed.txt
INTERNAL_PLATFORM_SYSTEM_EXACT_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/system-exact.txt
INTERNAL_PLATFORM_TEST_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/test-api.txt
INTERNAL_PLATFORM_TEST_REMOVED_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/test-removed.txt
INTERNAL_PLATFORM_TEST_EXACT_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/test-exact.txt
+INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-light-greylist.txt
+INTERNAL_PLATFORM_HIDDENAPI_DARK_GREYLIST := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-dark-greylist.txt
+INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-blacklist.txt
+
+# Missing optional uses-libraries so that the platform doesn't create build rules that depend on
+# them. See setup_one_odex.mk.
+INTERNAL_PLATFORM_MISSING_USES_LIBRARIES := com.google.android.ble com.google.android.wearable
+
# This is the standard way to name a directory containing prebuilt target
# objects. E.g., prebuilt/$(TARGET_PREBUILT_TAG)/libc.so
TARGET_PREBUILT_TAG := android-$(TARGET_ARCH)
@@ -882,57 +1042,23 @@ endif
RS_PREBUILT_CLCORE := prebuilts/sdk/renderscript/lib/$(TARGET_ARCH)/librsrt_$(TARGET_ARCH).bc
RS_PREBUILT_COMPILER_RT := prebuilts/sdk/renderscript/lib/$(TARGET_ARCH)/libcompiler_rt.a
-ifeq (true,$(TARGET_IS_64_BIT))
-RS_PREBUILT_LIBPATH := -L prebuilts/ndk/r10/platforms/android-21/arch-$(TARGET_ARCH)/usr/lib64 \
- -L prebuilts/ndk/r10/platforms/android-21/arch-$(TARGET_ARCH)/usr/lib
-else
-RS_PREBUILT_LIBPATH := -L prebuilts/ndk/r10/platforms/android-9/arch-$(TARGET_ARCH)/usr/lib
-endif
# API Level lists for Renderscript Compat lib.
RSCOMPAT_32BIT_ONLY_API_LEVELS := 8 9 10 11 12 13 14 15 16 17 18 19 20
RSCOMPAT_NO_USAGEIO_API_LEVELS := 8 9 10 11 12 13
-ifeq ($(JAVA_NOT_REQUIRED),true)
-# Remove java and tools from our path so that we make sure nobody uses them.
-unexport ANDROID_JAVA_HOME
-unexport JAVA_HOME
-export ANDROID_BUILD_PATHS:=$(abspath $(BUILD_SYSTEM)/no_java_path):$(ANDROID_BUILD_PATHS)
-export PATH:=$(abspath $(BUILD_SYSTEM)/no_java_path):$(PATH)
-endif
-
-# Projects clean of compiler warnings should be compiled with -Werror.
-# If most modules in a directory such as external/ have warnings,
-# the directory should be in ANDROID_WARNING_ALLOWED_PROJECTS list.
-# When some of its subdirectories are cleaned up, the subdirectories
-# can be added into ANDROID_WARNING_DISALLOWED_PROJECTS list, e.g.
-# external/fio/.
-ANDROID_WARNING_DISALLOWED_PROJECTS := \
- art/% \
- bionic/% \
- external/fio/% \
- hardware/interfaces/% \
-
-define find_warning_disallowed_projects
- $(filter $(ANDROID_WARNING_DISALLOWED_PROJECTS),$(1)/)
-endef
+# Add BUILD_NUMBER to apps default version name if it's unbundled build.
+ifdef TARGET_BUILD_APPS
+TARGET_BUILD_WITH_APPS_VERSION_NAME := true
+endif
-# Projects with compiler warnings are compiled without -Werror.
-ANDROID_WARNING_ALLOWED_PROJECTS := \
- bootable/% \
- cts/% \
- dalvik/% \
- development/% \
- device/% \
- external/% \
- frameworks/% \
- hardware/% \
- packages/% \
- system/% \
- test/vts/% \
- tools/adt/idea/android/ultimate/get_modification_time/jni/% \
- vendor/% \
+ifdef TARGET_BUILD_WITH_APPS_VERSION_NAME
+APPS_DEFAULT_VERSION_NAME := $(PLATFORM_VERSION)-$(BUILD_NUMBER_FROM_FILE)
+else
+APPS_DEFAULT_VERSION_NAME := $(PLATFORM_VERSION)
+endif
+# ANDROID_WARNING_ALLOWED_PROJECTS is generated by build/soong.
define find_warning_allowed_projects
$(filter $(ANDROID_WARNING_ALLOWED_PROJECTS),$(1)/)
endef
@@ -946,6 +1072,7 @@ dont_bother_goals := out \
cacheimage-nodeps \
bptimage-nodeps \
vnod vendorimage-nodeps \
+ pnod productimage-nodeps \
systemotherimage-nodeps \
ramdisk-nodeps \
bootimage-nodeps \
@@ -953,7 +1080,7 @@ dont_bother_goals := out \
vbmetaimage-nodeps \
product-graph dump-products
-ifndef KATI
+ifeq ($(CALLED_FROM_SETUP),true)
include $(BUILD_SYSTEM)/ninja_config.mk
include $(BUILD_SYSTEM)/soong_config.mk
endif
diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk
index 0d182e9..d570ccd 100644
--- a/core/config_sanitizers.mk
+++ b/core/config_sanitizers.mk
@@ -22,6 +22,30 @@ ifeq ($(my_clang),true)
endif
endif
+# Disable global integer_overflow in excluded paths.
+ifneq ($(filter integer_overflow, $(my_global_sanitize)),)
+ combined_exclude_paths := $(INTEGER_OVERFLOW_EXCLUDE_PATHS) \
+ $(PRODUCT_INTEGER_OVERFLOW_EXCLUDE_PATHS)
+
+ ifneq ($(strip $(foreach dir,$(subst $(comma),$(space),$(combined_exclude_paths)),\
+ $(filter $(dir)%,$(LOCAL_PATH)))),)
+ my_global_sanitize := $(filter-out integer_overflow,$(my_global_sanitize))
+ my_global_sanitize_diag := $(filter-out integer_overflow,$(my_global_sanitize_diag))
+ endif
+endif
+
+# Disable global CFI in excluded paths
+ifneq ($(filter cfi, $(my_global_sanitize)),)
+ combined_exclude_paths := $(CFI_EXCLUDE_PATHS) \
+ $(PRODUCT_CFI_EXCLUDE_PATHS)
+
+ ifneq ($(strip $(foreach dir,$(subst $(comma),$(space),$(combined_exclude_paths)),\
+ $(filter $(dir)%,$(LOCAL_PATH)))),)
+ my_global_sanitize := $(filter-out cfi,$(my_global_sanitize))
+ my_global_sanitize_diag := $(filter-out cfi,$(my_global_sanitize_diag))
+ endif
+endif
+
ifneq ($(my_global_sanitize),)
my_sanitize := $(my_global_sanitize) $(my_sanitize)
endif
@@ -72,6 +96,20 @@ ifeq ($(LOCAL_SANITIZE),never)
my_sanitize_diag :=
endif
+# Enable CFI in included paths (for Arm64 only).
+ifeq ($(filter cfi, $(my_sanitize)),)
+ ifneq ($(filter arm64,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)),)
+ combined_include_paths := $(CFI_INCLUDE_PATHS) \
+ $(PRODUCT_CFI_INCLUDE_PATHS)
+
+ ifneq ($(strip $(foreach dir,$(subst $(comma),$(space),$(combined_include_paths)),\
+ $(filter $(dir)%,$(LOCAL_PATH)))),)
+ my_sanitize := cfi $(my_sanitize)
+ my_sanitize_diag := cfi $(my_sanitize_diag)
+ endif
+ endif
+endif
+
# If CFI is disabled globally, remove it from my_sanitize.
ifeq ($(strip $(ENABLE_CFI)),false)
my_sanitize := $(filter-out cfi,$(my_sanitize))
@@ -96,6 +134,12 @@ ifneq ($(filter mips mips64,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)),)
my_sanitize_diag := $(filter-out cfi,$(my_sanitize_diag))
endif
+# Disable CFI for host targets
+ifdef LOCAL_IS_HOST_MODULE
+ my_sanitize := $(filter-out cfi,$(my_sanitize))
+ my_sanitize_diag := $(filter-out cfi,$(my_sanitize_diag))
+endif
+
# Support for local sanitize blacklist paths.
ifneq ($(my_sanitize)$(my_global_sanitize),)
ifneq ($(LOCAL_SANITIZE_BLACKLIST),)
@@ -103,17 +147,8 @@ ifneq ($(my_sanitize)$(my_global_sanitize),)
endif
endif
+# Disable integer_overflow if LOCAL_NOSANITIZE=integer.
ifneq ($(filter integer_overflow, $(my_global_sanitize) $(my_sanitize)),)
- # Disable integer_overflow in excluded paths.
- combined_exclude_paths := $(INTEGER_OVERFLOW_EXCLUDE_PATHS) \
- $(PRODUCT_INTEGER_OVERFLOW_EXCLUDE_PATHS)
-
- ifneq ($(strip $(foreach dir,$(subst $(comma),$(space),$(combined_exclude_paths)),\
- $(filter $(dir)%,$(LOCAL_PATH)))),)
- my_sanitize := $(filter-out integer_overflow,$(my_sanitize))
- my_sanitize_diag := $(filter-out integer_overflow,$(my_sanitize_diag))
- endif
- # Disable integer_overflow if LOCAL_NOSANITIZE=integer.
ifneq ($(filter integer, $(strip $(LOCAL_NOSANITIZE))),)
my_sanitize := $(filter-out integer_overflow,$(my_sanitize))
my_sanitize_diag := $(filter-out integer_overflow,$(my_sanitize_diag))
@@ -134,6 +169,8 @@ ifneq ($(filter thread,$(my_sanitize)),)
else
$(error $(LOCAL_PATH): $(LOCAL_MODULE): TSAN cannot be used for 32-bit modules.)
endif
+ else
+ my_shared_libraries += $(TSAN_RUNTIME_LIBRARY)
endif
endif
@@ -172,7 +209,7 @@ ifneq ($(filter coverage,$(my_sanitize)),)
ifeq ($(filter address,$(my_sanitize)),)
$(error $(LOCAL_PATH): $(LOCAL_MODULE): Use of 'coverage' also requires 'address')
endif
- my_cflags += -fsanitize-coverage=trace-pc-guard
+ my_cflags += -fsanitize-coverage=trace-pc-guard,indirect-calls,trace-cmp
my_sanitize := $(filter-out coverage,$(my_sanitize))
endif
@@ -182,19 +219,17 @@ ifneq ($(filter integer_overflow,$(my_sanitize)),)
# Respect LOCAL_NOSANITIZE for integer-overflow flags.
ifeq ($(filter signed-integer-overflow, $(strip $(LOCAL_NOSANITIZE))),)
- my_cflags += -fsanitize=signed-integer-overflow
+ my_sanitize += signed-integer-overflow
endif
ifeq ($(filter unsigned-integer-overflow, $(strip $(LOCAL_NOSANITIZE))),)
- my_cflags += -fsanitize=unsigned-integer-overflow
+ my_sanitize += unsigned-integer-overflow
endif
- my_cflags += -fsanitize-trap=all
- my_cflags += -ftrap-function=abort
my_cflags += $(INTEGER_OVERFLOW_EXTRA_CFLAGS)
# Check for diagnostics mode (on by default).
ifneq ($(filter integer_overflow,$(my_sanitize_diag)),)
- my_cflags += -fno-sanitize-trap=signed-integer-overflow,unsigned-integer-overflow
- my_shared_libraries := $($(LOCAL_2ND_ARCH_VAR_PREFIX)UBSAN_RUNTIME_LIBRARY) $(my_shared_libraries)
+ my_sanitize_diag += signed-integer-overflow
+ my_sanitize_diag += unsigned-integer-overflow
endif
endif
endif
@@ -214,7 +249,6 @@ ifneq ($(my_sanitize),)
ifdef LOCAL_IS_HOST_MODULE
my_cflags += -fno-sanitize-recover=all
my_ldflags += -fsanitize=$(fsanitize_arg)
- my_ldlibs += -lrt -ldl
else
my_cflags += -fsanitize-trap=all
my_cflags += -ftrap-function=abort
@@ -231,12 +265,21 @@ ifneq ($(filter cfi,$(my_sanitize)),)
# entire module.
LOCAL_ARM_MODE := thumb
my_cflags += $(CFI_EXTRA_CFLAGS)
+ # Only append the default visibility flag if -fvisibility has not already been
+ # set to hidden.
+ ifeq ($(filter -fvisibility=hidden,$(LOCAL_CFLAGS)),)
+ my_cflags += -fvisibility=default
+ endif
my_ldflags += $(CFI_EXTRA_LDFLAGS)
my_arflags += --plugin $(LLVM_PREBUILTS_PATH)/../lib64/LLVMgold.so
- # Workaround for b/33678192. CFI jumptables need Thumb2 codegen. Revert when
- # Clang is updated past r290384.
- ifneq ($(filter arm,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)),)
- my_ldflags += -march=armv7-a
+
+ ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
+ my_ldflags := $(filter-out -fsanitize-cfi-cross-dso,$(my_ldflags))
+ my_cflags := $(filter-out -fsanitize-cfi-cross-dso,$(my_cflags))
+ else
+ # Apply the version script to non-static executables
+ my_ldflags += -Wl,--version-script,build/soong/cc/config/cfi_exports.map
+ LOCAL_ADDITIONAL_DEPENDENCIES += build/soong/cc/config/cfi_exports.map
endif
endif
@@ -246,7 +289,6 @@ ifneq ($(filter address,$(my_global_sanitize) $(my_sanitize)),)
ifdef LOCAL_IS_HOST_MODULE
# -nodefaultlibs (provided with libc++) prevents the driver from linking
# libraries needed with -fsanitize=address. http://b/18650275 (WAI)
- my_ldlibs += -lm -lpthread
my_ldflags += -Wl,--no-as-needed
else
# Add asan libraries unless LOCAL_MODULE is the asan library.
@@ -284,9 +326,25 @@ ifneq ($(filter address,$(my_sanitize)),)
endif
endif
-ifneq ($(filter undefined,$(my_sanitize)),)
- ifndef LOCAL_IS_HOST_MODULE
- $(error ubsan is not yet supported on the target)
+# Use minimal diagnostics when integer overflow is enabled; never do it for HOST or AUX modules
+ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_IS_AUX_MODULE),)
+ # Pre-emptively add UBSAN minimal runtime incase a static library dependency requires it
+ ifeq ($(filter STATIC_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
+ ifndef LOCAL_SDK_VERSION
+ my_static_libraries += $($(LOCAL_2ND_ARCH_VAR_PREFIX)UBSAN_MINIMAL_RUNTIME_LIBRARY)
+ my_ldflags += -Wl,--exclude-libs,$($(LOCAL_2ND_ARCH_VAR_PREFIX)UBSAN_MINIMAL_RUNTIME_LIBRARY).a
+ endif
+ endif
+ ifneq ($(filter unsigned-integer-overflow signed-integer-overflow integer,$(my_sanitize)),)
+ ifeq ($(filter unsigned-integer-overflow signed-integer overflow integer,$(my_sanitize_diag)),)
+ ifeq ($(filter cfi,$(my_sanitize_diag)),)
+ ifeq ($(filter address,$(my_sanitize)),)
+ my_cflags += -fsanitize-minimal-runtime
+ my_cflags += -fno-sanitize-trap=integer
+ my_cflags += -fno-sanitize-recover=integer
+ endif
+ endif
+ endif
endif
endif
@@ -296,11 +354,16 @@ ifneq ($(strip $(LOCAL_SANITIZE_RECOVER)),)
endif
ifneq ($(my_sanitize_diag),)
- notrap_arg := $(subst $(space),$(comma),$(my_sanitize_diag)),
- my_cflags += -fno-sanitize-trap=$(notrap_arg)
- # Diagnostic requires a runtime library, unless ASan or TSan are also enabled.
- ifeq ($(filter address thread,$(my_sanitize)),)
- # Does not have to be the first DT_NEEDED unlike ASan.
- my_shared_libraries += $($(LOCAL_2ND_ARCH_VAR_PREFIX)UBSAN_RUNTIME_LIBRARY)
+ # TODO(vishwath): Add diagnostic support for static executables once
+ # we switch to clang-4393122 (which adds the static ubsan runtime
+ # that this depends on)
+ ifneq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
+ notrap_arg := $(subst $(space),$(comma),$(my_sanitize_diag)),
+ my_cflags += -fno-sanitize-trap=$(notrap_arg)
+ # Diagnostic requires a runtime library, unless ASan or TSan are also enabled.
+ ifeq ($(filter address thread,$(my_sanitize)),)
+ # Does not have to be the first DT_NEEDED unlike ASan.
+ my_shared_libraries += $($(LOCAL_2ND_ARCH_VAR_PREFIX)UBSAN_RUNTIME_LIBRARY)
+ endif
endif
endif
diff --git a/core/configure_local_jack.mk b/core/configure_local_jack.mk
deleted file mode 100644
index f8049a3..0000000
--- a/core/configure_local_jack.mk
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# Copyright (C) 2008 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-ifdef ANDROID_FORCE_JACK_ENABLED
-LOCAL_JACK_ENABLED := $(ANDROID_FORCE_JACK_ENABLED)
-endif
-
-ifneq ($(ANDROID_COMPILE_WITH_JACK),true)
-LOCAL_JACK_ENABLED :=
-endif
-
-LOCAL_JACK_ENABLED := $(strip $(LOCAL_JACK_ENABLED))
-LOCAL_MODULE := $(strip $(LOCAL_MODULE))
-
-valid_jack_enabled_values := full incremental javac_frontend disabled
-
-ifdef LOCAL_JACK_ENABLED
- ifneq ($(LOCAL_JACK_ENABLED),$(filter $(firstword $(LOCAL_JACK_ENABLED)),$(valid_jack_enabled_values)))
- $(error $(LOCAL_PATH): invalid LOCAL_JACK_ENABLED "$(LOCAL_JACK_ENABLED)" for $(LOCAL_MODULE))
- endif
-
- ifeq ($(LOCAL_JACK_ENABLED),disabled)
- LOCAL_JACK_ENABLED :=
- endif
-endif
-
-ifdef $(LOCAL_MODULE).JACK_VERSION
-LOCAL_JACK_VERSION := $($(LOCAL_MODULE).JACK_VERSION)
-else
-LOCAL_JACK_VERSION := $(JACK_DEFAULT_VERSION)
-endif
diff --git a/core/construct_context.sh b/core/construct_context.sh
new file mode 100755
index 0000000..b4ae519
--- /dev/null
+++ b/core/construct_context.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+#
+# Copyright (C) 2018 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -e
+
+# inputs:
+# $1 is PRIVATE_CONDITIONAL_USES_LIBRARIES_HOST
+# $2 is PRIVATE_CONDITIONAL_USES_LIBRARIES_TARGET
+
+# class_loader_context: library paths on the host
+# stored_class_loader_context_libs: library paths on device
+# these are both comma separated paths, example: lib1.jar:lib2.jar or /system/framework/lib1.jar:/system/framework/lib2.jar
+
+# target_sdk_version: parsed from manifest
+# my_conditional_host_libs: libraries conditionally added for non P
+# my_conditional_target_libs: target libraries conditionally added for non P
+#
+# outputs
+# class_loader_context_arg: final class loader conext arg
+# stored_class_loader_context_arg: final stored class loader context arg
+
+my_conditional_host_libs=$1
+my_conditional_target_libs=$2
+
+# Note that SDK 28 is P.
+if [[ "${target_sdk_version}" -lt "28" ]]; then
+ if [[ -z "${class_loader_context}" ]]; then
+ export class_loader_context="${my_conditional_host_libs}"
+ else
+ export class_loader_context="${my_conditional_host_libs}:${class_loader_context}"
+ fi
+ if [[ -z "${stored_class_loader_context_libs}" ]]; then
+ export stored_class_loader_context_libs="${my_conditional_target_libs}";
+ else
+ export stored_class_loader_context_libs="${my_conditional_target_libs}:${stored_class_loader_context_libs}";
+ fi
+fi
+
+# Generate the actual context string.
+export class_loader_context_arg="--class-loader-context=PCL[${class_loader_context}]"
+export stored_class_loader_context_arg="--stored-class-loader-context=PCL[${stored_class_loader_context_libs}]"
diff --git a/core/cxx_stl_setup.mk b/core/cxx_stl_setup.mk
index 0baec26..5171b8a 100644
--- a/core/cxx_stl_setup.mk
+++ b/core/cxx_stl_setup.mk
@@ -74,6 +74,16 @@ my_cxx_ldlibs :=
ifneq ($(filter $(my_cxx_stl),libc++ libc++_static),)
my_cflags += -D_USING_LIBCXX
+ ifeq ($($(my_prefix)OS),darwin)
+ # libc++'s headers are annotated with availability macros that indicate
+ # which version of Mac OS was the first to ship with a libc++ feature
+ # available in its *system's* libc++.dylib. We do not use the system's
+ # library, but rather ship our own. As such, these availability
+ # attributes are meaningless for us but cause build breaks when we try
+ # to use code that would not be available in the system's dylib.
+ my_cppflags += -D_LIBCPP_DISABLE_AVAILABILITY
+ endif
+
# Note that the structure of this means that LOCAL_CXX_STL := libc++ will
# use the static libc++ for static executables.
ifeq ($(my_link_type),dynamic)
@@ -89,7 +99,6 @@ ifneq ($(filter $(my_cxx_stl),libc++ libc++_static),)
ifdef LOCAL_IS_HOST_MODULE
my_cppflags += -nostdinc++
my_ldflags += -nodefaultlibs
- my_ldlibs += -lpthread -lm
my_cxx_ldlibs += $($($(my_prefix)OS)_$(my_link_type)_gcclibs)
else
ifeq (arm,$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
diff --git a/core/definitions.mk b/core/definitions.mk
index 95e9a02..599ab49 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -167,7 +167,7 @@ endef
# $(1): directory to search under
# Ignores $(1)/Android.mk
define first-makefiles-under
-$(shell build/tools/findleaves.py $(FIND_LEAVES_EXCLUDES) \
+$(shell build/make/tools/findleaves.py $(FIND_LEAVES_EXCLUDES) \
--mindepth=2 $(addprefix --dir=,$(1)) Android.mk)
endef
@@ -671,26 +671,27 @@ endef
## $(2): Non-empty if IS_HOST_MODULE
###########################################################
-# $(1): library name
-# $(2): Non-empty if IS_HOST_MODULE
-define _java-lib-dir
-$(call intermediates-dir-for, \
- JAVA_LIBRARIES,$(1),$(2),COMMON)
-endef
-
-# $(1): library name
+# Get the jar files (you can pass to "javac -classpath") of static or shared
+# Java libraries that you want to link against.
+# $(1): library name list
# $(2): Non-empty if IS_HOST_MODULE
-define _java-lib-full-classes.jar
-$(call _java-lib-dir,$(1),$(2))/classes.jar
+define java-lib-files
+$(foreach lib,$(1),$(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),$(2),COMMON)/classes.jar)
endef
-# Get the jar files (you can pass to "javac -classpath") of static or shared
+# Get the header jar files (you can pass to "javac -classpath") of static or shared
# Java libraries that you want to link against.
# $(1): library name list
# $(2): Non-empty if IS_HOST_MODULE
-define java-lib-files
-$(foreach lib,$(1),$(call _java-lib-full-classes.jar,$(lib),$(2)))
+ifneq ($(TURBINE_ENABLED),false)
+define java-lib-header-files
+$(foreach lib,$(1),$(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),$(2),COMMON)/classes-header.jar)
+endef
+else
+define java-lib-header-files
+$(call java-lib-files,$(1),$(2))
endef
+endif
# Get the dependency files (you can put on the right side of "|" of a build rule)
# of the Java libraries.
@@ -704,24 +705,25 @@ define java-lib-deps
$(call java-lib-files,$(1),$(2))
endef
-
-###########################################################
-## Convert "core ext framework" to "out/.../classes.jack ..."
-## $(1): library list
-## $(2): Non-empty if IS_HOST_MODULE
-###########################################################
-
-# $(1): library name
-# $(2): Non-empty if IS_HOST_MODULE
-define _jack-lib-full-classes
-$(call _java-lib-dir,$(1),$(2))/classes.jack
+# Get the jar files (you can pass to "javac -classpath") of static or shared
+# APK libraries that you want to link against.
+# $(1): library name list
+define app-lib-files
+$(foreach lib,$(1),$(call intermediates-dir-for,APPS,$(lib),,COMMON)/classes.jar)
endef
+# Get the header jar files (you can pass to "javac -classpath") of static or shared
+# APK libraries that you want to link against.
# $(1): library name list
-# $(2): Non-empty if IS_HOST_MODULE
-define jack-lib-files
-$(foreach lib,$(1),$(call _jack-lib-full-classes,$(lib),$(2)))
+ifneq ($(TURBINE_ENABLED),false)
+define app-lib-header-files
+$(foreach lib,$(1),$(call intermediates-dir-for,APPS,$(lib),,COMMON)/classes-header.jar)
endef
+else
+define app-lib-header-files
+$(call app-lib-files,$(1))
+endef
+endif
###########################################################
## Returns true if $(1) and $(2) are equal. Returns
@@ -1034,9 +1036,9 @@ $(hide) $(RS_CC_ASAN_OPTIONS) $(PRIVATE_RS_CC) \
$(PRIVATE_RS_FLAGS) \
$(foreach inc,$(PRIVATE_RS_INCLUDES),$(addprefix -I , $(inc))) \
$(PRIVATE_RS_SOURCE_FILES)
+$(SOONG_ZIP) -o $@ -C $(PRIVATE_RS_OUTPUT_DIR)/src -D $(PRIVATE_RS_OUTPUT_DIR)/src
+$(SOONG_ZIP) -o $(PRIVATE_RS_OUTPUT_RES_ZIP) -C $(PRIVATE_RS_OUTPUT_DIR)/res -D $(PRIVATE_RS_OUTPUT_DIR)/res
$(call _merge-renderscript-d,$(PRIVATE_DEP_FILES),$@.d)
-$(hide) mkdir -p $(dir $@)
-$(hide) touch $@
endef
define transform-bc-to-so
@@ -1048,8 +1050,9 @@ $(hide) $(PRIVATE_CXX) -shared -Wl,-soname,$(notdir $@) -nostdlib \
-Wl,-rpath,\$$ORIGIN/../lib \
$(dir $@)/$(notdir $(<:.bc=.o)) \
$(RS_PREBUILT_COMPILER_RT) \
- -o $@ $(TARGET_GLOBAL_LDFLAGS) -Wl,--hash-style=sysv -L prebuilts/gcc/ \
- $(RS_PREBUILT_LIBPATH) \
+ -o $@ $(TARGET_GLOBAL_LDFLAGS) -Wl,--hash-style=sysv \
+ -L $(SOONG_OUT_DIR)/ndk/platforms/android-$(PRIVATE_SDK_VERSION)/arch-$(TARGET_ARCH)/usr/lib64 \
+ -L $(SOONG_OUT_DIR)/ndk/platforms/android-$(PRIVATE_SDK_VERSION)/arch-$(TARGET_ARCH)/usr/lib \
$(call intermediates-dir-for,SHARED_LIBRARIES,libRSSupport)/libRSSupport.so \
-lm -lc
endef
@@ -1553,7 +1556,7 @@ $(hide) ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(1)))_objs;
filelist="$$filelist $$ldir/$$ext$$f"; \
done ; \
$($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_AR) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_ARFLAGS) \
- $(2) $$filelist
+ $(PRIVATE_ARFLAGS) $(2) $$filelist
endef
@@ -1720,6 +1723,10 @@ define delete-dummy.o-if-no-objs
$(if $(PRIVATE_ALL_OBJECTS),,$(hide) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)AR) d $(1) $(dir $(1))dummy.o \
&& rm -f $(dir $(1))dummy.o)
endef
+else
+create-dummy.o-if-no-objs =
+get-dummy.o-if-no-objs =
+delete-dummy.o-if-no-objs =
endif # HOST_OS is darwin
# Explicitly delete the archive first so that ar doesn't
@@ -1842,6 +1849,7 @@ if $(PRIVATE_STRIP) --strip-all -R .comment $< -o $@; then \
$(PRIVATE_NM) -D $< --format=posix --defined-only | awk '{ print $$1 }' | sort >$@.dynsyms && \
$(PRIVATE_NM) $< --format=posix --defined-only | awk '{ if ($$2 == "T" || $$2 == "t" || $$2 == "D") print $$1 }' | sort >$@.funcsyms && \
comm -13 $@.dynsyms $@.funcsyms >$@.keep_symbols && \
+ echo >>$@.keep_symbols && \
$(PRIVATE_OBJCOPY) --rename-section .debug_frame=saved_debug_frame $@.debug $@.mini_debuginfo && \
$(PRIVATE_OBJCOPY) -S --remove-section .gdb_index --remove-section .comment --keep-symbols=$@.keep_symbols $@.mini_debuginfo && \
$(PRIVATE_OBJCOPY) --rename-section saved_debug_frame=.debug_frame $@.mini_debuginfo && \
@@ -1999,17 +2007,6 @@ endef
## Commands for running javac to make .class files
###########################################################
-# Add BUILD_NUMBER to apps default version name if it's unbundled build.
-ifdef TARGET_BUILD_APPS
-TARGET_BUILD_WITH_APPS_VERSION_NAME := true
-endif
-
-ifdef TARGET_BUILD_WITH_APPS_VERSION_NAME
-APPS_DEFAULT_VERSION_NAME := $(PLATFORM_VERSION)-$(BUILD_NUMBER_FROM_FILE)
-else
-APPS_DEFAULT_VERSION_NAME := $(PLATFORM_VERSION)
-endif
-
# b/37750224
AAPT_ASAN_OPTIONS := ASAN_OPTIONS=detect_leaks=0
@@ -2025,11 +2022,12 @@ AAPT_ASAN_OPTIONS := ASAN_OPTIONS=detect_leaks=0
# This rule creates the R.java and Manifest.java files, both of which
# are PRODUCT-neutral. Don't pass PRIVATE_PRODUCT_AAPT_CONFIG to this invocation.
define create-resource-java-files
-@mkdir -p $(PRIVATE_SOURCE_INTERMEDIATES_DIR)
@mkdir -p $(dir $(PRIVATE_RESOURCE_PUBLICS_OUTPUT))
+rm -rf $(PRIVATE_JAVA_GEN_DIR)
+mkdir -p $(PRIVATE_JAVA_GEN_DIR)
$(hide) $(AAPT_ASAN_OPTIONS) $(AAPT) package $(PRIVATE_AAPT_FLAGS) -m \
$(eval # PRIVATE_PRODUCT_AAPT_CONFIG is intentionally missing-- see comment.) \
- $(addprefix -J , $(PRIVATE_SOURCE_INTERMEDIATES_DIR)) \
+ $(addprefix -J , $(PRIVATE_JAVA_GEN_DIR)) \
$(addprefix -M , $(PRIVATE_ANDROID_MANIFEST)) \
$(addprefix -P , $(PRIVATE_RESOURCE_PUBLICS_OUTPUT)) \
$(addprefix -S , $(PRIVATE_RESOURCE_DIR)) \
@@ -2043,28 +2041,31 @@ $(hide) $(AAPT_ASAN_OPTIONS) $(AAPT) package $(PRIVATE_AAPT_FLAGS) -m \
$(addprefix --rename-manifest-package , $(PRIVATE_MANIFEST_PACKAGE_NAME)) \
$(addprefix --rename-instrumentation-target-package , $(PRIVATE_MANIFEST_INSTRUMENTATION_FOR)) \
--skip-symbols-without-default-localization
+$(SOONG_ZIP) -o $(PRIVATE_SRCJAR) -C $(PRIVATE_JAVA_GEN_DIR) -D $(PRIVATE_JAVA_GEN_DIR)
+# So that we re-run aapt when the list of input files change
+$(hide) echo $(PRIVATE_RESOURCE_LIST) >/dev/null
endef
-# Search for generated R.java/Manifest.java, copy the found R.java as $@.
+# Search for generated R.java/Manifest.java in $1, copy the found R.java as $2.
# Also copy them to a central 'R' directory to make it easier to add the files to an IDE.
define find-generated-R.java
-$(hide) for GENERATED_MANIFEST_FILE in `find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) \
+$(hide) for GENERATED_MANIFEST_FILE in `find $(1) \
-name Manifest.java 2> /dev/null`; do \
dir=`awk '/package/{gsub(/\./,"/",$$2);gsub(/;/,"",$$2);print $$2;exit}' $$GENERATED_MANIFEST_FILE`; \
mkdir -p $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
$(ACP) -fp $$GENERATED_MANIFEST_FILE $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
done;
-$(hide) for GENERATED_R_FILE in `find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) \
+$(hide) for GENERATED_R_FILE in `find $(1) \
-name R.java 2> /dev/null`; do \
dir=`awk '/package/{gsub(/\./,"/",$$2);gsub(/;/,"",$$2);print $$2;exit}' $$GENERATED_R_FILE`; \
mkdir -p $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
$(ACP) -fp $$GENERATED_R_FILE $(TARGET_COMMON_OUT_ROOT)/R/$$dir \
|| exit 31; \
- $(ACP) -fp $$GENERATED_R_FILE $@ || exit 32; \
+ $(ACP) -fp $$GENERATED_R_FILE $(2) || exit 32; \
done;
@# Ensure that the target file is always created, i.e. also in case we did not
@# enter the GENERATED_R_FILE-loop above. This avoids unnecessary rebuilding.
-$(hide) touch $@
+$(hide) touch $(2)
endef
###########################################################
@@ -2081,6 +2082,13 @@ $(hide) $(AAPT2) compile -o $@ $(addprefix --dir ,$(PRIVATE_SOURCE_RES_DIRS)) \
$(PRIVATE_AAPT2_CFLAGS) --legacy
endef
+# TODO(b/74574557): use aapt2 compile --zip if it gets implemented
+define aapt2-compile-resource-zips
+@mkdir -p $(dir $@)
+$(ZIPSYNC) -d $@.contents -l $@.list $(PRIVATE_SOURCE_RES_ZIPS)
+$(hide) $(AAPT2) compile -o $@ --dir $@.contents $(PRIVATE_AAPT2_CFLAGS) --legacy
+endef
+
# Set up rule to compile one resource file with aapt2.
# Must be called with $(eval).
# $(1): the source file
@@ -2105,15 +2113,18 @@ endef
define aapt2-link
@mkdir -p $(dir $@)
+rm -rf $(PRIVATE_JAVA_GEN_DIR)
+mkdir -p $(PRIVATE_JAVA_GEN_DIR)
$(call dump-words-to-file,$(PRIVATE_RES_FLAT),$(dir $@)aapt2-flat-list)
$(call dump-words-to-file,$(PRIVATE_OVERLAY_FLAT),$(dir $@)aapt2-flat-overlay-list)
$(hide) $(AAPT2) link -o $@ \
$(PRIVATE_AAPT_FLAGS) \
+ $(if $(PRIVATE_STATIC_LIBRARY_EXTRA_PACKAGES),$$(cat $(PRIVATE_STATIC_LIBRARY_EXTRA_PACKAGES))) \
$(addprefix --manifest ,$(PRIVATE_ANDROID_MANIFEST)) \
$(addprefix -I ,$(PRIVATE_AAPT_INCLUDES)) \
$(addprefix -I ,$(PRIVATE_SHARED_ANDROID_LIBRARIES)) \
$(addprefix -A ,$(PRIVATE_ASSET_DIR)) \
- $(addprefix --java ,$(PRIVATE_SOURCE_INTERMEDIATES_DIR)) \
+ $(addprefix --java ,$(PRIVATE_JAVA_GEN_DIR)) \
$(addprefix --proguard ,$(PRIVATE_PROGUARD_OPTIONS_FILE)) \
$(addprefix --min-sdk-version ,$(PRIVATE_DEFAULT_APP_TARGET_SDK)) \
$(addprefix --target-sdk-version ,$(PRIVATE_DEFAULT_APP_TARGET_SDK)) \
@@ -2126,6 +2137,8 @@ $(hide) $(AAPT2) link -o $@ \
$(addprefix --rename-instrumentation-target-package ,$(PRIVATE_MANIFEST_INSTRUMENTATION_FOR)) \
-R \@$(dir $@)aapt2-flat-overlay-list \
\@$(dir $@)aapt2-flat-list
+$(SOONG_ZIP) -o $(PRIVATE_SRCJAR) -C $(PRIVATE_JAVA_GEN_DIR) -D $(PRIVATE_JAVA_GEN_DIR)
+$(EXTRACT_JAR_PACKAGES) -i $(PRIVATE_SRCJAR) -o $(PRIVATE_AAPT_EXTRA_PACKAGES) --prefix '--extra-packages '
endef
###########################################################
@@ -2184,58 +2197,79 @@ define unzip-jar-files
exit 1; \
fi; \
unzip -qo $$f -d $(2); \
+ rm -f $(2)/module-info.class; \
done
$(if $(PRIVATE_DONT_DELETE_JAR_META_INF),,$(hide) rm -rf $(2)/META-INF)
endef
-# Call jack
+# Return jar arguments to compress files in a given directory
+# $(1): directory
#
-define call-jack
- JACK_VERSION=$(PRIVATE_JACK_VERSION) $(JACK) $(DEFAULT_JACK_EXTRA_ARGS)
+# Returns an @-file argument that contains the output of a subshell
+# that looks like -C $(1) path/to/file1 -C $(1) path/to/file2
+# Also adds "-C out/empty ." which avoids errors in jar when
+# there are no files in the directory.
+define jar-args-sorted-files-in-directory
+ @<(find $(1) -type f | sort | $(JAR_ARGS) $(1); echo "-C $(EMPTY_DIRECTORY) .")
+endef
+
+# append additional Java sources(resources/Proto sources, and etc) to $(1).
+define fetch-additional-java-source
+$(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \
+ find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' -and -not -name '.*' >> $(1); \
+fi
+$(if $(PRIVATE_HAS_PROTO_SOURCES), \
+ $(hide) find $(PRIVATE_PROTO_SOURCE_INTERMEDIATES_DIR) -name '*.java' -and -not -name '.*' >> $(1))
endef
-# Common definition to invoke javac on the host and target.
-#
# Some historical notes:
# - below we write the list of java files to java-source-list to avoid argument
# list length problems with Cygwin
# - we filter out duplicate java file names because eclipse's compiler
# doesn't like them.
+define write-java-source-list
+@echo "$($(PRIVATE_PREFIX)DISPLAY) Java source list: $(PRIVATE_MODULE)"
+$(hide) rm -f $@
+$(call dump-words-to-file,$(sort $(PRIVATE_JAVA_SOURCES)),$@.tmp)
+$(call fetch-additional-java-source,$@.tmp)
+$(hide) tr ' ' '\n' < $@.tmp | $(NORMALIZE_PATH) | sort -u > $@
+endef
+
+# Common definition to invoke javac on the host and target.
#
# $(1): javac
-# $(2): bootclasspath
+# $(2): classpath_libs
define compile-java
$(hide) rm -f $@
$(hide) rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR) $(PRIVATE_ANNO_INTERMEDIATES_DIR)
$(hide) mkdir -p $(dir $@)
$(hide) mkdir -p $(PRIVATE_CLASS_INTERMEDIATES_DIR) $(PRIVATE_ANNO_INTERMEDIATES_DIR)
-$(call unzip-jar-files,$(PRIVATE_STATIC_JAVA_LIBRARIES),$(PRIVATE_CLASS_INTERMEDIATES_DIR))
-$(call dump-words-to-file,$(PRIVATE_JAVA_SOURCES),$(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list)
-$(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \
- find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' -and -not -name '.*' >> $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list; \
-fi
-$(if $(PRIVATE_HAS_PROTO_SOURCES), \
- $(hide) find $(PRIVATE_PROTO_SOURCE_INTERMEDIATES_DIR) -name '*.java' -and -not -name '.*' >> $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list )
-$(if $(PRIVATE_HAS_RS_SOURCES), \
- $(hide) find $(PRIVATE_RS_SOURCE_INTERMEDIATES_DIR) -name '*.java' -and -not -name '.*' >> $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list )
-$(hide) tr ' ' '\n' < $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list \
- | $(NORMALIZE_PATH) | sort -u > $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq
-$(hide) if [ -s $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq ] ; then \
- $(SOONG_JAVAC_WRAPPER) $(1) -encoding UTF-8 \
+$(if $(PRIVATE_SRCJARS),\
+ $(ZIPSYNC) -d $(PRIVATE_SRCJAR_INTERMEDIATES_DIR) -l $(PRIVATE_SRCJAR_LIST_FILE) -f "*.java" $(PRIVATE_SRCJARS))
+$(hide) if [ -s $(PRIVATE_JAVA_SOURCE_LIST) $(if $(PRIVATE_SRCJARS),-o -s $(PRIVATE_SRCJAR_LIST_FILE) )] ; then \
+ $(SOONG_JAVAC_WRAPPER) $(JAVAC_WRAPPER) $(1) -encoding UTF-8 \
$(if $(findstring true,$(PRIVATE_WARNINGS_ENABLE)),$(xlint_unchecked),) \
- $(2) \
- $(addprefix -classpath ,$(strip \
- $(call normalize-path-list,$(PRIVATE_ALL_JAVA_LIBRARIES)))) \
+ $(if $(PRIVATE_USE_SYSTEM_MODULES), \
+ $(addprefix --system=,$(PRIVATE_SYSTEM_MODULES_DIR)), \
+ $(addprefix -bootclasspath ,$(strip \
+ $(call normalize-path-list,$(PRIVATE_BOOTCLASSPATH)) \
+ $(PRIVATE_EMPTY_BOOTCLASSPATH)))) \
+ $(if $(PRIVATE_USE_SYSTEM_MODULES), \
+ $(if $(PRIVATE_PATCH_MODULE), \
+ --patch-module=$(PRIVATE_PATCH_MODULE)=$(call normalize-path-list,. $(2)))) \
+ $(addprefix -classpath ,$(call normalize-path-list,$(strip \
+ $(if $(PRIVATE_USE_SYSTEM_MODULES), \
+ $(filter-out $(PRIVATE_SYSTEM_MODULES_LIBS),$(PRIVATE_BOOTCLASSPATH))) \
+ $(2)))) \
$(if $(findstring true,$(PRIVATE_WARNINGS_ENABLE)),$(xlint_unchecked),) \
- -extdirs "" -d $(PRIVATE_CLASS_INTERMEDIATES_DIR) -s $(PRIVATE_ANNO_INTERMEDIATES_DIR) \
+ -d $(PRIVATE_CLASS_INTERMEDIATES_DIR) -s $(PRIVATE_ANNO_INTERMEDIATES_DIR) \
$(PRIVATE_JAVACFLAGS) \
- \@$(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq \
+ \@$(PRIVATE_JAVA_SOURCE_LIST) \
+ $(if $(PRIVATE_SRCJARS),\@$(PRIVATE_SRCJAR_LIST_FILE)) \
|| ( rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR) ; exit 41 ) \
fi
-$(if $(PRIVATE_JAVA_LAYERS_FILE), $(hide) build/tools/java-layers.py \
- $(PRIVATE_JAVA_LAYERS_FILE) \@$(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq,)
-$(hide) rm -f $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list
-$(hide) rm -f $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq
+$(if $(PRIVATE_JAVA_LAYERS_FILE), $(hide) build/make/tools/java-layers.py \
+ $(PRIVATE_JAVA_LAYERS_FILE) @$(PRIVATE_JAVA_SOURCE_LIST),)
$(if $(PRIVATE_JAR_EXCLUDE_FILES), $(hide) find $(PRIVATE_CLASS_INTERMEDIATES_DIR) \
-name $(word 1, $(PRIVATE_JAR_EXCLUDE_FILES)) \
$(addprefix -o -name , $(wordlist 2, 999, $(PRIVATE_JAR_EXCLUDE_FILES))) \
@@ -2248,153 +2282,32 @@ $(if $(PRIVATE_JAR_PACKAGES), \
$(if $(PRIVATE_JAR_EXCLUDE_PACKAGES), $(hide) rm -rf \
$(foreach pkg, $(PRIVATE_JAR_EXCLUDE_PACKAGES), \
$(PRIVATE_CLASS_INTERMEDIATES_DIR)/$(subst .,/,$(pkg))))
-$(if $(PRIVATE_JAR_MANIFEST), \
- $(hide) sed -e "s/%BUILD_NUMBER%/$(BUILD_NUMBER_FROM_FILE)/" \
- $(PRIVATE_JAR_MANIFEST) > $(dir $@)/manifest.mf && \
- $(JAR) -cfm $@ $(dir $@)/manifest.mf \
- -C $(PRIVATE_CLASS_INTERMEDIATES_DIR) ., \
- $(hide) $(JAR) -cf $@ -C $(PRIVATE_CLASS_INTERMEDIATES_DIR) .)
+$(hide) $(JAR) -cf $@ $(call jar-args-sorted-files-in-directory,$(PRIVATE_CLASS_INTERMEDIATES_DIR))
$(if $(PRIVATE_EXTRA_JAR_ARGS),$(call add-java-resources-to,$@))
endef
-define transform-java-to-classes.jar
-@echo "$($(PRIVATE_PREFIX)DISPLAY) Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))"
-$(call compile-java,$(TARGET_JAVAC),$(PRIVATE_BOOTCLASSPATH))
-endef
-
-# Invoke Jack to compile java from source to dex and jack files.
-#
-# Some historical notes:
-# - below we write the list of java files to java-source-list to avoid argument
-# list length problems with Cygwin
-# - we filter out duplicate java file names because Jack doesn't like them.
-define jack-java-to-dex
-$(hide) rm -f $@
-$(hide) rm -f $(PRIVATE_CLASSES_JACK)
-$(hide) rm -rf $(PRIVATE_JACK_INTERMEDIATES_DIR)
-$(hide) mkdir -p $(dir $@)
-$(hide) mkdir -p $(dir $(PRIVATE_CLASSES_JACK))
-$(hide) mkdir -p $(PRIVATE_JACK_INTERMEDIATES_DIR)
-$(if $(PRIVATE_JACK_INCREMENTAL_DIR),$(hide) mkdir -p $(PRIVATE_JACK_INCREMENTAL_DIR))
-$(call dump-words-to-file,$(PRIVATE_JAVA_SOURCES),$(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list)
-$(if $(PRIVATE_SOURCE_INTERMEDIATES_DIR), \
- $(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \
- find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list; \
- fi)
-$(if $(PRIVATE_HAS_PROTO_SOURCES), \
- $(hide) find $(PRIVATE_PROTO_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list )
-$(if $(PRIVATE_HAS_RS_SOURCES), \
- $(hide) find $(PRIVATE_RS_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list )
-$(hide) tr ' ' '\n' < $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list \
- | $(NORMALIZE_PATH) | sort -u > $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq
-$(if $(PRIVATE_JACK_PROGUARD_FLAGS), \
- $(hide) echo -basedirectory $(CURDIR) > $@.flags; \
- echo $(PRIVATE_JACK_PROGUARD_FLAGS) >> $@.flags; \
-)
-$(if $(PRIVATE_EXTRA_JAR_ARGS),
- $(hide) mkdir -p $@.res.tmp
- $(hide) $(call create-empty-package-at,$@.res.tmp.zip)
- $(hide) $(call add-java-resources-to,$@.res.tmp.zip)
- $(hide) unzip -qo $@.res.tmp.zip -d $@.res.tmp
- $(hide) rm $@.res.tmp.zip)
-$(if $(PRIVATE_JACK_IMPORT_JAR),
- $(hide) mkdir -p $@.tmpjill.res
- $(hide) unzip -qo $(PRIVATE_JACK_IMPORT_JAR) -d $@.tmpjill.res
- $(hide) find $@.tmpjill.res -iname "*.class" -delete)
-$(hide) if [ -s $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq ] ; then \
- export tmpEcjArg="@$(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq"; \
-else \
- export tmpEcjArg=""; \
-fi; \
-$(call call-jack) \
- $(strip $(PRIVATE_JACK_FLAGS)) \
- $(strip $(PRIVATE_JACK_COVERAGE_OPTIONS)) \
- $(if $(NO_OPTIMIZE_DX), \
- -D jack.dex.optimize="false") \
- $(if $(PRIVATE_RMTYPEDEFS), \
- -D jack.android.remove-typedef="true") \
- $(if $(PRIVATE_JACK_IMPORT_JAR), \
- --import $(PRIVATE_JACK_IMPORT_JAR) --import-resource $@.tmpjill.res) \
+define transform-java-to-header.jar
+@echo "$($(PRIVATE_PREFIX)DISPLAY) Turbine: $(PRIVATE_MODULE)"
+@mkdir -p $(dir $@)
+@rm -rf $(dir $@)/classes-turbine
+@mkdir $(dir $@)/classes-turbine
+$(hide) if [ -s $(PRIVATE_JAVA_SOURCE_LIST) -o -n "$(PRIVATE_SRCJARS)" ] ; then \
+ $(JAVA) -jar $(TURBINE) \
+ --output $@.premerged --temp_dir $(dir $@)/classes-turbine \
+ --sources \@$(PRIVATE_JAVA_SOURCE_LIST) --source_jars $(PRIVATE_SRCJARS) \
+ --javacopts $(PRIVATE_JAVACFLAGS) $(COMMON_JDK_FLAGS) \
+ $(addprefix --bootclasspath ,$(strip \
+ $(call normalize-path-list,$(PRIVATE_BOOTCLASSPATH)) \
+ $(PRIVATE_EMPTY_BOOTCLASSPATH))) \
$(addprefix --classpath ,$(strip \
- $(call normalize-path-list,$(PRIVATE_JACK_SHARED_LIBRARIES)))) \
- $(addprefix --import ,$(call reverse-list,$(PRIVATE_STATIC_JACK_LIBRARIES))) \
- $(addprefix --pluginpath ,$(strip \
- $(call normalize-path-list,$(PRIVATE_JACK_PLUGIN_PATH)))) \
- $(if $(PRIVATE_JACK_PLUGIN),--plugin $(call normalize-comma-list,$(PRIVATE_JACK_PLUGIN))) \
- $(if $(PRIVATE_EXTRA_JAR_ARGS),--import-resource $@.res.tmp) \
- -D jack.android.min-api-level=$(PRIVATE_JACK_MIN_SDK_VERSION) \
- -D jack.import.resource.policy=keep-first \
- -D jack.import.type.policy=keep-first \
- --output-jack $(PRIVATE_CLASSES_JACK) \
- $(if $(PRIVATE_JACK_INCREMENTAL_DIR),--incremental-folder $(PRIVATE_JACK_INCREMENTAL_DIR)) \
- --output-dex $(PRIVATE_JACK_INTERMEDIATES_DIR) \
- $(addprefix --config-jarjar ,$(strip $(PRIVATE_JARJAR_RULES))) \
- $(if $(PRIVATE_JACK_PROGUARD_FLAGS),--config-proguard $@.flags) \
- $$tmpEcjArg \
- || ( rm -rf $(PRIVATE_CLASSES_JACK); exit 41 )
-$(hide) mv $(PRIVATE_JACK_INTERMEDIATES_DIR)/classes*.dex $(dir $@)
-$(hide) rm -f $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list
-$(if $(PRIVATE_EXTRA_JAR_ARGS),$(hide) rm -rf $@.res.tmp)
-$(hide) mv $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq $(PRIVATE_JACK_INTERMEDIATES_DIR).java-source-list
-$(if $(PRIVATE_JAR_PACKAGES), $(hide) echo unsupported options PRIVATE_JAR_PACKAGES in $@; exit 53)
-$(if $(PRIVATE_JAR_EXCLUDE_PACKAGES), $(hide) echo unsupported options JAR_EXCLUDE_PACKAGES in $@; exit 53)
-$(if $(PRIVATE_JAR_MANIFEST), $(hide) echo unsupported options JAR_MANIFEST in $@; exit 53)
-endef
-
-# Invoke Jack to compile java source just to check it compiles correctly.
-#
-# Some historical notes:
-# - below we write the list of java files to java-source-list to avoid argument
-# list length problems with Cygwin
-# - we filter out duplicate java file names because Jack doesn't like them.
-define jack-check-java
-$(hide) rm -f $@
-$(hide) rm -f $@.java-source-list
-$(hide) rm -f $@.java-source-list-uniq
-$(hide) mkdir -p $(dir $@)
-$(if $(PRIVATE_JACK_INCREMENTAL_DIR),$(hide) mkdir -p $(PRIVATE_JACK_INCREMENTAL_DIR))
-$(call dump-words-to-file,$(PRIVATE_JAVA_SOURCES),$@.java-source-list)
-$(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \
- find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $@.java-source-list; \
-fi
-$(if $(PRIVATE_HAS_PROTO_SOURCES), \
- $(hide) find $(PRIVATE_PROTO_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $@.java-source-list )
-$(if $(PRIVATE_HAS_RS_SOURCES), \
- $(hide) find $(PRIVATE_RS_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $@.java-source-list )
-$(hide) tr ' ' '\n' < $@.java-source-list \
- | sort -u > $@.java-source-list-uniq
-$(hide) if [ -s $@.java-source-list-uniq ] ; then \
- $(call call-jack,$(PRIVATE_JACK_EXTRA_ARGS)) \
- $(strip $(PRIVATE_JACK_FLAGS)) \
- $(strip $(PRIVATE_JACK_DEBUG_FLAGS)) \
- $(addprefix --classpath ,$(strip \
- $(call normalize-path-list,$(call reverse-list,$(PRIVATE_STATIC_JACK_LIBRARIES)) $(PRIVATE_JACK_SHARED_LIBRARIES)))) \
- -D jack.import.resource.policy=keep-first \
- -D jack.android.min-api-level=$(PRIVATE_JACK_MIN_SDK_VERSION) \
- -D jack.import.type.policy=keep-first \
- $(if $(PRIVATE_JACK_INCREMENTAL_DIR),--incremental-folder $(PRIVATE_JACK_INCREMENTAL_DIR)) \
- @$@.java-source-list-uniq; \
+ $(call normalize-path-list,$(PRIVATE_ALL_JAVA_HEADER_LIBRARIES)))) \
+ || ( rm -rf $(dir $@)/classes-turbine ; exit 41 ) && \
+ $(MERGE_ZIPS) -j --ignore-duplicates -stripDir META-INF $@.tmp $@.premerged $(call reverse-list,$(PRIVATE_STATIC_JAVA_HEADER_LIBRARIES)) ; \
+else \
+ $(MERGE_ZIPS) -j --ignore-duplicates -stripDir META-INF $@.tmp $(call reverse-list,$(PRIVATE_STATIC_JAVA_HEADER_LIBRARIES)) ; \
fi
-touch $@
-endef
-
-define transform-jar-to-jack
- $(hide) mkdir -p $(dir $@)
- $(hide) mkdir -p $@.tmpjill.res
- $(hide) unzip -qo $< -d $@.tmpjill.res
- $(hide) find $@.tmpjill.res -iname "*.class" -delete
- $(hide) $(call call-jack) \
- $(PRIVATE_JACK_FLAGS) \
- $(addprefix --pluginpath ,$(strip \
- $(call normalize-path-list,$(PRIVATE_JACK_PLUGIN_PATH)))) \
- $(if $(PRIVATE_JACK_PLUGIN),--plugin $(call normalize-comma-list,$(PRIVATE_JACK_PLUGIN))) \
- -D jack.import.resource.policy=keep-first \
- -D jack.import.type.policy=keep-first \
- -D jack.android.min-api-level=$(PRIVATE_JACK_MIN_SDK_VERSION) \
- --import $< \
- --import-resource $@.tmpjill.res \
- --output-jack $@
- $(hide) rm -rf $@.tmpjill.res
+$(hide) $(ZIPTIME) $@.tmp
+$(hide) $(call commit-change-for-toc,$@)
endef
# Moves $1.tmp to $1 if necessary. This is designed to be used with
@@ -2409,26 +2322,6 @@ else \
fi
endef
-# b/37756495
-IJAR_ASAN_OPTIONS := ASAN_OPTIONS=detect_leaks=0
-
-## Rule to create a table of contents from a .jar file.
-## Must be called with $(eval).
-# $(1): A .jar file
-define _transform-jar-to-toc
-$1.toc: $1 | $(IJAR)
- @echo Generating TOC: $$@
- $(hide) $(IJAR_ASAN_OPTIONS) $(IJAR) $$< $$@.tmp
- $$(call commit-change-for-toc,$$@)
-endef
-
-## Define a rule which generates .jar.toc and mark it as .KATI_RESTAT.
-# $(1): A .jar file
-define define-jar-to-toc-rule
-$(eval $(call _transform-jar-to-toc,$1))\
-$(eval .KATI_RESTAT: $1.toc)
-endef
-
ifeq (,$(TARGET_BUILD_APPS))
## Rule to create a table of contents from a .dex file.
@@ -2458,75 +2351,6 @@ endef
endif # TARGET_BUILD_APPS
-# Invoke Jack to compile java from source to jack files without shrink or obfuscation.
-#
-# Some historical notes:
-# - below we write the list of java files to java-source-list to avoid argument
-# list length problems with Cygwin
-# - we filter out duplicate java file names because Jack doesn't like them.
-define java-to-jack
-$(hide) rm -f $@
-$(hide) rm -rf $(PRIVATE_JACK_INTERMEDIATES_DIR)
-$(hide) mkdir -p $(dir $@)
-$(hide) mkdir -p $(PRIVATE_JACK_INTERMEDIATES_DIR)
-$(if $(PRIVATE_JACK_INCREMENTAL_DIR),$(hide) mkdir -p $(PRIVATE_JACK_INCREMENTAL_DIR))
-$(call dump-words-to-file,$(PRIVATE_JAVA_SOURCES),$(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list)
-$(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \
- find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list; \
-fi
-$(if $(PRIVATE_HAS_PROTO_SOURCES), \
- $(hide) find $(PRIVATE_PROTO_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list )
-$(if $(PRIVATE_HAS_RS_SOURCES), \
- $(hide) find $(PRIVATE_RS_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list )
-$(hide) tr ' ' '\n' < $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list \
- | $(NORMALIZE_PATH) | sort -u > $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq
-$(if $(PRIVATE_JACK_PROGUARD_FLAGS), \
- $(hide) echo -basedirectory $(CURDIR) > $@.flags; \
- echo $(PRIVATE_JACK_PROGUARD_FLAGS) >> $@.flags; \
-)
-$(if $(PRIVATE_EXTRA_JAR_ARGS),
- $(hide) mkdir -p $@.res.tmp
- $(hide) $(call create-empty-package-at,$@.res.tmp.zip)
- $(hide) $(call add-java-resources-to,$@.res.tmp.zip)
- $(hide) unzip -qo $@.res.tmp.zip -d $@.res.tmp
- $(hide) rm $@.res.tmp.zip)
-$(hide) if [ -s $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq ] ; then \
- export tmpEcjArg="@$(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq"; \
-else \
- export tmpEcjArg=""; \
-fi; \
-$(call call-jack) \
- $(strip $(PRIVATE_JACK_FLAGS)) \
- $(if $(NO_OPTIMIZE_DX), \
- -D jack.dex.optimize="false") \
- $(addprefix --classpath ,$(strip \
- $(call normalize-path-list,$(PRIVATE_JACK_SHARED_LIBRARIES)))) \
- $(addprefix --import ,$(call reverse-list,$(PRIVATE_STATIC_JACK_LIBRARIES))) \
- $(addprefix --pluginpath ,$(strip \
- $(call normalize-path-list,$(PRIVATE_JACK_PLUGIN_PATH)))) \
- $(if $(PRIVATE_JACK_PLUGIN),--plugin $(call normalize-comma-list,$(PRIVATE_JACK_PLUGIN))) \
- $(if $(PRIVATE_EXTRA_JAR_ARGS),--import-resource $@.res.tmp) \
- -D jack.import.resource.policy=keep-first \
- -D jack.import.type.policy=keep-first \
- -D jack.android.min-api-level=$(PRIVATE_JACK_MIN_SDK_VERSION) \
- $(if $(PRIVATE_JACK_INCREMENTAL_DIR),--incremental-folder $(PRIVATE_JACK_INCREMENTAL_DIR)) \
- --output-jack $@ \
- $(addprefix --config-jarjar ,$(strip $(PRIVATE_JARJAR_RULES))) \
- $(if $(PRIVATE_JACK_PROGUARD_FLAGS),--config-proguard $@.flags) \
- $$tmpEcjArg \
- || ( rm -f $@ ; exit 41 )
-$(hide) rm -f $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list
-$(if $(PRIVATE_EXTRA_JAR_ARGS),$(hide) rm -rf $@.res.tmp)
-$(hide) mv $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq $(PRIVATE_JACK_INTERMEDIATES_DIR).java-source-list
-$(if $(PRIVATE_JAR_PACKAGES), $(hide) echo unsupported options PRIVATE_JAR_PACKAGES in $@; exit 53)
-$(if $(PRIVATE_JAR_EXCLUDE_PACKAGES), $(hide) echo unsupported options JAR_EXCLUDE_PACKAGES in $@; exit 53)
-$(if $(PRIVATE_JAR_MANIFEST), $(hide) echo unsupported options JAR_MANIFEST in $@; exit 53)
-endef
-
-define desugar-classpath
-$(filter-out -classpath -bootclasspath "",$(subst :,$(space),$(1)))
-endef
-
# Takes an sdk version that might be PLATFORM_VERSION_CODENAME (for example P),
# returns a number greater than the highest existing sdk version if it is, or
# the input if it is not.
@@ -2542,12 +2366,12 @@ $(hide) rm -f $@ $@.tmp
@rm -rf $(dir $@)/desugar_dumped_classes
@mkdir $(dir $@)/desugar_dumped_classes
$(hide) $(JAVA) \
- $(if $(EXPERIMENTAL_USE_OPENJDK9),--add-opens java.base/java.lang.invoke=ALL-UNNAMED,) \
+ $(if $(USE_OPENJDK9),--add-opens java.base/java.lang.invoke=ALL-UNNAMED,) \
-Djdk.internal.lambda.dumpProxyClasses=$(abspath $(dir $@))/desugar_dumped_classes \
-jar $(DESUGAR) \
- $(addprefix --bootclasspath_entry ,$(call desugar-bootclasspath,$(PRIVATE_BOOTCLASSPATH))) \
- $(addprefix --classpath_entry ,$(PRIVATE_ALL_JAVA_LIBRARIES)) \
- --min_sdk_version $(call codename-or-sdk-to-sdk,$(PRIVATE_DEFAULT_APP_TARGET_SDK)) \
+ $(addprefix --bootclasspath_entry ,$(PRIVATE_BOOTCLASSPATH)) \
+ $(addprefix --classpath_entry ,$(PRIVATE_SHARED_JAVA_HEADER_LIBRARIES)) \
+ --min_sdk_version $(call codename-or-sdk-to-sdk,$(PRIVATE_MIN_SDK_VERSION)) \
--allow_empty_bootclasspath \
$(if $(filter --core-library,$(PRIVATE_DX_FLAGS)),--core_library) \
-i $< -o $@.tmp
@@ -2561,7 +2385,7 @@ define transform-classes.jar-to-dex
$(hide) rm -f $(dir $@)classes*.dex
$(hide) $(DX_COMMAND) \
--dex --output=$(dir $@) \
- --min-sdk-version=$(call codename-or-sdk-to-sdk,$(PRIVATE_DEFAULT_APP_TARGET_SDK)) \
+ --min-sdk-version=$(PRIVATE_MIN_SDK_VERSION) \
$(if $(NO_OPTIMIZE_DX), \
--no-optimize) \
$(if $(GENERATE_DEX_DEBUG), \
@@ -2572,6 +2396,21 @@ $(hide) $(DX_COMMAND) \
$<
endef
+
+define transform-classes-d8.jar-to-dex
+@echo "target Dex: $(PRIVATE_MODULE)"
+@mkdir -p $(dir $@)
+$(hide) rm -f $(dir $@)classes*.dex $(dir $@)d8_input.jar
+$(hide) $(ZIP2ZIP) -j -i $< -o $(dir $@)d8_input.jar "**/*.class"
+$(hide) $(DX_COMMAND) \
+ --output $(dir $@) \
+ --min-api $(PRIVATE_MIN_SDK_VERSION) \
+ $(subst --main-dex-list=, --main-dex-list , \
+ $(filter-out --core-library --multi-dex --minimal-main-dex,$(PRIVATE_DX_FLAGS))) \
+ $(dir $@)d8_input.jar
+$(hide) rm -f $(dir $@)d8_input.jar
+endef
+
# Create a mostly-empty .jar file that we'll add to later.
# The MacOS jar tool doesn't like creating empty jar files,
# so we need to give it something.
@@ -2628,6 +2467,8 @@ $(hide) $(AAPT_ASAN_OPTIONS) $(AAPT) package -u $(PRIVATE_AAPT_FLAGS) \
$(addprefix --rename-instrumentation-target-package , $(PRIVATE_MANIFEST_INSTRUMENTATION_FOR)) \
--skip-symbols-without-default-localization \
-F $@
+# So that we re-run aapt when the list of input files change
+$(hide) echo $(PRIVATE_RESOURCE_LIST) >/dev/null
endef
# We need the extra blank line, so that the command will be on a separate line.
@@ -2677,17 +2518,15 @@ $(hide) $(JAR) uf $(1) @$(1).jar-arg-list
@rm -f $(1).jar-arg-list
endef
-# Add resources carried by static Jack libraries.
-#
-define add-carried-jack-resources
- $(hide) if [ -d $(PRIVATE_JACK_INTERMEDIATES_DIR) ] ; then \
- find $(PRIVATE_JACK_INTERMEDIATES_DIR) -type f | sort \
- | sed -e "s?^$(PRIVATE_JACK_INTERMEDIATES_DIR)/? -C \"$(PRIVATE_JACK_INTERMEDIATES_DIR)\" \"?" -e "s/$$/\"/" \
- > $(dir $@)jack_res_jar_flags; \
- if [ -s $(dir $@)jack_res_jar_flags ] ; then \
- $(JAR) uf $@ @$(dir $@)jack_res_jar_flags; \
- fi; \
-fi
+# Add resources (non .class files) from a jar to a package
+# $(1): the package file
+# $(2): the jar file
+# $(3): temporary directory
+define add-jar-resources-to-package
+ rm -rf $(3)
+ mkdir -p $(3)
+ unzip -qo $(2) -d $(3) $$(zipinfo -1 $(2) | grep -v -E "\.class$$")
+ $(JAR) uf $(1) $(call jar-args-sorted-files-in-directory,$(3))
endef
# Sign a package using the specified key/cert.
@@ -2696,14 +2535,10 @@ define sign-package
$(call sign-package-arg,$@)
endef
-# signapk uses internal APIs from sun.security.{pkcs,x509}; see http://b/37137869
# $(1): the package file we are signing.
define sign-package-arg
$(hide) mv $(1) $(1).unsigned
-$(hide) $(JAVA) -Djava.library.path=$(SIGNAPK_JNI_LIBRARY_PATH) \
- $(if $(EXPERIMENTAL_USE_OPENJDK9),--add-exports java.base/sun.security.pkcs=ALL-UNNAMED,) \
- $(if $(EXPERIMENTAL_USE_OPENJDK9),--add-exports java.base/sun.security.x509=ALL-UNNAMED,) \
- -jar $(SIGNAPK_JAR) \
+$(hide) $(JAVA) -Djava.library.path=$(SIGNAPK_JNI_LIBRARY_PATH) -jar $(SIGNAPK_JAR) \
$(PRIVATE_CERTIFICATE) $(PRIVATE_PRIVATE_KEY) \
$(PRIVATE_ADDITIONAL_CERTIFICATES) $(1).unsigned $(1).signed
$(hide) mv $(1).signed $(1)
@@ -2738,14 +2573,27 @@ define remove-timestamps-from-package
$(hide) $(ZIPTIME) $@
endef
+# Uncompress dex files embedded in an apk.
+#
+define uncompress-dexs
+$(hide) if (zipinfo $@ '*.dex' 2>/dev/null | grep -v ' stor ' >/dev/null) ; then \
+ tmpdir=$@.tmpdir; \
+ rm -rf $$tmpdir && mkdir $$tmpdir; \
+ unzip -q $@ '*.dex' -d $$tmpdir && \
+ zip -qd $@ '*.dex' && \
+ ( cd $$tmpdir && find . -type f | sort | zip -qD -X -0 ../$(notdir $@) -@ ) && \
+ rm -rf $$tmpdir; \
+ fi
+endef
+
# Uncompress shared libraries embedded in an apk.
#
define uncompress-shared-libs
$(hide) if (zipinfo $@ $(PRIVATE_EMBEDDED_JNI_LIBS) 2>/dev/null | grep -v ' stor ' >/dev/null) ; then \
rm -rf $(dir $@)uncompressedlibs && mkdir $(dir $@)uncompressedlibs; \
- unzip $@ $(PRIVATE_EMBEDDED_JNI_LIBS) -d $(dir $@)uncompressedlibs && \
- zip -d $@ 'lib/*.so' && \
- ( cd $(dir $@)uncompressedlibs && find lib -type f | sort | zip -D -X -0 ../$(notdir $@) -@ ) && \
+ unzip -q $@ $(PRIVATE_EMBEDDED_JNI_LIBS) -d $(dir $@)uncompressedlibs && \
+ zip -qd $@ 'lib/*.so' && \
+ ( cd $(dir $@)uncompressedlibs && find lib -type f | sort | zip -qD -X -0 ../$(notdir $@) -@ ) && \
rm -rf $(dir $@)uncompressedlibs; \
fi
endef
@@ -2757,8 +2605,15 @@ endef
# Note: we intentionally don't clean PRIVATE_CLASS_INTERMEDIATES_DIR
# in transform-java-to-classes for the sake of vm-tests.
define transform-host-java-to-package
-@echo "$($(PRIVATE_PREFIX)DISPLAY) Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))"
-$(call compile-java,$(HOST_JAVAC),$(PRIVATE_BOOTCLASSPATH))
+@echo "Host Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))"
+$(call compile-java,$(HOST_JAVAC),$(PRIVATE_ALL_JAVA_LIBRARIES))
+endef
+
+# Note: we intentionally don't clean PRIVATE_CLASS_INTERMEDIATES_DIR
+# in transform-java-to-classes for the sake of vm-tests.
+define transform-host-java-to-dalvik-package
+@echo "Dalvik Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))"
+$(call compile-java,$(HOST_JAVAC),$(PRIVATE_ALL_JAVA_HEADER_LIBRARIES))
endef
###########################################################
@@ -2783,6 +2638,14 @@ $(2): $(1)
$$(copy-file-to-target)
endef
+define copy-and-uncompress-dexs
+$(2): $(1) $(ZIPALIGN)
+ @echo "Uncompress dexs in: $$@"
+ $$(copy-file-to-target)
+ $$(uncompress-dexs)
+ $$(align-package)
+endef
+
# Copies many files.
# $(1): The files to copy. Each entry is a ':' separated src:dst pair
# Evaluates to the list of the dst files (ie suitable for a dependency list)
@@ -2799,9 +2662,9 @@ endef
# $(1): source file
# $(2): destination file, must end with .xml.
define copy-xml-file-checked
-$(2): $(1)
+$(2): $(1) $(XMLLINT)
@echo "Copy xml: $$@"
- $(hide) xmllint $$< >/dev/null # Don't print the xml file to stdout.
+ $(hide) $(XMLLINT) $$< >/dev/null # Don't print the xml file to stdout.
$$(copy-file-to-target)
endef
@@ -2822,7 +2685,7 @@ endef
define copy-file-to-target
@mkdir -p $(dir $@)
$(hide) rm -f $@
-$(hide) cp $< $@
+$(hide) cp "$<" "$@"
endef
# The same as copy-file-to-target, but use the local
@@ -2830,7 +2693,7 @@ endef
define copy-file-to-target-with-cp
@mkdir -p $(dir $@)
$(hide) rm -f $@
-$(hide) cp -p $< $@
+$(hide) cp -p "$<" "$@"
endef
# The same as copy-file-to-target, but strip out "# comment"-style
@@ -2898,15 +2761,90 @@ $(3): | $(1)
$(hide) ln -sf $(2) $$@
endef
+# Copy an apk to a target location while removing classes*.dex
+# $(1): source file
+# $(2): destination file
+# $(3): LOCAL_DEX_PREOPT, if nostripping then leave classes*.dex
+define dexpreopt-copy-jar
+$(2): $(1)
+ @echo "Copy: $$@"
+ $$(copy-file-to-target)
+ $(if $(filter nostripping,$(3)),,$$(call dexpreopt-remove-classes.dex,$$@))
+endef
+
+# $(1): the .jar or .apk to remove classes.dex. Note that if all dex files
+# are uncompressed in the archive, then dexopt will not do a copy of the dex
+# files and we should not strip.
+define dexpreopt-remove-classes.dex
+$(hide) if (zipinfo $1 '*.dex' 2>/dev/null | grep -v ' stor ' >/dev/null) ; then \
+zip --quiet --delete $(1) classes.dex; \
+dex_index=2; \
+while zip --quiet --delete $(1) classes$${dex_index}.dex > /dev/null; do \
+ let dex_index=dex_index+1; \
+done \
+fi
+endef
+
+define hiddenapi-copy-dex-files
+$(2): $(1) $(HIDDENAPI) $(INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST) \
+ $(INTERNAL_PLATFORM_HIDDENAPI_DARK_GREYLIST) $(INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST)
+ @rm -rf $(dir $(2))
+ @mkdir -p $(dir $(2))
+ find $(dir $(1)) -maxdepth 1 -name "classes*.dex" | sort | \
+ xargs -I{} cp -f {} $(dir $(2))
+ find $(dir $(2)) -name "classes*.dex" | sort | sed 's/^/--dex=/' | \
+ xargs $(HIDDENAPI) --light-greylist=$(INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST) \
+ --dark-greylist=$(INTERNAL_PLATFORM_HIDDENAPI_DARK_GREYLIST) \
+ --blacklist=$(INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST)
+endef
+
+define hiddenapi-copy-soong-jar
+$(2): PRIVATE_FOLDER := $(dir $(2))dex-hiddenapi
+$(2): $(1) $(HIDDENAPI) $(SOONG_ZIP) $(MERGE_ZIPS) $(INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST) \
+ $(INTERNAL_PLATFORM_HIDDENAPI_DARK_GREYLIST) $(INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST)
+ @echo "Hidden API: $$@"
+ $$(copy-file-to-target)
+ @rm -rf $${PRIVATE_FOLDER}
+ @mkdir -p $${PRIVATE_FOLDER}
+ unzip -q $(2) 'classes*.dex' -d $${PRIVATE_FOLDER}
+ find $${PRIVATE_FOLDER} -name "classes*.dex" | sort | sed 's/^/--dex=/' | \
+ xargs $(HIDDENAPI) --light-greylist=$(INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST) \
+ --dark-greylist=$(INTERNAL_PLATFORM_HIDDENAPI_DARK_GREYLIST) \
+ --blacklist=$(INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST)
+ $(SOONG_ZIP) -o $${PRIVATE_FOLDER}/classes.dex.jar -C $${PRIVATE_FOLDER} -D $${PRIVATE_FOLDER}
+ $(MERGE_ZIPS) -D -zipToNotStrip $${PRIVATE_FOLDER}/classes.dex.jar -stripFile "classes*.dex" \
+ $(2) $${PRIVATE_FOLDER}/classes.dex.jar $(1)
+endef
+
###########################################################
## Commands to call Proguard
###########################################################
+ifdef TARGET_OPENJDK9
+define transform-jar-to-proguard
+@echo Skipping Proguard: $< $@
+$(hide) cp '$<' $@
+endef
+else
define transform-jar-to-proguard
@echo Proguard: $@
-$(hide) $(PROGUARD) -injars '$<$(PRIVATE_PROGUARD_INJAR_FILTERS)' \
- -outjars $@ $(PRIVATE_PROGUARD_FLAGS) \
+$(hide) $(PROGUARD) -injars $< -outjars $@ $(PRIVATE_PROGUARD_FLAGS) \
$(addprefix -injars , $(PRIVATE_EXTRA_INPUT_JAR))
endef
+endif
+
+
+###########################################################
+## Commands to call R8
+###########################################################
+define transform-jar-to-dex-r8
+@echo R8: $@
+$(hide) $(R8_COMPAT_PROGUARD) -injars '$<' \
+ --min-api $(PRIVATE_MIN_SDK_VERSION) \
+ --force-proguard-compatibility --output $(subst classes.dex,,$@) \
+ $(PRIVATE_PROGUARD_FLAGS) \
+ $(addprefix -injars , $(PRIVATE_EXTRA_INPUT_JAR)) \
+ $(PRIVATE_DX_FLAGS)
+endef
###########################################################
## Stuff source generated from one-off tools
@@ -2928,39 +2866,16 @@ ifndef get-file-size
$(error HOST_OS must define get-file-size)
endif
-# Convert a partition data size (eg, as reported in /proc/mtd) to the
-# size of the image used to flash that partition (which includes a
-# spare area for each page).
-# $(1): the partition data size
-define image-size-from-data-size
-$(strip $(eval _isfds_value := $$(shell echo $$$$(($(1) / $(BOARD_NAND_PAGE_SIZE) * \
- ($(BOARD_NAND_PAGE_SIZE)+$(BOARD_NAND_SPARE_SIZE))))))\
-$(if $(filter 0, $(_isfds_value)),$(shell echo $$(($(BOARD_NAND_PAGE_SIZE)+$(BOARD_NAND_SPARE_SIZE)))),$(_isfds_value))\
-$(eval _isfds_value :=))
-endef
-
# $(1): The file(s) to check (often $@)
-# $(2): The maximum total image size, in decimal bytes.
-# Make sure to take into account any reserved space needed for the FS.
-#
-# If $(2) is empty, evaluates to "true"
-#
-# Reserve bad blocks. Make sure that MAX(1% of partition size, 2 blocks)
-# is left over after the image has been flashed. Round the 1% up to the
-# next whole flash block size.
-define assert-max-file-size
+# $(2): The partition size.
+define assert-max-image-size
$(if $(2), \
size=$$(for i in $(1); do $(call get-file-size,$$i); echo +; done; echo 0); \
total=$$(( $$( echo "$$size" ) )); \
printname=$$(echo -n "$(1)" | tr " " +); \
- img_blocksize=$(call image-size-from-data-size,$(BOARD_FLASH_BLOCK_SIZE)); \
- twoblocks=$$((img_blocksize * 2)); \
- onepct=$$((((($(2) / 100) - 1) / img_blocksize + 1) * img_blocksize)); \
- reserve=$$((twoblocks > onepct ? twoblocks : onepct)); \
- maxsize=$$(($(2) - reserve)); \
- echo "$$printname maxsize=$$maxsize blocksize=$$img_blocksize total=$$total reserve=$$reserve"; \
+ maxsize=$$(($(2))); \
if [ "$$total" -gt "$$maxsize" ]; then \
- echo "error: $$printname too large ($$total > [$(2) - $$reserve])"; \
+ echo "error: $$printname too large ($$total > $$maxsize)"; \
false; \
elif [ "$$total" -gt $$((maxsize - 32768)) ]; then \
echo "WARNING: $$printname approaching size limit ($$total now; limit $$maxsize)"; \
@@ -2970,17 +2885,6 @@ $(if $(2), \
)
endef
-# Like assert-max-file-size, but the second argument is a partition
-# size, which we'll convert to a max image size before checking it
-# against the files.
-#
-# $(1): The file(s) to check (often $@)
-# $(2): The partition size.
-define assert-max-image-size
-$(if $(2), \
- $(call assert-max-file-size,$(1),$(call image-size-from-data-size,$(2))))
-endef
-
###########################################################
## Define device-specific radio files
@@ -3157,9 +3061,11 @@ STATS.MODULE_TYPE := \
HOST_DALVIK_JAVA_LIBRARY \
HOST_DALVIK_STATIC_JAVA_LIBRARY \
base_rules \
- HEADER_LIBRARY
+ HEADER_LIBRARY \
+ HOST_TEST_CONFIG \
+ TARGET_TEST_CONFIG
-$(foreach $(s),$(STATS.MODULE_TYPE),$(eval STATS.MODULE_TYPE.$(s) :=))
+$(foreach s,$(STATS.MODULE_TYPE),$(eval STATS.MODULE_TYPE.$(s) :=))
define record-module-type
$(strip $(if $(LOCAL_RECORDED_MODULE_TYPE),,
$(if $(filter-out $(SOONG_ANDROID_MK),$(LOCAL_MODULE_MAKEFILE)),
@@ -3189,7 +3095,7 @@ endef
define create-suite-dependencies
$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
$(eval COMPATIBILITY.$(suite).FILES := \
- $(COMPATIBILITY.$(suite).FILES) $(foreach f,$(my_compat_dist_$(suite)),$(call word-colon,2,$(f))))) \
+ $$(COMPATIBILITY.$(suite).FILES) $$(foreach f,$$(my_compat_dist_$(suite)),$$(call word-colon,2,$$(f))))) \
$(eval $(my_all_targets) : $(call copy-many-files, \
$(sort $(foreach suite,$(LOCAL_COMPATIBILITY_SUITE),$(my_compat_dist_$(suite))))))
endef
@@ -3330,6 +3236,122 @@ ifeq ($(TEST_MAKE_clean_path),true)
endif
###########################################################
+## Given a filepath, returns nonempty if the path cannot be
+## validated to be contained in the current directory
+## This is, this function checks for '/' and '..'
+##
+## $(1): path to validate
+define try-validate-path-is-subdir
+$(strip
+ $(if $(filter /%,$(1)),
+ $(1) starts with a slash
+ )
+ $(if $(filter ../%,$(call clean-path,$(1))),
+ $(1) escapes its parent using '..'
+ )
+ $(if $(strip $(1)),
+ ,
+ '$(1)' is empty
+ )
+)
+endef
+
+define validate-path-is-subdir
+$(if $(call try-validate-path-is-subdir,$(1)),
+ $(call pretty-error, Illegal path: $(call try-validate-path-is-subdir,$(1)))
+)
+endef
+
+###########################################################
+## Given a space-delimited list of filepaths, returns
+## nonempty if any cannot be validated to be contained in
+## the current directory
+##
+## $(1): path list to validate
+define try-validate-paths-are-subdirs
+$(strip \
+ $(foreach my_path,$(1),\
+ $(call try-validate-path-is-subdir,$(my_path))\
+ )
+)
+endef
+
+define validate-paths-are-subdirs
+$(if $(call try-validate-paths-are-subdirs,$(1)),
+ $(call pretty-error,Illegal paths:\'$(call try-validate-paths-are-subdirs,$(1))\')
+)
+endef
+
+###########################################################
+## Tests of try-validate-path-is-subdir
+## and try-validate-paths-are-subdirs
+define test-validate-paths-are-subdirs
+$(eval my_error := $(call try-validate-path-is-subdir,/tmp)) \
+$(if $(call streq,$(my_error),/tmp starts with a slash),
+,
+ $(error incorrect error message for path /tmp. Got '$(my_error)')
+) \
+$(eval my_error := $(call try-validate-path-is-subdir,../sibling)) \
+$(if $(call streq,$(my_error),../sibling escapes its parent using '..'),
+,
+ $(error incorrect error message for path ../sibling. Got '$(my_error)')
+) \
+$(eval my_error := $(call try-validate-path-is-subdir,child/../../sibling)) \
+$(if $(call streq,$(my_error),child/../../sibling escapes its parent using '..'),
+,
+ $(error incorrect error message for path child/../../sibling. Got '$(my_error)')
+) \
+$(eval my_error := $(call try-validate-path-is-subdir,)) \
+$(if $(call streq,$(my_error),'' is empty),
+,
+ $(error incorrect error message for empty path ''. Got '$(my_error)')
+) \
+$(eval my_error := $(call try-validate-path-is-subdir,subdir/subsubdir)) \
+$(if $(call streq,$(my_error),),
+,
+ $(error rejected valid path 'subdir/subsubdir'. Got '$(my_error)')
+)
+
+$(eval my_error := $(call try-validate-paths-are-subdirs,a/b /c/d e/f))
+$(if $(call streq,$(my_error),/c/d starts with a slash),
+,
+ $(error incorrect error message for path list 'a/b /c/d e/f'. Got '$(my_error)')
+)
+$(eval my_error := $(call try-validate-paths-are-subdirs,a/b c/d))
+$(if $(call streq,$(my_error),),
+,
+ $(error rejected valid path list 'a/b c/d'. Got '$(my_error)')
+)
+endef
+# run test
+$(strip $(call test-validate-paths-are-subdirs))
+
+###########################################################
+## Validate jacoco class filters and convert them to
+## file arguments
+## Jacoco class filters are comma-separated lists of class
+## files (android.app.Application), and may have '*' as the
+## last character to match all classes in a package
+## including subpackages.
+define jacoco-class-filter-to-file-args
+$(strip $(call jacoco-validate-file-args,\
+ $(subst $(comma),$(space),\
+ $(subst .,/,\
+ $(strip $(1))))))
+endef
+
+define jacoco-validate-file-args
+$(strip $(1)\
+ $(call validate-paths-are-subdirs,$(1))
+ $(foreach arg,$(1),\
+ $(if $(findstring ?,$(arg)),$(call pretty-error,\
+ '?' filters are not supported in LOCAL_JACK_COVERAGE_INCLUDE_FILTER or LOCAL_JACK_COVERAGE_EXCLUDE_FILTER))\
+ $(if $(findstring *,$(patsubst %*,%,$(arg))),$(call pretty-error,\
+ '*' is only supported at the end of a filter in LOCAL_JACK_COVERAGE_INCLUDE_FILTER or LOCAL_JACK_COVERAGE_EXCLUDE_FILTER))\
+ ))
+endef
+
+###########################################################
## Other includes
###########################################################
@@ -3409,3 +3431,43 @@ $(foreach source,$(ENFORCE_RRO_SOURCES), \
$(eval ALL_MODULES.$(enforce_rro_source_module).REQUIRED += $(enforce_rro_module)) \
)
endef
+
+###########################################################
+## Find system_$(VER) in LOCAL_SDK_VERSION
+##
+## $(1): LOCAL_SDK_VERSION
+###########################################################
+define has-system-sdk-version
+$(filter system_%,$(1))
+endef
+
+###########################################################
+## Get numerical version in LOCAL_SDK_VERSION
+##
+## $(1): LOCAL_SDK_VERSION
+###########################################################
+define get-numeric-sdk-version
+$(filter-out current,\
+ $(if $(call has-system-sdk-version,$(1)),$(patsubst system_%,%,$(1)),$(1)))
+endef
+
+# Convert to lower case without requiring a shell, which isn't cacheable.
+to-lower=$(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1))))))))))))))))))))))))))
+
+# Convert to upper case without requiring a shell, which isn't cacheable.
+to-upper=$(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,$(subst y,Y,$(subst z,Z,$1))))))))))))))))))))))))))
+
+# Sanity-check to-lower and to-upper
+lower := abcdefghijklmnopqrstuvwxyz-_
+upper := ABCDEFGHIJKLMNOPQRSTUVWXYZ-_
+
+ifneq ($(lower),$(call to-lower,$(upper)))
+ $(error to-lower sanity check failure)
+endif
+
+ifneq ($(upper),$(call to-upper,$(lower)))
+ $(error to-upper sanity check failure)
+endif
+
+lower :=
+upper :=
diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk
index 8e496a7..7298bde 100644
--- a/core/dex_preopt.mk
+++ b/core/dex_preopt.mk
@@ -24,34 +24,42 @@ DEX_PREOPT_DEFAULT ?= true
SYSTEM_OTHER_ODEX_FILTER ?= app/% priv-app/%
# Method returning whether the install path $(1) should be for system_other.
+# Under SANITIZE_LITE, we do not want system_other. Just put things under /data/asan.
+ifeq ($(SANITIZE_LITE),true)
+install-on-system-other =
+else
install-on-system-other = $(filter-out $(PRODUCT_DEXPREOPT_SPEED_APPS) $(PRODUCT_SYSTEM_SERVER_APPS),$(basename $(notdir $(filter $(foreach f,$(SYSTEM_OTHER_ODEX_FILTER),$(TARGET_OUT)/$(f)),$(1)))))
+endif
# The default values for pre-opting: always preopt PIC.
# Conditional to building on linux, as dex2oat currently does not work on darwin.
ifeq ($(HOST_OS),linux)
WITH_DEXPREOPT ?= true
-# For an eng build only pre-opt the boot image and system server. This gives reasonable performance
-# and still allows a simple workflow: building in frameworks/base and syncing.
ifeq (eng,$(TARGET_BUILD_VARIANT))
+ # Don't strip for quick development turnarounds.
+ DEX_PREOPT_DEFAULT := nostripping
+ # For an eng build only pre-opt the boot image and system server. This gives reasonable performance
+ # and still allows a simple workflow: building in frameworks/base and syncing.
WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY ?= true
endif
-# Add mini-debug-info to the boot classpath unless explicitly asked not to.
+ # Add mini-debug-info to the boot classpath unless explicitly asked not to.
ifneq (false,$(WITH_DEXPREOPT_DEBUG_INFO))
PRODUCT_DEX_PREOPT_BOOT_FLAGS += --generate-mini-debug-info
endif
+
+ # Non eng linux builds must have preopt enabled so that system server doesn't run as interpreter
+ # only. b/74209329
+ ifeq (,$(filter eng, $(TARGET_BUILD_VARIANT)))
+ ifneq (true,$(WITH_DEXPREOPT))
+ ifneq (true,$(WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY))
+ $(call pretty-error, DEXPREOPT must be enabled for user and userdebug builds)
+ endif
+ endif
+ endif
endif
GLOBAL_DEXPREOPT_FLAGS :=
-# $(1): the .jar or .apk to remove classes.dex
-define dexpreopt-remove-classes.dex
-$(hide) zip --quiet --delete $(1) classes.dex; \
-dex_index=2; \
-while zip --quiet --delete $(1) classes$${dex_index}.dex > /dev/null; do \
- let dex_index=dex_index+1; \
-done
-endef
-
# Special rules for building stripped boot jars that override java_library.mk rules
# $(1): boot jar module name
@@ -59,11 +67,7 @@ define _dexpreopt-boot-jar-remove-classes.dex
_dbj_jar_no_dex := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(1)_nodex.jar
_dbj_src_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(1),,COMMON)/javalib.jar
-$$(_dbj_jar_no_dex) : $$(_dbj_src_jar)
- $$(call copy-file-to-target)
-ifneq ($(DEX_PREOPT_DEFAULT),nostripping)
- $$(call dexpreopt-remove-classes.dex,$$@)
-endif
+$(call dexpreopt-copy-jar,$$(_dbj_src_jar),$$(_dbj_jar_no_dex),$(DEX_PREOPT_DEFAULT))
_dbj_jar_no_dex :=
_dbj_src_jar :=
@@ -85,3 +89,20 @@ DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT := $(DEFAULT_DEX_PREOPT_BUILT_IM
ifdef TARGET_2ND_ARCH
$(TARGET_2ND_ARCH_VAR_PREFIX)DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT := $($(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME)
endif # TARGET_2ND_ARCH
+
+ifeq ($(PRODUCT_DIST_BOOT_AND_SYSTEM_JARS),true)
+boot_profile_jars_zip := $(PRODUCT_OUT)/boot_profile_jars.zip
+all_boot_jars := \
+ $(foreach m,$(DEXPREOPT_BOOT_JARS_MODULES),$(PRODUCT_OUT)/system/framework/$(m).jar) \
+ $(foreach m,$(PRODUCT_SYSTEM_SERVER_JARS),$(PRODUCT_OUT)/system/framework/$(m).jar)
+
+$(boot_profile_jars_zip): PRIVATE_JARS := $(all_boot_jars)
+$(boot_profile_jars_zip): $(all_boot_jars) $(SOONG_ZIP)
+ echo "Create boot profiles package: $@"
+ rm -f $@
+ $(SOONG_ZIP) -o $@ -C $(PRODUCT_OUT) $(PRIVATE_JARS)
+
+droidcore: $(boot_profile_jars_zip)
+
+$(call dist-for-goals, droidcore, $(boot_profile_jars_zip))
+endif
diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk
index 9616036..9c4d55d 100644
--- a/core/dex_preopt_libart.mk
+++ b/core/dex_preopt_libart.mk
@@ -7,15 +7,14 @@
# Set USE_DEX2OAT_DEBUG to false for only building non-debug versions.
ifeq ($(USE_DEX2OAT_DEBUG),false)
DEX2OAT := $(HOST_OUT_EXECUTABLES)/dex2oat$(HOST_EXECUTABLE_SUFFIX)
+PATCHOAT := $(HOST_OUT_EXECUTABLES)/patchoat$(HOST_EXECUTABLE_SUFFIX)
else
DEX2OAT := $(HOST_OUT_EXECUTABLES)/dex2oatd$(HOST_EXECUTABLE_SUFFIX)
+PATCHOAT := $(HOST_OUT_EXECUTABLES)/patchoatd$(HOST_EXECUTABLE_SUFFIX)
endif
-# Pass special class loader context to skip the classpath and collision check.
-# Should modify build system to pass used libraries properly later.
-DEX2OAT_CLASS_LOADER_CONTEXT := "&"
-
DEX2OAT_DEPENDENCY += $(DEX2OAT)
+PATCHOAT_DEPENDENCY += $(PATCHOAT)
# Use the first preloaded-classes file in PRODUCT_COPY_FILES.
PRELOADED_CLASSES := $(call word-colon,1,$(firstword \
@@ -30,7 +29,9 @@ DIRTY_IMAGE_OBJECTS := $(call word-colon,1,$(firstword \
$(filter %system/etc/dirty-image-objects,$(PRODUCT_COPY_FILES))))
define get-product-default-property
-$(strip $(patsubst $(1)=%,%,$(filter $(1)=%,$(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))))
+$(strip \
+ $(eval _prop := $(patsubst $(1)=%,%,$(filter $(1)=%,$(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))))\
+ $(if $(_prop),$(_prop),$(patsubst $(1)=%,%,$(filter $(1)=%,$(PRODUCT_SYSTEM_DEFAULT_PROPERTIES)))))
endef
DEX2OAT_IMAGE_XMS := $(call get-product-default-property,dalvik.vm.image-dex2oat-Xms)
@@ -89,14 +90,19 @@ LIBART_TARGET_BOOT_DEX_FILES := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),$(call
# is converted into to boot.art (to match the legacy assumption that boot.art
# exists), and the rest are converted to boot-<name>.art.
# In addition, each .art file has an associated .oat file.
-LIBART_TARGET_BOOT_ART_EXTRA_FILES := $(foreach jar,$(wordlist 2,999,$(LIBART_TARGET_BOOT_JARS)),boot-$(jar).art boot-$(jar).oat boot-$(jar).vdex)
-LIBART_TARGET_BOOT_ART_EXTRA_FILES += boot.oat boot.vdex
+LIBART_TARGET_BOOT_ART_EXTRA_FILES := $(foreach jar,$(wordlist 2,999,$(LIBART_TARGET_BOOT_JARS)),boot-$(jar).art boot-$(jar).art.rel boot-$(jar).oat)
+LIBART_TARGET_BOOT_ART_EXTRA_FILES += boot.art.rel boot.oat
+LIBART_TARGET_BOOT_ART_VDEX_FILES := $(foreach jar,$(wordlist 2,999,$(LIBART_TARGET_BOOT_JARS)),boot-$(jar).vdex)
+LIBART_TARGET_BOOT_ART_VDEX_FILES += boot.vdex
# If we use a boot image profile.
my_use_profile_for_boot_image := $(PRODUCT_USE_PROFILE_FOR_BOOT_IMAGE)
ifeq (,$(my_use_profile_for_boot_image))
-# If not set, use the default.
-my_use_profile_for_boot_image := false
+# If not set, set the default to true if we are not a PDK build. PDK builds
+# can't build the profile since they don't have frameworks/base.
+ifneq (true,$(TARGET_BUILD_PDK))
+my_use_profile_for_boot_image := true
+endif
endif
ifeq (true,$(my_use_profile_for_boot_image))
@@ -128,6 +134,8 @@ ALL_DEFAULT_INSTALLED_MODULES += $(my_installed_profile)
endif
+LIBART_TARGET_BOOT_ART_VDEX_INSTALLED_SHARED_FILES := $(addprefix $(PRODUCT_OUT)/$(DEXPREOPT_BOOT_JAR_DIR)/,$(LIBART_TARGET_BOOT_ART_VDEX_FILES))
+
my_2nd_arch_prefix :=
include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk
@@ -135,22 +143,50 @@ ifneq ($(TARGET_TRANSLATE_2ND_ARCH),true)
ifdef TARGET_2ND_ARCH
my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk
-my_2nd_arch_prefix :=
endif
endif
+# Copy shared vdex to the directory and create corresponding symlinks in primary and secondary arch.
+$(LIBART_TARGET_BOOT_ART_VDEX_INSTALLED_SHARED_FILES) : PRIMARY_ARCH_DIR := $(dir $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE))
+$(LIBART_TARGET_BOOT_ART_VDEX_INSTALLED_SHARED_FILES) : SECOND_ARCH_DIR := $(dir $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE))
+$(LIBART_TARGET_BOOT_ART_VDEX_INSTALLED_SHARED_FILES) : $(DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME)
+ @echo "Install: $@"
+ @mkdir -p $(dir $@)
+ @rm -f $@
+ $(hide) cp "$(dir $<)$(notdir $@)" "$@"
+ # Make symlink for both the archs. In the case its single arch the symlink will just get overridden.
+ @mkdir -p $(PRIMARY_ARCH_DIR)
+ $(hide) ln -sf /$(DEXPREOPT_BOOT_JAR_DIR)/$(notdir $@) $(PRIMARY_ARCH_DIR)$(notdir $@)
+ @mkdir -p $(SECOND_ARCH_DIR)
+ $(hide) ln -sf /$(DEXPREOPT_BOOT_JAR_DIR)/$(notdir $@) $(SECOND_ARCH_DIR)$(notdir $@)
+
+my_2nd_arch_prefix :=
########################################################################
# For a single jar or APK
# $(1): the input .jar or .apk file
# $(2): the output .odex file
+# In the case where LOCAL_ENFORCE_USES_LIBRARIES is true, PRIVATE_DEX2OAT_CLASS_LOADER_CONTEXT
+# contains the normalized path list of the libraries. This makes it easier to conditionally prepend
+# org.apache.http.legacy.boot based on the SDK level if required.
define dex2oat-one-file
$(hide) rm -f $(2)
$(hide) mkdir -p $(dir $(2))
-$(hide) ANDROID_LOG_TAGS="*:e" $(DEX2OAT) \
+stored_class_loader_context_libs=$(PRIVATE_DEX2OAT_STORED_CLASS_LOADER_CONTEXT_LIBS) && \
+class_loader_context_arg=--class-loader-context=$(PRIVATE_DEX2OAT_CLASS_LOADER_CONTEXT) && \
+class_loader_context=$(PRIVATE_DEX2OAT_CLASS_LOADER_CONTEXT) && \
+stored_class_loader_context_arg="" && \
+uses_library_names="$(PRIVATE_USES_LIBRARY_NAMES)" && \
+optional_uses_library_names="$(PRIVATE_OPTIONAL_USES_LIBRARY_NAMES)" && \
+$(if $(PRIVATE_ENFORCE_USES_LIBRARIES), \
+source build/make/core/verify_uses_libraries.sh "$(1)" && \
+source build/make/core/construct_context.sh "$(PRIVATE_CONDITIONAL_USES_LIBRARIES_HOST)" "$(PRIVATE_CONDITIONAL_USES_LIBRARIES_TARGET)" && \
+,) \
+ANDROID_LOG_TAGS="*:e" $(DEX2OAT) \
--runtime-arg -Xms$(DEX2OAT_XMS) --runtime-arg -Xmx$(DEX2OAT_XMX) \
- --class-loader-context=$(DEX2OAT_CLASS_LOADER_CONTEXT) \
+ $${class_loader_context_arg} \
+ $${stored_class_loader_context_arg} \
--boot-image=$(PRIVATE_DEX_PREOPT_IMAGE_LOCATION) \
--dex-file=$(1) \
--dex-location=$(PRIVATE_DEX_LOCATION) \
diff --git a/core/dex_preopt_libart_boot.mk b/core/dex_preopt_libart_boot.mk
index e3eb9ef..a5e7e88 100644
--- a/core/dex_preopt_libart_boot.mk
+++ b/core/dex_preopt_libart_boot.mk
@@ -30,6 +30,8 @@ $(my_2nd_arch_prefix)LIBART_TARGET_BOOT_OAT_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPE
$(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE := $(PRODUCT_OUT)$($(my_2nd_arch_prefix)LIBART_BOOT_IMAGE_FILENAME)
$(my_2nd_arch_prefix)LIBART_TARGET_BOOT_ART_EXTRA_INSTALLED_FILES := $(addprefix $(dir $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)),\
$(LIBART_TARGET_BOOT_ART_EXTRA_FILES))
+$(my_2nd_arch_prefix)LIBART_TARGET_BOOT_ART_VDEX_INSTALLED_FILES := $(addprefix $(dir $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)),\
+ $(LIBART_TARGET_BOOT_ART_VDEX_FILES))
# If we have a compiled-classes file, create a parameter.
COMPILED_CLASSES_FLAGS :=
@@ -45,7 +47,7 @@ endif
# The rule to install boot.art
# Depends on installed boot.oat, boot-*.art, boot-*.oat
-$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE) : $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) | $(ACP) $($(my_2nd_arch_prefix)LIBART_TARGET_BOOT_ART_EXTRA_INSTALLED_FILES)
+$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE) : $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) | $(ACP) $($(my_2nd_arch_prefix)LIBART_TARGET_BOOT_ART_EXTRA_INSTALLED_FILES) $($(my_2nd_arch_prefix)LIBART_TARGET_BOOT_ART_VDEX_INSTALLED_SHARED_FILES)
@echo "Install: $@"
$(copy-file-to-target)
@@ -65,17 +67,42 @@ my_boot_image_flags := --compiler-filter=speed-profile
my_boot_image_flags += --profile-file=$(my_out_boot_image_profile_location)
endif
+ifneq (addresstrue,$(SANITIZE_TARGET)$(SANITIZE_LITE))
+# Skip recompiling the boot image for the second sanitization phase. We'll get separate paths
+# and invalidate first-stage artifacts which are crucial to SANITIZE_LITE builds.
+# Note: this is technically incorrect. Compiled code contains stack checks which may depend
+# on ASAN settings.
+
+# Use ANDROID_LOG_TAGS to suppress most logging by default...
+ifeq (,$(ART_BOOT_IMAGE_EXTRA_ARGS))
+DEX2OAT_BOOT_IMAGE_LOG_TAGS := ANDROID_LOG_TAGS="*:e"
+else
+# ...unless the boot image is generated specifically for testing, then allow all logging.
+DEX2OAT_BOOT_IMAGE_LOG_TAGS := ANDROID_LOG_TAGS="*:v"
+endif
+
+# An additional message to print on dex2oat failure.
+DEX2OAT_FAILURE_MESSAGE := ERROR: Dex2oat failed to compile a boot image.
+DEX2OAT_FAILURE_MESSAGE += It is likely that the boot classpath is inconsistent.
+ifeq ($(ONE_SHOT_MAKEFILE),)
+ DEX2OAT_FAILURE_MESSAGE += Rebuild with ART_BOOT_IMAGE_EXTRA_ARGS="--runtime-arg -verbose:verifier" to see verification errors.
+else
+ DEX2OAT_FAILURE_MESSAGE += Build with m, mma, or mmma instead of mm or mmm to remedy the situation.
+endif
+
$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME): PRIVATE_BOOT_IMAGE_FLAGS := $(my_boot_image_flags)
$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME): PRIVATE_2ND_ARCH_VAR_PREFIX := $(my_2nd_arch_prefix)
+$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME): PRIVATE_IMAGE_LOCATION := $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_LOCATION)
# Use dex2oat debug version for better error reporting
-$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) : $(LIBART_TARGET_BOOT_DEX_FILES) $(PRELOADED_CLASSES) $(COMPILED_CLASSES) $(DIRTY_IMAGE_OBJECTS) $(DEX2OAT_DEPENDENCY) $(my_out_boot_image_profile_location)
+$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) : $(LIBART_TARGET_BOOT_DEX_FILES) $(PRELOADED_CLASSES) $(COMPILED_CLASSES) $(DIRTY_IMAGE_OBJECTS) $(DEX2OAT_DEPENDENCY) $(PATCHOAT_DEPENDENCY) $(my_out_boot_image_profile_location)
@echo "target dex2oat: $@"
@mkdir -p $(dir $@)
@mkdir -p $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))
- @rm -f $(dir $@)/*.art $(dir $@)/*.oat
+ @rm -f $(dir $@)/*.art $(dir $@)/*.oat $(dir $@)/*.art.rel
@rm -f $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))/*.art
@rm -f $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))/*.oat
- $(DEX2OAT) --runtime-arg -Xms$(DEX2OAT_IMAGE_XMS) \
+ @rm -f $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))/*.art.rel
+ $(hide) $(DEX2OAT_BOOT_IMAGE_LOG_TAGS) $(DEX2OAT) --runtime-arg -Xms$(DEX2OAT_IMAGE_XMS) \
--runtime-arg -Xmx$(DEX2OAT_IMAGE_XMX) \
$(PRIVATE_BOOT_IMAGE_FLAGS) \
$(addprefix --dex-file=,$(LIBART_TARGET_BOOT_DEX_FILES)) \
@@ -91,4 +118,14 @@ $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) : $(LIBART_TARGE
--runtime-arg -Xnorelocate --compile-pic \
--no-generate-debug-info --generate-build-id \
--multi-image --no-inline-from=core-oj.jar \
- $(PRODUCT_DEX_PREOPT_BOOT_FLAGS) $(GLOBAL_DEXPREOPT_FLAGS) $(ART_BOOT_IMAGE_EXTRA_ARGS)
+ --abort-on-hard-verifier-error \
+ --abort-on-soft-verifier-error \
+ $(PRODUCT_DEX_PREOPT_BOOT_FLAGS) $(GLOBAL_DEXPREOPT_FLAGS) $(ART_BOOT_IMAGE_EXTRA_ARGS) \
+ || ( echo "$(DEX2OAT_FAILURE_MESSAGE)" ; false ) && \
+ $(DEX2OAT_BOOT_IMAGE_LOG_TAGS) ANDROID_ROOT=$(PRODUCT_OUT)/system ANDROID_DATA=$(dir $@) $(PATCHOAT) \
+ --input-image-location=$(PRIVATE_IMAGE_LOCATION) \
+ --output-image-relocation-directory=$(dir $@) \
+ --instruction-set=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \
+ --base-offset-delta=0x10000000
+
+endif
diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk
index 235f4bc..ce91759 100644
--- a/core/dex_preopt_odex_install.mk
+++ b/core/dex_preopt_odex_install.mk
@@ -1,6 +1,20 @@
# dexpreopt_odex_install.mk is used to define odex creation rules for JARs and APKs
# This file depends on variables set in base_rules.mk
-# Output variables: LOCAL_DEX_PREOPT, built_odex, dexpreopt_boot_jar_module
+# Output variables: LOCAL_DEX_PREOPT, LOCAL_UNCOMPRESS_DEX, built_odex,
+# dexpreopt_boot_jar_module
+
+# We explicitly uncompress APKs of privileged apps, and used by
+# privileged apps
+LOCAL_UNCOMPRESS_DEX := false
+ifneq (true,$(DONT_UNCOMPRESS_PRIV_APPS_DEXS))
+ifeq (true,$(LOCAL_PRIVILEGED_MODULE))
+ LOCAL_UNCOMPRESS_DEX := true
+else
+ ifneq (,$(filter $(PRODUCT_LOADED_BY_PRIVILEGED_MODULES), $(LOCAL_MODULE)))
+ LOCAL_UNCOMPRESS_DEX := true
+ endif # PRODUCT_LOADED_BY_PRIVILEGED_MODULES
+endif # LOCAL_PRIVILEGED_MODULE
+endif # DONT_UNCOMPRESS_PRIV_APPS_DEXS
# Setting LOCAL_DEX_PREOPT based on WITH_DEXPREOPT, LOCAL_DEX_PREOPT, etc
LOCAL_DEX_PREOPT := $(strip $(LOCAL_DEX_PREOPT))
@@ -30,7 +44,7 @@ endif
ifdef LOCAL_UNINSTALLABLE_MODULE
LOCAL_DEX_PREOPT :=
endif
-ifeq (,$(strip $(built_dex)$(my_prebuilt_src_file))) # contains no java code
+ifeq (,$(strip $(built_dex)$(my_prebuilt_src_file)$(LOCAL_SOONG_DEX_JAR))) # contains no java code
LOCAL_DEX_PREOPT :=
endif
# if WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY=true and module is not in boot class path skip
@@ -46,14 +60,27 @@ endif
endif
endif
-# if installing into system, and odex are being installed into system_other, don't strip
-ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
ifeq ($(LOCAL_DEX_PREOPT),true)
+
+# Don't strip with dexes we explicitly uncompress (dexopt will not store the dex code).
+ifeq ($(LOCAL_UNCOMPRESS_DEX),true)
+LOCAL_DEX_PREOPT := nostripping
+endif # LOCAL_UNCOMPRESS_DEX
+
+# system_other isn't there for an OTA, so don't strip
+# if module is on system, and odex is on system_other.
+ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
ifneq ($(call install-on-system-other, $(my_module_path)),)
LOCAL_DEX_PREOPT := nostripping
-endif
-endif
-endif
+endif # install-on-system-other
+endif # BOARD_USES_SYSTEM_OTHER_ODEX
+
+# We also don't strip if all dexs are uncompressed (dexopt will not store the dex code),
+# but that requires to inspect the source file, which is too early at this point (as we
+# don't know if the source file will actually be used).
+# See dexpreopt-remove-classes.dex.
+
+endif # LOCAL_DEX_PREOPT
built_odex :=
built_vdex :=
@@ -64,32 +91,39 @@ installed_art :=
built_installed_odex :=
built_installed_vdex :=
built_installed_art :=
+my_process_profile :=
+my_profile_is_text_listing :=
ifeq (false,$(WITH_DEX_PREOPT_GENERATE_PROFILE))
LOCAL_DEX_PREOPT_GENERATE_PROFILE := false
endif
ifndef LOCAL_DEX_PREOPT_GENERATE_PROFILE
+
+
# If LOCAL_DEX_PREOPT_GENERATE_PROFILE is not defined, default it based on the existence of the
# profile class listing. TODO: Use product specific directory here.
my_classes_directory := $(PRODUCT_DEX_PREOPT_PROFILE_DIR)
-LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING := $(my_classes_directory)/$(LOCAL_MODULE).prof.txt
-ifneq (,$(wildcard $(LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING)))
-# Profile listing exists, use it to generate the profile.
-LOCAL_DEX_PREOPT_GENERATE_PROFILE := true
+LOCAL_DEX_PREOPT_PROFILE := $(my_classes_directory)/$(LOCAL_MODULE).prof
+
+ifneq (,$(wildcard $(LOCAL_DEX_PREOPT_PROFILE)))
+my_process_profile := true
+my_profile_is_text_listing := false
endif
+else
+my_process_profile := $(LOCAL_DEX_PREOPT_GENERATE_PROFILE)
+my_profile_is_text_listing := true
+LOCAL_DEX_PREOPT_PROFILE := $(LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING)
endif
-ifeq (true,$(LOCAL_DEX_PREOPT_GENERATE_PROFILE))
+ifeq (true,$(my_process_profile))
-ifdef LOCAL_VENDOR_MODULE
-$(call pretty-error, Internal error: profiles are not supported for vendor modules)
-else
+ifeq (,$(LOCAL_DEX_PREOPT_APP_IMAGE))
LOCAL_DEX_PREOPT_APP_IMAGE := true
endif
-ifndef LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING
-$(call pretty-error,Must have specified class listing (LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING))
+ifndef LOCAL_DEX_PREOPT_PROFILE
+$(call pretty-error,Must have specified class listing (LOCAL_DEX_PREOPT_PROFILE))
endif
ifeq (,$(dex_preopt_profile_src_file))
$(call pretty-error, Internal error: dex_preopt_profile_src_file must be set)
@@ -100,20 +134,40 @@ my_dex_location := $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE))
my_dex_location := $(patsubst %.gz,%,$(my_dex_location))
$(my_built_profile): PRIVATE_BUILT_MODULE := $(dex_preopt_profile_src_file)
$(my_built_profile): PRIVATE_DEX_LOCATION := $(my_dex_location)
-$(my_built_profile): PRIVATE_SOURCE_CLASSES := $(LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING)
-$(my_built_profile): $(LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING)
+$(my_built_profile): PRIVATE_SOURCE_CLASSES := $(LOCAL_DEX_PREOPT_PROFILE)
+$(my_built_profile): $(LOCAL_DEX_PREOPT_PROFILE)
$(my_built_profile): $(PROFMAN)
$(my_built_profile): $(dex_preopt_profile_src_file)
-$(my_built_profile):
+ifeq (true,$(my_profile_is_text_listing))
+# The profile is a test listing of classes (used for framework jars).
+# We need to generate the actual binary profile before being able to compile.
$(hide) mkdir -p $(dir $@)
ANDROID_LOG_TAGS="*:e" $(PROFMAN) \
--create-profile-from=$(PRIVATE_SOURCE_CLASSES) \
--apk=$(PRIVATE_BUILT_MODULE) \
--dex-location=$(PRIVATE_DEX_LOCATION) \
--reference-profile-file=$@
-dex_preopt_profile_src_file:=
-# Remove compressed APK extension.
+else
+# The profile is binary profile (used for apps). Run it through profman to
+# ensure the profile keys match the apk.
+$(my_built_profile):
+ $(hide) mkdir -p $(dir $@)
+ touch $@
+ ANDROID_LOG_TAGS="*:i" $(PROFMAN) \
+ --copy-and-update-profile-key \
+ --profile-file=$(PRIVATE_SOURCE_CLASSES) \
+ --apk=$(PRIVATE_BUILT_MODULE) \
+ --dex-location=$(PRIVATE_DEX_LOCATION) \
+ --reference-profile-file=$@ \
+ || echo "Profile out of date for $(PRIVATE_BUILT_MODULE)"
+endif
+
+my_profile_is_text_listing :=
+dex_preopt_profile_src_file :=
+
+# Remove compressed APK extension.
my_installed_profile := $(patsubst %.gz,%,$(LOCAL_INSTALLED_MODULE)).prof
+
# my_installed_profile := $(LOCAL_INSTALLED_MODULE).prof
$(eval $(call copy-one-file,$(my_built_profile),$(my_installed_profile)))
build_installed_profile:=$(my_built_profile):$(my_installed_profile)
@@ -125,6 +179,12 @@ endif
ifdef LOCAL_DEX_PREOPT
dexpreopt_boot_jar_module := $(filter $(DEXPREOPT_BOOT_JARS_MODULES),$(LOCAL_MODULE))
+
+# Filter org.apache.http.legacy.boot.
+ifeq ($(dexpreopt_boot_jar_module),org.apache.http.legacy.boot)
+dexpreopt_boot_jar_module :=
+endif
+
ifdef dexpreopt_boot_jar_module
# For libart, the boot jars' odex files are replaced by $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE).
# We use this installed_odex trick to get boot.art installed.
@@ -178,7 +238,7 @@ installed_vdex := $(strip $(installed_vdex))
installed_art := $(strip $(installed_art))
ifdef built_odex
-ifeq (true,$(LOCAL_DEX_PREOPT_GENERATE_PROFILE))
+ifeq (true,$(my_process_profile))
$(built_odex): $(my_built_profile)
$(built_odex): PRIVATE_PROFILE_PREOPT_FLAGS := --profile-file=$(my_built_profile)
else
@@ -197,6 +257,12 @@ ifeq (,$(my_system_server_compiler_filter))
my_system_server_compiler_filter := speed
endif
+my_default_compiler_filter := $(PRODUCT_DEX_PREOPT_DEFAULT_COMPILER_FILTER)
+ifeq (,$(my_default_compiler_filter))
+# If no default compiler filter is specified, default to 'quicken' to save on storage.
+my_default_compiler_filter := quicken
+endif
+
ifeq (,$(filter --compiler-filter=%, $(LOCAL_DEX_PREOPT_FLAGS)))
ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS),$(LOCAL_MODULE)))
# Jars of system server, use the product option if it is set, speed otherwise.
@@ -207,45 +273,107 @@ ifeq (,$(filter --compiler-filter=%, $(LOCAL_DEX_PREOPT_FLAGS)))
# 'speed' compiler filter.
LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=speed
else
- ifeq (true,$(LOCAL_DEX_PREOPT_GENERATE_PROFILE))
+ ifeq (true,$(my_process_profile))
# For non system server jars, use speed-profile when we have a profile.
LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=speed-profile
else
- # If no compiler filter is specified, default to 'quicken' to save on storage.
- LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=quicken
+ LOCAL_DEX_PREOPT_FLAGS += --compiler-filter=$(my_default_compiler_filter)
endif
endif
endif
endif
-# PRODUCT_SYSTEM_SERVER_DEBUG_INFO overrides WITH_DEXPREOPT_DEBUG_INFO.
-my_system_server_debug_info := $(PRODUCT_SYSTEM_SERVER_DEBUG_INFO)
-ifeq (,$(filter eng, $(TARGET_BUILD_VARIANT)))
-# Only enable for non-eng builds.
-ifeq (,$(my_system_server_debug_info))
-my_system_server_debug_info := true
+my_generate_dm := $(PRODUCT_DEX_PREOPT_GENERATE_DM_FILES)
+ifeq (,$(filter $(LOCAL_DEX_PREOPT_FLAGS),--compiler-filter=verify))
+# Generating DM files only makes sense for verify, avoid doing for non verify compiler filter APKs.
+my_generate_dm := false
endif
+
+# No reason to use a dm file if the dex is already uncompressed.
+ifeq ($(LOCAL_UNCOMPRESS_DEX),true)
+my_generate_dm := false
endif
-ifeq (true, $(my_system_server_debug_info))
- ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS),$(LOCAL_MODULE)))
- LOCAL_DEX_PREOPT_FLAGS += --generate-mini-debug-info
+ifeq (true,$(my_generate_dm))
+LOCAL_DEX_PREOPT_FLAGS += --copy-dex-files=false
+LOCAL_DEX_PREOPT := nostripping
+my_built_dm := $(dir $(LOCAL_BUILT_MODULE))generated.dm
+my_installed_dm := $(patsubst %.apk,%,$(LOCAL_INSTALLED_MODULE)).dm
+my_copied_vdex := $(dir $(LOCAL_BUILT_MODULE))primary.vdex
+$(eval $(call copy-one-file,$(built_vdex),$(my_copied_vdex)))
+$(my_built_dm): PRIVATE_INPUT_VDEX := $(my_copied_vdex)
+$(my_built_dm): $(my_copied_vdex) $(ZIPTIME)
+ $(hide) mkdir -p $(dir $@)
+ $(hide) rm -f $@
+ $(hide) zip -qD -j -X -9 $@ $(PRIVATE_INPUT_VDEX)
+ $(ZIPTIME) $@
+$(eval $(call copy-one-file,$(my_built_dm),$(my_installed_dm)))
+endif
+
+# By default, emit debug info.
+my_dexpreopt_debug_info := true
+# If the global setting suppresses mini-debug-info, disable it.
+ifeq (false,$(WITH_DEXPREOPT_DEBUG_INFO))
+ my_dexpreopt_debug_info := false
+endif
+
+# PRODUCT_SYSTEM_SERVER_DEBUG_INFO overrides WITH_DEXPREOPT_DEBUG_INFO.
+# PRODUCT_OTHER_JAVA_DEBUG_INFO overrides WITH_DEXPREOPT_DEBUG_INFO.
+ifneq (,$(filter $(PRODUCT_SYSTEM_SERVER_JARS),$(LOCAL_MODULE)))
+ ifeq (true,$(PRODUCT_SYSTEM_SERVER_DEBUG_INFO))
+ my_dexpreopt_debug_info := true
+ else ifeq (false,$(PRODUCT_SYSTEM_SERVER_DEBUG_INFO))
+ my_dexpreopt_debug_info := false
endif
+else
+ ifeq (true,$(PRODUCT_OTHER_JAVA_DEBUG_INFO))
+ my_dexpreopt_debug_info := true
+ else ifeq (false,$(PRODUCT_OTHER_JAVA_DEBUG_INFO))
+ my_dexpreopt_debug_info := false
+ endif
+endif
+
+# Never enable on eng.
+ifeq (eng,$(filter eng, $(TARGET_BUILD_VARIANT)))
+my_dexpreopt_debug_info := false
endif
+# Add dex2oat flag for debug-info/no-debug-info.
+ifeq (true,$(my_dexpreopt_debug_info))
+ LOCAL_DEX_PREOPT_FLAGS += --generate-mini-debug-info
+else ifeq (false,$(my_dexpreopt_debug_info))
+ LOCAL_DEX_PREOPT_FLAGS += --no-generate-mini-debug-info
+endif
+
+# Set the compiler reason to 'prebuilt' to identify the oat files produced
+# during the build, as opposed to compiled on the device.
+LOCAL_DEX_PREOPT_FLAGS += --compilation-reason=prebuilt
+
$(built_odex): PRIVATE_DEX_PREOPT_FLAGS := $(LOCAL_DEX_PREOPT_FLAGS)
$(built_vdex): $(built_odex)
$(built_art): $(built_odex)
endif
-# Add the installed_odex to the list of installed files for this module.
-ALL_MODULES.$(my_register_name).INSTALLED += $(installed_odex)
-ALL_MODULES.$(my_register_name).INSTALLED += $(installed_vdex)
-ALL_MODULES.$(my_register_name).INSTALLED += $(installed_art)
+ifneq (true,$(my_generate_dm))
+ # Add the installed_odex to the list of installed files for this module if we aren't generating a
+ # dm file.
+ ALL_MODULES.$(my_register_name).INSTALLED += $(installed_odex)
+ ALL_MODULES.$(my_register_name).INSTALLED += $(installed_vdex)
+ ALL_MODULES.$(my_register_name).INSTALLED += $(installed_art)
-ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_odex)
-ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_vdex)
-ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_art)
+ ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_odex)
+ ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_vdex)
+ ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_art)
+
+ # Make sure to install the .odex and .vdex when you run "make <module_name>"
+ $(my_all_targets): $(installed_odex) $(installed_vdex) $(installed_art)
+else
+ ALL_MODULES.$(my_register_name).INSTALLED += $(my_installed_dm)
+ ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(my_built_dm) $(my_installed_dm)
+
+ # Make sure to install the .dm when you run "make <module_name>"
+ $(my_all_targets): $(installed_dm)
+endif
# Record dex-preopt config.
DEXPREOPT.$(LOCAL_MODULE).DEX_PREOPT := $(LOCAL_DEX_PREOPT)
@@ -259,14 +387,12 @@ DEXPREOPT.$(LOCAL_MODULE).INSTALLED_STRIPPED := $(LOCAL_INSTALLED_MODULE)
DEXPREOPT.MODULES.$(LOCAL_MODULE_CLASS) := $(sort \
$(DEXPREOPT.MODULES.$(LOCAL_MODULE_CLASS)) $(LOCAL_MODULE))
-
-# Make sure to install the .odex and .vdex when you run "make <module_name>"
-$(my_all_targets): $(installed_odex) $(installed_vdex) $(installed_art)
-
endif # LOCAL_DEX_PREOPT
# Profile doesn't depend on LOCAL_DEX_PREOPT.
ALL_MODULES.$(my_register_name).INSTALLED += $(my_installed_profile)
ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(build_installed_profile)
+my_process_profile :=
+
$(my_all_targets): $(my_installed_profile)
diff --git a/core/distdir.mk b/core/distdir.mk
index 89c5966..c074186 100644
--- a/core/distdir.mk
+++ b/core/distdir.mk
@@ -17,9 +17,6 @@
# When specifying "dist", the user has asked that we copy the important
# files from this build into DIST_DIR.
-dist_goal := $(strip $(filter dist,$(MAKECMDGOALS)))
-MAKECMDGOALS := $(strip $(filter-out dist,$(MAKECMDGOALS)))
-
ifdef dist_goal
# $(1): source file
diff --git a/core/dpi_specific_apk.mk b/core/dpi_specific_apk.mk
index 1b0be07..f32daf5 100644
--- a/core/dpi_specific_apk.mk
+++ b/core/dpi_specific_apk.mk
@@ -9,7 +9,7 @@ additional_certificates := $(foreach c,$(LOCAL_ADDITIONAL_CERTIFICATES), $(c).x5
# Set up all the target-specific variables.
$(built_dpi_apk): PRIVATE_MODULE := $(dpi_apk_name)
-$(built_dpi_apk): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) $(PRODUCT_AAPT_FLAGS) $($(LOCAL_PACKAGE_NAME)_aapt_flags_$(my_dpi))
+$(built_dpi_apk): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) --pseudo-localize $($(LOCAL_PACKAGE_NAME)_aapt_flags_$(my_dpi))
# Clear PRIVATE_PRODUCT_AAPT_CONFIG to include everything by default.
$(built_dpi_apk): PRIVATE_PRODUCT_AAPT_CONFIG :=
$(built_dpi_apk): PRIVATE_PRODUCT_AAPT_PREF_CONFIG := $(my_dpi)
@@ -17,8 +17,9 @@ $(built_dpi_apk): PRIVATE_ANDROID_MANIFEST := $(full_android_manifest)
$(built_dpi_apk): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR)
$(built_dpi_apk): PRIVATE_ASSET_DIR := $(LOCAL_ASSET_DIR)
$(built_dpi_apk): PRIVATE_AAPT_INCLUDES := $(all_library_res_package_exports)
-ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
-$(built_dpi_apk): PRIVATE_DEFAULT_APP_TARGET_SDK := $(LOCAL_SDK_VERSION)
+$(built_dpi_apk): PRIVATE_RESOURCE_LIST := $(all_res_assets)
+ifneq (,$(filter-out current system_current test_current core_current, $(LOCAL_SDK_VERSION)))
+$(built_dpi_apk): PRIVATE_DEFAULT_APP_TARGET_SDK := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
else
$(built_dpi_apk): PRIVATE_DEFAULT_APP_TARGET_SDK := $(DEFAULT_APP_TARGET_SDK)
endif
@@ -34,12 +35,8 @@ $(built_dpi_apk): PRIVATE_ADDITIONAL_CERTIFICATES := $(additional_certificates)
$(built_dpi_apk): PRIVATE_SOURCE_ARCHIVE :=
ifneq ($(full_classes_jar),)
$(built_dpi_apk): PRIVATE_DEX_FILE := $(built_dex)
-ifndef LOCAL_JACK_ENABLED
# Use the jarjar processed arhive as the initial package file.
$(built_dpi_apk): PRIVATE_SOURCE_ARCHIVE := $(full_classes_pre_proguard_jar)
-else
-$(built_dpi_apk): PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-rsc
-endif # LOCAL_JACK_ENABLED
$(built_dpi_apk): $(built_dex)
else
$(built_dpi_apk): PRIVATE_DEX_FILE :=
@@ -64,9 +61,6 @@ ifeq ($(full_classes_jar),)
$(if $(PRIVATE_EXTRA_JAR_ARGS),$(call add-java-resources-to,$@))
else
$(add-dex-to-package)
-ifdef LOCAL_JACK_ENABLED
- $(add-carried-jack-resources)
-endif
endif
$(sign-package)
diff --git a/core/droiddoc.mk b/core/droiddoc.mk
index 94e282d..bcd2002 100644
--- a/core/droiddoc.mk
+++ b/core/droiddoc.mk
@@ -15,12 +15,9 @@
#
$(call record-module-type,DROIDDOC)
-##
-##
-## Common to both droiddoc and javadoc
-##
-##
-
+###########################################################
+## Common logic to both droiddoc and javadoc
+###########################################################
LOCAL_IS_HOST_MODULE := $(call true-or-empty,$(LOCAL_IS_HOST_MODULE))
ifeq ($(LOCAL_IS_HOST_MODULE),true)
my_prefix := HOST_
@@ -54,10 +51,10 @@ LOCAL_DROIDDOC_CUSTOM_ASSET_DIR := assets
endif
ifeq ($(LOCAL_IS_HOST_MODULE),true)
+
$(full_target): PRIVATE_BOOTCLASSPATH :=
full_java_libs := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/,\
$(addsuffix $(COMMON_JAVA_PACKAGE_SUFFIX),$(LOCAL_JAVA_LIBRARIES)))
-full_java_lib_deps := $(full_java_libs)
else
@@ -72,30 +69,43 @@ ifneq ($(LOCAL_SDK_VERSION),)
else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),test_current)
LOCAL_JAVA_LIBRARIES := android_test_stubs_current $(LOCAL_JAVA_LIBRARIES)
$(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, android_test_stubs_current)
+ else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),core_current)
+ LOCAL_JAVA_LIBRARIES := core.current.stubs $(LOCAL_JAVA_LIBRARIES)
+ $(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, core.current.stubs)
else
- LOCAL_JAVA_LIBRARIES := sdk_v$(LOCAL_SDK_VERSION) $(LOCAL_JAVA_LIBRARIES)
- $(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, sdk_v$(LOCAL_SDK_VERSION))
+ # core_<ver> is subset of <ver>. Instead of defining a prebuilt lib for core_<ver>,
+ # use the stub for <ver> when building for apps.
+ _version := $(patsubst core_%,%,$(LOCAL_SDK_VERSION))
+ LOCAL_JAVA_LIBRARIES := sdk_v$(_version) $(LOCAL_JAVA_LIBRARIES)
+ $(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, sdk_v$(_version))
+ _version :=
endif
else
- LOCAL_JAVA_LIBRARIES := core-oj core-libart ext framework $(LOCAL_JAVA_LIBRARIES)
+ ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
+ LOCAL_JAVA_LIBRARIES := core-oj core-libart
+ else
+ LOCAL_JAVA_LIBRARIES := core-oj core-libart ext framework $(LOCAL_JAVA_LIBRARIES)
+ endif
$(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, core-oj):$(call java-lib-files, core-libart)
endif # LOCAL_SDK_VERSION
LOCAL_JAVA_LIBRARIES := $(sort $(LOCAL_JAVA_LIBRARIES))
full_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES)) $(LOCAL_CLASSPATH)
-full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES)) $(LOCAL_CLASSPATH)
endif # !LOCAL_IS_HOST_MODULE
-$(full_target): PRIVATE_CLASSPATH := $(subst $(space),:,$(full_java_libs))
-
+$(full_target): PRIVATE_CLASSPATH := $(call normalize-path-list,$(full_java_libs))
intermediates.COMMON := $(call local-intermediates-dir,COMMON)
$(full_target): PRIVATE_SOURCE_PATH := $(call normalize-path-list,$(LOCAL_DROIDDOC_SOURCE_PATH))
$(full_target): PRIVATE_JAVA_FILES := $(filter %.java,$(full_src_files))
$(full_target): PRIVATE_JAVA_FILES += $(addprefix $($(my_prefix)OUT_COMMON_INTERMEDIATES)/, $(filter %.java,$(LOCAL_INTERMEDIATE_SOURCES)))
+$(full_target): PRIVATE_JAVA_FILES += $(filter %.java,$(LOCAL_GENERATED_SOURCES))
+$(full_target): PRIVATE_SRCJARS := $(LOCAL_SRCJARS)
$(full_target): PRIVATE_SOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/src
+$(full_target): PRIVATE_SRCJAR_INTERMEDIATES_DIR := $(intermediates.COMMON)/srcjars
$(full_target): PRIVATE_SRC_LIST_FILE := $(intermediates.COMMON)/droiddoc-src-list
+$(full_target): PRIVATE_SRCJAR_LIST_FILE := $(intermediates.COMMON)/droiddoc-srcjar-list
ifneq ($(strip $(LOCAL_ADDITIONAL_JAVA_DIR)),)
$(full_target): PRIVATE_ADDITIONAL_JAVA_DIR := $(LOCAL_ADDITIONAL_JAVA_DIR)
@@ -104,6 +114,7 @@ endif
$(full_target): PRIVATE_OUT_DIR := $(out_dir)
$(full_target): PRIVATE_DROIDDOC_OPTIONS := $(LOCAL_DROIDDOC_OPTIONS)
$(full_target): PRIVATE_STUB_OUT_DIR := $(LOCAL_DROIDDOC_STUB_OUT_DIR)
+$(full_target): PRIVATE_METALAVA_DOCS_STUB_OUT_DIR := $(LOCAL_DROIDDOC_METALAVA_DOCS_STUB_OUT_DIR)
# Lists the input files for the doc build into a text file
# suitable for the @ syntax of javadoc.
@@ -116,18 +127,10 @@ $(call dump-words-to-file, $(2), $(1))
$(hide) for d in $(3) ; do find $$d -name '*.java' -and -not -name '.*' >> $(1) 2> /dev/null ; done ; true
endef
-ifeq (a,b)
-$(full_target): PRIVATE_PROFILING_OPTIONS := \
- -J-agentlib:jprofilerti=port=8849 -J-Xbootclasspath/a:/Applications/jprofiler5/bin/agent.jar
-endif
-
-
+###########################################################
+## Logic for droiddoc only
+###########################################################
ifneq ($(strip $(LOCAL_DROIDDOC_USE_STANDARD_DOCLET)),true)
-##
-##
-## droiddoc only
-##
-##
droiddoc_templates := \
$(sort $(shell find $(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR) -type f $(if $(ALLOW_MISSING_DEPENDENCIES),2>/dev/null)))
@@ -138,10 +141,6 @@ ifdef ALLOW_MISSING_DEPENDENCIES
endif
endif
-droiddoc := \
- $(HOST_JDK_TOOLS_JAR) \
- $(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX)
-
$(full_target): PRIVATE_DOCLETPATH := $(HOST_OUT_JAVA_LIBRARIES)/jsilver$(COMMON_JAVA_PACKAGE_SUFFIX):$(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX)
$(full_target): PRIVATE_CURRENT_BUILD := -hdf page.build $(BUILD_ID)-$(BUILD_NUMBER_FROM_FILE)
$(full_target): PRIVATE_CURRENT_TIME := -hdf page.now "$$($(DATE_FROM_FILE) "+%d %b %Y %k:%M")"
@@ -163,60 +162,162 @@ else
$(full_target): PRIVATE_ADDITIONAL_HTML_DIR :=
endif
-# TODO: not clear if this is used any more
+# TODO(nanzhang): Remove it if this is not used any more
$(full_target): PRIVATE_LOCAL_PATH := $(LOCAL_PATH)
+ifeq ($(strip $(LOCAL_DROIDDOC_USE_METALAVA)),true)
+ifneq ($(LOCAL_DROIDDOC_METALAVA_PREVIOUS_API),)
+$(full_target): PRIVATE_DROIDDOC_METALAVA_PREVIOUS_API := --previous-api $(LOCAL_DROIDDOC_METALAVA_PREVIOUS_API)
+else
+$(full_target): PRIVATE_DROIDDOC_METALAVA_PREVIOUS_API :=
+endif #!LOCAL_DROIDDOC_METALAVA_PREVIOUS_API
+
+metalava_annotations_deps :=
+ifeq ($(strip $(LOCAL_DROIDDOC_METALAVA_ANNOTATIONS_ENABLED)),true)
+ifeq ($(LOCAL_DROIDDOC_METALAVA_PREVIOUS_API),)
+$(error $(LOCAL_PATH): LOCAL_DROIDDOC_METALAVA_PREVIOUS_API has to be non-empty if metalava annotations was enabled!)
+endif
+ifeq ($(LOCAL_DROIDDOC_METALAVA_MERGE_ANNOTATIONS_DIR),)
+$(error $(LOCAL_PATH): LOCAL_DROIDDOC_METALAVA_MERGE_ANNOTATIONS_DIR has to be non-empty if metalava annotations was enabled!)
+endif
+
+$(full_target): PRIVATE_DROIDDOC_METALAVA_ANNOTATIONS := --include-annotations --migrate-nullness \
+ --extract-annotations $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(LOCAL_MODULE)_annotations.zip \
+ --merge-annotations $(LOCAL_DROIDDOC_METALAVA_MERGE_ANNOTATIONS_DIR) \
+ --hide HiddenTypedefConstant --hide SuperfluousPrefix --hide AnnotationExtraction
+metalava_annotations_deps := $(sort $(shell find $(LOCAL_DROIDDOC_METALAVA_MERGE_ANNOTATIONS_DIR) -type f))
+else
+$(full_target): PRIVATE_DROIDDOC_METALAVA_ANNOTATIONS :=
+endif #LOCAL_DROIDDOC_METALAVA_ANNOTATIONS_ENABLED=true
+
+ifneq (,$(filter --generate-documentation,$(LOCAL_DROIDDOC_OPTIONS)))
+
+pos = $(if $(findstring $1,$2),$(call pos,$1,$(wordlist 2,$(words $2),$2),x $3),$3)
+metalava_args := $(wordlist 1, $(words $(call pos,--generate-documentation,$(LOCAL_DROIDDOC_OPTIONS))), \
+ $(LOCAL_DROIDDOC_OPTIONS))
+remaining_args := $(wordlist $(words $(call pos,--generate-documentation,$(LOCAL_DROIDDOC_OPTIONS))), \
+ $(words $(LOCAL_DROIDDOC_OPTIONS)), $(LOCAL_DROIDDOC_OPTIONS))
+doclava_args := $(wordlist 2, $(words $(remaining_args)), $(remaining_args))
+
+$(full_target): \
+ $(full_src_files) $(LOCAL_GENERATED_SOURCES) \
+ $(droiddoc_templates) \
+ $(HOST_JDK_TOOLS_JAR) \
+ $(HOST_OUT_JAVA_LIBRARIES)/jsilver$(COMMON_JAVA_PACKAGE_SUFFIX) \
+ $(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX) \
+ $(HOST_OUT_JAVA_LIBRARIES)/metalava$(COMMON_JAVA_PACKAGE_SUFFIX) \
+ $(html_dir_files) \
+ $(full_java_libs) \
+ $(ZIPSYNC) \
+ $(LOCAL_SRCJARS) \
+ $(LOCAL_ADDITIONAL_DEPENDENCIES) \
+ $(LOCAL_DROIDDOC_METALAVA_PREVIOUS_API) \
+ $(metalava_annotations_deps)
+ @echo metalava based docs: $(PRIVATE_OUT_DIR)
+ $(hide) mkdir -p $(dir $@)
+ $(hide) rm -rf $(PRIVATE_STUB_OUT_DIR)
+ $(hide) rm -rf $(PRIVATE_METALAVA_DOCS_STUB_OUT_DIR)
+ $(call prepare-doc-source-list,$(PRIVATE_SRC_LIST_FILE),$(PRIVATE_JAVA_FILES), \
+ $(PRIVATE_SOURCE_INTERMEDIATES_DIR) $(PRIVATE_ADDITIONAL_JAVA_DIR))
+ $(ZIPSYNC) -d $(PRIVATE_SRCJAR_INTERMEDIATES_DIR) -l $(PRIVATE_SRCJAR_LIST_FILE) -f "*.java" $(PRIVATE_SRCJARS)
+ $(hide) ( \
+ $(JAVA) -jar $(HOST_OUT_JAVA_LIBRARIES)/metalava$(COMMON_JAVA_PACKAGE_SUFFIX) \
+ -encoding UTF-8 -source 1.8 \@$(PRIVATE_SRC_LIST_FILE) \@$(PRIVATE_SRCJAR_LIST_FILE) \
+ $(addprefix -bootclasspath ,$(PRIVATE_BOOTCLASSPATH)) \
+ $(addprefix -classpath ,$(PRIVATE_CLASSPATH)) \
+ --sourcepath $(PRIVATE_SOURCE_PATH) \
+ --no-banner --color --quiet \
+ $(addprefix --stubs ,$(PRIVATE_STUB_OUT_DIR)) \
+ $(addprefix --doc-stubs ,$(PRIVATE_METALAVA_DOCS_STUB_OUT_DIR)) \
+ --write-stubs-source-list $(intermediates.COMMON)/stubs-src-list \
+ $(metalava_args) $(PRIVATE_DROIDDOC_METALAVA_PREVIOUS_API) $(PRIVATE_DROIDDOC_METALAVA_ANNOTATIONS) \
+ $(JAVADOC) -encoding UTF-8 -source 1.8 STUBS_SOURCE_LIST \
+ -J-Xmx1600m -J-XX:-OmitStackTraceInFastThrow -XDignore.symbol.file \
+ -quiet -doclet com.google.doclava.Doclava -docletpath $(PRIVATE_DOCLETPATH) \
+ -templatedir $(PRIVATE_CUSTOM_TEMPLATE_DIR) \
+ $(PRIVATE_DROIDDOC_HTML_DIR) $(PRIVATE_ADDITIONAL_HTML_DIR) \
+ $(addprefix -bootclasspath ,$(PRIVATE_BOOTCLASSPATH)) \
+ $(addprefix -classpath ,$(PRIVATE_CLASSPATH)) \
+ -sourcepath $(PRIVATE_SOURCE_PATH) \
+ -d $(PRIVATE_OUT_DIR) \
+ $(PRIVATE_CURRENT_BUILD) $(PRIVATE_CURRENT_TIME) $(doclava_args) \
+ && touch -f $@ ) || (rm -rf $(PRIVATE_OUT_DIR) $(PRIVATE_SRC_LIST_FILE); exit 45)
+else
+# no docs generation
+$(full_target): \
+ $(full_src_files) $(LOCAL_GENERATED_SOURCES) \
+ $(full_java_libs) \
+ $(HOST_OUT_JAVA_LIBRARIES)/metalava$(COMMON_JAVA_PACKAGE_SUFFIX) \
+ $(ZIPSYNC) \
+ $(LOCAL_SRCJARS) \
+ $(LOCAL_ADDITIONAL_DEPENDENCIES)
+ @echo metalava based stubs: $@
+ $(hide) mkdir -p $(dir $@)
+ $(hide) rm -rf $(PRIVATE_STUB_OUT_DIR)
+ $(call prepare-doc-source-list,$(PRIVATE_SRC_LIST_FILE),$(PRIVATE_JAVA_FILES), \
+ $(PRIVATE_SOURCE_INTERMEDIATES_DIR) $(PRIVATE_ADDITIONAL_JAVA_DIR))
+ $(ZIPSYNC) -d $(PRIVATE_SRCJAR_INTERMEDIATES_DIR) -l $(PRIVATE_SRCJAR_LIST_FILE) -f "*.java" $(PRIVATE_SRCJARS)
+ $(hide) ( \
+ $(JAVA) -jar $(HOST_OUT_JAVA_LIBRARIES)/metalava$(COMMON_JAVA_PACKAGE_SUFFIX) \
+ -encoding UTF-8 -source 1.8 \@$(PRIVATE_SRC_LIST_FILE) \@$(PRIVATE_SRCJAR_LIST_FILE) \
+ $(addprefix -bootclasspath ,$(PRIVATE_BOOTCLASSPATH)) \
+ $(addprefix -classpath ,$(PRIVATE_CLASSPATH)) \
+ --sourcepath $(PRIVATE_SOURCE_PATH) \
+ $(PRIVATE_DROIDDOC_OPTIONS) $(PRIVATE_DROIDDOC_METALAVA_PREVIOUS_API) $(PRIVATE_DROIDDOC_METALAVA_ANNOTATIONS) \
+ --no-banner --color --quiet \
+ $(addprefix --stubs ,$(PRIVATE_STUB_OUT_DIR)) \
+ && touch -f $@ ) || (rm -rf $(PRIVATE_SRC_LIST_FILE); exit 45)
+
+endif # stubs + docs generation
+ifeq ($(strip $(LOCAL_DROIDDOC_METALAVA_ANNOTATIONS_ENABLED)),true)
+$(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(LOCAL_MODULE)_annotations.zip: $(full_target)
+endif
+
+else # doclava based droiddoc generation
+
# TODO(tobiast): Clean this up once we move to -source 1.9.
# OpenJDK 9 does not have the concept of a "boot classpath" so we should
# then rename PRIVATE_BOOTCLASSPATH to PRIVATE_MODULE or similar. For now,
# keep -bootclasspath here since it works in combination with -source 1.8.
$(full_target): \
- $(full_src_files) \
+ $(full_src_files) $(LOCAL_GENERATED_SOURCES) \
$(droiddoc_templates) \
- $(droiddoc) \
+ $(HOST_JDK_TOOLS_JAR) \
+ $(HOST_OUT_JAVA_LIBRARIES)/jsilver$(COMMON_JAVA_PACKAGE_SUFFIX) \
+ $(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX) \
$(html_dir_files) \
- $(full_java_lib_deps) \
+ $(full_java_libs) \
+ $(ZIPSYNC) \
+ $(LOCAL_SRCJARS) \
$(LOCAL_ADDITIONAL_DEPENDENCIES)
@echo Docs droiddoc: $(PRIVATE_OUT_DIR)
$(hide) mkdir -p $(dir $@)
- $(addprefix $(hide) rm -rf ,$(PRIVATE_STUB_OUT_DIR))
+ $(hide) rm -rf $(PRIVATE_STUB_OUT_DIR)
$(call prepare-doc-source-list,$(PRIVATE_SRC_LIST_FILE),$(PRIVATE_JAVA_FILES), \
$(PRIVATE_SOURCE_INTERMEDIATES_DIR) $(PRIVATE_ADDITIONAL_JAVA_DIR))
+ $(ZIPSYNC) -d $(PRIVATE_SRCJAR_INTERMEDIATES_DIR) -l $(PRIVATE_SRCJAR_LIST_FILE) -f "*.java" $(PRIVATE_SRCJARS)
$(hide) ( \
$(JAVADOC) \
- -encoding UTF-8 \
- -source 1.8 \
- \@$(PRIVATE_SRC_LIST_FILE) \
- -J-Xmx1600m \
- -J-XX:-OmitStackTraceInFastThrow \
- -XDignore.symbol.file \
- $(PRIVATE_PROFILING_OPTIONS) \
- -quiet \
- -doclet com.google.doclava.Doclava \
- -docletpath $(PRIVATE_DOCLETPATH) \
+ -encoding UTF-8 -source 1.8 \@$(PRIVATE_SRC_LIST_FILE) \@$(PRIVATE_SRCJAR_LIST_FILE) \
+ -J-Xmx1600m -J-XX:-OmitStackTraceInFastThrow -XDignore.symbol.file \
+ -quiet -doclet com.google.doclava.Doclava -docletpath $(PRIVATE_DOCLETPATH) \
-templatedir $(PRIVATE_CUSTOM_TEMPLATE_DIR) \
- $(PRIVATE_DROIDDOC_HTML_DIR) \
- $(PRIVATE_ADDITIONAL_HTML_DIR) \
+ $(PRIVATE_DROIDDOC_HTML_DIR) $(PRIVATE_ADDITIONAL_HTML_DIR) \
$(addprefix -bootclasspath ,$(PRIVATE_BOOTCLASSPATH)) \
$(addprefix -classpath ,$(PRIVATE_CLASSPATH)) \
-sourcepath $(PRIVATE_SOURCE_PATH)$(addprefix :,$(PRIVATE_CLASSPATH)) \
-d $(PRIVATE_OUT_DIR) \
- $(PRIVATE_CURRENT_BUILD) $(PRIVATE_CURRENT_TIME) \
- $(PRIVATE_DROIDDOC_OPTIONS) \
+ $(PRIVATE_CURRENT_BUILD) $(PRIVATE_CURRENT_TIME) $(PRIVATE_DROIDDOC_OPTIONS) \
$(addprefix -stubs ,$(PRIVATE_STUB_OUT_DIR)) \
- && touch -f $@ \
- ) || (rm -rf $(PRIVATE_OUT_DIR) $(PRIVATE_SRC_LIST_FILE); exit 45)
-
-
+ && touch -f $@ ) || (rm -rf $(PRIVATE_OUT_DIR) $(PRIVATE_SRC_LIST_FILE); exit 45)
+endif #LOCAL_DROIDDOC_USE_METALAVA
else
-##
-##
-## standard doclet only
-##
-##
-ifneq ($(EXPERIMENTAL_USE_OPENJDK9),)
+###########################################################
+## Logic for javadoc only
+###########################################################
+ifdef USE_OPENJDK9
# For OpenJDK 9 we use --patch-module to define the core libraries code.
# TODO(tobiast): Reorganize this when adding proper support for OpenJDK 9
# modules. Here we treat all code in core libraries as being in java.base
@@ -226,37 +327,22 @@ else
# For OpenJDK 8 we can use -bootclasspath to define the core libraries code.
$(full_target): PRIVATE_BOOTCLASSPATH_ARG := $(addprefix -bootclasspath ,$(PRIVATE_BOOTCLASSPATH))
endif
-
-$(full_target): $(full_src_files) $(full_java_lib_deps)
+$(full_target): $(full_src_files) $(LOCAL_GENERATED_SOURCES) $(full_java_libs) $(ZIPSYNC) $(LOCAL_SRCJARS) $(LOCAL_ADDITIONAL_DEPENDENCIES)
@echo Docs javadoc: $(PRIVATE_OUT_DIR)
@mkdir -p $(dir $@)
$(call prepare-doc-source-list,$(PRIVATE_SRC_LIST_FILE),$(PRIVATE_JAVA_FILES), \
$(PRIVATE_SOURCE_INTERMEDIATES_DIR) $(PRIVATE_ADDITIONAL_JAVA_DIR))
+ $(ZIPSYNC) -d $(PRIVATE_SRCJAR_INTERMEDIATES_DIR) -l $(PRIVATE_SRCJAR_LIST_FILE) -f "*.java" $(PRIVATE_SRCJARS)
$(hide) ( \
- $(JAVADOC) \
- -encoding UTF-8 \
- $(PRIVATE_DROIDDOC_OPTIONS) \
- \@$(PRIVATE_SRC_LIST_FILE) \
- -J-Xmx1024m \
- -XDignore.symbol.file \
- -Xdoclint:none \
- $(PRIVATE_PROFILING_OPTIONS) \
- $(addprefix -classpath ,$(PRIVATE_CLASSPATH)) \
- $(PRIVATE_BOOTCLASSPATH_ARG) \
- -sourcepath $(PRIVATE_SOURCE_PATH)$(addprefix :,$(PRIVATE_CLASSPATH)) \
+ $(JAVADOC) -encoding UTF-8 \@$(PRIVATE_SRC_LIST_FILE) \@$(PRIVATE_SRCJAR_LIST_FILE) \
+ $(PRIVATE_DROIDDOC_OPTIONS) -J-Xmx1024m -XDignore.symbol.file -Xdoclint:none -quiet \
+ $(addprefix -classpath ,$(PRIVATE_CLASSPATH)) $(PRIVATE_BOOTCLASSPATH_ARG) \
+ -sourcepath $(PRIVATE_SOURCE_PATH) \
-d $(PRIVATE_OUT_DIR) \
- -quiet \
&& touch -f $@ \
) || (rm -rf $(PRIVATE_OUT_DIR) $(PRIVATE_SRC_LIST_FILE); exit 45)
-
-endif
-##
-##
-## Common to both droiddoc and javadoc
-##
-##
-
+endif # !LOCAL_DROIDDOC_USE_STANDARD_DOCLET
ALL_DOCS += $(full_target)
@@ -278,4 +364,4 @@ $(LOCAL_MODULE)-docs.zip : $(out_zip)
$(call dist-for-goals,docs,$(out_zip))
-endif
+endif #!LOCAL_UNINSTALLABLE_MODULE
diff --git a/core/dumpvar.mk b/core/dumpvar.mk
index acae48e..59efb04 100644
--- a/core/dumpvar.mk
+++ b/core/dumpvar.mk
@@ -1,37 +1,3 @@
-
-# List of variables we want to print in the build banner.
-print_build_config_vars := \
- PLATFORM_VERSION_CODENAME \
- PLATFORM_VERSION \
- TARGET_PRODUCT \
- TARGET_BUILD_VARIANT \
- TARGET_BUILD_TYPE \
- TARGET_PLATFORM_VERSION \
- TARGET_BUILD_APPS \
- TARGET_ARCH \
- TARGET_ARCH_VARIANT \
- TARGET_CPU_VARIANT \
- TARGET_2ND_ARCH \
- TARGET_2ND_ARCH_VARIANT \
- TARGET_2ND_CPU_VARIANT \
- HOST_ARCH \
- HOST_2ND_ARCH \
- HOST_OS \
- HOST_OS_EXTRA \
- HOST_CROSS_OS \
- HOST_CROSS_ARCH \
- HOST_CROSS_2ND_ARCH \
- HOST_BUILD_TYPE \
- BUILD_ID \
- OUT_DIR \
- AUX_OS_VARIANT_LIST
-
-ifeq ($(TARGET_BUILD_PDK),true)
-print_build_config_vars += \
- TARGET_BUILD_PDK \
- PDK_FUSION_PLATFORM_ZIP
-endif
-
# ---------------------------------------------------------------
# the setpath shell function in envsetup.sh uses this to figure out
# what to add to the path given the config we have chosen.
@@ -52,79 +18,14 @@ ANDROID_BUILD_PATHS := $(ABP)
ANDROID_PREBUILTS := prebuilt/$(HOST_PREBUILT_TAG)
ANDROID_GCC_PREBUILTS := prebuilts/gcc/$(HOST_PREBUILT_TAG)
-# The "dumpvar" stuff lets you say something like
-#
-# CALLED_FROM_SETUP=true \
-# make -f config/envsetup.make dumpvar-TARGET_OUT
-# or
-# CALLED_FROM_SETUP=true \
-# make -f config/envsetup.make dumpvar-abs-HOST_OUT_EXECUTABLES
-#
-# The plain (non-abs) version just dumps the value of the named variable.
-# The "abs" version will treat the variable as a path, and dumps an
-# absolute path to it.
-#
-dumpvar_goals := \
- $(strip $(patsubst dumpvar-%,%,$(filter dumpvar-%,$(MAKECMDGOALS))))
-ifdef dumpvar_goals
-
- ifneq ($(words $(dumpvar_goals)),1)
- $(error Only one "dumpvar-" goal allowed. Saw "$(MAKECMDGOALS)")
- endif
-
- # If the goal is of the form "dumpvar-abs-VARNAME", then
- # treat VARNAME as a path and return the absolute path to it.
- absolute_dumpvar := $(strip $(filter abs-%,$(dumpvar_goals)))
- ifdef absolute_dumpvar
- dumpvar_goals := $(patsubst abs-%,%,$(dumpvar_goals))
- DUMPVAR_VALUE := $(abspath $($(dumpvar_goals)))
- dumpvar_target := dumpvar-abs-$(dumpvar_goals)
- else
- DUMPVAR_VALUE := $($(dumpvar_goals))
- dumpvar_target := dumpvar-$(dumpvar_goals)
- endif
-
-.PHONY: $(dumpvar_target)
-$(dumpvar_target):
- @echo $(DUMPVAR_VALUE)
-
-endif # dumpvar_goals
-
-ifneq ($(dumpvar_goals),report_config)
-PRINT_BUILD_CONFIG:=
-endif
-
-ifneq ($(filter report_config,$(DUMP_MANY_VARS)),)
-# Construct the shell commands that print the config banner.
-report_config_sh := echo '============================================';
-report_config_sh += $(foreach v,$(print_build_config_vars),echo '$v=$($(v))';)
-report_config_sh += echo '============================================';
-endif
-
# Dump mulitple variables to "<var>=<value>" pairs, one per line.
# The output may be executed as bash script.
# Input variables:
# DUMP_MANY_VARS: the list of variable names.
# DUMP_VAR_PREFIX: an optional prefix of the variable name added to the output.
-# DUMP_MANY_ABS_VARS: the list of abs variable names.
-# DUMP_ABS_VAR_PREFIX: an optional prefix of the abs variable name added to the output.
.PHONY: dump-many-vars
dump-many-vars :
- @$(foreach v, $(filter-out report_config, $(DUMP_MANY_VARS)),\
+ @$(foreach v, $(DUMP_MANY_VARS),\
echo "$(DUMP_VAR_PREFIX)$(v)='$($(v))'";)
-ifneq ($(filter report_config, $(DUMP_MANY_VARS)),)
- @# Construct a special variable for report_config.
- @# Escape \` to defer the execution of report_config_sh to preserve the line breaks.
- @echo "$(DUMP_VAR_PREFIX)report_config=\`$(report_config_sh)\`"
-endif
- @$(foreach v, $(sort $(DUMP_MANY_ABS_VARS)),\
- echo "$(DUMP_ABS_VAR_PREFIX)$(v)='$(abspath $($(v)))'";)
endif # CALLED_FROM_SETUP
-
-ifneq ($(PRINT_BUILD_CONFIG),)
-$(info ============================================)
-$(foreach v, $(print_build_config_vars),\
- $(info $v=$($(v))))
-$(info ============================================)
-endif
diff --git a/core/dynamic_binary.mk b/core/dynamic_binary.mk
index 949793b..f44b8a8 100644
--- a/core/dynamic_binary.mk
+++ b/core/dynamic_binary.mk
@@ -99,10 +99,15 @@ ifeq ($(BREAKPAD_GENERATE_SYMBOLS),true)
my_breakpad_path := $(TARGET_OUT_BREAKPAD)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_module_path))
breakpad_input := $(relocation_packer_output)
breakpad_output := $(my_breakpad_path)/$(my_installed_module_stem).sym
-$(breakpad_output) : $(breakpad_input) | $(BREAKPAD_DUMP_SYMS)
+$(breakpad_output) : $(breakpad_input) | $(BREAKPAD_DUMP_SYMS) $(PRIVATE_READELF)
@echo "target breakpad: $(PRIVATE_MODULE) ($@)"
@mkdir -p $(dir $@)
- $(hide) $(BREAKPAD_DUMP_SYMS) -c $< > $@
+ $(hide) if $(PRIVATE_READELF) -S $< > /dev/null 2>&1 ; then \
+ $(BREAKPAD_DUMP_SYMS) -c $< > $@ ; \
+ else \
+ echo "skipped for non-elf file."; \
+ touch $@; \
+ fi
$(LOCAL_BUILT_MODULE) : $(breakpad_output)
endif
diff --git a/core/empty_test_config.xml b/core/empty_test_config.xml
new file mode 100644
index 0000000..7c9daff
--- /dev/null
+++ b/core/empty_test_config.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- No AndroidTest.xml was provided and the manifest does not include
+ instrumentation, hence this apk is not instrumentable.
+-->
+<configuration description="Empty Configuration" />
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 46066e3..700189e 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -97,8 +97,6 @@ endif
# compiles except for arm/mips, so the HOST is whatever we are
# running on
-UNAME := $(shell uname -sm)
-
# HOST_OS
ifneq (,$(findstring Linux,$(UNAME)))
HOST_OS := linux
@@ -110,7 +108,15 @@ ifneq (,$(findstring Macintosh,$(UNAME)))
HOST_OS := darwin
endif
-HOST_OS_EXTRA:=$(shell python -c "import platform; print(platform.platform())")
+HOST_OS_EXTRA := $(shell uname -rsm)
+ifeq ($(HOST_OS),linux)
+ ifneq ($(wildcard /etc/os-release),)
+ HOST_OS_EXTRA += $(shell source /etc/os-release; echo $$PRETTY_NAME)
+ endif
+else ifeq ($(HOST_OS),darwin)
+ HOST_OS_EXTRA += $(shell sw_vers -productVersion)
+endif
+HOST_OS_EXTRA := $(subst $(space),-,$(HOST_OS_EXTRA))
# BUILD_OS is the real host doing the build.
BUILD_OS := $(HOST_OS)
@@ -118,11 +124,13 @@ BUILD_OS := $(HOST_OS)
HOST_CROSS_OS :=
# We can cross-build Windows binaries on Linux
ifeq ($(HOST_OS),linux)
+ifeq ($(BUILD_HOST_static),)
HOST_CROSS_OS := windows
HOST_CROSS_ARCH := x86
HOST_CROSS_2ND_ARCH := x86_64
2ND_HOST_CROSS_IS_64_BIT := true
endif
+endif
ifeq ($(HOST_OS),)
$(error Unable to determine HOST_OS from uname -sm: $(UNAME)!)
@@ -171,6 +179,7 @@ TARGET_COPY_OUT_DATA := data
TARGET_COPY_OUT_ASAN := $(TARGET_COPY_OUT_DATA)/asan
TARGET_COPY_OUT_OEM := oem
TARGET_COPY_OUT_ODM := odm
+TARGET_COPY_OUT_PRODUCT := product
TARGET_COPY_OUT_ROOT := root
TARGET_COPY_OUT_RECOVERY := recovery
@@ -190,10 +199,29 @@ _vendor_path_placeholder := ||VENDOR-PATH-PH||
TARGET_COPY_OUT_VENDOR := $(_vendor_path_placeholder)
###########################################
+###########################################
+# Define TARGET_COPY_OUT_PRODUCT to a placeholder, for at this point
+# we don't know if the device wants to build a separate product.img
+# or just build product stuff into system.img.
+# A device can set up TARGET_COPY_OUT_PRODUCT to "product" in its
+# BoardConfig.mk.
+# We'll substitute with the real value after loading BoardConfig.mk.
+_product_path_placeholder := ||PRODUCT-PATH-PH||
+TARGET_COPY_OUT_PRODUCT := $(_product_path_placeholder)
+###########################################
+
#################################################################
# Set up minimal BOOTCLASSPATH list of jars to build/execute
# java code with dalvikvm/art.
TARGET_CORE_JARS := core-oj core-libart conscrypt okhttp bouncycastle apache-xml
+ifeq ($(EMMA_INSTRUMENT),true)
+ ifneq ($(EMMA_INSTRUMENT_STATIC),true)
+ # For instrumented build, if Jacoco is not being included statically
+ # in instrumented packages then include Jacoco classes into the
+ # bootclasspath.
+ TARGET_CORE_JARS += jacocoagent
+ endif # EMMA_INSTRUMENT_STATIC
+endif # EMMA_INSTRUMENT
HOST_CORE_JARS := $(addsuffix -hostdex,$(TARGET_CORE_JARS))
#################################################################
@@ -257,6 +285,29 @@ BOARD_USES_VENDORIMAGE := true
else ifdef BOARD_USES_VENDORIMAGE
$(error TARGET_COPY_OUT_VENDOR must be set to 'vendor' to use a vendor image)
endif
+
+###########################################
+# Now we can substitute with the real value of TARGET_COPY_OUT_PRODUCT
+ifeq ($(TARGET_COPY_OUT_PRODUCT),$(_product_path_placeholder))
+TARGET_COPY_OUT_PRODUCT := system/product
+else ifeq ($(filter product system/product,$(TARGET_COPY_OUT_PRODUCT)),)
+$(error TARGET_COPY_OUT_PRODUCT must be either 'product' or 'system/product', seeing '$(TARGET_COPY_OUT_PRODUCT)'.)
+endif
+PRODUCT_COPY_FILES := $(subst $(_product_path_placeholder),$(TARGET_COPY_OUT_PRODUCT),$(PRODUCT_COPY_FILES))
+
+BOARD_USES_PRODUCTIMAGE :=
+ifdef BOARD_PREBUILT_PRODUCTIMAGE
+BOARD_USES_PRODUCTIMAGE := true
+endif
+ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
+BOARD_USES_PRODUCTIMAGE := true
+endif
+ifeq ($(TARGET_COPY_OUT_PRODUCT),product)
+BOARD_USES_PRODUCTIMAGE := true
+else ifdef BOARD_USES_PRODUCTIMAGE
+$(error TARGET_COPY_OUT_PRODUCT must be set to 'product' to use a product image)
+endif
+
###########################################
# Ensure that only TARGET_RECOVERY_UPDATER_LIBS *or* AB_OTA_UPDATER is set.
TARGET_RECOVERY_UPDATER_LIBS ?=
@@ -269,6 +320,11 @@ ifeq ($(AB_OTA_UPDATER),true)
endif
# Check BOARD_VNDK_VERSION
+define check_vndk_version
+ $(eval vndk_path := prebuilts/vndk/v$(1)) \
+ $(if $(wildcard $(vndk_path)/*/Android.bp),,$(error VNDK version $(1) not found))
+endef
+
ifdef BOARD_VNDK_VERSION
ifneq ($(BOARD_VNDK_VERSION),current)
$(error BOARD_VNDK_VERSION: Only "current" is implemented)
@@ -279,6 +335,17 @@ else
TARGET_VENDOR_TEST_SUFFIX :=
endif
+ifdef PRODUCT_EXTRA_VNDK_VERSIONS
+ $(foreach v,$(PRODUCT_EXTRA_VNDK_VERSIONS),$(call check_vndk_version,$(v)))
+endif
+
+# Ensure that BOARD_SYSTEMSDK_VERSIONS are all within PLATFORM_SYSTEMSDK_VERSIONS
+_unsupported_systemsdk_versions := $(filter-out $(PLATFORM_SYSTEMSDK_VERSIONS),$(BOARD_SYSTEMSDK_VERSIONS))
+ifneq (,$(_unsupported_systemsdk_versions))
+ $(error System SDK versions '$(_unsupported_systemsdk_versions)' in BOARD_SYSTEMSDK_VERSIONS are not supported.\
+ Supported versions are $(PLATFORM_SYSTEMSDK_VERSIONS))
+endif
+
# ---------------------------------------------------------------
# Set up configuration for target machine.
# The following must be set:
@@ -309,29 +376,17 @@ endif
SOONG_OUT_DIR := $(OUT_DIR)/soong
-DEBUG_OUT_DIR := $(OUT_DIR)/debug
+TARGET_OUT_ROOT := $(OUT_DIR)/target
-# Move the host or target under the debug/ directory
-# if necessary.
-TARGET_OUT_ROOT_release := $(OUT_DIR)/target
-TARGET_OUT_ROOT_debug := $(DEBUG_OUT_DIR)/target
-TARGET_OUT_ROOT := $(TARGET_OUT_ROOT_$(TARGET_BUILD_TYPE))
-
-HOST_OUT_ROOT_release := $(OUT_DIR)/host
-HOST_OUT_ROOT_debug := $(DEBUG_OUT_DIR)/host
-HOST_OUT_ROOT := $(HOST_OUT_ROOT_$(HOST_BUILD_TYPE))
+HOST_OUT_ROOT := $(OUT_DIR)/host
# We want to avoid two host bin directories in multilib build.
-HOST_OUT_release := $(HOST_OUT_ROOT_release)/$(HOST_OS)-$(HOST_PREBUILT_ARCH)
-HOST_OUT_debug := $(HOST_OUT_ROOT_debug)/$(HOST_OS)-$(HOST_PREBUILT_ARCH)
-HOST_OUT := $(HOST_OUT_$(HOST_BUILD_TYPE))
+HOST_OUT := $(HOST_OUT_ROOT)/$(HOST_OS)-$(HOST_PREBUILT_ARCH)
SOONG_HOST_OUT := $(SOONG_OUT_DIR)/host/$(HOST_OS)-$(HOST_PREBUILT_ARCH)
# TODO: remove
BUILD_OUT := $(HOST_OUT)
-HOST_CROSS_OUT_release := $(HOST_OUT_ROOT_release)/windows-$(HOST_PREBUILT_ARCH)
-HOST_CROSS_OUT_debug := $(HOST_OUT_ROOT_debug)/windows-$(HOST_PREBUILT_ARCH)
-HOST_CROSS_OUT := $(HOST_CROSS_OUT_$(HOST_BUILD_TYPE))
+HOST_CROSS_OUT := $(HOST_OUT_ROOT)/windows-$(HOST_PREBUILT_ARCH)
TARGET_PRODUCT_OUT_ROOT := $(TARGET_OUT_ROOT)/product
@@ -341,6 +396,7 @@ HOST_COMMON_OUT_ROOT := $(HOST_OUT_ROOT)/common
PRODUCT_OUT := $(TARGET_PRODUCT_OUT_ROOT)/$(TARGET_DEVICE)
OUT_DOCS := $(TARGET_COMMON_OUT_ROOT)/docs
+OUT_NDK_DOCS := $(TARGET_COMMON_OUT_ROOT)/ndk-docs
BUILD_OUT_EXECUTABLES := $(BUILD_OUT)/bin
SOONG_HOST_OUT_EXECUTABLES := $(SOONG_HOST_OUT)/bin
@@ -352,12 +408,13 @@ HOST_OUT_JAVA_LIBRARIES := $(HOST_OUT)/framework
HOST_OUT_SDK_ADDON := $(HOST_OUT)/sdk_addon
HOST_OUT_NATIVE_TESTS := $(HOST_OUT)/nativetest64
HOST_OUT_COVERAGE := $(HOST_OUT)/coverage
+HOST_OUT_TESTCASES := $(HOST_OUT)/testcases
HOST_CROSS_OUT_EXECUTABLES := $(HOST_CROSS_OUT)/bin
HOST_CROSS_OUT_SHARED_LIBRARIES := $(HOST_CROSS_OUT)/lib
HOST_CROSS_OUT_NATIVE_TESTS := $(HOST_CROSS_OUT)/nativetest
HOST_CROSS_OUT_COVERAGE := $(HOST_CROSS_OUT)/coverage
-HOST_OUT_TESTCASES := $(HOST_OUT)/testcases
+HOST_CROSS_OUT_TESTCASES := $(HOST_CROSS_OUT)/testcases
HOST_OUT_INTERMEDIATES := $(HOST_OUT)/obj
HOST_OUT_INTERMEDIATE_LIBRARIES := $(HOST_OUT_INTERMEDIATES)/lib
@@ -377,6 +434,8 @@ HOST_OUT_COMMON_GEN := $(HOST_COMMON_OUT_ROOT)/gen
HOST_CROSS_OUT_GEN := $(HOST_CROSS_OUT)/gen
+HOST_OUT_TEST_CONFIG := $(HOST_OUT)/test_config
+
# Out for HOST_2ND_ARCH
HOST_2ND_ARCH_VAR_PREFIX := 2ND_
HOST_2ND_ARCH_MODULE_SUFFIX := _32
@@ -421,8 +480,16 @@ TARGET_OUT_COMMON_GEN := $(TARGET_COMMON_OUT_ROOT)/gen
TARGET_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_SYSTEM)
ifneq ($(filter address,$(SANITIZE_TARGET)),)
target_out_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/system
+ifeq ($(SANITIZE_LITE),true)
+# When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not
+# work with unsanitized app_process. For simplicity, generate APKs into /data/asan/.
+target_out_app_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/system
+else
+target_out_app_base := $(TARGET_OUT)
+endif
else
target_out_shared_libraries_base := $(TARGET_OUT)
+target_out_app_base := $(TARGET_OUT)
endif
TARGET_OUT_EXECUTABLES := $(TARGET_OUT)/bin
@@ -436,16 +503,23 @@ TARGET_OUT_SHARED_LIBRARIES := $(target_out_shared_libraries_base)/lib
endif
TARGET_OUT_RENDERSCRIPT_BITCODE := $(TARGET_OUT_SHARED_LIBRARIES)
TARGET_OUT_JAVA_LIBRARIES := $(TARGET_OUT)/framework
-TARGET_OUT_APPS := $(TARGET_OUT)/app
-TARGET_OUT_APPS_PRIVILEGED := $(TARGET_OUT)/priv-app
+TARGET_OUT_APPS := $(target_out_app_base)/app
+TARGET_OUT_APPS_PRIVILEGED := $(target_out_app_base)/priv-app
TARGET_OUT_KEYLAYOUT := $(TARGET_OUT)/usr/keylayout
TARGET_OUT_KEYCHARS := $(TARGET_OUT)/usr/keychars
TARGET_OUT_ETC := $(TARGET_OUT)/etc
TARGET_OUT_NOTICE_FILES := $(TARGET_OUT_INTERMEDIATES)/NOTICE_FILES
TARGET_OUT_FAKE := $(PRODUCT_OUT)/fake_packages
TARGET_OUT_TESTCASES := $(PRODUCT_OUT)/testcases
+TARGET_OUT_TEST_CONFIG := $(PRODUCT_OUT)/test_config
+ifeq ($(SANITIZE_LITE),true)
+# When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not
+# work with unsanitized app_process. For simplicity, generate APKs into /data/asan/.
+TARGET_OUT_SYSTEM_OTHER := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/$(TARGET_COPY_OUT_SYSTEM_OTHER)
+else
TARGET_OUT_SYSTEM_OTHER := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_SYSTEM_OTHER)
+endif
# Out for TARGET_2ND_ARCH
TARGET_2ND_ARCH_VAR_PREFIX := $(HOST_2ND_ARCH_VAR_PREFIX)
@@ -514,8 +588,16 @@ TARGET_OUT_CACHE := $(PRODUCT_OUT)/cache
TARGET_OUT_VENDOR := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR)
ifneq ($(filter address,$(SANITIZE_TARGET)),)
target_out_vendor_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/vendor
+ifeq ($(SANITIZE_LITE),true)
+# When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not
+# work with unsanitized app_process. For simplicity, generate APKs into /data/asan/.
+target_out_vendor_app_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/vendor
+else
+target_out_vendor_app_base := $(TARGET_OUT_VENDOR)
+endif
else
target_out_vendor_shared_libraries_base := $(TARGET_OUT_VENDOR)
+target_out_vendor_app_base := $(TARGET_OUT_VENDOR)
endif
TARGET_OUT_VENDOR_EXECUTABLES := $(TARGET_OUT_VENDOR)/bin
@@ -527,8 +609,8 @@ TARGET_OUT_VENDOR_SHARED_LIBRARIES := $(target_out_vendor_shared_libraries_base)
endif
TARGET_OUT_VENDOR_RENDERSCRIPT_BITCODE := $(TARGET_OUT_VENDOR_SHARED_LIBRARIES)
TARGET_OUT_VENDOR_JAVA_LIBRARIES := $(TARGET_OUT_VENDOR)/framework
-TARGET_OUT_VENDOR_APPS := $(TARGET_OUT_VENDOR)/app
-TARGET_OUT_VENDOR_APPS_PRIVILEGED := $(TARGET_OUT_VENDOR)/priv-app
+TARGET_OUT_VENDOR_APPS := $(target_out_vendor_app_base)/app
+TARGET_OUT_VENDOR_APPS_PRIVILEGED := $(target_out_vendor_app_base)/priv-app
TARGET_OUT_VENDOR_ETC := $(TARGET_OUT_VENDOR)/etc
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_EXECUTABLES := $(TARGET_OUT_VENDOR_EXECUTABLES)
@@ -579,6 +661,39 @@ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_SHARED_LIBRARIES := $(TARGET_OUT_ODM
endif
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_APPS := $(TARGET_OUT_ODM_APPS)
+TARGET_OUT_PRODUCT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_PRODUCT)
+ifneq ($(filter address,$(SANITIZE_TARGET)),)
+target_out_product_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/product
+ifeq ($(SANITIZE_LITE),true)
+# When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not
+# work with unsanitized app_process. For simplicity, generate APKs into /data/asan/.
+target_out_product_app_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/product
+else
+target_out_product_app_base := $(TARGET_OUT_PRODUCT)
+endif
+else
+target_out_product_shared_libraries_base := $(TARGET_OUT_PRODUCT)
+target_out_product_app_base := $(TARGET_OUT_PRODUCT)
+endif
+
+ifeq ($(TARGET_IS_64_BIT),true)
+TARGET_OUT_PRODUCT_SHARED_LIBRARIES := $(target_out_product_shared_libraries_base)/lib64
+else
+TARGET_OUT_PRODUCT_SHARED_LIBRARIES := $(target_out_product_shared_libraries_base)/lib
+endif
+TARGET_OUT_PRODUCT_JAVA_LIBRARIES:= $(TARGET_OUT_PRODUCT)/framework
+TARGET_OUT_PRODUCT_APPS := $(target_out_product_app_base)/app
+TARGET_OUT_PRODUCT_APPS_PRIVILEGED := $(target_out_product_app_base)/priv-app
+TARGET_OUT_PRODUCT_ETC := $(TARGET_OUT_PRODUCT)/etc
+
+ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_SHARED_LIBRARIES := $(target_out_product_shared_libraries_base)/lib/$(TARGET_2ND_ARCH)
+else
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_SHARED_LIBRARIES := $(target_out_product_shared_libraries_base)/lib
+endif
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_APPS := $(TARGET_OUT_PRODUCT_APPS)
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_APPS_PRIVILEGED := $(TARGET_OUT_PRODUCT_APPS_PRIVILEGED)
+
TARGET_OUT_BREAKPAD := $(PRODUCT_OUT)/breakpad
TARGET_OUT_UNSTRIPPED := $(PRODUCT_OUT)/symbols
@@ -615,16 +730,6 @@ ifeq (,$(strip $(DIST_DIR)))
DIST_DIR := $(OUT_DIR)/dist
endif
-ifndef KATI
+ifeq ($(CALLED_FROM_SETUP),true)
PRINT_BUILD_CONFIG ?= true
endif
-
-ifeq ($(USE_CLANG_PLATFORM_BUILD),)
-USE_CLANG_PLATFORM_BUILD := true
-endif
-
-ifneq ($(USE_CLANG_PLATFORM_BUILD),true)
-ifneq ($(USE_CLANG_PLATFORM_BUILD),false)
-$(error USE_CLANG_PLATFORM_BUILD must be true or false)
-endif
-endif
diff --git a/core/executable_internal.mk b/core/executable_internal.mk
index 3509bd2..4a62fbf 100644
--- a/core/executable_internal.mk
+++ b/core/executable_internal.mk
@@ -12,7 +12,9 @@ ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
LOCAL_MODULE_SUFFIX := $(TARGET_EXECUTABLE_SUFFIX)
endif
+ifdef target-executable-hook
$(call target-executable-hook)
+endif
skip_build_from_source :=
ifdef LOCAL_PREBUILT_MODULE_FILE
@@ -76,4 +78,39 @@ $(linked_module): $(my_target_crtbegin_dynamic_o) $(all_objects) $(all_libraries
$(PRIVATE_POST_LINK_CMD)
endif
+ifeq ($(my_native_coverage),true)
+gcno_suffix := .gcnodir
+
+built_whole_gcno_libraries := \
+ $(foreach lib,$(my_whole_static_libraries), \
+ $(call intermediates-dir-for, \
+ STATIC_LIBRARIES,$(lib),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX), \
+ $(my_host_cross))/$(lib)$(gcno_suffix))
+
+built_static_gcno_libraries := \
+ $(foreach lib,$(my_static_libraries), \
+ $(call intermediates-dir-for, \
+ STATIC_LIBRARIES,$(lib),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX), \
+ $(my_host_cross))/$(lib)$(gcno_suffix))
+
+ifdef LOCAL_IS_HOST_MODULE
+my_coverage_path := $($(my_prefix)OUT_COVERAGE)/$(patsubst $($(my_prefix)OUT)/%,%,$(my_module_path))
+else
+my_coverage_path := $(TARGET_OUT_COVERAGE)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_module_path))
+endif
+
+GCNO_ARCHIVE := $(my_installed_module_stem)$(gcno_suffix)
+
+$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_OBJECTS := $(strip $(LOCAL_GCNO_FILES))
+$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_WHOLE_STATIC_LIBRARIES := $(strip $(built_whole_gcno_libraries)) $(strip $(built_static_gcno_libraries))
+$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_INTERMEDIATES_DIR := $(intermediates)
+$(intermediates)/$(GCNO_ARCHIVE) : $(LOCAL_GCNO_FILES) $(built_whole_gcno_libraries) $(built_static_gcno_libraries)
+ $(transform-o-to-static-lib)
+
+$(my_coverage_path)/$(GCNO_ARCHIVE) : $(intermediates)/$(GCNO_ARCHIVE)
+ $(copy-file-to-target)
+
+$(LOCAL_BUILT_MODULE): $(my_coverage_path)/$(GCNO_ARCHIVE)
+endif
+
endif # skip_build_from_source
diff --git a/core/find-jdk-tools-jar.sh b/core/find-jdk-tools-jar.sh
deleted file mode 100755
index ac0b3b6..0000000
--- a/core/find-jdk-tools-jar.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-if [ "x$ANDROID_JAVA_HOME" != x ] && [ -e "$ANDROID_JAVA_HOME/lib/tools.jar" ] ; then
- echo $ANDROID_JAVA_HOME/lib/tools.jar
-else
- JAVAC=$(realpath $(which javac) 2>/dev/null)
- if [ -z "$JAVAC" ]; then
- JAVAC=$(readlink -f $(which javac) 2>/dev/null)
- fi
- if [ -z "$JAVAC" ]; then
- JAVAC=$(which javac)
- fi
- if [ -z "$JAVAC" ] ; then
- exit 1
- fi
- while [ -L "$JAVAC" ] ; do
- LSLINE=$(ls -l "$JAVAC")
- JAVAC=$(echo -n "$LSLINE" | sed -e "s/.* -> //")
- done
- echo $JAVAC | sed -e 's:\(.*\)/javac$:\1/../lib/tools.jar:'
-fi
diff --git a/core/fuzz_test.mk b/core/fuzz_test.mk
index 4d41871..2cc2e2c 100644
--- a/core/fuzz_test.mk
+++ b/core/fuzz_test.mk
@@ -8,8 +8,50 @@ ifdef LOCAL_SDK_VERSION
$(error $(LOCAL_PATH): $(LOCAL_MODULE): NDK fuzz tests are not supported.)
endif
-LOCAL_CFLAGS += -fsanitize-coverage=trace-pc-guard
+my_fuzzer:=libFuzzer
+ifdef LOCAL_FUZZ_ENGINE
+ my_fuzzer:=$(LOCAL_FUZZ_ENGINE)
+else ifdef TARGET_FUZZ_ENGINE
+ my_fuzzer:=$(TARGET_FUZZ_ENGINE)
+endif
+
+
+LOCAL_CFLAGS += -fsanitize-coverage=trace-pc-guard,indirect-calls,trace-cmp
+
+ifeq ($(my_fuzzer),libFuzzer)
LOCAL_STATIC_LIBRARIES += libFuzzer
+else ifeq ($(my_fuzzer),honggfuzz)
+LOCAL_STATIC_LIBRARIES += honggfuzz_libhfuzz
+LOCAL_REQUIRED_MODULES += honggfuzz
+LOCAL_LDFLAGS += \
+ "-Wl,--wrap=strcmp" \
+ "-Wl,--wrap=strcasecmp" \
+ "-Wl,--wrap=strncmp" \
+ "-Wl,--wrap=strncasecmp" \
+ "-Wl,--wrap=strstr" \
+ "-Wl,--wrap=strcasestr" \
+ "-Wl,--wrap=memcmp" \
+ "-Wl,--wrap=bcmp" \
+ "-Wl,--wrap=memmem" \
+ "-Wl,--wrap=ap_cstr_casecmp" \
+ "-Wl,--wrap=ap_cstr_casecmpn" \
+ "-Wl,--wrap=ap_strcasestr" \
+ "-Wl,--wrap=apr_cstr_casecmp" \
+ "-Wl,--wrap=apr_cstr_casecmpn" \
+ "-Wl,--wrap=CRYPTO_memcmp" \
+ "-Wl,--wrap=OPENSSL_memcmp" \
+ "-Wl,--wrap=OPENSSL_strcasecmp" \
+ "-Wl,--wrap=OPENSSL_strncasecmp" \
+ "-Wl,--wrap=xmlStrncmp" \
+ "-Wl,--wrap=xmlStrcmp" \
+ "-Wl,--wrap=xmlStrEqual" \
+ "-Wl,--wrap=xmlStrcasecmp" \
+ "-Wl,--wrap=xmlStrncasecmp" \
+ "-Wl,--wrap=xmlStrstr" \
+ "-Wl,--wrap=xmlStrcasestr"
+else
+$(call pretty-error, Unknown fuzz engine $(my_fuzzer))
+endif
ifdef LOCAL_MODULE_PATH
$(error $(LOCAL_PATH): Do not set LOCAL_MODULE_PATH when building test $(LOCAL_MODULE))
@@ -32,4 +74,8 @@ LOCAL_MULTILIB := both
endif
endif
+ifndef LOCAL_STRIP_MODULE
+LOCAL_STRIP_MODULE := keep_symbols
+endif
+
include $(BUILD_EXECUTABLE)
diff --git a/core/generate_enforce_rro.mk b/core/generate_enforce_rro.mk
index 579089c..62a8c8d 100644
--- a/core/generate_enforce_rro.mk
+++ b/core/generate_enforce_rro.mk
@@ -7,12 +7,12 @@ rro_android_manifest_file := $(intermediates)/AndroidManifest.xml
ifeq (true,$(enforce_rro_source_is_manifest_package_name))
$(rro_android_manifest_file): PRIVATE_PACKAGE_NAME := $(enforce_rro_source_manifest_package_info)
-$(rro_android_manifest_file): build/tools/generate-enforce-rro-android-manifest.py
- $(hide) build/tools/generate-enforce-rro-android-manifest.py -u -p $(PRIVATE_PACKAGE_NAME) -o $@
+$(rro_android_manifest_file): build/make/tools/generate-enforce-rro-android-manifest.py
+ $(hide) build/make/tools/generate-enforce-rro-android-manifest.py -u -p $(PRIVATE_PACKAGE_NAME) -o $@
else
$(rro_android_manifest_file): PRIVATE_SOURCE_MANIFEST_FILE := $(enforce_rro_source_manifest_package_info)
-$(rro_android_manifest_file): $(enforce_rro_source_manifest_package_info) build/tools/generate-enforce-rro-android-manifest.py
- $(hide) build/tools/generate-enforce-rro-android-manifest.py -p $(PRIVATE_SOURCE_MANIFEST_FILE) -o $@
+$(rro_android_manifest_file): $(enforce_rro_source_manifest_package_info) build/make/tools/generate-enforce-rro-android-manifest.py
+ $(hide) build/make/tools/generate-enforce-rro-android-manifest.py -p $(PRIVATE_SOURCE_MANIFEST_FILE) -o $@
endif
LOCAL_PATH:= $(intermediates)
diff --git a/core/help.mk b/core/help.mk
deleted file mode 100644
index c034e79..0000000
--- a/core/help.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# Copyright (C) 2010 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-.PHONY: help
-help:
- @echo
- @echo "Common make targets:"
- @echo "----------------------------------------------------------------------------------"
- @echo "droid Default target"
- @echo "clean (aka clobber) equivalent to rm -rf out/"
- @echo "snod Quickly rebuild the system image from built packages"
- @echo "vnod Quickly rebuild the vendor image from built packages"
- @echo "offline-sdk-docs Generate the HTML for the developer SDK docs"
- @echo "doc-comment-check-docs Check HTML doc links & validity, without generating HTML"
- @echo "libandroid_runtime All the JNI framework stuff"
- @echo "framework All the java framework stuff"
- @echo "services The system server (Java) and friends"
- @echo "help You're reading it right now"
-
-.PHONY: out
-out:
- @echo "I'm sure you're nice and all, but no thanks."
diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk
index 4f3069f..1ef0ccb 100644
--- a/core/host_dalvik_java_library.mk
+++ b/core/host_dalvik_java_library.mk
@@ -24,53 +24,39 @@ $(call record-module-type,HOST_DALVIK_JAVA_LIBRARY)
ifeq ($(HOST_OS),linux)
USE_CORE_LIB_BOOTCLASSPATH := true
-#################################
-include $(BUILD_SYSTEM)/configure_local_jack.mk
-#################################
-
#######################################
include $(BUILD_SYSTEM)/host_java_library_common.mk
#######################################
-ifdef LOCAL_JACK_ENABLED
-ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
- # For static library, $(LOCAL_BUILT_MODULE) is $(full_classes_jack).
- LOCAL_BUILT_MODULE_STEM := classes.jack
-endif
-endif
-
-ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
- LOCAL_JAVA_LIBRARIES := core-oj-hostdex core-libart-hostdex $(LOCAL_JAVA_LIBRARIES)
-endif
+full_classes_turbine_jar := $(intermediates.COMMON)/classes-turbine.jar
+full_classes_header_jarjar := $(intermediates.COMMON)/classes-header-jarjar.jar
+full_classes_header_jar := $(intermediates.COMMON)/classes-header.jar
full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar
+full_classes_combined_jar := $(intermediates.COMMON)/classes-combined.jar
full_classes_desugar_jar := $(intermediates.COMMON)/desugar.classes.jar
full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar
full_classes_jar := $(intermediates.COMMON)/classes.jar
-full_classes_jack := $(intermediates.COMMON)/classes.jack
-jack_check_timestamp := $(intermediates.COMMON)/jack.check.timestamp
built_dex := $(intermediates.COMMON)/classes.dex
+java_source_list_file := $(intermediates.COMMON)/java-source-list
LOCAL_INTERMEDIATE_TARGETS += \
+ $(full_classes_turbine_jar) \
$(full_classes_compiled_jar) \
+ $(full_classes_combined_jar) \
$(full_classes_desugar_jar) \
$(full_classes_jarjar_jar) \
- $(full_classes_jack) \
$(full_classes_jar) \
- $(jack_check_timestamp) \
- $(built_dex)
+ $(built_dex) \
+ $(java_source_list_file)
# See comment in java.mk
ifndef LOCAL_CHECKED_MODULE
-ifdef LOCAL_JACK_ENABLED
-LOCAL_CHECKED_MODULE := $(jack_check_timestamp)
-else
ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
LOCAL_CHECKED_MODULE := $(full_classes_compiled_jar)
else
LOCAL_CHECKED_MODULE := $(built_dex)
endif
endif
-endif
#######################################
include $(BUILD_SYSTEM)/base_rules.mk
@@ -81,51 +67,113 @@ all_java_sources := $(java_sources)
include $(BUILD_SYSTEM)/java_common.mk
+include $(BUILD_SYSTEM)/sdk_check.mk
+
$(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON)
-ifndef LOCAL_JACK_ENABLED
+# List of dependencies for anything that needs all java sources in place
+java_sources_deps := \
+ $(java_sources) \
+ $(java_resource_sources) \
+ $(proto_java_sources_file_stamp) \
+ $(LOCAL_SRCJARS) \
+ $(LOCAL_ADDITIONAL_DEPENDENCIES)
+
+$(java_source_list_file): $(java_sources_deps)
+ $(write-java-source-list)
$(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
-$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
+$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES :=
$(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES :=
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES :=
+$(full_classes_compiled_jar): PRIVATE_SRCJARS := $(LOCAL_SRCJARS)
+$(full_classes_compiled_jar): PRIVATE_SRCJAR_LIST_FILE := $(intermediates.COMMON)/srcjar-list
+$(full_classes_compiled_jar): PRIVATE_SRCJAR_INTERMEDIATES_DIR := $(intermediates.COMMON)/srcjars
$(full_classes_compiled_jar): \
- $(java_sources) \
- $(java_resource_sources) \
- $(full_java_lib_deps) \
- $(jar_manifest_file) \
- $(proto_java_sources_file_stamp) \
- $(annotation_processor_deps) \
- $(NORMALIZE_PATH) \
- $(LOCAL_ADDITIONAL_DEPENDENCIES) \
- | $(SOONG_JAVAC_WRAPPER)
- $(transform-host-java-to-package)
-
-my_desugaring :=
-ifeq ($(LOCAL_JAVA_LANGUAGE_VERSION),1.8)
-my_desugaring := true
-$(full_classes_desugar_jar): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
-$(full_classes_desugar_jar): $(full_classes_compiled_jar) $(DESUGAR)
- $(desugar-classes-jar)
+ $(java_source_list_file) \
+ $(java_sources_deps) \
+ $(full_java_header_libs) \
+ $(full_java_bootclasspath_libs) \
+ $(full_java_system_modules_deps) \
+ $(annotation_processor_deps) \
+ $(NORMALIZE_PATH) \
+ $(JAR_ARGS) \
+ $(ZIPSYNC) \
+ | $(SOONG_JAVAC_WRAPPER)
+ $(transform-host-java-to-dalvik-package)
+
+ifneq ($(TURBINE_ENABLED),false)
+
+$(full_classes_turbine_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
+$(full_classes_turbine_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF)
+$(full_classes_turbine_jar): PRIVATE_SRCJARS := $(LOCAL_SRCJARS)
+$(full_classes_turbine_jar): \
+ $(java_source_list_file) \
+ $(java_sources_deps) \
+ $(full_java_header_libs) \
+ $(full_java_bootclasspath_libs) \
+ $(NORMALIZE_PATH) \
+ $(JAR_ARGS) \
+ $(ZIPTIME) \
+ | $(TURBINE) \
+ $(MERGE_ZIPS)
+ $(transform-java-to-header.jar)
+
+.KATI_RESTAT: $(full_classes_turbine_jar)
+
+# Run jarjar before generate classes-header.jar if necessary.
+ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
+$(full_classes_header_jarjar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
+$(full_classes_header_jarjar): $(full_classes_turbine_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
+ @echo Header JarJar: $@
+ $(hide) $(JAVA) -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
+else
+full_classes_header_jarjar := $(full_classes_turbine_jar)
endif
-ifndef my_desugaring
-full_classes_desugar_jar := $(full_classes_compiled_jar)
-endif
+$(eval $(call copy-one-file,$(full_classes_header_jarjar),$(full_classes_header_jar)))
+
+endif # TURBINE_ENABLED != false
+
+$(full_classes_combined_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF)
+$(full_classes_combined_jar): $(full_classes_compiled_jar) \
+ $(jar_manifest_file) \
+ $(full_static_java_libs) | $(MERGE_ZIPS)
+ $(if $(PRIVATE_JAR_MANIFEST), $(hide) sed -e "s/%BUILD_NUMBER%/$(BUILD_NUMBER_FROM_FILE)/" \
+ $(PRIVATE_JAR_MANIFEST) > $(dir $@)/manifest.mf)
+ $(MERGE_ZIPS) -j --ignore-duplicates $(if $(PRIVATE_JAR_MANIFEST),-m $(dir $@)/manifest.mf) \
+ $(if $(PRIVATE_DONT_DELETE_JAR_META_INF),,-stripDir META-INF -zipToNotStrip $<) \
+ $@ $< $(call reverse-list,$(PRIVATE_STATIC_JAVA_LIBRARIES))
# Run jarjar if necessary, otherwise just copy the file.
ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
-$(full_classes_jarjar_jar): $(full_classes_desugar_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
+$(full_classes_jarjar_jar): $(full_classes_combined_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
@echo JarJar: $@
$(hide) $(JAVA) -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
else
-full_classes_jarjar_jar := $(full_classes_desugar_jar)
+full_classes_jarjar_jar := $(full_classes_combined_jar)
endif
$(eval $(call copy-one-file,$(full_classes_jarjar_jar),$(full_classes_jar)))
+ifneq ($(USE_D8_DESUGAR),true)
+my_desugaring :=
+ifeq ($(LOCAL_JAVA_LANGUAGE_VERSION),1.8)
+my_desugaring := true
+$(full_classes_desugar_jar): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
+$(full_classes_desugar_jar): $(full_classes_jar) $(full_java_header_libs) $(DESUGAR)
+ $(desugar-classes-jar)
+endif
+else
+my_desugaring :=
+endif
+
+ifndef my_desugaring
+full_classes_desugar_jar := $(full_classes_jar)
+endif
+
ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
# No dex; all we want are the .class files with resources.
$(LOCAL_BUILT_MODULE) : $(java_resource_sources)
@@ -136,8 +184,12 @@ $(LOCAL_BUILT_MODULE) : $(full_classes_jar)
else # !LOCAL_IS_STATIC_JAVA_LIBRARY
$(built_dex): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON)
$(built_dex): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
-$(built_dex): $(full_classes_jar) $(DX)
+$(built_dex): $(full_classes_desugar_jar) $(DX) $(ZIP2ZIP)
+ifneq ($(USE_D8_DESUGAR),true)
$(transform-classes.jar-to-dex)
+else
+ $(transform-classes-d8.jar-to-dex)
+endif
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
$(LOCAL_BUILT_MODULE): PRIVATE_SOURCE_ARCHIVE := $(full_classes_jarjar_jar)
@@ -149,67 +201,23 @@ $(LOCAL_BUILT_MODULE): $(built_dex) $(java_resource_sources)
endif # !LOCAL_IS_STATIC_JAVA_LIBRARY
-ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(LOCAL_SDK_VERSION)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SDK_VERSION := $(LOCAL_SDK_VERSION)
+ifneq (,$(filter-out current system_current test_current core_current, $(LOCAL_SDK_VERSION)))
+ my_default_app_target_sdk := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
+ my_sdk_version := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
else
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(DEFAULT_APP_TARGET_SDK)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SDK_VERSION := $(PLATFORM_SDK_VERSION)
+ my_default_app_target_sdk := $(DEFAULT_APP_TARGET_SDK)
+ my_sdk_version := $(PLATFORM_SDK_VERSION)
endif
-else # LOCAL_JACK_ENABLED
-$(LOCAL_INTERMEDIATE_TARGETS): \
- PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-rsc
-
-ifeq ($(LOCAL_JACK_ENABLED),incremental)
-$(LOCAL_INTERMEDIATE_TARGETS): \
- PRIVATE_JACK_INCREMENTAL_DIR := $(intermediates.COMMON)/jack-incremental
+ifdef LOCAL_MIN_SDK_VERSION
+ my_min_sdk_version := $(LOCAL_MIN_SDK_VERSION)
else
-$(LOCAL_INTERMEDIATE_TARGETS): \
- PRIVATE_JACK_INCREMENTAL_DIR :=
+ my_min_sdk_version := $(call codename-or-sdk-to-sdk,$(my_default_app_target_sdk))
endif
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_FLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JACK_FLAGS)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_VERSION := $(LOCAL_JACK_VERSION)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_MIN_SDK_VERSION := $(PLATFORM_JACK_MIN_SDK_VERSION)
-
-jack_all_deps := $(java_sources) $(java_resource_sources) $(full_jack_deps) \
- $(jar_manifest_file) $(proto_java_sources_file_stamp) \
- $(LOCAL_ADDITIONAL_DEPENDENCIES) $(NORMALIZE_PATH) $(JACK_DEFAULT_ARGS) $(JACK)
-
-ifneq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
-$(built_dex): PRIVATE_CLASSES_JACK := $(full_classes_jack)
-$(built_dex): PRIVATE_JACK_PLUGIN_PATH := $(LOCAL_JACK_PLUGIN_PATH)
-$(built_dex): PRIVATE_JACK_PLUGIN := $(LOCAL_JACK_PLUGIN)
-$(built_dex): $(jack_all_deps) $(LOCAL_JACK_PLUGIN_PATH) | setup-jack-server
- @echo Building with Jack: $@
- $(jack-java-to-dex)
-
-# $(full_classes_jack) is just by-product of $(built_dex).
-# The dummy command was added because, without it, make misses the fact the $(built_dex) also
-# change $(full_classes_jack).
-$(full_classes_jack): $(built_dex)
- $(hide) touch $@
-
-$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
-$(LOCAL_BUILT_MODULE): $(built_dex) $(java_resource_sources)
- @echo "Host Jar: $(PRIVATE_MODULE) ($@)"
- $(create-empty-package)
- $(add-dex-to-package)
- $(add-carried-jack-resources)
-
-else # LOCAL_IS_STATIC_JAVA_LIBRARY
-$(full_classes_jack): PRIVATE_JACK_PLUGIN_PATH := $(LOCAL_JACK_PLUGIN_PATH)
-$(full_classes_jack): PRIVATE_JACK_PLUGIN := $(LOCAL_JACK_PLUGIN)
-$(full_classes_jack): $(jack_all_deps) $(LOCAL_JACK_PLUGIN_PATH) | setup-jack-server
- @echo Building with Jack: $@
- $(java-to-jack)
-
-endif # LOCAL_IS_STATIC_JAVA_LIBRARY
-$(jack_check_timestamp): $(jack_all_deps) | setup-jack-server
- @echo Checking build with Jack: $@
- $(jack-check-java)
-endif # LOCAL_JACK_ENABLED
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(my_default_app_target_sdk)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SDK_VERSION := $(my_sdk_version)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_MIN_SDK_VERSION := $(my_min_sdk_version)
USE_CORE_LIB_BOOTCLASSPATH :=
diff --git a/core/host_executable_internal.mk b/core/host_executable_internal.mk
index 19200fd..c4f9f66 100644
--- a/core/host_executable_internal.mk
+++ b/core/host_executable_internal.mk
@@ -12,7 +12,9 @@ ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
LOCAL_MODULE_SUFFIX := $($(my_prefix)EXECUTABLE_SUFFIX)
endif
+ifdef host-executable-hook
$(call host-executable-hook)
+endif
skip_build_from_source :=
ifdef LOCAL_PREBUILT_MODULE_FILE
diff --git a/core/host_fuzz_test.mk b/core/host_fuzz_test.mk
index 8622911..556e02f 100644
--- a/core/host_fuzz_test.mk
+++ b/core/host_fuzz_test.mk
@@ -4,7 +4,7 @@
################################################
$(call record-module-type,HOST_FUZZ_TEST)
-LOCAL_CFLAGS += -fsanitize-coverage=trace-pc-guard
+LOCAL_CFLAGS += -fsanitize-coverage=trace-pc-guard,indirect-calls,trace-cmp
LOCAL_STATIC_LIBRARIES += libLLVMFuzzer
include $(BUILD_HOST_EXECUTABLE)
diff --git a/core/host_java_library.mk b/core/host_java_library.mk
index a68be6a..750254f 100644
--- a/core/host_java_library.mk
+++ b/core/host_java_library.mk
@@ -34,10 +34,15 @@ endif
full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar
full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar
full_classes_jar := $(intermediates.COMMON)/classes.jar
+java_source_list_file := $(intermediates.COMMON)/java-source-list
+full_classes_header_jar := $(intermediates.COMMON)/classes-header.jar
+full_classes_combined_jar := $(intermediates.COMMON)/classes-combined.jar
LOCAL_INTERMEDIATE_TARGETS += \
$(full_classes_compiled_jar) \
$(full_classes_jarjar_jar) \
+ $(java_source_list_file) \
+ $(full_classes_combined_jar)
#######################################
include $(BUILD_SYSTEM)/base_rules.mk
@@ -50,53 +55,73 @@ all_java_sources := $(java_sources)
include $(BUILD_SYSTEM)/java_common.mk
# The layers file allows you to enforce a layering between java packages.
-# Run build/tools/java-layers.py for more details.
+# Run build/make/tools/java-layers.py for more details.
layers_file := $(addprefix $(LOCAL_PATH)/, $(LOCAL_JAVA_LAYERS_FILE))
-# If error prone is enabled then add LOCAL_ERROR_PRONE_FLAGS to LOCAL_JAVACFLAGS
-ifeq ($(RUN_ERROR_PRONE),true)
-LOCAL_JAVACFLAGS += $(LOCAL_ERROR_PRONE_FLAGS)
-endif
+# List of dependencies for anything that needs all java sources in place
+java_sources_deps := \
+ $(java_sources) \
+ $(java_resource_sources) \
+ $(proto_java_sources_file_stamp) \
+ $(LOCAL_SRCJARS) \
+ $(LOCAL_ADDITIONAL_DEPENDENCIES)
+
+$(java_source_list_file): $(java_sources_deps)
+ $(write-java-source-list)
$(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
-$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
+$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES :=
$(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES :=
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES :=
+$(full_classes_compiled_jar): PRIVATE_SRCJARS := $(LOCAL_SRCJARS)
+$(full_classes_compiled_jar): PRIVATE_SRCJAR_LIST_FILE := $(intermediates.COMMON)/srcjar-list
+$(full_classes_compiled_jar): PRIVATE_SRCJAR_INTERMEDIATES_DIR := $(intermediates.COMMON)/srcjars
$(full_classes_compiled_jar): \
- $(java_sources) \
- $(java_resource_sources) \
- $(full_java_lib_deps) \
- $(jar_manifest_file) \
- $(proto_java_sources_file_stamp) \
- $(annotation_processor_deps) \
- $(NORMALIZE_PATH) \
- $(ZIPTIME) \
- $(LOCAL_ADDITIONAL_DEPENDENCIES) \
- | $(SOONG_JAVAC_WRAPPER)
+ $(java_source_list_file) \
+ $(java_sources_deps) \
+ $(full_java_libs) \
+ $(full_java_bootclasspath_libs) \
+ $(annotation_processor_deps) \
+ $(NORMALIZE_PATH) \
+ $(ZIPTIME) \
+ $(JAR_ARGS) \
+ $(ZIPSYNC) \
+ | $(SOONG_JAVAC_WRAPPER)
$(transform-host-java-to-package)
$(remove-timestamps-from-package)
javac-check : $(full_classes_compiled_jar)
javac-check-$(LOCAL_MODULE) : $(full_classes_compiled_jar)
+$(full_classes_combined_jar): $(full_classes_compiled_jar) \
+ $(jar_manifest_file) \
+ $(full_static_java_libs) | $(MERGE_ZIPS)
+ $(if $(PRIVATE_JAR_MANIFEST), $(hide) sed -e "s/%BUILD_NUMBER%/$(BUILD_NUMBER_FROM_FILE)/" \
+ $(PRIVATE_JAR_MANIFEST) > $(dir $@)/manifest.mf)
+ $(MERGE_ZIPS) -j --ignore-duplicates $(if $(PRIVATE_JAR_MANIFEST),-m $(dir $@)/manifest.mf) \
+ -stripDir META-INF -zipToNotStrip $< $@ $< $(call reverse-list,$(PRIVATE_STATIC_JAVA_LIBRARIES))
+
# Run jarjar if necessary, otherwise just copy the file.
ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
-$(full_classes_jarjar_jar): $(full_classes_compiled_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
+$(full_classes_jarjar_jar): $(full_classes_combined_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
@echo JarJar: $@
$(hide) $(JAVA) -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
else
-full_classes_jarjar_jar := $(full_classes_compiled_jar)
+full_classes_jarjar_jar := $(full_classes_combined_jar)
endif
+#######################################
LOCAL_FULL_CLASSES_PRE_JACOCO_JAR := $(full_classes_jarjar_jar)
-#######################################
include $(BUILD_SYSTEM)/jacoco.mk
#######################################
$(eval $(call copy-one-file,$(LOCAL_FULL_CLASSES_JACOCO_JAR),$(LOCAL_BUILT_MODULE)))
$(eval $(call copy-one-file,$(LOCAL_FULL_CLASSES_JACOCO_JAR),$(full_classes_jar)))
+ifeq ($(TURBINE_ENABLED),false)
+$(eval $(call copy-one-file,$(LOCAL_FULL_CLASSES_JACOCO_JAR),$(full_classes_header_jar)))
+endif
diff --git a/core/host_java_library_common.mk b/core/host_java_library_common.mk
index 8df4b37..51e2d94 100644
--- a/core/host_java_library_common.mk
+++ b/core/host_java_library_common.mk
@@ -48,3 +48,8 @@ endif
LOCAL_INTERMEDIATE_SOURCE_DIR := $(intermediates.COMMON)/src
LOCAL_JAVA_LIBRARIES := $(sort $(LOCAL_JAVA_LIBRARIES))
+
+# If error prone is enabled then add LOCAL_ERROR_PRONE_FLAGS to LOCAL_JAVACFLAGS
+ifeq ($(RUN_ERROR_PRONE),true)
+LOCAL_JAVACFLAGS += $(LOCAL_ERROR_PRONE_FLAGS)
+endif
diff --git a/core/host_shared_library_internal.mk b/core/host_shared_library_internal.mk
index bfbde21..0a3b317 100644
--- a/core/host_shared_library_internal.mk
+++ b/core/host_shared_library_internal.mk
@@ -20,7 +20,9 @@ ifneq ($(strip $(LOCAL_MODULE_STEM)$(LOCAL_BUILT_MODULE_STEM)),)
$(error $(LOCAL_PATH): Cannot set module stem for a library)
endif
+ifdef host-shared-library-hook
$(call host-shared-library-hook)
+endif
skip_build_from_source :=
ifdef LOCAL_PREBUILT_MODULE_FILE
@@ -39,7 +41,7 @@ OVERRIDE_BUILT_MODULE_PATH := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTE
include $(BUILD_SYSTEM)/binary.mk
my_host_libprofile_rt := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)LIBPROFILE_RT)
-$(LOCAL_BUILD_MODULE): PRIVATE_HOST_LIBPROFILE_RT := $(my_host_libprofile_rt)
+$(LOCAL_BUILT_MODULE): PRIVATE_HOST_LIBPROFILE_RT := $(my_host_libprofile_rt)
$(LOCAL_BUILT_MODULE): \
$(all_objects) \
diff --git a/target/product/generic_armv5.mk b/core/host_test_config.mk
index daa321a..b9975e5 100644
--- a/target/product/generic_armv5.mk
+++ b/core/host_test_config.mk
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2011 The Android Open Source Project
+# Copyright (C) 2017 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -14,12 +14,12 @@
# limitations under the License.
#
-# This is a generic product that isn't specialized for a specific device.
-# It includes the base Android platform.
+#
+# Common rules for building a TradeFed test XML file for host side tests.
+#
+
+$(call record-module-type,HOST_TEST_CONFIG)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk)
+LOCAL_IS_HOST_MODULE := true
-# Overrides
-PRODUCT_BRAND := generic_armv5
-PRODUCT_DEVICE := generic_armv5
-PRODUCT_NAME := generic_armv5
+include $(BUILD_SYSTEM)/test_config_common.mk
diff --git a/core/host_test_internal.mk b/core/host_test_internal.mk
index ffb22c7..42e01e1 100644
--- a/core/host_test_internal.mk
+++ b/core/host_test_internal.mk
@@ -5,9 +5,7 @@
ifeq ($(LOCAL_GTEST),true)
LOCAL_CFLAGS_windows += -DGTEST_OS_WINDOWS
LOCAL_CFLAGS_linux += -DGTEST_OS_LINUX
- LOCAL_LDLIBS_linux += -lpthread
LOCAL_CFLAGS_darwin += -DGTEST_OS_MAC
- LOCAL_LDLIBS_darwin += -lpthread
LOCAL_CFLAGS += -DGTEST_HAS_STD_STRING -O0 -g
diff --git a/core/install_jni_libs.mk b/core/install_jni_libs.mk
index e88db40..b7d83dc 100644
--- a/core/install_jni_libs.mk
+++ b/core/install_jni_libs.mk
@@ -18,19 +18,9 @@ endif
ifneq ($(filter tests samples, $(LOCAL_MODULE_TAGS)),)
my_embed_jni := true
endif
-ifeq ($(PRODUCT_FULL_TREBLE),true)
- ifeq ($(filter $(TARGET_OUT)/%, $(my_module_path)),)
- # If this app isn't to be installed to the system partition, and the device
- # is fully treble-ized then jni libs are embedded, Otherwise, access to the
- # directory where the lib is installed to (usually /vendor/lib) needs to be
- # allowed for system processes, which is a Treble violation.
- my_embed_jni := true
- endif
-else
- ifeq ($(filter $(TARGET_OUT)/% $(TARGET_OUT_VENDOR)/% $(TARGET_OUT_OEM)/%, $(my_module_path)),)
- # If this app isn't to be installed to system, vendor, or oem partitions.
- my_embed_jni := true
- endif
+ifeq ($(filter $(TARGET_OUT)/% $(TARGET_OUT_VENDOR)/% $(TARGET_OUT_OEM)/%, $(my_module_path)),)
+# If this app isn't to be installed to system partitions.
+my_embed_jni := true
endif
# If we're installing this APP as a compressed module, we include all JNI libraries
# in the compressed artifact, rather than as separate files on the partition in question.
diff --git a/core/install_jni_libs_internal.mk b/core/install_jni_libs_internal.mk
index b5f10cf..a99d88a 100644
--- a/core/install_jni_libs_internal.mk
+++ b/core/install_jni_libs_internal.mk
@@ -24,16 +24,11 @@ my_embedded_prebuilt_jni_libs :=
ifdef my_embed_jni
# App explicitly requires the prebuilt NDK stl shared libraies.
# The NDK stl shared libraries should never go to the system image.
-ifneq ($(filter $(LOCAL_NDK_STL_VARIANT), stlport_shared c++_shared),)
+ifeq ($(LOCAL_NDK_STL_VARIANT),c++_shared)
ifndef LOCAL_SDK_VERSION
$(error LOCAL_SDK_VERSION must be defined with LOCAL_NDK_STL_VARIANT, \
LOCAL_PACKAGE_NAME=$(LOCAL_PACKAGE_NAME))
endif
-endif
-ifeq (stlport_shared,$(LOCAL_NDK_STL_VARIANT))
-my_jni_shared_libraries += \
- $(HISTORICAL_NDK_VERSIONS_ROOT)/$(LOCAL_NDK_VERSION)/sources/cxx-stl/stlport/libs/$(TARGET_$(my_2nd_arch_prefix)CPU_ABI)/libstlport_shared.so
-else ifeq (c++_shared,$(LOCAL_NDK_STL_VARIANT))
my_jni_shared_libraries += \
$(HISTORICAL_NDK_VERSIONS_ROOT)/$(LOCAL_NDK_VERSION)/sources/cxx-stl/llvm-libc++/libs/$(TARGET_$(my_2nd_arch_prefix)CPU_ABI)/libc++_shared.so
endif
@@ -108,15 +103,19 @@ endif # inner my_prebuilt_jni_libs
endif # outer my_prebuilt_jni_libs
# Verify that all included libraries are built against the NDK
+include $(BUILD_SYSTEM)/allowed_ndk_types.mk
ifneq ($(strip $(LOCAL_JNI_SHARED_LIBRARIES)),)
ifneq ($(LOCAL_SDK_VERSION),)
my_link_type := app:sdk
-my_warn_types := native:platform
-my_allowed_types := native:ndk
+my_warn_types := native:platform $(my_warn_ndk_types)
+my_allowed_types := $(my_allowed_ndk_types)
+ ifneq (,$(filter true,$(LOCAL_VENDOR_MODULE) $(LOCAL_ODM_MODULE) $(LOCAL_PROPRIETARY_MODULE)))
+ my_allowed_types += native:vendor native:vndk
+ endif
else
my_link_type := app:platform
-my_warn_types :=
-my_allowed_types := native:ndk native:platform native:vendor
+my_warn_types := $(my_warn_ndk_types)
+my_allowed_types := $(my_allowed_ndk_types) native:platform native:vendor native:vndk native:vndk_private
endif
my_link_deps := $(addprefix SHARED_LIBRARIES:,$(LOCAL_JNI_SHARED_LIBRARIES))
diff --git a/core/instrumentation_test_config_template.xml b/core/instrumentation_test_config_template.xml
new file mode 100644
index 0000000..18ea676
--- /dev/null
+++ b/core/instrumentation_test_config_template.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- This test config file is auto-generated. -->
+<configuration description="Runs {LABEL}.">
+ <option name="test-suite-tag" value="apct" />
+ <option name="test-suite-tag" value="apct-instrumentation" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="{MODULE}.apk" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.{TEST_TYPE}" >
+ <option name="package" value="{PACKAGE}" />
+ <option name="runner" value="{RUNNER}" />
+ </test>
+</configuration>
diff --git a/core/jack-default.args b/core/jack-default.args
deleted file mode 100644
index 433bc53..0000000
--- a/core/jack-default.args
+++ /dev/null
@@ -1,9 +0,0 @@
--D sched.runner=multi-threaded
--D sched.runner.thread.kind=fixed
--D sched.runner.thread.fixed.count=4
---sanity-checks off
--D jack.reporter.level.file=error=--,warning=-
---verbose error
--D jack.jayce.cache=false
--D jack.lambda.grouping-scope=package
--D jack.lambda.simplify-stateless=true
diff --git a/core/jacoco.mk b/core/jacoco.mk
index a04d25e..6406df4 100644
--- a/core/jacoco.mk
+++ b/core/jacoco.mk
@@ -19,44 +19,20 @@
# (at the time of authorship, it is included by java.mk and
# java_host_library.mk)
-my_include_filter :=
-my_exclude_filter :=
+# determine Jacoco include/exclude filters even when coverage is not enabled
+# to get syntax checking on LOCAL_JACK_COVERAGE_(INCLUDE|EXCLUDE)_FILTER
+# copy filters from Jack but also skip some known java packages
+my_include_filter := $(strip $(LOCAL_JACK_COVERAGE_INCLUDE_FILTER))
+my_exclude_filter := $(strip $(DEFAULT_JACOCO_EXCLUDE_FILTER),$(LOCAL_JACK_COVERAGE_EXCLUDE_FILTER))
-ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
- ifeq ($(ANDROID_COMPILE_WITH_JACK),false)
- # determine Jacoco include/exclude filters
- DEFAULT_JACOCO_EXCLUDE_FILTER := org/junit/*,org/jacoco/*,org/mockito/*
- # copy filters from Jack but also skip some known java packages
- my_include_filter := $(strip $(LOCAL_JACK_COVERAGE_INCLUDE_FILTER))
- my_exclude_filter := $(strip $(DEFAULT_JACOCO_EXCLUDE_FILTER),$(LOCAL_JACK_COVERAGE_EXCLUDE_FILTER))
-
- # replace '.' with '/' and ',' with ' ', and quote each arg
- ifneq ($(strip $(my_include_filter)),)
- my_include_args := $(strip $(my_include_filter))
-
- my_include_args := $(subst .,/,$(my_include_args))
- my_include_args := '$(subst $(comma),' ',$(my_include_args))'
- else
- my_include_args :=
- endif
-
- # replace '.' with '/' and ',' with ' ', and quote each arg
- ifneq ($(strip $(my_exclude_filter)),)
- my_exclude_args := $(my_exclude_filter)
-
- my_exclude_args := $(subst .,/,$(my_exclude_args))
- my_exclude_args := $(subst $(comma)$(comma),$(comma),$(my_exclude_args))
- my_exclude_args := '$(subst $(comma),' ', $(my_exclude_args))'
- else
- my_exclude_args :=
- endif
- endif # ANDROID_COMPILE_WITH_JACK==false
-endif # LOCAL_EMMA_INSTRUMENT == true
+my_include_args := $(call jacoco-class-filter-to-file-args, $(my_include_filter))
+my_exclude_args := $(call jacoco-class-filter-to-file-args, $(my_exclude_filter))
-# determine whether to run the instrumenter based on whether there is any work
-# for it to do
-ifneq ($(my_include_filter),)
+# single-quote each arg of the include args so the '*' gets evaluated by zip
+# don't quote the exclude args they need to be evaluated by bash for rm -rf
+my_include_args := $(foreach arg,$(my_include_args),'$(arg)')
+ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
my_files := $(intermediates.COMMON)/jacoco
# make a task that unzips the classes that we want to instrument from the
@@ -74,7 +50,8 @@ $(my_unzipped_timestamp_path): $(LOCAL_FULL_CLASSES_PRE_JACOCO_JAR)
unzip -q $(PRIVATE_FULL_CLASSES_PRE_JACOCO_JAR) \
-d $(PRIVATE_UNZIPPED_PATH) \
$(PRIVATE_INCLUDE_ARGS)
- rm -rf $(PRIVATE_EXCLUDE_ARGS)
+ (cd $(PRIVATE_UNZIPPED_PATH) && rm -rf $(PRIVATE_EXCLUDE_ARGS))
+ (cd $(PRIVATE_UNZIPPED_PATH) && find -not -name "*.class" -type f | xargs --no-run-if-empty rm)
touch $(PRIVATE_UNZIPPED_TIMESTAMP_PATH)
# Unfortunately in the previous task above,
# 'rm -rf $(PRIVATE_EXCLUDE_ARGS)' needs to be a separate
@@ -107,8 +84,8 @@ $(my_instrumented_timestamp_path): $(my_unzipped_timestamp_path) $(JACOCO_CLI_JA
mkdir -p $(PRIVATE_INSTRUMENTED_PATH)
java -jar $(JACOCO_CLI_JAR) \
instrument \
- -quiet \
- -dest '$(PRIVATE_INSTRUMENTED_PATH)' \
+ --quiet \
+ --dest '$(PRIVATE_INSTRUMENTED_PATH)' \
$(PRIVATE_UNZIPPED_PATH)
touch $(PRIVATE_INSTRUMENTED_TIMESTAMP_PATH)
@@ -120,12 +97,13 @@ $(my_instrumented_timestamp_path): $(my_unzipped_timestamp_path) $(JACOCO_CLI_JA
$(LOCAL_FULL_CLASSES_JACOCO_JAR): PRIVATE_TEMP_JAR_PATH := $(my_temp_jar_path)
$(LOCAL_FULL_CLASSES_JACOCO_JAR): PRIVATE_INSTRUMENTED_PATH := $(my_instrumented_path)
$(LOCAL_FULL_CLASSES_JACOCO_JAR): PRIVATE_FULL_CLASSES_PRE_JACOCO_JAR := $(LOCAL_FULL_CLASSES_PRE_JACOCO_JAR)
+$(LOCAL_FULL_CLASSES_JACOCO_JAR): $(JAR_ARGS)
$(LOCAL_FULL_CLASSES_JACOCO_JAR): $(my_instrumented_timestamp_path) $(LOCAL_FULL_CLASSES_PRE_JACOCO_JAR)
rm -f $@ $(PRIVATE_TEMP_JAR_PATH)
# copy the pre-jacoco jar (containing files excluded from instrumentation)
cp $(PRIVATE_FULL_CLASSES_PRE_JACOCO_JAR) $(PRIVATE_TEMP_JAR_PATH)
# copy instrumented files back into the resultant jar
- $(JAR) -uf $(PRIVATE_TEMP_JAR_PATH) -C $(PRIVATE_INSTRUMENTED_PATH) .
+ $(JAR) -uf $(PRIVATE_TEMP_JAR_PATH) $(call jar-args-sorted-files-in-directory,$(PRIVATE_INSTRUMENTED_PATH))
mv $(PRIVATE_TEMP_JAR_PATH) $@
# this is used to trigger $(my_classes_to_report_on_path) to build
@@ -133,8 +111,8 @@ $(LOCAL_FULL_CLASSES_JACOCO_JAR): $(my_instrumented_timestamp_path) $(LOCAL_FULL
# dependency.
$(LOCAL_FULL_CLASSES_JACOCO_JAR): $(my_classes_to_report_on_path)
-else # my_include_filter == ''
+else # LOCAL_EMMA_INSTRUMENT != true
LOCAL_FULL_CLASSES_JACOCO_JAR := $(LOCAL_FULL_CLASSES_PRE_JACOCO_JAR)
-endif # my_include_filter != ''
+endif # LOCAL_EMMA_INSTRUMENT == true
LOCAL_INTERMEDIATE_TARGETS += $(LOCAL_FULL_CLASSES_JACOCO_JAR)
diff --git a/core/java.mk b/core/java.mk
index 3601292..9147849 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -18,47 +18,6 @@ endif #PDK
LOCAL_NO_STANDARD_LIBRARIES:=$(strip $(LOCAL_NO_STANDARD_LIBRARIES))
LOCAL_SDK_VERSION:=$(strip $(LOCAL_SDK_VERSION))
-ifneq ($(LOCAL_SDK_VERSION),)
- ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
- $(error $(LOCAL_PATH): Must not define both LOCAL_NO_STANDARD_LIBRARIES and LOCAL_SDK_VERSION)
- else
- ifeq ($(strip $(filter $(LOCAL_SDK_VERSION),$(TARGET_AVAILABLE_SDK_VERSIONS))),)
- $(error $(LOCAL_PATH): Invalid LOCAL_SDK_VERSION '$(LOCAL_SDK_VERSION)' \
- Choices are: $(TARGET_AVAILABLE_SDK_VERSIONS))
- else
- ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current)
- # Use android_stubs_current if LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS.
- LOCAL_JAVA_LIBRARIES := android_stubs_current $(LOCAL_JAVA_LIBRARIES)
- else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current)
- LOCAL_JAVA_LIBRARIES := android_system_stubs_current $(LOCAL_JAVA_LIBRARIES)
- else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),test_current)
- LOCAL_JAVA_LIBRARIES := android_test_stubs_current $(LOCAL_JAVA_LIBRARIES)
- else
- LOCAL_JAVA_LIBRARIES := sdk_v$(LOCAL_SDK_VERSION) $(LOCAL_JAVA_LIBRARIES)
- endif
-
- ifeq ($(LOCAL_SDK_VERSION),current)
- my_jack_min_sdk_version := $(PLATFORM_JACK_MIN_SDK_VERSION)
- else ifeq ($(LOCAL_SDK_VERSION),system_current)
- my_jack_min_sdk_version := $(PLATFORM_JACK_MIN_SDK_VERSION)
- else ifeq ($(LOCAL_SDK_VERSION),test_current)
- my_jack_min_sdk_version := $(PLATFORM_JACK_MIN_SDK_VERSION)
- else
- my_jack_min_sdk_version := $(LOCAL_SDK_VERSION)
- endif
- endif
- endif
-else
- my_jack_min_sdk_version := $(PLATFORM_JACK_MIN_SDK_VERSION)
- ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
- LOCAL_JAVA_LIBRARIES := $(TARGET_DEFAULT_JAVA_LIBRARIES) $(LOCAL_JAVA_LIBRARIES)
- endif
-endif
-
-ifneq (,$(strip $(LOCAL_MIN_SDK_VERSION)))
- my_jack_min_sdk_version := $(LOCAL_MIN_SDK_VERSION)
-endif
-
proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES))
ifneq ($(proto_sources),)
ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),micro)
@@ -100,27 +59,24 @@ endif
intermediates := $(call local-intermediates-dir)
intermediates.COMMON := $(call local-intermediates-dir,COMMON)
-# Choose leaf name for the compiled jar file.
-ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
-full_classes_compiled_jar_leaf := classes-no-debug-var.jar
-built_dex_intermediate_leaf := no-local
-else
-full_classes_compiled_jar_leaf := classes-full-debug.jar
-built_dex_intermediate_leaf := with-local
-endif
-
ifeq ($(LOCAL_PROGUARD_ENABLED),disabled)
LOCAL_PROGUARD_ENABLED :=
endif
-full_classes_compiled_jar := $(intermediates.COMMON)/$(full_classes_compiled_jar_leaf)
+full_classes_turbine_jar := $(intermediates.COMMON)/classes-turbine.jar
+full_classes_header_jarjar := $(intermediates.COMMON)/classes-header-jarjar.jar
+full_classes_header_jar := $(intermediates.COMMON)/classes-header.jar
+full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar
full_classes_processed_jar := $(intermediates.COMMON)/classes-processed.jar
full_classes_desugar_jar := $(intermediates.COMMON)/classes-desugar.jar
-jarjar_leaf := classes-jarjar.jar
-full_classes_jarjar_jar := $(intermediates.COMMON)/$(jarjar_leaf)
+full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar
full_classes_proguard_jar := $(intermediates.COMMON)/classes-proguard.jar
-built_dex_intermediate := $(intermediates.COMMON)/$(built_dex_intermediate_leaf)/classes.dex
+full_classes_combined_jar := $(intermediates.COMMON)/classes-combined.jar
+built_dex_intermediate := $(intermediates.COMMON)/dex/classes.dex
+built_dex_hiddenapi := $(intermediates.COMMON)/dex-hiddenapi/classes.dex
full_classes_stubs_jar := $(intermediates.COMMON)/stubs.jar
+java_source_list_file := $(intermediates.COMMON)/java-source-list
+
ifeq ($(LOCAL_MODULE_CLASS)$(LOCAL_SRC_FILES)$(LOCAL_STATIC_JAVA_LIBRARIES)$(LOCAL_SOURCE_FILES_ALL_GENERATED),APPS)
# If this is an apk without any Java code (e.g. framework-res), we should skip compiling Java.
@@ -130,174 +86,22 @@ else
full_classes_jar := $(intermediates.COMMON)/classes.jar
built_dex := $(intermediates.COMMON)/classes.dex
endif
-# final Jack library, shrinked and obfuscated if it must be
-full_classes_jack := $(intermediates.COMMON)/classes.jack
-# intermediate Jack library without shrink and obfuscation
-noshrob_classes_jack := $(intermediates.COMMON)/classes.noshrob.jack
-jack_check_timestamp := $(intermediates.COMMON)/jack.check.timestamp
LOCAL_INTERMEDIATE_TARGETS += \
+ $(full_classes_turbine_jar) \
$(full_classes_compiled_jar) \
$(full_classes_desugar_jar) \
$(full_classes_jarjar_jar) \
$(full_classes_jar) \
+ $(full_classes_combined_jar) \
$(full_classes_proguard_jar) \
$(built_dex_intermediate) \
- $(full_classes_jack) \
- $(noshrob_classes_jack) \
- $(jack_check_timestamp) \
$(built_dex) \
- $(full_classes_stubs_jar)
-
+ $(full_classes_stubs_jar) \
+ $(java_source_list_file)
LOCAL_INTERMEDIATE_SOURCE_DIR := $(intermediates.COMMON)/src
-###############################################################
-## .rs files: RenderScript sources to .java files and .bc files
-## .fs files: Filterscript sources to .java files and .bc files
-###############################################################
-renderscript_sources := $(filter %.rs %.fs,$(LOCAL_SRC_FILES))
-# Because names of the java files from RenderScript are unknown until the
-# .rs file(s) are compiled, we have to depend on a timestamp file.
-RenderScript_file_stamp :=
-rs_generated_res_dir :=
-rs_compatibility_jni_libs :=
-ifneq ($(renderscript_sources),)
-renderscript_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(renderscript_sources))
-RenderScript_file_stamp := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/RenderScript.stamp
-renderscript_intermediate.COMMON := $(intermediates.COMMON)/renderscript
-
-# Defaulting to an empty string uses the latest available platform SDK.
-renderscript_target_api :=
-
-ifneq (,$(LOCAL_RENDERSCRIPT_TARGET_API))
- renderscript_target_api := $(LOCAL_RENDERSCRIPT_TARGET_API)
-else
- ifneq (,$(LOCAL_SDK_VERSION))
- # Set target-api for LOCAL_SDK_VERSIONs other than current.
- ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
- renderscript_target_api := $(LOCAL_SDK_VERSION)
- endif
- endif # LOCAL_SDK_VERSION is set
-endif # LOCAL_RENDERSCRIPT_TARGET_API is set
-
-# For 64-bit, we always have to upgrade to at least 21 for compat build.
-ifneq ($(LOCAL_RENDERSCRIPT_COMPATIBILITY),)
- ifeq ($(TARGET_IS_64_BIT),true)
- ifneq ($(filter $(RSCOMPAT_32BIT_ONLY_API_LEVELS),$(renderscript_target_api)),)
- renderscript_target_api := 21
- endif
- endif
-endif
-
-ifeq ($(LOCAL_RENDERSCRIPT_CC),)
-LOCAL_RENDERSCRIPT_CC := $(LLVM_RS_CC)
-endif
-
-# Turn on all warnings and warnings as errors for RS compiles.
-# This can be disabled with LOCAL_RENDERSCRIPT_FLAGS := -Wno-error
-renderscript_flags := -Wall -Werror
-renderscript_flags += $(LOCAL_RENDERSCRIPT_FLAGS)
-
-# prepend the RenderScript system include path
-ifneq ($(filter-out current system_current test_current,$(LOCAL_SDK_VERSION))$(if $(TARGET_BUILD_APPS),$(filter current system_current test_current,$(LOCAL_SDK_VERSION))),)
-# if a numeric LOCAL_SDK_VERSION, or current LOCAL_SDK_VERSION with TARGET_BUILD_APPS
-LOCAL_RENDERSCRIPT_INCLUDES := \
- $(HISTORICAL_SDK_VERSIONS_ROOT)/renderscript/clang-include \
- $(HISTORICAL_SDK_VERSIONS_ROOT)/renderscript/include \
- $(LOCAL_RENDERSCRIPT_INCLUDES)
-else
-LOCAL_RENDERSCRIPT_INCLUDES := \
- $(TOPDIR)external/clang/lib/Headers \
- $(TOPDIR)frameworks/rs/script_api/include \
- $(LOCAL_RENDERSCRIPT_INCLUDES)
-endif
-
-ifneq ($(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE),)
-LOCAL_RENDERSCRIPT_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE)
-endif
-
-bc_files := $(patsubst %.fs,%.bc, $(patsubst %.rs,%.bc, $(notdir $(renderscript_sources))))
-bc_dep_files := $(addprefix $(renderscript_intermediate.COMMON)/,$(patsubst %.bc,%.d,$(bc_files)))
-
-$(RenderScript_file_stamp): PRIVATE_RS_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES)
-$(RenderScript_file_stamp): PRIVATE_RS_CC := $(LOCAL_RENDERSCRIPT_CC)
-$(RenderScript_file_stamp): PRIVATE_RS_FLAGS := $(renderscript_flags)
-$(RenderScript_file_stamp): PRIVATE_RS_SOURCE_FILES := $(renderscript_sources_fullpath)
-# By putting the generated java files into $(LOCAL_INTERMEDIATE_SOURCE_DIR), they will be
-# automatically found by the java compiling function transform-java-to-classes.jar.
-$(RenderScript_file_stamp): PRIVATE_RS_OUTPUT_DIR := $(renderscript_intermediate.COMMON)
-$(RenderScript_file_stamp): PRIVATE_RS_TARGET_API := $(renderscript_target_api)
-$(RenderScript_file_stamp): PRIVATE_DEP_FILES := $(bc_dep_files)
-$(RenderScript_file_stamp): $(renderscript_sources_fullpath) $(LOCAL_RENDERSCRIPT_CC)
- $(transform-renderscripts-to-java-and-bc)
-
-# include the dependency files (.d/.P) generated by llvm-rs-cc.
-$(call include-depfile,$(RenderScript_file_stamp).P,$(RenderScript_file_stamp))
-
-ifneq ($(LOCAL_RENDERSCRIPT_COMPATIBILITY),)
-
-
-ifeq ($(filter $(RSCOMPAT_32BIT_ONLY_API_LEVELS),$(renderscript_target_api)),)
-ifeq ($(TARGET_IS_64_BIT),true)
-renderscript_intermediate.bc_folder := $(renderscript_intermediate.COMMON)/res/raw/bc64/
-else
-renderscript_intermediate.bc_folder := $(renderscript_intermediate.COMMON)/res/raw/bc32/
-endif
-else
-renderscript_intermediate.bc_folder := $(renderscript_intermediate.COMMON)/res/raw/
-endif
-
-rs_generated_bc := $(addprefix \
- $(renderscript_intermediate.bc_folder), $(bc_files))
-
-renderscript_intermediate := $(intermediates)/renderscript
-
-# We don't need the .so files in bundled branches
-# Prevent these from showing up on the device
-# One exception is librsjni.so, which is needed for
-# both native path and compat path.
-rs_jni_lib := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/librsjni.so
-LOCAL_JNI_SHARED_LIBRARIES += librsjni
-
-ifneq (,$(TARGET_BUILD_APPS)$(FORCE_BUILD_RS_COMPAT))
-
-rs_compatibility_jni_libs := $(addprefix \
- $(renderscript_intermediate)/librs., \
- $(patsubst %.bc,%.so, $(bc_files)))
-
-$(rs_generated_bc) : $(RenderScript_file_stamp)
-
-rs_support_lib := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/libRSSupport.so
-LOCAL_JNI_SHARED_LIBRARIES += libRSSupport
-
-rs_support_io_lib :=
-# check if the target api level support USAGE_IO
-ifeq ($(filter $(RSCOMPAT_NO_USAGEIO_API_LEVELS),$(renderscript_target_api)),)
-rs_support_io_lib := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/libRSSupportIO.so
-LOCAL_JNI_SHARED_LIBRARIES += libRSSupportIO
-endif
-
-
-$(rs_compatibility_jni_libs): $(RenderScript_file_stamp) $(RS_PREBUILT_CLCORE) \
- $(rs_support_lib) $(rs_support_io_lib) $(rs_jni_lib) $(rs_compiler_rt)
-$(rs_compatibility_jni_libs): $(BCC_COMPAT)
-$(rs_compatibility_jni_libs): PRIVATE_CXX := $(CXX_WRAPPER) $(TARGET_CXX)
-$(rs_compatibility_jni_libs): $(renderscript_intermediate)/librs.%.so: \
- $(renderscript_intermediate.bc_folder)%.bc
- $(transform-bc-to-so)
-
-endif
-
-endif
-
-LOCAL_INTERMEDIATE_TARGETS += $(RenderScript_file_stamp)
-# Make sure the generated resource will be added to the apk.
-rs_generated_res_dir := $(renderscript_intermediate.COMMON)/res
-LOCAL_RESOURCE_DIR := $(rs_generated_res_dir) $(LOCAL_RESOURCE_DIR)
-endif
-
-
###########################################################
## AIDL: Compile .aidl files to .java
###########################################################
@@ -308,7 +112,7 @@ ifneq ($(strip $(aidl_sources)),)
aidl_preprocess_import :=
ifdef LOCAL_SDK_VERSION
-ifneq ($(filter current system_current test_current, $(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS)),)
+ifneq ($(filter current system_current test_current core_current, $(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS)),)
# LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS
aidl_preprocess_import := $(TARGET_OUT_COMMON_INTERMEDIATES)/framework.aidl
else
@@ -320,7 +124,7 @@ LOCAL_AIDL_INCLUDES += $(FRAMEWORKS_BASE_JAVA_SRC_DIRS)
endif # LOCAL_SDK_VERSION
$(foreach s,$(aidl_sources),\
- $(eval $(call define-aidl-java-rule,$(s),$(intermediates.COMMON),aidl_java_sources)))
+ $(eval $(call define-aidl-java-rule,$(s),$(intermediates.COMMON)/aidl,aidl_java_sources)))
$(foreach java,$(aidl_java_sources), \
$(call include-depfile,$(java:%.java=%.P),$(java)))
@@ -339,15 +143,7 @@ endif
# command line.
ifndef LOCAL_CHECKED_MODULE
ifdef full_classes_jar
-ifdef LOCAL_JACK_ENABLED
-ifeq ($(LOCAL_JACK_ENABLED),javac_frontend)
LOCAL_CHECKED_MODULE := $(full_classes_compiled_jar)
-else
-LOCAL_CHECKED_MODULE := $(jack_check_timestamp)
-endif
-else
-LOCAL_CHECKED_MODULE := $(full_classes_compiled_jar)
-endif
endif
endif
@@ -360,11 +156,11 @@ include $(BUILD_SYSTEM)/base_rules.mk
###########################################################
ifneq ($(strip $(logtags_sources)),)
-logtags_java_sources := $(patsubst %.logtags,%.java,$(addprefix $(intermediates.COMMON)/src/, $(logtags_sources)))
+logtags_java_sources := $(patsubst %.logtags,%.java,$(addprefix $(intermediates.COMMON)/logtags/, $(logtags_sources)))
logtags_sources := $(addprefix $(LOCAL_PATH)/, $(logtags_sources))
$(logtags_java_sources): PRIVATE_MERGED_TAG := $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt
-$(logtags_java_sources): $(intermediates.COMMON)/src/%.java: $(LOCAL_PATH)/%.logtags $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt $(JAVATAGS) build/tools/event_log_tags.py
+$(logtags_java_sources): $(intermediates.COMMON)/logtags/%.java: $(LOCAL_PATH)/%.logtags $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt $(JAVATAGS) build/make/tools/event_log_tags.py
$(transform-logtags-to-java)
else
@@ -374,12 +170,12 @@ endif
##########################################
java_sources := $(addprefix $(LOCAL_PATH)/, $(filter %.java,$(LOCAL_SRC_FILES))) $(aidl_java_sources) $(logtags_java_sources) \
$(filter %.java,$(LOCAL_GENERATED_SOURCES))
-all_java_sources := $(java_sources) $(addprefix $(TARGET_OUT_COMMON_INTERMEDIATES)/, $(filter %.java,$(LOCAL_INTERMEDIATE_SOURCES)))
+java_intermediate_sources := $(addprefix $(TARGET_OUT_COMMON_INTERMEDIATES)/, $(filter %.java,$(LOCAL_INTERMEDIATE_SOURCES)))
+all_java_sources := $(java_sources) $(java_intermediate_sources)
include $(BUILD_SYSTEM)/java_common.mk
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HAS_RS_SOURCES := $(if $(renderscript_sources),true)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RS_SOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/renderscript
+include $(BUILD_SYSTEM)/sdk_check.mk
# Set the profile source so that the odex / profile code included from java.mk
# can find it.
@@ -402,13 +198,10 @@ include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk
# Make sure there's something to build.
ifdef full_classes_jar
ifndef need_compile_java
-$(error $(LOCAL_PATH): Target java module does not define any source or resource files)
+$(call pretty-error,Target java module does not define any source or resource files)
endif
endif
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_MIN_SDK_VERSION := $(my_jack_min_sdk_version)
-my_jack_min_sdk_version :=
-
# Since we're using intermediates.COMMON, make sure that it gets cleaned
# properly.
$(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON)
@@ -422,7 +215,7 @@ $(eval $(call copy-one-file,$(full_classes_jar),$(full_classes_stubs_jar)))
ALL_MODULES.$(LOCAL_MODULE).STUBS := $(full_classes_stubs_jar)
# The layers file allows you to enforce a layering between java packages.
-# Run build/tools/java-layers.py for more details.
+# Run build/make/tools/java-layers.py for more details.
layers_file := $(addprefix $(LOCAL_PATH)/, $(LOCAL_JAVA_LAYERS_FILE))
$(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
$(full_classes_compiled_jar): PRIVATE_WARNINGS_ENABLE := $(LOCAL_WARNINGS_ENABLE)
@@ -443,38 +236,98 @@ endif
ifneq (,$(PRODUCT_MINIMIZE_JAVA_DEBUG_INFO))
ifneq (,$(filter userdebug user,$(TARGET_BUILD_VARIANT)))
LOCAL_JAVACFLAGS+= -g:source,lines
-LOCAL_JACK_FLAGS+= -D jack.dex.debug.vars=false -D jack.dex.debug.vars.synthetic=false
endif
endif
-$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
+# List of dependencies for anything that needs all java sources in place
+java_sources_deps := \
+ $(java_sources) \
+ $(java_resource_sources) \
+ $(proto_java_sources_file_stamp) \
+ $(LOCAL_SRCJARS) \
+ $(LOCAL_ADDITIONAL_DEPENDENCIES)
+
+$(java_source_list_file): $(java_sources_deps)
+ $(write-java-source-list)
+
+ifneq ($(TURBINE_ENABLED),false)
+
+$(full_classes_turbine_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
+$(full_classes_turbine_jar): PRIVATE_SRCJARS := $(LOCAL_SRCJARS)
+$(full_classes_turbine_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF)
+$(full_classes_turbine_jar): \
+ $(java_source_list_file) \
+ $(java_sources_deps) \
+ $(full_java_header_libs) \
+ $(full_java_bootclasspath_libs) \
+ $(full_java_system_modules_deps) \
+ $(NORMALIZE_PATH) \
+ $(JAR_ARGS) \
+ $(ZIPTIME) \
+ | $(TURBINE) \
+ $(MERGE_ZIPS)
+ $(transform-java-to-header.jar)
+
+.KATI_RESTAT: $(full_classes_turbine_jar)
+
+# Run jarjar before generate classes-header.jar if necessary.
+ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
+$(full_classes_header_jarjar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
+$(full_classes_header_jarjar): $(full_classes_turbine_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
+ @echo Header JarJar: $@
+ $(hide) $(JAVA) -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
+else
+full_classes_header_jarjar := $(full_classes_turbine_jar)
+endif
+
+$(eval $(call copy-one-file,$(full_classes_header_jarjar),$(full_classes_header_jar)))
+
+endif # TURBINE_ENABLED != false
+
+$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES := $(LOCAL_JAR_EXCLUDE_FILES)
$(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES := $(LOCAL_JAR_PACKAGES)
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES := $(LOCAL_JAR_EXCLUDE_PACKAGES)
$(full_classes_compiled_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF)
+$(full_classes_compiled_jar): PRIVATE_JAVA_SOURCE_LIST := $(java_source_list_file)
+$(full_classes_compiled_jar): PRIVATE_ALL_JAVA_HEADER_LIBRARIES := $(full_java_header_libs)
+$(full_classes_compiled_jar): PRIVATE_SRCJARS := $(LOCAL_SRCJARS)
+$(full_classes_compiled_jar): PRIVATE_SRCJAR_LIST_FILE := $(intermediates.COMMON)/srcjar-list
+$(full_classes_compiled_jar): PRIVATE_SRCJAR_INTERMEDIATES_DIR := $(intermediates.COMMON)/srcjars
$(full_classes_compiled_jar): \
- $(java_sources) \
- $(java_resource_sources) \
- $(full_java_lib_deps) \
- $(jar_manifest_file) \
- $(layers_file) \
- $(RenderScript_file_stamp) \
- $(proto_java_sources_file_stamp) \
- $(annotation_processor_deps) \
- $(NORMALIZE_PATH) \
- $(LOCAL_ADDITIONAL_DEPENDENCIES) \
- | $(SOONG_JAVAC_WRAPPER)
- $(transform-java-to-classes.jar)
+ $(java_source_list_file) \
+ $(full_java_header_libs) \
+ $(java_sources_deps) \
+ $(full_java_bootclasspath_libs) \
+ $(full_java_system_modules_deps) \
+ $(layers_file) \
+ $(annotation_processor_deps) \
+ $(NORMALIZE_PATH) \
+ $(JAR_ARGS) \
+ $(ZIPSYNC) \
+ | $(SOONG_JAVAC_WRAPPER)
+ @echo "Target Java: $@
+ $(call compile-java,$(TARGET_JAVAC),$(PRIVATE_ALL_JAVA_HEADER_LIBRARIES))
javac-check : $(full_classes_compiled_jar)
javac-check-$(LOCAL_MODULE) : $(full_classes_compiled_jar)
+$(full_classes_combined_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF)
+$(full_classes_combined_jar): $(full_classes_compiled_jar) \
+ $(jar_manifest_file) \
+ $(full_static_java_libs) | $(MERGE_ZIPS)
+ $(if $(PRIVATE_JAR_MANIFEST), $(hide) sed -e "s/%BUILD_NUMBER%/$(BUILD_NUMBER_FROM_FILE)/" \
+ $(PRIVATE_JAR_MANIFEST) > $(dir $@)/manifest.mf)
+ $(MERGE_ZIPS) -j --ignore-duplicates $(if $(PRIVATE_JAR_MANIFEST),-m $(dir $@)/manifest.mf) \
+ $(if $(PRIVATE_DONT_DELETE_JAR_META_INF),,-stripDir META-INF -zipToNotStrip $<) \
+ $@ $< $(call reverse-list,$(PRIVATE_STATIC_JAVA_LIBRARIES))
+
ifdef LOCAL_JAR_PROCESSOR
# LOCAL_JAR_PROCESSOR_ARGS must be evaluated here to set up the rule-local
# PRIVATE_JAR_PROCESSOR_ARGS variable, but $< and $@ are not available yet.
# Set ${in} and ${out} so they can be referenced by LOCAL_JAR_PROCESSOR_ARGS
# using deferred evaluation (LOCAL_JAR_PROCESSOR_ARGS = instead of :=).
-in := $(full_classes_compiled_jar)
+in := $(full_classes_combined_jar)
out := $(full_classes_processed_jar).tmp
my_jar_processor := $(HOST_OUT_JAVA_LIBRARIES)/$(LOCAL_JAR_PROCESSOR).jar
@@ -484,7 +337,7 @@ $(full_classes_processed_jar): PRIVATE_TMP_OUT := $(out)
in :=
out :=
-$(full_classes_processed_jar): $(full_classes_compiled_jar) $(my_jar_processor)
+$(full_classes_processed_jar): $(full_classes_combined_jar) $(my_jar_processor)
@echo Processing $@ with $(PRIVATE_JAR_PROCESSOR)
$(hide) rm -f $@ $(PRIVATE_TMP_OUT)
$(hide) $(JAVA) -jar $(PRIVATE_JAR_PROCESSOR) $(PRIVATE_JAR_PROCESSOR_ARGS)
@@ -492,99 +345,109 @@ $(full_classes_processed_jar): $(full_classes_compiled_jar) $(my_jar_processor)
my_jar_processor :=
else
-full_classes_processed_jar := $(full_classes_compiled_jar)
-endif
-
-my_desugaring :=
-ifndef LOCAL_JACK_ENABLED
-ifndef LOCAL_IS_STATIC_JAVA_LIBRARY
-my_desugaring := true
-$(full_classes_desugar_jar): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
-$(full_classes_desugar_jar): $(full_classes_processed_jar) $(DESUGAR)
- $(desugar-classes-jar)
-endif
-endif
-
-ifndef my_desugaring
-full_classes_desugar_jar := $(full_classes_processed_jar)
+full_classes_processed_jar := $(full_classes_combined_jar)
endif
# Run jarjar if necessary
ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
-$(full_classes_jarjar_jar): $(full_classes_desugar_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
+$(full_classes_jarjar_jar): $(full_classes_processed_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
@echo JarJar: $@
$(hide) $(JAVA) -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
else
-full_classes_jarjar_jar := $(full_classes_desugar_jar)
+full_classes_jarjar_jar := $(full_classes_processed_jar)
endif
-LOCAL_FULL_CLASSES_PRE_JACOCO_JAR := $(full_classes_jarjar_jar)
+$(eval $(call copy-one-file,$(full_classes_jarjar_jar),$(full_classes_jar)))
#######################################
+LOCAL_FULL_CLASSES_PRE_JACOCO_JAR := $(full_classes_jar)
+
include $(BUILD_SYSTEM)/jacoco.mk
#######################################
-full_classes_pre_proguard_jar := $(LOCAL_FULL_CLASSES_JACOCO_JAR)
+# Temporarily enable --multi-dex until proguard supports v53 class files
+# ( http://b/67673860 ) or we move away from proguard altogether.
+ifdef TARGET_OPENJDK9
+LOCAL_DX_FLAGS := $(filter-out --multi-dex,$(LOCAL_DX_FLAGS)) --multi-dex
+endif
+
+ifneq ($(USE_D8_DESUGAR),true)
+my_desugaring :=
+ifndef LOCAL_IS_STATIC_JAVA_LIBRARY
+my_desugaring := true
+$(full_classes_desugar_jar): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
+$(full_classes_desugar_jar): $(LOCAL_FULL_CLASSES_JACOCO_JAR) $(full_java_header_libs) $(DESUGAR)
+ $(desugar-classes-jar)
+endif
+else
+my_desugaring :=
+endif
+
+ifndef my_desugaring
+full_classes_desugar_jar := $(LOCAL_FULL_CLASSES_JACOCO_JAR)
+endif
+
+full_classes_pre_proguard_jar := $(full_classes_desugar_jar)
# Keep a copy of the jar just before proguard processing.
$(eval $(call copy-one-file,$(full_classes_pre_proguard_jar),$(intermediates.COMMON)/classes-pre-proguard.jar))
# Run proguard if necessary
ifdef LOCAL_PROGUARD_ENABLED
-ifneq ($(filter-out full custom nosystem obfuscation optimization shrinktests,$(LOCAL_PROGUARD_ENABLED)),)
+ifneq ($(filter-out full custom obfuscation optimization,$(LOCAL_PROGUARD_ENABLED)),)
$(warning while processing: $(LOCAL_MODULE))
$(error invalid value for LOCAL_PROGUARD_ENABLED: $(LOCAL_PROGUARD_ENABLED))
endif
proguard_dictionary := $(intermediates.COMMON)/proguard_dictionary
-jack_dictionary := $(intermediates.COMMON)/jack_dictionary
-# Hack: see b/20667396
-# When an app's LOCAL_SDK_VERSION is lower than the support library's LOCAL_SDK_VERSION,
-# we artifically raises the "SDK version" "linked" by ProGuard, to
+# When an app contains references to APIs that are not in the SDK specified by
+# its LOCAL_SDK_VERSION for example added by support library or by runtime
+# classes added by desugar, we artifically raise the "SDK version" "linked" by
+# ProGuard, to
# - suppress ProGuard warnings of referencing symbols unknown to the lower SDK version.
# - prevent ProGuard stripping subclass in the support library that extends class added in the higher SDK version.
-my_support_library_sdk_raise :=
-ifneq (,$(filter android-support-%,$(LOCAL_STATIC_JAVA_LIBRARIES)))
+# See b/20667396
+my_proguard_sdk_raise :=
ifdef LOCAL_SDK_VERSION
ifdef TARGET_BUILD_APPS
-ifeq (,$(filter current system_current test_current, $(LOCAL_SDK_VERSION)))
- my_support_library_sdk_raise := $(call java-lib-files, sdk_vcurrent)
+ifeq (,$(filter current system_current test_current core_current, $(LOCAL_SDK_VERSION)))
+ my_proguard_sdk_raise := $(call java-lib-header-files, sdk_vcurrent)
endif
else
# For platform build, we can't just raise to the "current" SDK,
# that would break apps that use APIs removed from the current SDK.
- my_support_library_sdk_raise := $(call java-lib-files,$(TARGET_DEFAULT_JAVA_LIBRARIES))
+ my_proguard_sdk_raise := $(call java-lib-header-files,$(TARGET_DEFAULT_BOOTCLASSPATH_LIBRARIES) $(TARGET_DEFAULT_JAVA_LIBRARIES))
endif
endif
+
+ifeq ($(USE_R8),true)
+proguard_jars_prefix := -libraryjars
+else
+proguard_jars_prefix := -systemjars
endif
+legacy_proguard_flags := $(addprefix $(proguard_jars_prefix) ,$(my_proguard_sdk_raise) \
+ $(filter-out $(my_proguard_sdk_raise), \
+ $(full_java_bootclasspath_libs) \
+ $(full_shared_java_header_libs)))
-# jack already has the libraries in its classpath and doesn't support jars
-legacy_proguard_flags := $(addprefix -libraryjars ,$(my_support_library_sdk_raise) \
- $(filter-out $(my_support_library_sdk_raise),$(full_shared_java_libs)))
+legacy_proguard_lib_deps := $(my_proguard_sdk_raise) \
+ $(filter-out $(my_proguard_sdk_raise),$(full_shared_java_header_libs))
legacy_proguard_flags += -printmapping $(proguard_dictionary)
-jack_proguard_flags := -printmapping $(jack_dictionary)
common_proguard_flags := -forceprocessing
-common_proguard_flag_files :=
-ifeq ($(filter nosystem,$(LOCAL_PROGUARD_ENABLED)),)
-common_proguard_flag_files += $(BUILD_SYSTEM)/proguard.flags
-ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
-ifdef LOCAL_JACK_ENABLED
-common_proguard_flag_files += $(BUILD_SYSTEM)/proguard.jacoco.flags
-else
-common_proguard_flags += -include $(BUILD_SYSTEM)/proguard.emma.flags
-endif # LOCAL_JACK_ENABLED
-endif
-# If this is a test package, add proguard keep flags for tests.
+common_proguard_flag_files := $(BUILD_SYSTEM)/proguard.flags
ifneq ($(LOCAL_INSTRUMENTATION_FOR)$(filter tests,$(LOCAL_MODULE_TAGS)),)
-common_proguard_flag_files += $(BUILD_SYSTEM)/proguard_tests.flags
-ifeq ($(filter shrinktests,$(LOCAL_PROGUARD_ENABLED)),)
common_proguard_flags += -dontshrink # don't shrink tests by default
-endif # shrinktests
endif # test package
+ifneq ($(LOCAL_PROGUARD_ENABLED),custom)
+ ifdef LOCAL_USE_AAPT2
+ common_proguard_flag_files += $(foreach l,$(LOCAL_STATIC_ANDROID_LIBRARIES),\
+ $(call intermediates-dir-for,JAVA_LIBRARIES,$(l),,COMMON)/export_proguard_flags)
+ endif
+endif
ifneq ($(common_proguard_flag_files),)
common_proguard_flags += $(addprefix -include , $(common_proguard_flag_files))
# This is included from $(BUILD_SYSTEM)/proguard.flags
@@ -604,8 +467,8 @@ ifdef LOCAL_INSTRUMENTATION_FOR
ifeq ($(filter obfuscation,$(LOCAL_PROGUARD_ENABLED)),)
# If no obfuscation, link in the instrmented package's classes.jar as a library.
# link_instr_classes_jar is defined in base_rule.mk
-# jack already has this library in its classpath and doesn't support jars
legacy_proguard_flags += -libraryjars $(link_instr_classes_jar)
+legacy_proguard_lib_deps += $(link_instr_classes_jar)
else # obfuscation
# If obfuscation is enabled, the main app must be obfuscated too.
# We need to run obfuscation using the main app's dictionary,
@@ -616,10 +479,6 @@ legacy_proguard_flags := -injars $(link_instr_classes_jar) \
-applymapping $(link_instr_intermediates_dir.COMMON)/proguard_dictionary \
-verbose \
$(legacy_proguard_flags)
-ifdef LOCAL_JACK_ENABLED
-jack_proguard_flags += -applymapping $(link_instr_intermediates_dir.COMMON)/jack_dictionary
-full_jack_deps += $(link_instr_intermediates_dir.COMMON)/jack_dictionary
-endif
# Sometimes (test + main app) uses different keep rules from the main app -
# apply the main app's dictionary anyway.
@@ -630,9 +489,11 @@ $(full_classes_proguard_jar) : $(link_instr_intermediates_dir.COMMON)/proguard.c
endif # no obfuscation
endif # LOCAL_INSTRUMENTATION_FOR
-endif # LOCAL_PROGUARD_ENABLED is not nosystem
proguard_flag_files := $(addprefix $(LOCAL_PATH)/, $(LOCAL_PROGUARD_FLAG_FILES))
+ifeq ($(USE_R8),true)
+proguard_flag_files += $(addprefix $(LOCAL_PATH)/, $(LOCAL_R8_FLAG_FILES))
+endif # USE_R8
LOCAL_PROGUARD_FLAGS += $(addprefix -include , $(proguard_flag_files))
ifdef LOCAL_TEST_MODULE_TO_PROGUARD_WITH
@@ -641,52 +502,66 @@ else
extra_input_jar :=
endif
-# If not using jack and building against the current SDK version then filter
-# out the junit, android.test and c.a.i.u.Predicate classes that are to be
-# removed from the Android API as part of b/30188076 but which are still
-# present in the Android API. This is to allow changes to be made to the
-# build to statically include those classes into the application without
-# simultaneously removing those classes from the API.
-proguard_injar_filters :=
-ifndef LOCAL_JACK_ENABLED
-ifdef LOCAL_SDK_VERSION
-ifeq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
-proguard_injar_filters := (!junit/framework/**,!junit/runner/**,!junit/textui/**,!android/test/**,!com/android/internal/util/*)
-endif
+ifneq ($(filter obfuscation,$(LOCAL_PROGUARD_ENABLED)),)
+ifneq ($(USE_R8),true)
+ $(full_classes_proguard_jar): .KATI_IMPLICIT_OUTPUTS := $(proguard_dictionary)
+else
+ $(built_dex_intermediate): .KATI_IMPLICIT_OUTPUTS := $(proguard_dictionary)
endif
endif
-$(full_classes_proguard_jar): PRIVATE_PROGUARD_INJAR_FILTERS := $(proguard_injar_filters)
+# If R8 is not enabled run Proguard.
+ifneq ($(USE_R8),true)
+# Changes to these dependencies need to be replicated below when using R8
+# instead of Proguard + dx.
$(full_classes_proguard_jar): PRIVATE_EXTRA_INPUT_JAR := $(extra_input_jar)
$(full_classes_proguard_jar): PRIVATE_PROGUARD_FLAGS := $(legacy_proguard_flags) $(common_proguard_flags) $(LOCAL_PROGUARD_FLAGS)
-$(full_classes_proguard_jar) : $(full_classes_pre_proguard_jar) $(extra_input_jar) $(my_support_library_sdk_raise) $(common_proguard_flag_files) $(proguard_flag_files) | $(PROGUARD)
+$(full_classes_proguard_jar) : $(full_classes_pre_proguard_jar) $(extra_input_jar) $(my_proguard_sdk_raise) $(common_proguard_flag_files) $(proguard_flag_files) $(legacy_proguard_lib_deps) | $(PROGUARD)
$(call transform-jar-to-proguard)
+else # !USE_R8
+# Running R8 instead of Proguard, proguarded jar is actually the pre-Proguarded jar.
+full_classes_proguard_jar := $(full_classes_pre_proguard_jar)
+endif # !USE_R8
else # LOCAL_PROGUARD_ENABLED not defined
+proguard_flag_files :=
full_classes_proguard_jar := $(full_classes_pre_proguard_jar)
endif # LOCAL_PROGUARD_ENABLED defined
-$(eval $(call copy-one-file,$(full_classes_proguard_jar),$(full_classes_jar)))
-
-$(call define-jar-to-toc-rule, $(full_classes_jar))
-
ifneq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
-ifndef LOCAL_JACK_ENABLED
$(built_dex_intermediate): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
-# If you instrument class files that have local variable debug information in
-# them emma does not correctly maintain the local variable table.
-# This will cause an error when you try to convert the class files for Android.
-# The workaround here is to build different dex file here based on emma switch
-# then later copy into classes.dex. When emma is on, dx is run with --no-locals
-# option to remove local variable information
-ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
-$(built_dex_intermediate): PRIVATE_DX_FLAGS += --no-locals
-endif
-$(built_dex_intermediate): $(full_classes_jar) $(DX)
+
+my_r8 :=
+ifdef LOCAL_PROGUARD_ENABLED
+ifeq ($(USE_R8),true)
+# These are the dependencies for the proguarded jar when running
+# Proguard + dx. They are used for the generated dex when using R8, as
+# R8 does Proguard + dx
+my_r8 := true
+$(built_dex_intermediate): PRIVATE_EXTRA_INPUT_JAR := $(extra_input_jar)
+$(built_dex_intermediate): PRIVATE_PROGUARD_FLAGS := $(legacy_proguard_flags) $(common_proguard_flags) $(LOCAL_PROGUARD_FLAGS)
+$(built_dex_intermediate) : $(full_classes_proguard_jar) $(extra_input_jar) $(my_support_library_sdk_raise) $(common_proguard_flag_files) $(proguard_flag_files) $(legacy_proguard_lib_deps) $(R8_COMPAT_PROGUARD)
+ $(transform-jar-to-dex-r8)
+endif # USE_R8
+endif # LOCAL_PROGUARD_ENABLED
+
+ifndef my_r8
+$(built_dex_intermediate): $(full_classes_proguard_jar) $(DX) $(ZIP2ZIP)
+ifneq ($(USE_D8_DESUGAR),true)
$(transform-classes.jar-to-dex)
-endif # LOCAL_JACK_ENABLED is disabled
+else
+ $(transform-classes-d8.jar-to-dex)
+endif
+endif
-$(built_dex): $(built_dex_intermediate)
+ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),) # is_boot_jar
+ $(eval $(call hiddenapi-copy-dex-files,$(built_dex_intermediate),$(built_dex_hiddenapi)))
+ built_dex_copy_from := $(built_dex_hiddenapi)
+else # !is_boot_jar
+ built_dex_copy_from := $(built_dex_intermediate)
+endif # is_boot_jar
+
+$(built_dex): $(built_dex_copy_from)
@echo Copying: $@
$(hide) mkdir -p $(dir $@)
$(hide) rm -f $(dir $@)/classes*.dex
@@ -722,135 +597,20 @@ $(LOCAL_MODULE)-findbugs : $(findbugs_html)
endif # full_classes_jar is defined
-ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(LOCAL_SDK_VERSION)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SDK_VERSION := $(LOCAL_SDK_VERSION)
-else
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(DEFAULT_APP_TARGET_SDK)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SDK_VERSION := $(PLATFORM_SDK_VERSION)
-endif
-
-ifdef LOCAL_JACK_ENABLED
-$(LOCAL_INTERMEDIATE_TARGETS): \
- PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-rsc
-ifeq ($(LOCAL_JACK_ENABLED),incremental)
-$(LOCAL_INTERMEDIATE_TARGETS): \
- PRIVATE_JACK_INCREMENTAL_DIR := $(intermediates.COMMON)/jack-incremental
-$(noshrob_classes_jack): PRIVATE_JACK_INCREMENTAL_DIR := $(intermediates.COMMON)/jack-noshrob-incremental
-$(jack_check_timestamp): PRIVATE_JACK_INCREMENTAL_DIR := $(intermediates.COMMON)/jack-check-incremental
+ifneq (,$(filter-out current system_current test_current core_current, $(LOCAL_SDK_VERSION)))
+ my_default_app_target_sdk := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
+ my_sdk_version := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
else
-$(LOCAL_INTERMEDIATE_TARGETS): \
- PRIVATE_JACK_INCREMENTAL_DIR :=
-$(noshrob_classes_jack): PRIVATE_JACK_INCREMENTAL_DIR :=
-$(jack_check_timestamp): PRIVATE_JACK_INCREMENTAL_DIR :=
+ my_default_app_target_sdk := $(DEFAULT_APP_TARGET_SDK)
+ my_sdk_version := $(PLATFORM_SDK_VERSION)
endif
-ifdef full_classes_jar
-ifdef LOCAL_PROGUARD_ENABLED
-
-ifndef LOCAL_JACK_PROGUARD_FLAGS
- LOCAL_JACK_PROGUARD_FLAGS := $(LOCAL_PROGUARD_FLAGS)
-endif
-LOCAL_JACK_PROGUARD_FLAGS += $(addprefix -include , $(proguard_flag_files))
-ifdef LOCAL_TEST_MODULE_TO_PROGUARD_WITH
- $(error $(LOCAL_MODULE): Build with jack when LOCAL_TEST_MODULE_TO_PROGUARD_WITH is defined is not yet implemented)
+ifdef LOCAL_MIN_SDK_VERSION
+ my_min_sdk_version := $(LOCAL_MIN_SDK_VERSION)
+else
+ my_min_sdk_version := $(call codename-or-sdk-to-sdk,$(my_default_app_target_sdk))
endif
-# $(jack_dictionary) is just by-product of $(built_dex_intermediate).
-# The dummy command was added because, without it, make misses the fact the $(built_dex) also
-# change $(jack_dictionary).
-$(jack_dictionary): $(full_classes_jack)
- $(hide) touch $@
-
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_PROGUARD_FLAGS := $(common_proguard_flags) $(jack_proguard_flags) $(LOCAL_JACK_PROGUARD_FLAGS)
-else # LOCAL_PROGUARD_ENABLED not defined
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_PROGUARD_FLAGS :=
-endif # LOCAL_PROGUARD_ENABLED defined
-
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_FLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JACK_FLAGS) $(annotation_processor_flags)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_VERSION := $(LOCAL_JACK_VERSION)
-
-jack_all_deps := $(java_sources) $(java_resource_sources) $(full_jack_deps) \
- $(jar_manifest_file) $(layers_file) $(RenderScript_file_stamp) \
- $(common_proguard_flag_files) $(proguard_flag_files) \
- $(proto_java_sources_file_stamp) $(annotation_processor_deps) \
- $(LOCAL_ADDITIONAL_DEPENDENCIES) $(LOCAL_JARJAR_RULES) \
- $(NORMALIZE_PATH) $(JACK_DEFAULT_ARGS) $(JACK)
-
-$(jack_check_timestamp): $(jack_all_deps) | setup-jack-server
- @echo Checking build with Jack: $@
- $(jack-check-java)
-
-ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
-$(full_classes_jack): PRIVATE_JACK_PLUGIN_PATH := $(LOCAL_JACK_PLUGIN_PATH)
-$(full_classes_jack): PRIVATE_JACK_PLUGIN := $(LOCAL_JACK_PLUGIN)
-$(full_classes_jack): $(jack_all_deps) $(LOCAL_JACK_PLUGIN_PATH) | setup-jack-server
- @echo Building with Jack: $@
- $(java-to-jack)
-
-# Update timestamps of .toc files for static java libraries so
-# dependents will be always rebuilt.
-$(built_dex).toc: $(full_classes_jack)
- touch $@
-
-else #LOCAL_IS_STATIC_JAVA_LIBRARY
-$(built_dex_intermediate): PRIVATE_CLASSES_JACK := $(full_classes_jack)
-
-ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
-LOCAL_JACK_PLUGIN_PATH += $(HOST_OUT_JAVA_LIBRARIES)/jack-coverage-plugin.jar
-LOCAL_JACK_PLUGIN += com.android.jack.coverage.CodeCoverage
-$(built_dex_intermediate): PRIVATE_JACK_COVERAGE_OPTIONS := \
- -D jack.coverage=true \
- -D jack.coverage.metadata.file=$(intermediates.COMMON)/coverage.em \
- -D jack.coverage.jacoco.package=$(JACOCO_PACKAGE_NAME) \
- $(addprefix -D jack.coverage.jacoco.include=,$(LOCAL_JACK_COVERAGE_INCLUDE_FILTER)) \
- $(addprefix -D jack.coverage.jacoco.exclude=,$(LOCAL_JACK_COVERAGE_EXCLUDE_FILTER))
-else
-$(built_dex_intermediate): PRIVATE_JACK_COVERAGE_OPTIONS :=
-endif
-
-# Compiling with javac to jar, then converting jar to dex with jack
-ifeq ($(LOCAL_JACK_ENABLED),javac_frontend)
-
-# PRIVATE_EXTRA_JAR_ARGS and source files were already handled during javac
-$(built_dex_intermediate): PRIVATE_EXTRA_JAR_ARGS :=
-$(built_dex_intermediate): PRIVATE_JAVA_SOURCES :=
-$(built_dex_intermediate): PRIVATE_SOURCE_INTERMEDIATES_DIR :=
-$(built_dex_intermediate): PRIVATE_HAS_PROTO_SOURCES :=
-$(built_dex_intermediate): PRIVATE_HAS_RS_SOURCES :=
-
-# Incremental compilation is not supported when mixing javac and jack
-$(built_dex_intermediate): PRIVATE_JACK_INCREMENTAL_DIR :=
-
-# Pass output of javac to jack
-$(built_dex_intermediate): PRIVATE_JACK_IMPORT_JAR := $(full_classes_compiled_jar)
-$(built_dex_intermediate): $(full_classes_compiled_jar)
-else # LOCAL_JACK_ENABLED != javac_frontend
-$(built_dex_intermediate): PRIVATE_JACK_IMPORT_JAR :=
-endif # LOCAL_JACK_ENABLED != javac_frontend
-
-$(built_dex_intermediate): PRIVATE_JACK_PLUGIN_PATH := $(LOCAL_JACK_PLUGIN_PATH)
-$(built_dex_intermediate): PRIVATE_JACK_PLUGIN := $(LOCAL_JACK_PLUGIN)
-$(built_dex_intermediate): $(jack_all_deps) $(LOCAL_JACK_PLUGIN_PATH) | setup-jack-server
- @echo Building with Jack: $@
- $(jack-java-to-dex)
-
-# $(full_classes_jack) is just by-product of $(built_dex_intermediate).
-# The dummy command was added because, without it, make misses the fact the $(built_dex) also
-# change $(full_classes_jack).
-$(full_classes_jack): $(built_dex_intermediate)
- $(hide) touch $@
-
-$(call define-dex-to-toc-rule, $(intermediates.COMMON))
-
-endif #LOCAL_IS_STATIC_JAVA_LIBRARY
-
-$(noshrob_classes_jack): PRIVATE_JACK_PLUGIN_PATH := $(LOCAL_JACK_PLUGIN_PATH)
-$(noshrob_classes_jack): PRIVATE_JACK_PLUGIN := $(LOCAL_JACK_PLUGIN)
-$(noshrob_classes_jack): PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-noshrob-rsc
-$(noshrob_classes_jack): PRIVATE_JACK_PROGUARD_FLAGS :=
-$(noshrob_classes_jack): $(jack_all_deps) $(LOCAL_JACK_PLUGIN_PATH) | setup-jack-server
- @echo Building with Jack: $@
- $(java-to-jack)
-endif # full_classes_jar is defined
-endif # LOCAL_JACK_ENABLED
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(my_default_app_target_sdk)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SDK_VERSION := $(my_sdk_version)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_MIN_SDK_VERSION := $(my_min_sdk_version)
diff --git a/core/java_common.mk b/core/java_common.mk
index bf7f039..8f4611e 100644
--- a/core/java_common.mk
+++ b/core/java_common.mk
@@ -1,5 +1,11 @@
# Common to host and target Java modules.
+my_soong_problems :=
+
+ifneq ($(filter ../%,$(LOCAL_SRC_FILES)),)
+my_soong_problems += dotdot_srcs
+endif
+
###########################################################
## Java version
###########################################################
@@ -15,18 +21,47 @@
# Modules can override this logic by specifying
# LOCAL_JAVA_LANGUAGE_VERSION explicitly.
ifeq (,$(LOCAL_JAVA_LANGUAGE_VERSION))
- private_sdk_versions_without_any_java_18_support := 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
- ifneq (,$(filter $(LOCAL_SDK_VERSION), $(private_sdk_versions_without_any_java_18_support)))
+ ifneq (,$(filter $(LOCAL_SDK_VERSION), $(TARGET_SDK_VERSIONS_WITHOUT_JAVA_18_SUPPORT)))
LOCAL_JAVA_LANGUAGE_VERSION := 1.7
- else
+ else ifneq (,$(filter $(LOCAL_SDK_VERSION), $(TARGET_SDK_VERSIONS_WITHOUT_JAVA_19_SUPPORT)))
+ LOCAL_JAVA_LANGUAGE_VERSION := 1.8
+ else ifneq (,$(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS))
+ # TODO(ccross): allow 1.9 for current and unbundled once we have SDK system modules
LOCAL_JAVA_LANGUAGE_VERSION := 1.8
+ else
+ # DEFAULT_JAVA_LANGUAGE_VERSION is 1.8, unless TARGET_OPENJDK9 in which case it is 1.9
+ LOCAL_JAVA_LANGUAGE_VERSION := $(DEFAULT_JAVA_LANGUAGE_VERSION)
endif
endif
LOCAL_JAVACFLAGS += -source $(LOCAL_JAVA_LANGUAGE_VERSION) -target $(LOCAL_JAVA_LANGUAGE_VERSION)
###########################################################
+
+# OpenJDK versions up to 8 shipped with bootstrap and tools jars
+# (rt.jar, jce.jar, tools.jar etc.). These are no longer part of
+# OpenJDK 9, but we still make them available for host tools that
+# are targeting older versions.
+USE_HOST_BOOTSTRAP_JARS := true
+ifeq (,$(filter $(LOCAL_JAVA_LANGUAGE_VERSION), 1.6 1.7 1.8))
+USE_HOST_BOOTSTRAP_JARS := false
+endif
+
+###########################################################
+
+# Drop HOST_JDK_TOOLS_JAR from classpath when targeting versions > 9 (which don't have it).
+# TODO: Remove HOST_JDK_TOOLS_JAR and all references to it once host
+# bootstrap jars are no longer supported (ie. when USE_HOST_BOOTSTRAP_JARS
+# is always false). http://b/38418220
+ifneq ($(USE_HOST_BOOTSTRAP_JARS),true)
+LOCAL_CLASSPATH := $(filter-out $(HOST_JDK_TOOLS_JAR),$(LOCAL_CLASSPATH))
+endif
+
+###########################################################
## .proto files: Compile proto files to .java
###########################################################
+ifeq ($(strip $(LOCAL_PROTOC_OPTIMIZE_TYPE)),)
+ LOCAL_PROTOC_OPTIMIZE_TYPE := lite
+endif
proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES))
# Because names of the .java files compiled from .proto files are unknown until the
# .proto files are compiled, we use a timestamp file as depedency.
@@ -56,7 +91,7 @@ $(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --java_out
endif
endif
$(proto_java_sources_file_stamp): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS)
-$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_PARAMS := $(LOCAL_PROTO_JAVA_OUTPUT_PARAMS)
+$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_PARAMS := $(if $(filter lite,$(LOCAL_PROTOC_OPTIMIZE_TYPE)),lite$(if $(LOCAL_PROTO_JAVA_OUTPUT_PARAMS),:,),)$(LOCAL_PROTO_JAVA_OUTPUT_PARAMS)
$(proto_java_sources_file_stamp) : $(proto_sources_fullpath) $(PROTOC)
$(call transform-proto-to-java)
@@ -142,7 +177,7 @@ endif # java_resource_file_groups
#####################################
## Warn if there is unrecognized file in LOCAL_SRC_FILES.
my_unknown_src_files := $(filter-out \
- %.java %.aidl %.proto %.logtags %.fs %.rs, \
+ %.java %.aidl %.proto %.logtags, \
$(LOCAL_SRC_FILES) $(LOCAL_INTERMEDIATE_SOURCES) $(LOCAL_GENERATED_SOURCES))
ifneq ($(my_unknown_src_files),)
$(warning $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): Unused source files: $(my_unknown_src_files))
@@ -153,14 +188,14 @@ endif
# LOCAL_SOURCE_FILES_ALL_GENERATED is set only if the module does not have static source files,
# but generated source files in its LOCAL_INTERMEDIATE_SOURCE_DIR.
# You have to set up the dependency in some other way.
-need_compile_java := $(strip $(all_java_sources)$(all_res_assets)$(java_resource_sources))$(LOCAL_STATIC_JAVA_LIBRARIES)$(filter true,$(LOCAL_SOURCE_FILES_ALL_GENERATED))
+need_compile_java := $(strip $(all_java_sources)$(LOCAL_SRCJARS)$(all_res_assets)$(java_resource_sources))$(LOCAL_STATIC_JAVA_LIBRARIES)$(filter true,$(LOCAL_SOURCE_FILES_ALL_GENERATED))
ifdef need_compile_java
annotation_processor_flags :=
annotation_processor_deps :=
ifdef LOCAL_ANNOTATION_PROCESSORS
- annotation_processor_jars := $(call java-lib-deps,$(LOCAL_ANNOTATION_PROCESSORS),true)
+ annotation_processor_jars := $(call java-lib-files,$(LOCAL_ANNOTATION_PROCESSORS),true)
annotation_processor_flags += -processorpath $(call normalize-path-list,$(annotation_processor_jars))
annotation_processor_deps += $(annotation_processor_jars)
@@ -170,12 +205,11 @@ ifdef LOCAL_ANNOTATION_PROCESSORS
annotation_processor_jars :=
endif
-full_static_java_libs := \
- $(foreach lib,$(LOCAL_STATIC_JAVA_LIBRARIES), \
- $(call intermediates-dir-for, \
- JAVA_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),COMMON)/classes.jar)
+full_static_java_libs := $(call java-lib-files,$(LOCAL_STATIC_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
+full_static_java_header_libs := $(call java-lib-header-files,$(LOCAL_STATIC_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JAVA_LIBRARIES := $(full_static_java_libs)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JAVA_HEADER_LIBRARIES := $(full_static_java_header_libs)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASSET_DIR := $(LOCAL_ASSET_DIR)
@@ -187,90 +221,157 @@ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HAS_PROTO_SOURCES := $(if $(proto_sources
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_PROTO_SOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/proto
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HAS_RS_SOURCES :=
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_SOURCES := $(all_java_sources)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_SOURCE_LIST := $(java_source_list_file)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RMTYPEDEFS := $(LOCAL_RMTYPEDEFS)
-# full_java_libs: The list of files that should be used as the classpath.
-# Using this list as a dependency list WILL NOT WORK.
-# full_java_lib_deps: Should be specified as a prerequisite of this module
-# to guarantee that the files in full_java_libs will
-# be up-to-date.
+full_java_bootclasspath_libs :=
+empty_bootclasspath :=
+my_system_modules :=
+
ifndef LOCAL_IS_HOST_MODULE
-ifeq ($(LOCAL_SDK_VERSION),)
-ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
-# No bootclasspath. But we still need "" to prevent javac from using default host bootclasspath.
-my_bootclasspath := ""
-else # LOCAL_NO_STANDARD_LIBRARIES
-my_bootclasspath := $(call java-lib-files,core-oj):$(call java-lib-files,core-libart)
-endif # LOCAL_NO_STANDARD_LIBRARIES
-else
-ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current)
-# LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS.
-my_bootclasspath := $(call java-lib-files,android_stubs_current)
-else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current)
-my_bootclasspath := $(call java-lib-files,android_system_stubs_current)
-else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),test_current)
-my_bootclasspath := $(call java-lib-files,android_test_stubs_current)
-else
-my_bootclasspath := $(call java-lib-files,sdk_v$(LOCAL_SDK_VERSION))
-endif # current, system_current, or test_current
-endif # LOCAL_SDK_VERSION
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(my_bootclasspath)
-
-# In order to compile lambda code javac requires various invokedynamic-
-# related classes to be present. This change adds stubs needed for
-# javac to compile lambdas.
-my_additional_javac_libs :=
-ifndef TARGET_BUILD_APPS
-# TODO: support to build lamdbas using javac in unbundled build.
-# We may need to check in a prebuilt core-lambda-stubs to prebuilts/sdk.
-ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
-my_additional_javac_libs := core-lambda-stubs
-endif
-endif
+ ifeq ($(LOCAL_SDK_VERSION),)
+ ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
+ # No bootclasspath. But we still need "" to prevent javac from using default host bootclasspath.
+ empty_bootclasspath := ""
+ # Most users of LOCAL_NO_STANDARD_LIBRARIES really mean no framework libs,
+ # and manually add back the core libs. The ones that don't are in soong
+ # now, so just always assume that they want the default system modules
+ my_system_modules := $(DEFAULT_SYSTEM_MODULES)
+ else # LOCAL_NO_STANDARD_LIBRARIES
+ full_java_bootclasspath_libs := $(call java-lib-header-files,$(TARGET_DEFAULT_BOOTCLASSPATH_LIBRARIES) $(TARGET_DEFAULT_JAVA_LIBRARIES))
+ LOCAL_JAVA_LIBRARIES := $(filter-out $(TARGET_DEFAULT_BOOTCLASSPATH_LIBRARIES) $(TARGET_DEFAULT_JAVA_LIBRARIES),$(LOCAL_JAVA_LIBRARIES))
+ my_system_modules := $(DEFAULT_SYSTEM_MODULES)
+ endif # LOCAL_NO_STANDARD_LIBRARIES
+ else
+ ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
+ $(call pretty-error,Must not define both LOCAL_NO_STANDARD_LIBRARIES and LOCAL_SDK_VERSION)
+ endif
+ ifeq ($(strip $(filter $(LOCAL_SDK_VERSION),$(TARGET_AVAILABLE_SDK_VERSIONS))),)
+ $(call pretty-error,Invalid LOCAL_SDK_VERSION '$(LOCAL_SDK_VERSION)' \
+ Choices are: $(TARGET_AVAILABLE_SDK_VERSIONS))
+ endif
+ ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current)
+ # LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS.
+ full_java_bootclasspath_libs := $(call java-lib-header-files,android_stubs_current)
+ else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current)
+ full_java_bootclasspath_libs := $(call java-lib-header-files,android_system_stubs_current)
+ else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),test_current)
+ full_java_bootclasspath_libs := $(call java-lib-header-files,android_test_stubs_current)
+ else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),core_current)
+ full_java_bootclasspath_libs := $(call java-lib-header-files,core.current.stubs)
+ else
+ # core_<ver> is subset of <ver>. Instead of defining a prebuilt lib for core_<ver>,
+ # use the stub for <ver> when building for apps.
+ _version := $(patsubst core_%,%,$(LOCAL_SDK_VERSION))
+ full_java_bootclasspath_libs := $(call java-lib-header-files,sdk_v$(_version))
+ _version :=
+ endif # current, system_current, system_${VER}, test_current or core_current
+ endif # LOCAL_SDK_VERSION
+
+ ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
+ ifneq ($(LOCAL_MODULE),jacocoagent)
+ ifeq ($(EMMA_INSTRUMENT),true)
+ ifneq ($(EMMA_INSTRUMENT_STATIC),true)
+ # For instrumented build, if Jacoco is not being included statically
+ # in instrumented packages then include Jacoco classes into the
+ # bootclasspath.
+ full_java_bootclasspath_libs += $(call java-lib-header-files,jacocoagent)
+ endif # EMMA_INSTRUMENT_STATIC
+ endif # EMMA_INSTRUMENT
+ endif # LOCAL_MODULE == jacocoagent
+ endif # LOCAL_NO_STANDARD_LIBRARIES
+
+ # In order to compile lambda code javac requires various invokedynamic-
+ # related classes to be present. This change adds stubs needed for
+ # javac to compile lambdas.
+ ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
+ ifdef TARGET_BUILD_APPS
+ full_java_bootclasspath_libs += $(call java-lib-header-files,sdk-core-lambda-stubs)
+ else
+ full_java_bootclasspath_libs += $(call java-lib-header-files,core-lambda-stubs)
+ endif
+ endif
-full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES) $(my_additional_javac_libs),$(LOCAL_IS_HOST_MODULE))
-full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES) $(my_additional_javac_libs),$(LOCAL_IS_HOST_MODULE))
-full_java_lib_deps := $(addsuffix .toc, $(full_java_lib_deps))
+ full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
+ full_shared_java_header_libs := $(call java-lib-header-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
else # LOCAL_IS_HOST_MODULE
-ifeq ($(USE_CORE_LIB_BOOTCLASSPATH),true)
-ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
-my_bootclasspath := ""
-else
-my_bootclasspath := $(call normalize-path-list,$(call java-lib-files,core-oj-hostdex core-libart-hostdex,true))
-endif
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(my_bootclasspath)
-
-full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),true)
-full_java_lib_deps := $(full_shared_java_libs)
-else # !USE_CORE_LIB_BOOTCLASSPATH
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH :=
+ ifeq ($(USE_CORE_LIB_BOOTCLASSPATH),true)
+ ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
+ empty_bootclasspath := ""
+ else
+ full_java_bootclasspath_libs := $(call java-lib-header-files,$(addsuffix -hostdex,$(TARGET_DEFAULT_BOOTCLASSPATH_LIBRARIES)),true)
+ endif
-full_shared_java_libs := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/,\
- $(addsuffix $(COMMON_JAVA_PACKAGE_SUFFIX),$(LOCAL_JAVA_LIBRARIES)))
-full_java_lib_deps := $(full_shared_java_libs)
-endif # USE_CORE_LIB_BOOTCLASSPATH
+ my_system_modules := $(DEFAULT_SYSTEM_MODULES)
+ full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),true)
+ full_shared_java_header_libs := $(call java-lib-header-files,$(LOCAL_JAVA_LIBRARIES),true)
+ else # !USE_CORE_LIB_BOOTCLASSPATH
+ # Give host-side tools a version of OpenJDK's standard libraries
+ # close to what they're targeting. As of Dec 2017, AOSP is only
+ # bundling OpenJDK 8 and 9, so nothing < 8 is available.
+ #
+ # When building with OpenJDK 8, the following should have no
+ # effect since those jars would be available by default.
+ #
+ # When building with OpenJDK 9 but targeting a version < 1.8,
+ # putting them on the bootclasspath means that:
+ # a) code can't (accidentally) refer to OpenJDK 9 specific APIs
+ # b) references to existing APIs are not reinterpreted in an
+ # OpenJDK 9-specific way, eg. calls to subclasses of
+ # java.nio.Buffer as in http://b/70862583
+ ifeq ($(USE_HOST_BOOTSTRAP_JARS),true)
+ full_java_bootclasspath_libs += $(ANDROID_JAVA8_HOME)/jre/lib/jce.jar
+ full_java_bootclasspath_libs += $(ANDROID_JAVA8_HOME)/jre/lib/rt.jar
+ endif
+ full_shared_java_libs := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/,\
+ $(addsuffix $(COMMON_JAVA_PACKAGE_SUFFIX),$(LOCAL_JAVA_LIBRARIES)))
+ full_shared_java_header_libs := $(full_shared_java_libs)
+ endif # USE_CORE_LIB_BOOTCLASSPATH
endif # !LOCAL_IS_HOST_MODULE
-full_java_libs := $(full_shared_java_libs) $(full_static_java_libs) $(LOCAL_CLASSPATH)
-full_java_lib_deps := $(full_java_lib_deps) $(full_static_java_libs) $(LOCAL_CLASSPATH)
+ifdef empty_bootclasspath
+ ifdef full_java_bootclasspath_libs
+ $(call pretty-error,internal error: empty_bootclasspath and full_java_bootclasspath_libs should not both be set)
+ endif
+endif
+
+full_java_system_modules_deps :=
+my_system_modules_dir :=
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_USE_SYSTEM_MODULES :=
+ifeq ($(LOCAL_JAVA_LANGUAGE_VERSION),1.9)
+ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_USE_SYSTEM_MODULES := true
+ ifdef my_system_modules
+ ifneq ($(my_system_modules),none)
+ ifndef SOONG_SYSTEM_MODULES_$(my_system_modules)
+ $(call pretty-error, Invalid system modules $(my_system_modules))
+ endif
+ full_java_system_modules_deps := $(SOONG_SYSTEM_MODULES_$(my_system_modules))
+ my_system_modules_dir := $(patsubst %/lib/modules,%,$(SOONG_SYSTEM_MODULES_$(my_system_modules)))
+ endif
+ endif
+endif
+
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := $(full_java_bootclasspath_libs)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_EMPTY_BOOTCLASSPATH := $(empty_bootclasspath)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SYSTEM_MODULES := $(my_system_modules)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SYSTEM_MODULES_DIR := $(my_system_modules_dir)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SYSTEM_MODULES_LIBS := $(call java-lib-files,$(SOONG_SYSTEM_MODULES_LIBS_$(my_system_modules)))
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_PATCH_MODULE := $(LOCAL_PATCH_MODULE)
ifndef LOCAL_IS_HOST_MODULE
# This is set by packages that are linking to other packages that export
# shared libraries, allowing them to make use of the code in the linked apk.
apk_libraries := $(sort $(LOCAL_APK_LIBRARIES) $(LOCAL_RES_LIBRARIES))
ifneq ($(apk_libraries),)
- link_apk_libraries := \
- $(foreach lib,$(apk_libraries), \
- $(call intermediates-dir-for, \
- APPS,$(lib),,COMMON)/classes-pre-proguard.jar)
+ link_apk_libraries := $(call app-lib-files,$(apk_libraries))
+ link_apk_header_libs := $(call app-lib-header-files,$(apk_libraries))
# link against the jar with full original names (before proguard processing).
full_shared_java_libs += $(link_apk_libraries)
- full_java_libs += $(link_apk_libraries)
- full_java_lib_deps += $(link_apk_libraries)
+ full_shared_java_header_libs += $(link_apk_header_libs)
endif
# This is set by packages that contain instrumentation, allowing them to
@@ -287,8 +388,13 @@ ifdef LOCAL_INSTRUMENTATION_FOR
APPS,$(LOCAL_INSTRUMENTATION_FOR),,COMMON)
# link against the jar with full original names (before proguard processing).
link_instr_classes_jar := $(link_instr_intermediates_dir.COMMON)/classes-pre-proguard.jar
- full_java_libs += $(link_instr_classes_jar)
- full_java_lib_deps += $(link_instr_classes_jar)
+ ifneq ($(TURBINE_ENABLED),false)
+ link_instr_classes_header_jar := $(link_instr_intermediates_dir.COMMON)/classes-header.jar
+ else
+ link_instr_classes_header_jar := $(link_instr_intermediates_dir.COMMON)/classes.jar
+ endif
+ full_shared_java_libs += $(link_instr_classes_jar)
+ full_shared_java_header_libs += $(link_instr_classes_header_jar)
endif # LOCAL_INSTRUMENTATION_FOR
endif # LOCAL_IS_HOST_MODULE
@@ -305,100 +411,31 @@ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAR_MANIFEST :=
endif
##########################################################
-ifndef LOCAL_IS_HOST_MODULE
-## AAPT Flags
-# aapt doesn't accept multiple --extra-packages flags.
-# We have to collapse them into a single --extra-packages flag here.
-LOCAL_AAPT_FLAGS := $(strip $(LOCAL_AAPT_FLAGS))
-ifdef LOCAL_AAPT_FLAGS
-ifeq ($(filter 0 1,$(words $(filter --extra-packages,$(LOCAL_AAPT_FLAGS)))),)
-aapt_flags := $(subst --extra-packages$(space),--extra-packages@,$(LOCAL_AAPT_FLAGS))
-aapt_flags_extra_packages := $(patsubst --extra-packages@%,%,$(filter --extra-packages@%,$(aapt_flags)))
-aapt_flags_extra_packages := $(sort $(subst :,$(space),$(aapt_flags_extra_packages)))
-LOCAL_AAPT_FLAGS := $(filter-out --extra-packages@%,$(aapt_flags)) \
- --extra-packages $(subst $(space),:,$(aapt_flags_extra_packages))
-aapt_flags_extra_packages :=
-aapt_flags :=
-endif
-endif
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) $(PRODUCT_AAPT_FLAGS)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_AAPT_CHARACTERISTICS := $(TARGET_AAPT_CHARACTERISTICS)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_MANIFEST_PACKAGE_NAME := $(LOCAL_MANIFEST_PACKAGE_NAME)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(LOCAL_MANIFEST_INSTRUMENTATION_FOR)
-
-ifdef aidl_sources
-ALL_MODULES.$(my_register_name).AIDL_FILES := $(aidl_sources)
-endif
-ifdef renderscript_sources
-ALL_MODULES.$(my_register_name).RS_FILES := $(renderscript_sources_fullpath)
-endif
-endif # !LOCAL_IS_HOST_MODULE
+full_java_libs := $(full_shared_java_libs) $(full_static_java_libs) $(LOCAL_CLASSPATH)
+full_java_header_libs := $(full_shared_java_header_libs) $(full_static_java_header_libs)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_JAVA_LIBRARIES := $(full_java_libs)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_JAVA_HEADER_LIBRARIES := $(full_java_header_libs)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SHARED_JAVA_HEADER_LIBRARIES := $(full_shared_java_header_libs)
ALL_MODULES.$(my_register_name).INTERMEDIATE_SOURCE_DIR := \
$(ALL_MODULES.$(my_register_name).INTERMEDIATE_SOURCE_DIR) $(LOCAL_INTERMEDIATE_SOURCE_DIR)
-###########################################################
-# JACK
-###########################################################
-ifdef LOCAL_JACK_ENABLED
-ifdef need_compile_java
-
-LOCAL_JACK_FLAGS += -D jack.java.source.version=$(LOCAL_JAVA_LANGUAGE_VERSION)
-full_static_jack_libs := \
+##########################################################
+# Copy NOTICE files of transitive static dependencies
+# Don't do this in mm, since many of the targets won't exist.
+ifeq ($(ONE_SHOT_MAKEFILE),)
+installed_static_library_notice_file_targets := \
$(foreach lib,$(LOCAL_STATIC_JAVA_LIBRARIES), \
- $(call intermediates-dir-for, \
- JAVA_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),COMMON)/classes.jack)
-
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JACK_LIBRARIES := $(full_static_jack_libs)
-
-full_shared_jack_libs := $(call jack-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
-full_jack_deps := $(full_shared_jack_libs)
-
-ifndef LOCAL_IS_HOST_MODULE
-# Turn off .toc optimization for apps build as we cannot build dexdump.
-ifeq (,$(TARGET_BUILD_APPS))
-full_jack_deps := $(patsubst %.jack, %.dex.toc, $(full_jack_deps))
-endif
-endif # !LOCAL_IS_HOST_MODULE
-full_shared_jack_libs += $(LOCAL_JACK_CLASSPATH)
-full_jack_deps += $(full_static_jack_libs) $(LOCAL_JACK_CLASSPATH)
-
-ifndef LOCAL_IS_HOST_MODULE
-# This is set by packages that are linking to other packages that export
-# shared libraries, allowing them to make use of the code in the linked apk.
-ifneq ($(apk_libraries),)
- link_apk_jack_libraries := \
- $(foreach lib,$(apk_libraries), \
- $(call intermediates-dir-for, \
- APPS,$(lib),,COMMON)/classes.jack)
-
- # link against the jar with full original names (before proguard processing).
- full_shared_jack_libs += $(link_apk_jack_libraries)
- full_jack_deps += $(link_apk_jack_libraries)
+ NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST,TARGET)-JAVA_LIBRARIES-$(lib))
+else
+installed_static_library_notice_file_targets :=
endif
-# This is set by packages that contain instrumentation, allowing them to
-# link against the package they are instrumenting. Currently only one such
-# package is allowed.
-ifdef LOCAL_INSTRUMENTATION_FOR
- # link against the jar with full original names (before proguard processing).
- link_instr_classes_jack := $(link_instr_intermediates_dir.COMMON)/classes.noshrob.jack
- full_shared_jack_libs += $(link_instr_classes_jack)
- full_jack_deps += $(link_instr_classes_jack)
-endif # LOCAL_INSTRUMENTATION_FOR
-endif # !LOCAL_IS_HOST_MODULE
-
-# Propagate local configuration options to this target.
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_SHARED_LIBRARIES:= $(full_shared_jack_libs)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
-
-endif # need_compile_java
-endif # LOCAL_JACK_ENABLED
-
+$(notice_target): | $(installed_static_library_notice_file_targets)
+$(LOCAL_INSTALLED_MODULE): | $(notice_target)
###########################################################
# Verify that all libraries are safe to use
@@ -406,22 +443,51 @@ endif # LOCAL_JACK_ENABLED
ifndef LOCAL_IS_HOST_MODULE
ifeq ($(LOCAL_SDK_VERSION),system_current)
my_link_type := java:system
-my_warn_types := java:platform
-my_allowed_types := java:sdk java:system
+my_warn_types :=
+my_allowed_types := java:sdk java:system java:core
+else ifneq (,$(call has-system-sdk-version,$(LOCAL_SDK_VERSION)))
+my_link_type := java:system
+my_warn_types :=
+my_allowed_types := java:sdk java:system java:core
+else ifeq ($(LOCAL_SDK_VERSION),core_current)
+my_link_type := java:core
+my_warn_types :=
+my_allowed_types := java:core
else ifneq ($(LOCAL_SDK_VERSION),)
my_link_type := java:sdk
-my_warn_types := java:system java:platform
-my_allowed_types := java:sdk
+my_warn_types :=
+my_allowed_types := java:sdk java:core
else
my_link_type := java:platform
my_warn_types :=
-my_allowed_types := java:sdk java:system java:platform
+my_allowed_types := java:sdk java:system java:platform java:core
endif
-my_link_deps := $(addprefix JAVA_LIBRARIES:,$(LOCAL_STATIC_JAVA_LIBRARIES))
+ifdef LOCAL_AAPT2_ONLY
+my_link_type += aapt2_only
+endif
+ifdef LOCAL_USE_AAPT2
+my_allowed_types += aapt2_only
+endif
+
+my_link_deps := $(addprefix JAVA_LIBRARIES:,$(LOCAL_STATIC_JAVA_LIBRARIES) $(LOCAL_JAVA_LIBRARIES))
my_link_deps += $(addprefix APPS:,$(apk_libraries))
my_2nd_arch_prefix := $(LOCAL_2ND_ARCH_VAR_PREFIX)
my_common := COMMON
include $(BUILD_SYSTEM)/link_type.mk
endif # !LOCAL_IS_HOST_MODULE
+
+ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
+
+SOONG_CONV.$(LOCAL_MODULE).PROBLEMS := \
+ $(SOONG_CONV.$(LOCAL_MODULE).PROBLEMS) $(my_soong_problems)
+SOONG_CONV.$(LOCAL_MODULE).DEPS := \
+ $(SOONG_CONV.$(LOCAL_MODULE).DEPS) \
+ $(LOCAL_STATIC_JAVA_LIBRARIES) \
+ $(LOCAL_JAVA_LIBRARIES) \
+ $(LOCAL_JNI_SHARED_LIBRARIES)
+SOONG_CONV.$(LOCAL_MODULE).TYPE := java
+SOONG_CONV := $(SOONG_CONV) $(LOCAL_MODULE)
+
+endif
diff --git a/core/java_library.mk b/core/java_library.mk
index 84f4419..1b914f5 100644
--- a/core/java_library.mk
+++ b/core/java_library.mk
@@ -25,21 +25,8 @@ endif
LOCAL_BUILT_MODULE_STEM := javalib.jar
-#################################
-include $(BUILD_SYSTEM)/configure_local_jack.mk
-#################################
-
-ifdef LOCAL_JACK_ENABLED
-ifdef LOCAL_IS_STATIC_JAVA_LIBRARY
-LOCAL_BUILT_MODULE_STEM := classes.jack
-endif
-endif
-
-# For non-static java libraries, other modules should depend on
-# out/target/common/obj/JAVA_LIBRARIES/.../javalib.jar (for jack)
-# or out/target/common/obj/JAVA_LIBRARIES/.../classes.jar (for javac).
-# For static java libraries, other modules should depend on
-# out/target/common/obj/JAVA_LIBRARIES/.../classes.jar
+# For java libraries, other modules should depend on
+# out/target/common/obj/JAVA_LIBRARIES/.../classes.jar.
# There are some dependencies outside the build system that assume static
# java libraries produce javalib.jar, so we will copy classes.jar there too.
intermediates.COMMON := $(call local-intermediates-dir,COMMON)
@@ -55,6 +42,8 @@ ifeq (true,$(EMMA_INSTRUMENT))
ifeq (true,$(LOCAL_EMMA_INSTRUMENT))
ifeq (true,$(EMMA_INSTRUMENT_STATIC))
LOCAL_STATIC_JAVA_LIBRARIES += jacocoagent
+# Exclude jacoco classes from proguard
+LOCAL_PROGUARD_FLAGS += -include $(BUILD_SYSTEM)/proguard.jacoco.flags
endif # LOCAL_EMMA_INSTRUMENT
endif # EMMA_INSTRUMENT_STATIC
else
@@ -68,31 +57,27 @@ include $(BUILD_SYSTEM)/java.mk
ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
# There are some dependencies outside the build system that assume classes.jar
# is available as javalib.jar so copy it there too.
-$(eval $(call copy-one-file,$(full_classes_jar),$(common_javalib.jar)))
+$(eval $(call copy-one-file,$(full_classes_proguard_jar),$(common_javalib.jar)))
-ifdef LOCAL_JACK_ENABLED
-$(eval $(call copy-one-file,$(full_classes_jack),$(LOCAL_BUILT_MODULE)))
-else
-$(eval $(call copy-one-file,$(full_classes_jar),$(LOCAL_BUILT_MODULE)))
-endif
+$(eval $(call copy-one-file,$(full_classes_proguard_jar),$(LOCAL_BUILT_MODULE)))
else # !LOCAL_IS_STATIC_JAVA_LIBRARY
$(common_javalib.jar): PRIVATE_DEX_FILE := $(built_dex)
$(common_javalib.jar): PRIVATE_SOURCE_ARCHIVE := $(full_classes_pre_proguard_jar)
$(common_javalib.jar): PRIVATE_DONT_DELETE_JAR_DIRS := $(LOCAL_DONT_DELETE_JAR_DIRS)
-$(common_javalib.jar) : $(built_dex) $(java_resource_sources) | $(ZIPTIME)
+$(common_javalib.jar) : $(built_dex) $(java_resource_sources) | $(ZIPTIME) $(ZIPALIGN)
@echo "target Jar: $(PRIVATE_MODULE) ($@)"
-ifdef LOCAL_JACK_ENABLED
- $(create-empty-package)
-else
- $(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@)
-endif
- $(add-dex-to-package)
-ifdef LOCAL_JACK_ENABLED
- $(add-carried-jack-resources)
-endif
- $(remove-timestamps-from-package)
+ $(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@.tmp)
+ $(call add-dex-to-package-arg,$@.tmp)
+ $(hide) $(ZIPTIME) $@.tmp
+ $(call commit-change-for-toc,$@)
+ifeq (true, $(LOCAL_UNCOMPRESS_DEX))
+ $(uncompress-dexs)
+ $(align-package)
+endif # LOCAL_UNCOMPRESS_DEX
+
+.KATI_RESTAT: $(common_javalib.jar)
ifdef LOCAL_DEX_PREOPT
ifneq ($(dexpreopt_boot_jar_module),) # boot jar
@@ -108,10 +93,7 @@ $(built_odex) : $(dir $(LOCAL_BUILT_MODULE))% : $(common_javalib.jar)
@echo "Dexpreopt Jar: $(PRIVATE_MODULE) ($@)"
$(call dexpreopt-one-file,$<,$@)
-$(eval $(call copy-one-file,$(common_javalib.jar),$(LOCAL_BUILT_MODULE)))
-ifneq (nostripping,$(LOCAL_DEX_PREOPT))
- $(call dexpreopt-remove-classes.dex,$@)
-endif
+$(eval $(call dexpreopt-copy-jar,$(common_javalib.jar),$(LOCAL_BUILT_MODULE),$(LOCAL_DEX_PREOPT)))
endif # ! boot jar
diff --git a/core/java_renderscript.mk b/core/java_renderscript.mk
new file mode 100644
index 0000000..191b3be
--- /dev/null
+++ b/core/java_renderscript.mk
@@ -0,0 +1,155 @@
+###############################################################
+## Renderscript support for java
+## Adds rules to convert .rs files to .java and .bc files
+###############################################################
+
+renderscript_sources := $(filter %.rs,$(LOCAL_SRC_FILES))
+LOCAL_SRC_FILES := $(filter-out %.rs,$(LOCAL_SRC_FILES))
+
+rs_generated_res_zip :=
+rs_generated_src_jar :=
+rs_compatibility_jni_libs :=
+ifneq ($(renderscript_sources),)
+renderscript_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(renderscript_sources))
+renderscript_intermediate.COMMON := $(intermediates.COMMON)/renderscript
+rs_generated_res_zip := $(renderscript_intermediate.COMMON)/res.zip
+rs_generated_src_jar := $(renderscript_intermediate.COMMON)/rs.srcjar
+
+LOCAL_SRCJARS += $(rs_generated_src_jar)
+
+# Defaulting to an empty string uses the latest available platform SDK.
+renderscript_target_api :=
+
+ifneq (,$(LOCAL_RENDERSCRIPT_TARGET_API))
+ renderscript_target_api := $(LOCAL_RENDERSCRIPT_TARGET_API)
+else
+ ifneq (,$(LOCAL_SDK_VERSION))
+ # Set target-api for LOCAL_SDK_VERSIONs other than current.
+ ifneq (,$(filter-out current system_current test_current core_current, $(LOCAL_SDK_VERSION)))
+ renderscript_target_api := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
+ endif
+ endif # LOCAL_SDK_VERSION is set
+endif # LOCAL_RENDERSCRIPT_TARGET_API is set
+
+# For 64-bit, we always have to upgrade to at least 21 for compat build.
+ifneq ($(LOCAL_RENDERSCRIPT_COMPATIBILITY),)
+ ifeq ($(TARGET_IS_64_BIT),true)
+ ifneq ($(filter $(RSCOMPAT_32BIT_ONLY_API_LEVELS),$(renderscript_target_api)),)
+ renderscript_target_api := 21
+ endif
+ endif
+endif
+
+ifeq ($(LOCAL_RENDERSCRIPT_CC),)
+LOCAL_RENDERSCRIPT_CC := $(LLVM_RS_CC)
+endif
+
+# Turn on all warnings and warnings as errors for RS compiles.
+# This can be disabled with LOCAL_RENDERSCRIPT_FLAGS := -Wno-error
+renderscript_flags := -Wall -Werror
+renderscript_flags += $(LOCAL_RENDERSCRIPT_FLAGS)
+
+# prepend the RenderScript system include path
+ifneq ($(filter-out current system_current test_current core_current,$(LOCAL_SDK_VERSION))$(if $(TARGET_BUILD_APPS),$(filter current system_current test_current,$(LOCAL_SDK_VERSION))),)
+# if a numeric LOCAL_SDK_VERSION, or current LOCAL_SDK_VERSION with TARGET_BUILD_APPS
+LOCAL_RENDERSCRIPT_INCLUDES := \
+ $(HISTORICAL_SDK_VERSIONS_ROOT)/renderscript/clang-include \
+ $(HISTORICAL_SDK_VERSIONS_ROOT)/renderscript/include \
+ $(LOCAL_RENDERSCRIPT_INCLUDES)
+else
+LOCAL_RENDERSCRIPT_INCLUDES := \
+ $(TOPDIR)external/clang/lib/Headers \
+ $(TOPDIR)frameworks/rs/script_api/include \
+ $(LOCAL_RENDERSCRIPT_INCLUDES)
+endif
+
+ifneq ($(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE),)
+LOCAL_RENDERSCRIPT_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE)
+endif
+
+bc_files := $(patsubst %.rs,%.bc, $(notdir $(renderscript_sources)))
+bc_dep_files := $(addprefix $(renderscript_intermediate.COMMON)/,$(patsubst %.bc,%.d,$(bc_files)))
+
+$(rs_generated_src_jar): PRIVATE_RS_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES)
+$(rs_generated_src_jar): PRIVATE_RS_CC := $(LOCAL_RENDERSCRIPT_CC)
+$(rs_generated_src_jar): PRIVATE_RS_FLAGS := $(renderscript_flags)
+$(rs_generated_src_jar): PRIVATE_RS_SOURCE_FILES := $(renderscript_sources_fullpath)
+$(rs_generated_src_jar): PRIVATE_RS_OUTPUT_DIR := $(renderscript_intermediate.COMMON)
+$(rs_generated_src_jar): PRIVATE_RS_TARGET_API := $(renderscript_target_api)
+$(rs_generated_src_jar): PRIVATE_DEP_FILES := $(bc_dep_files)
+$(rs_generated_src_jar): PRIVATE_RS_OUTPUT_RES_ZIP := $(rs_generated_res_zip)
+$(rs_generated_src_jar): .KATI_IMPLICIT_OUTPUTS := $(rs_generated_res_zip)
+$(rs_generated_src_jar): $(renderscript_sources_fullpath) $(LOCAL_RENDERSCRIPT_CC) $(SOONG_ZIP)
+ $(transform-renderscripts-to-java-and-bc)
+
+# include the dependency files (.d/.P) generated by llvm-rs-cc.
+$(call include-depfile,$(rs_generated_src_jar).P,$(rs_generated_src_jar))
+
+ifneq ($(LOCAL_RENDERSCRIPT_COMPATIBILITY),)
+
+
+ifeq ($(filter $(RSCOMPAT_32BIT_ONLY_API_LEVELS),$(renderscript_target_api)),)
+ifeq ($(TARGET_IS_64_BIT),true)
+renderscript_intermediate.bc_folder := $(renderscript_intermediate.COMMON)/res/raw/bc64/
+else
+renderscript_intermediate.bc_folder := $(renderscript_intermediate.COMMON)/res/raw/bc32/
+endif
+else
+renderscript_intermediate.bc_folder := $(renderscript_intermediate.COMMON)/res/raw/
+endif
+
+rs_generated_bc := $(addprefix \
+ $(renderscript_intermediate.bc_folder), $(bc_files))
+
+renderscript_intermediate := $(intermediates)/renderscript
+
+# We don't need the .so files in bundled branches
+# Prevent these from showing up on the device
+# One exception is librsjni.so, which is needed for
+# both native path and compat path.
+rs_jni_lib := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/librsjni.so
+LOCAL_JNI_SHARED_LIBRARIES += librsjni
+
+ifneq (,$(TARGET_BUILD_APPS)$(FORCE_BUILD_RS_COMPAT))
+
+rs_compatibility_jni_libs := $(addprefix \
+ $(renderscript_intermediate)/librs., \
+ $(patsubst %.bc,%.so, $(bc_files)))
+
+$(rs_generated_src_jar): .KATI_IMPLICIT_OUTPUTS += $(rs_generated_bc)
+
+rs_support_lib := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/libRSSupport.so
+LOCAL_JNI_SHARED_LIBRARIES += libRSSupport
+
+rs_support_io_lib :=
+# check if the target api level support USAGE_IO
+ifeq ($(filter $(RSCOMPAT_NO_USAGEIO_API_LEVELS),$(renderscript_target_api)),)
+rs_support_io_lib := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/libRSSupportIO.so
+LOCAL_JNI_SHARED_LIBRARIES += libRSSupportIO
+endif
+
+my_arch := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
+ifneq (,$(filter arm64 mips64 x86_64,$(my_arch)))
+ my_min_sdk_version := 21
+else
+ my_min_sdk_version := $(MIN_SUPPORTED_SDK_VERSION)
+endif
+
+$(rs_compatibility_jni_libs): $(RS_PREBUILT_CLCORE) \
+ $(rs_support_lib) $(rs_support_io_lib) $(rs_jni_lib) $(rs_compiler_rt)
+$(rs_compatibility_jni_libs): $(BCC_COMPAT)
+$(rs_compatibility_jni_libs): PRIVATE_CXX := $(CXX_WRAPPER) $(TARGET_CXX)
+$(rs_compatibility_jni_libs): PRIVATE_SDK_VERSION := $(my_min_sdk_version)
+$(rs_compatibility_jni_libs): $(renderscript_intermediate)/librs.%.so: \
+ $(renderscript_intermediate.bc_folder)%.bc \
+ $(SOONG_OUT_DIR)/ndk.timestamp
+ $(transform-bc-to-so)
+
+endif
+
+endif
+
+LOCAL_INTERMEDIATE_TARGETS += $(rs_generated_src_jar)
+# Make sure the generated resource will be added to the apk.
+LOCAL_RESOURCE_DIR := $(renderscript_intermediate.COMMON)/res $(LOCAL_RESOURCE_DIR)
+endif
diff --git a/core/jetifier.mk b/core/jetifier.mk
new file mode 100644
index 0000000..33a4624
--- /dev/null
+++ b/core/jetifier.mk
@@ -0,0 +1,34 @@
+#
+# Copyright (C) 2018 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This file sets up the running of Jetifier
+
+# now add the rule to run jetifier
+ifeq ($(strip $(LOCAL_JETIFIER_ENABLED)),true)
+ my_jetifier_input_path := $(LOCAL_JETIFIER_INPUT_FILE)
+ my_files := $(intermediates.COMMON)/jetifier
+ my_jetifier_output_path := $(my_files)/jetified-$(notdir $(my_jetifier_input_path))
+
+$(my_jetifier_output_path) : $(my_jetifier_input_path) $(JETIFIER)
+ rm -rf $@
+ $(JETIFIER) -outputfile $@ -i $<
+
+ LOCAL_JETIFIER_OUTPUT_FILE := $(my_jetifier_output_path)
+ LOCAL_INTERMEDIATE_TARGETS += $(LOCAL_JETIFIER_OUTPUT_FILE)
+else
+ LOCAL_JETIFIER_OUTPUT_FILE := $(LOCAL_JETIFIER_INPUT_FILE)
+endif
+
diff --git a/core/local_systemsdk.mk b/core/local_systemsdk.mk
new file mode 100644
index 0000000..49085fd
--- /dev/null
+++ b/core/local_systemsdk.mk
@@ -0,0 +1,61 @@
+#
+# Copyright (C) 2018 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+ifdef BOARD_SYSTEMSDK_VERSIONS
+ # Apps and jars in vendor or odm partition are forced to build against System SDK.
+ _is_vendor_app :=
+ ifneq (,$(filter true,$(LOCAL_VENDOR_MODULE) $(LOCAL_ODM_MODULE) $(LOCAL_PROPRIETARY_MODULE)))
+ # Note: no need to check LOCAL_MODULE_PATH* since LOCAL_[VENDOR|ODM|OEM]_MODULE is already
+ # set correctly before this is included.
+ _is_vendor_app := true
+ endif
+ ifneq (,$(filter JAVA_LIBRARIES APPS,$(LOCAL_MODULE_CLASS)))
+ ifndef LOCAL_SDK_VERSION
+ ifeq ($(_is_vendor_app),true)
+ ifeq (,$(findstring __auto_generated_rro,$(LOCAL_MODULE)))
+ # Runtime resource overlay for framework-res is exempted from building
+ # against System SDK.
+ # TODO(b/35859726): remove this exception
+ LOCAL_SDK_VERSION := system_current
+ endif
+ endif
+ endif
+ endif
+endif
+
+# Ensure that the selected System SDK version is one of the supported versions.
+# The range of support versions becomes narrower when BOARD_SYSTEMSDK_VERSIONS
+# is set, which is a subset of PLATFORM_SYSTEMSDK_VERSIONS.
+ifneq (,$(call has-system-sdk-version,$(LOCAL_SDK_VERSION)))
+ ifneq ($(_is_vendor_app),true)
+ # apps bundled in system partition can use all system sdk versions provided by the platform
+ _supported_systemsdk_versions := $(PLATFORM_SYSTEMSDK_VERSIONS)
+ else ifdef BOARD_SYSTEMSDK_VERSIONS
+ # When BOARD_SYSTEMSDK_VERSIONS is set, vendors apps are restricted to use those versions
+ # which is equal to or smaller than PLATFORM_SYSTEMSDK_VERSIONS
+ _supported_systemsdk_versions := $(BOARD_SYSTEMSDK_VERSIONS)
+ else
+ # If not, vendor apks are treated equally to system apps
+ _supported_systemsdk_versions := $(PLATFORM_SYSTEMSDK_VERSIONS)
+ endif
+ _system_sdk_version := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
+ ifneq ($(_system_sdk_version),$(filter $(_system_sdk_version),$(_supported_systemsdk_versions)))
+ $(call pretty-error,Incompatible LOCAL_SDK_VERSION '$(LOCAL_SDK_VERSION)'. \
+ System SDK version '$(_system_sdk_version)' is not supported. Supported versions are: $(_supported_systemsdk_versions))
+ endif
+ _system_sdk_version :=
+ _supported_systemsdk_versions :=
+endif
diff --git a/core/local_vndk.mk b/core/local_vndk.mk
index 640aac7..3677d40 100644
--- a/core/local_vndk.mk
+++ b/core/local_vndk.mk
@@ -5,10 +5,8 @@ ifndef LOCAL_IS_HOST_MODULE
ifndef LOCAL_SDK_VERSION
ifneq (,$(filter true,$(LOCAL_VENDOR_MODULE) $(LOCAL_ODM_MODULE) $(LOCAL_OEM_MODULE) $(LOCAL_PROPRIETARY_MODULE)))
LOCAL_USE_VNDK:=true
- else
- ifneq (,$(filter $(TARGET_OUT_VENDOR)%,$(LOCAL_MODULE_PATH) $(LOCAL_MODULE_PATH_32) $(LOCAL_MODULE_PATH_64)))
- LOCAL_USE_VNDK:=true
- endif
+ # Note: no need to check LOCAL_MODULE_PATH* since LOCAL_[VENDOR|ODM|OEM]_MODULE is already
+ # set correctly before this is included.
endif
endif
endif
diff --git a/core/main.mk b/core/main.mk
index 1ea2160..1946edb 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -34,7 +34,7 @@ PWD := $(shell pwd)
TOP := .
TOPDIR :=
-BUILD_SYSTEM := $(TOPDIR)build/core
+BUILD_SYSTEM := $(TOPDIR)build/make/core
# This is the default target. It must be the first declared target.
.PHONY: droid
@@ -52,6 +52,10 @@ ifneq ($(filter $(dont_bother_goals), $(MAKECMDGOALS)),)
dont_bother := true
endif
+.KATI_READONLY := SOONG_CONFIG_NAMESPACES
+.KATI_READONLY := $(foreach n,$(SOONG_CONFIG_NAMESPACES),SOONG_CONFIG_$(n))
+.KATI_READONLY := $(foreach n,$(SOONG_CONFIG_NAMESPACES),$(foreach k,$(SOONG_CONFIG_$(n)),SOONG_CONFIG_$(n)_$(k)))
+
include $(SOONG_MAKEVARS_MK)
include $(BUILD_SYSTEM)/clang/config.mk
@@ -60,16 +64,28 @@ include $(BUILD_SYSTEM)/clang/config.mk
# without changing the command line every time. Avoids rebuilds
# when using ninja.
$(shell mkdir -p $(OUT_DIR) && \
- echo -n $(BUILD_NUMBER) > $(OUT_DIR)/build_number.txt && \
- echo -n $(BUILD_DATETIME) > $(OUT_DIR)/build_date.txt)
-BUILD_NUMBER_FROM_FILE := $$(cat $(OUT_DIR)/build_number.txt)
-BUILD_DATETIME_FROM_FILE := $$(cat $(OUT_DIR)/build_date.txt)
+ echo -n $(BUILD_NUMBER) > $(OUT_DIR)/build_number.txt)
+BUILD_NUMBER_FILE := $(OUT_DIR)/build_number.txt
+
ifeq ($(HOST_OS),darwin)
DATE_FROM_FILE := date -r $(BUILD_DATETIME_FROM_FILE)
else
DATE_FROM_FILE := date -d @$(BUILD_DATETIME_FROM_FILE)
endif
+# Pick a reasonable string to use to identify files.
+ifeq ($(strip $(HAS_BUILD_NUMBER)),false)
+ # BUILD_NUMBER has a timestamp in it, which means that
+ # it will change every time. Pick a stable value.
+ FILE_NAME_TAG := eng.$(USER)
+else
+ FILE_NAME_TAG := $(file <$(BUILD_NUMBER_FILE))
+endif
+
+# Make an empty directory, which can be used to make empty jars
+EMPTY_DIRECTORY := $(OUT_DIR)/empty
+$(shell mkdir -p $(EMPTY_DIRECTORY) && rm -rf $(EMPTY_DIRECTORY)/*)
+
# CTS-specific config.
-include cts/build/config.mk
# VTS-specific config.
@@ -80,12 +96,16 @@ endif
-include tools/tradefederation/build/suites/general-tests/config.mk
# STS-specific config.
-include test/sts/tools/sts-tradefed/build/config.mk
+# CTS-Instant-specific config
+-include test/suite_harness/tools/cts-instant-tradefed/build/config.mk
-# This allows us to force a clean build - included after the config.mk
-# environment setup is done, but before we generate any dependencies. This
-# file does the rm -rf inline so the deps which are all done below will
-# be generated correctly
-include $(BUILD_SYSTEM)/cleanbuild.mk
+# Clean rules
+.PHONY: clean-dex-files
+clean-dex-files:
+ $(hide) find $(OUT_DIR) -name "*.dex" | xargs rm -f
+ $(hide) for i in `find $(OUT_DIR) -name "*.jar" -o -name "*.apk"` ; do ((unzip -l $$i 2> /dev/null | \
+ grep -q "\.dex$$" && rm -f $$i) || continue ) ; done
+ @echo "All dex files and archives containing dex files have been removed."
# Include the google-specific config
-include vendor/google/build/config.mk
@@ -95,11 +115,21 @@ include $(BUILD_SYSTEM)/cleanbuild.mk
# (must be defined before including definitions.make)
INTERNAL_MODIFIER_TARGETS := all
-# EMMA_INSTRUMENT_STATIC merges the static emma library to each emma-enabled module.
+# EMMA_INSTRUMENT_STATIC merges the static jacoco library to each
+# jacoco-enabled module.
ifeq (true,$(EMMA_INSTRUMENT_STATIC))
EMMA_INSTRUMENT := true
endif
+ifeq (true,$(EMMA_INSTRUMENT))
+# Adding the jacoco library can cause the inclusion of
+# some typically banned classes
+# So if the user didn't specify SKIP_BOOT_JARS_CHECK, enable it here
+ifndef SKIP_BOOT_JARS_CHECK
+SKIP_BOOT_JARS_CHECK := true
+endif
+endif
+
#
# -----------------------------------------------------------------
# Validate ADDITIONAL_DEFAULT_PROPERTIES.
@@ -114,6 +144,8 @@ ifneq ($(ADDITIONAL_BUILD_PROPERTIES),)
$(error ADDITIONAL_BUILD_PROPERTIES must not be set before here: $(ADDITIONAL_BUILD_PROPERTIES))
endif
+ADDITIONAL_BUILD_PROPERTIES :=
+
#
# -----------------------------------------------------------------
# Add the product-defined properties to the build properties.
@@ -169,39 +201,38 @@ TARGET_BUILD_JAVA_SUPPORT_LEVEL := platform
# -----------------------------------------------------------------
# The pdk (Platform Development Kit) build
-include build/core/pdk_config.mk
+include build/make/core/pdk_config.mk
#
# -----------------------------------------------------------------
-# Jack version configuration
--include $(TOPDIR)prebuilts/sdk/tools/jack_versions.mk
--include $(TOPDIR)prebuilts/sdk/tools/jack_for_module.mk
-
-#
-# -----------------------------------------------------------------
-# Install and start Jack server
--include $(TOPDIR)prebuilts/sdk/tools/jack_server_setup.mk
-
-#
-# -----------------------------------------------------------------
-# Jacoco package name for Jack
--include $(TOPDIR)external/jacoco/config.mk
-
-#
-# -----------------------------------------------------------------
-# Enable dynamic linker developer warnings for userdebug, eng
-# and non-REL builds
+# Enable dynamic linker and hidden API developer warnings for
+# userdebug, eng and non-REL builds
ifneq ($(TARGET_BUILD_VARIANT),user)
- ADDITIONAL_BUILD_PROPERTIES += ro.bionic.ld.warning=1
+ ADDITIONAL_BUILD_PROPERTIES += ro.bionic.ld.warning=1 \
+ ro.art.hiddenapi.warning=1
else
# Enable it for user builds as long as they are not final.
ifneq ($(PLATFORM_VERSION_CODENAME),REL)
- ADDITIONAL_BUILD_PROPERTIES += ro.bionic.ld.warning=1
+ ADDITIONAL_BUILD_PROPERTIES += ro.bionic.ld.warning=1 \
+ ro.art.hiddenapi.warning=1
endif
endif
ADDITIONAL_BUILD_PROPERTIES += ro.treble.enabled=${PRODUCT_FULL_TREBLE}
+$(KATI_obsolete_var PRODUCT_FULL_TREBLE,\
+ Code should be written to work regardless of a device being Treble or \
+ variables like PRODUCT_SEPOLICY_SPLIT should be used until that is \
+ possible.)
+
+# Sets ro.actionable_compatible_property.enabled to know on runtime whether the whitelist
+# of actionable compatible properties is enabled or not.
+ifeq ($(PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE),true)
+ADDITIONAL_DEFAULT_PROPERTIES += ro.actionable_compatible_property.enabled=false
+else
+ADDITIONAL_DEFAULT_PROPERTIES += ro.actionable_compatible_property.enabled=${PRODUCT_COMPATIBLE_PROPERTY}
+endif
+
# -----------------------------------------------------------------
###
### In this section we set up the things that are different
@@ -418,16 +449,16 @@ ifneq ($(dont_bother),true)
# Include all of the makefiles in the system
#
-subdir_makefiles := $(SOONG_ANDROID_MK) $(call first-makefiles-under,$(TOP))
+subdir_makefiles := $(SOONG_ANDROID_MK) $(file <$(OUT_DIR)/.module_paths/Android.mk.list)
subdir_makefiles_total := $(words $(subdir_makefiles))
.KATI_READONLY := subdir_makefiles_total
$(foreach mk,$(subdir_makefiles),$(info [$(call inc_and_print,subdir_makefiles_inc)/$(subdir_makefiles_total)] including $(mk) ...)$(eval include $(mk)))
-ifdef PDK_FUSION_PLATFORM_ZIP
+ifneq (,$(PDK_FUSION_PLATFORM_ZIP)$(PDK_FUSION_PLATFORM_DIR))
# Bring in the PDK platform.zip modules.
include $(BUILD_SYSTEM)/pdk_fusion_modules.mk
-endif # PDK_FUSION_PLATFORM_ZIP
+endif # PDK_FUSION_PLATFORM_ZIP || PDK_FUSION_PLATFORM_DIR
droid_targets : blueprint_tools
@@ -500,9 +531,10 @@ endif # TARGET_TRANSLATE_2ND_ARCH
# If a module is for a cross host os, the required modules must be for
# that OS too.
# If a module is built for 32-bit, the required modules must be 32-bit too;
-# Otherwise if the module is an exectuable or shared library,
+# Otherwise if the module is an executable or shared library,
# the required modules must be 64-bit;
# otherwise we require both 64-bit and 32-bit variant, if one exists.
+define select-bitness-of-required-modules
$(foreach m,$(ALL_MODULES),\
$(eval r := $(ALL_MODULES.$(m).REQUIRED))\
$(if $(r),\
@@ -518,6 +550,8 @@ $(foreach m,$(ALL_MODULES),\
$(eval ALL_MODULES.$(m).REQUIRED := $(strip $(r_r)))\
)\
)
+endef
+$(call select-bitness-of-required-modules)
r_r :=
define add-required-deps
@@ -532,24 +566,93 @@ define add-required-host-so-deps
$(1): $(2)
endef
+# Sets up dependencies such that whenever a host module is installed,
+# any other host modules listed in $(ALL_MODULES.$(m).REQUIRED) will also be installed
+define add-all-host-to-host-required-modules-deps
$(foreach m,$(ALL_MODULES), \
$(eval r := $(ALL_MODULES.$(m).REQUIRED)) \
$(if $(r), \
$(eval r := $(call module-installed-files,$(r))) \
- $(eval t_m := $(filter $(TARGET_OUT_ROOT)/%, $(ALL_MODULES.$(m).INSTALLED))) \
$(eval h_m := $(filter $(HOST_OUT)/%, $(ALL_MODULES.$(m).INSTALLED))) \
$(eval hc_m := $(filter $(HOST_CROSS_OUT)/%, $(ALL_MODULES.$(m).INSTALLED))) \
- $(eval t_r := $(filter $(TARGET_OUT_ROOT)/%, $(r))) \
$(eval h_r := $(filter $(HOST_OUT)/%, $(r))) \
$(eval hc_r := $(filter $(HOST_CROSS_OUT)/%, $(r))) \
- $(eval t_m := $(filter-out $(t_r), $(t_m))) \
$(eval h_m := $(filter-out $(h_r), $(h_m))) \
$(eval hc_m := $(filter-out $(hc_r), $(hc_m))) \
- $(if $(t_m), $(eval $(call add-required-deps, $(t_m),$(t_r)))) \
$(if $(h_m), $(eval $(call add-required-deps, $(h_m),$(h_r)))) \
$(if $(hc_m), $(eval $(call add-required-deps, $(hc_m),$(hc_r)))) \
- ) \
- )
+ ) \
+)
+endef
+$(call add-all-host-to-host-required-modules-deps)
+
+# Sets up dependencies such that whenever a target module is installed,
+# any other target modules listed in $(ALL_MODULES.$(m).REQUIRED) will also be installed
+define add-all-target-to-target-required-modules-deps
+$(foreach m,$(ALL_MODULES), \
+ $(eval r := $(ALL_MODULES.$(m).REQUIRED)) \
+ $(if $(r), \
+ $(eval r := $(call module-installed-files,$(r))) \
+ $(eval t_m := $(filter $(TARGET_OUT_ROOT)/%, $(ALL_MODULES.$(m).INSTALLED))) \
+ $(eval t_r := $(filter $(TARGET_OUT_ROOT)/%, $(r))) \
+ $(eval t_m := $(filter-out $(t_r), $(t_m))) \
+ $(if $(t_m), $(eval $(call add-required-deps, $(t_m),$(t_r)))) \
+ ) \
+)
+endef
+$(call add-all-target-to-target-required-modules-deps)
+
+# Sets up dependencies such that whenever a host module is installed,
+# any target modules listed in $(ALL_MODULES.$(m).TARGET_REQUIRED) will also be installed
+define add-all-host-to-target-required-modules-deps
+$(foreach m,$(ALL_MODULES), \
+ $(eval req_mods := $(ALL_MODULES.$(m).TARGET_REQUIRED))\
+ $(if $(req_mods), \
+ $(eval req_files := )\
+ $(foreach req_mod,$(req_mods), \
+ $(eval req_file := $(filter $(TARGET_OUT_ROOT)/%, $(call module-installed-files,$(req_mod)))) \
+ $(if $(strip $(req_file)),\
+ ,\
+ $(error $(m).LOCAL_TARGET_REQUIRED_MODULES : illegal value $(req_mod) : not a device module. If you want to specify host modules to be required to be installed along with your host module, add those module names to LOCAL_REQUIRED_MODULES instead)\
+ )\
+ $(eval req_files := $(req_files)$(space)$(req_file))\
+ )\
+ $(eval req_files := $(strip $(req_files)))\
+ $(eval mod_files := $(filter $(HOST_OUT)/%, $(call module-installed-files,$(m)))) \
+ $(eval mod_files := $(filter-out $(req_files),$(mod_files)))\
+ $(if $(mod_files),\
+ $(eval $(call add-required-deps, $(mod_files),$(req_files))) \
+ )\
+ )\
+)
+endef
+$(call add-all-host-to-target-required-modules-deps)
+
+# Sets up dependencies such that whenever a target module is installed,
+# any host modules listed in $(ALL_MODULES.$(m).HOST_REQUIRED) will also be installed
+define add-all-target-to-host-required-modules-deps
+$(foreach m,$(ALL_MODULES), \
+ $(eval req_mods := $(ALL_MODULES.$(m).HOST_REQUIRED))\
+ $(if $(req_mods), \
+ $(eval req_files := )\
+ $(foreach req_mod,$(req_mods), \
+ $(eval req_file := $(filter $(HOST_OUT)/%, $(call module-installed-files,$(req_mod)))) \
+ $(if $(strip $(req_file)),\
+ ,\
+ $(error $(m).LOCAL_HOST_REQUIRED_MODULES : illegal value $(req_mod) : not a host module. If you want to specify target modules to be required to be installed along with your target module, add those module names to LOCAL_REQUIRED_MODULES instead)\
+ )\
+ $(eval req_files := $(req_files)$(space)$(req_file))\
+ )\
+ $(eval req_files := $(strip $(req_files)))\
+ $(eval mod_files := $(filter $(TARGET_OUT_ROOT)/%, $(call module-installed-files,$(m))))\
+ $(eval mod_files := $(filter-out $(req_files),$(mod_files)))\
+ $(if $(mod_files),\
+ $(eval $(call add-required-deps, $(mod_files),$(req_files))) \
+ )\
+ )\
+)
+endef
+$(call add-all-target-to-host-required-modules-deps)
t_m :=
h_m :=
@@ -558,7 +661,7 @@ t_r :=
h_r :=
hc_r :=
-# Establish the dependecies on the shared libraries.
+# Establish the dependencies on the shared libraries.
# It also adds the shared library module names to ALL_MODULES.$(m).REQUIRED,
# so they can be expanded to product_MODULES later.
# $(1): TARGET_ or HOST_ or HOST_CROSS_.
@@ -794,6 +897,9 @@ ifdef FULL_BUILD
# by the appropriate product definition file, which was included
# by product_config.mk.
product_MODULES := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES)
+ifdef BOARD_VNDK_VERSION
+ product_MODULES += vndk_package
+endif
# Filter out the overridden packages before doing expansion
product_MODULES := $(filter-out $(foreach p, $(product_MODULES), \
$(PACKAGES.$(p).OVERRIDES)), $(product_MODULES))
@@ -905,7 +1011,7 @@ ifdef is_sdk_build
$(warning $(ALL_MODULES.$(m).MAKEFILE): Module '$(m)' in PRODUCT_PACKAGES_TESTS has nothing to install!)))
endif
-# build/core/Makefile contains extra stuff that we don't want to pollute this
+# build/make/core/Makefile contains extra stuff that we don't want to pollute this
# top-level makefile with. It expects that ALL_DEFAULT_INSTALLED_MODULES
# contains everything that's built during the current make, but it also further
# extends ALL_DEFAULT_INSTALLED_MODULES.
@@ -983,6 +1089,9 @@ bptimage: $(INSTALLED_BPTIMAGE_TARGET)
.PHONY: vendorimage
vendorimage: $(INSTALLED_VENDORIMAGE_TARGET)
+.PHONY: productimage
+productimage: $(INSTALLED_PRODUCTIMAGE_TARGET)
+
.PHONY: systemotherimage
systemotherimage: $(INSTALLED_SYSTEMOTHERIMAGE_TARGET)
@@ -1006,10 +1115,13 @@ droidcore: files \
$(INSTALLED_CACHEIMAGE_TARGET) \
$(INSTALLED_BPTIMAGE_TARGET) \
$(INSTALLED_VENDORIMAGE_TARGET) \
+ $(INSTALLED_PRODUCTIMAGE_TARGET) \
$(INSTALLED_SYSTEMOTHERIMAGE_TARGET) \
$(INSTALLED_FILES_FILE) \
$(INSTALLED_FILES_FILE_VENDOR) \
- $(INSTALLED_FILES_FILE_SYSTEMOTHER)
+ $(INSTALLED_FILES_FILE_PRODUCT) \
+ $(INSTALLED_FILES_FILE_SYSTEMOTHER) \
+ soong_docs
# dist_files only for putting your library into the dist directory with a full build.
.PHONY: dist_files
@@ -1037,13 +1149,8 @@ ifneq ($(TARGET_BUILD_APPS),)
$(call dist-for-goals,apps_only, $(apps_only_dist_built_files))
ifeq ($(EMMA_INSTRUMENT),true)
- ifeq ($(ANDROID_COMPILE_WITH_JACK),false)
- $(JACOCO_REPORT_CLASSES_ALL) : $(apps_only_installed_files)
- $(call dist-for-goals,apps_only, $(JACOCO_REPORT_CLASSES_ALL))
- else
- $(EMMA_META_ZIP) : $(apps_only_installed_files)
- $(call dist-for-goals,apps_only, $(EMMA_META_ZIP))
- endif
+ $(JACOCO_REPORT_CLASSES_ALL) : $(apps_only_installed_files)
+ $(call dist-for-goals,apps_only, $(JACOCO_REPORT_CLASSES_ALL))
endif
$(PROGUARD_DICT_ZIP) : $(apps_only_installed_files)
@@ -1078,6 +1185,7 @@ else # TARGET_BUILD_APPS
$(COVERAGE_ZIP) \
$(INSTALLED_FILES_FILE) \
$(INSTALLED_FILES_FILE_VENDOR) \
+ $(INSTALLED_FILES_FILE_PRODUCT) \
$(INSTALLED_FILES_FILE_SYSTEMOTHER) \
$(INSTALLED_BUILD_PROP_TARGET) \
$(BUILT_TARGET_FILES_PACKAGE) \
@@ -1100,13 +1208,8 @@ else # TARGET_BUILD_APPS
endif
ifeq ($(EMMA_INSTRUMENT),true)
- ifeq ($(ANDROID_COMPILE_WITH_JACK),false)
- $(JACOCO_REPORT_CLASSES_ALL) : $(INSTALLED_SYSTEMIMAGE)
- $(call dist-for-goals, dist_files, $(JACOCO_REPORT_CLASSES_ALL))
- else
- $(EMMA_META_ZIP) : $(INSTALLED_SYSTEMIMAGE)
- $(call dist-for-goals, dist_files, $(EMMA_META_ZIP))
- endif
+ $(JACOCO_REPORT_CLASSES_ALL) : $(INSTALLED_SYSTEMIMAGE)
+ $(call dist-for-goals, dist_files, $(JACOCO_REPORT_CLASSES_ALL))
endif
# Building a full system-- the default is to build droidcore
@@ -1142,7 +1245,7 @@ target-java-tests : java-target-tests
target-native-tests : native-target-tests
tests : host-tests target-tests
-# Phony target to run all java compilations that use javac instead of jack.
+# Phony target to run all java compilations that use javac
.PHONY: javac-check
ifneq (,$(filter samplecode, $(MAKECMDGOALS)))
@@ -1164,6 +1267,9 @@ endif # samplecode in $(MAKECMDGOALS)
.PHONY: findbugs
findbugs: $(INTERNAL_FINDBUGS_HTML_TARGET) $(INTERNAL_FINDBUGS_XML_TARGET)
+.PHONY: findlsdumps
+findlsdumps: $(FIND_LSDUMPS_FILE)
+
#xxx scrape this from ALL_MODULE_NAME_TAGS
.PHONY: modules
modules:
diff --git a/core/math.mk b/core/math.mk
index 047d046..44e03ce 100644
--- a/core/math.mk
+++ b/core/math.mk
@@ -42,6 +42,11 @@ define _math_check_valid
$(if $(call math_is_number,$(1)),,$(error Only positive integers <= 100 are supported (not $(1))))
endef
+# return a list containing integers ranging from [$(1),$(2)]
+define int_range_list
+$(call _math_check_valid,$(1))$(call _math_check_valid,$(2))$(wordlist $(1),$(2),$(__MATH_NUMBERS))
+endef
+
#$(call _math_check_valid,0)
#$(call _math_check_valid,1)
#$(call _math_check_valid,100)
@@ -67,6 +72,10 @@ define math_gt_or_eq
$(if $(filter $(1),$(call math_max,$(1),$(2))),true)
endef
+define math_lt
+$(if $(call math_gt_or_eq,$(1),$(2)),,true)
+endef
+
#$(warning $(call math_gt_or_eq, 2, 1))
#$(warning $(call math_gt_or_eq, 1, 1))
#$(warning $(if $(call math_gt_or_eq, 1, 2),false,true))
@@ -75,3 +84,69 @@ endef
define inc_and_print
$(strip $(eval $(1) := $($(1)) .)$(words $($(1))))
endef
+
+# Returns the words in $2 that are numbers and are less than $1
+define numbers_less_than
+$(strip \
+ $(foreach n,$2, \
+ $(if $(call math_is_number,$(n)), \
+ $(if $(call math_lt,$(n),$(1)), \
+ $(n)))))
+endef
+
+_INT_LIMIT_WORDS := $(foreach a,x x,$(foreach b,x x x x x x x x x x x x x x x x,\
+ $(foreach c,x x x x x x x x x x x x x x x x,x x x x x x x x x x x x x x x x)))
+
+define _int_encode
+$(if $(filter $(words x $(_INT_LIMIT_WORDS)),$(words $(wordlist 1,$(1),x $(_INT_LIMIT_WORDS)))),\
+ $(call pretty-error,integer greater than $(words $(_INT_LIMIT_WORDS)) is not supported!),\
+ $(wordlist 1,$(1),$(_INT_LIMIT_WORDS)))
+endef
+
+# _int_max returns the maximum of the two arguments
+# input: two (x) lists; output: one (x) list
+# integer cannot be passed in directly. It has to be converted using _int_encode.
+define _int_max
+$(subst xx,x,$(join $(1),$(2)))
+endef
+
+# first argument is greater than second argument
+# output: non-empty if true
+# integer cannot be passed in directly. It has to be converted using _int_encode.
+define _int_greater-than
+$(filter-out $(words $(2)),$(words $(call _int_max,$(1),$(2))))
+endef
+
+# first argument equals to second argument
+# output: non-empty if true
+# integer cannot be passed in directly. It has to be converted using _int_encode.
+define _int_equal
+$(filter $(words $(1)),$(words $(2)))
+endef
+
+# first argument is greater than or equal to second argument
+# output: non-empty if true
+# integer cannot be passed in directly. It has to be converted using _int_encode.
+define _int_greater-or-equal
+$(call _int_greater-than,$(1),$(2))$(call _int_equal,$(1),$(2))
+endef
+
+define int_plus
+$(words $(call _int_encode,$(1)) $(call _int_encode,$(2)))
+endef
+
+define int_subtract
+$(if $(call _int_greater-or-equal,$(call _int_encode,$(1)),$(call _int_encode,$(2))),\
+ $(words $(filter-out xx,$(join $(call _int_encode,$(1)),$(call _int_encode,$(2))))),\
+ $(call pretty-error,$(1) subtract underflow $(2)))
+endef
+
+define int_multiply
+$(words $(foreach a,$(call _int_encode,$(1)),$(call _int_encode,$(2))))
+endef
+
+define int_divide
+$(if $(filter 0,$(2)),$(call pretty-error,division by zero is not allowed!),$(strip \
+ $(if $(call _int_greater-or-equal,$(call _int_encode,$(1)),$(call _int_encode,$(2))), \
+ $(call int_plus,$(call int_divide,$(call int_subtract,$(1),$(2)),$(2)),1),0)))
+endef
diff --git a/core/native_test_config_template.xml b/core/native_test_config_template.xml
new file mode 100644
index 0000000..a960529
--- /dev/null
+++ b/core/native_test_config_template.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- This test config file is auto-generated. -->
+<configuration description="Runs {MODULE}.">
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <option name="cleanup" value="true" />
+ <option name="push" value="{MODULE}->/data/local/tmp/{MODULE}" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.GTest" >
+ <option name="native-test-device-path" value="/data/local/tmp" />
+ <option name="module-name" value="{MODULE}" />
+ </test>
+</configuration>
diff --git a/core/no_java_path/jar b/core/no_java_path/jar
deleted file mode 120000
index 8586397..0000000
--- a/core/no_java_path/jar
+++ /dev/null
@@ -1 +0,0 @@
-java \ No newline at end of file
diff --git a/core/no_java_path/jarsigner b/core/no_java_path/jarsigner
deleted file mode 120000
index 8586397..0000000
--- a/core/no_java_path/jarsigner
+++ /dev/null
@@ -1 +0,0 @@
-java \ No newline at end of file
diff --git a/core/no_java_path/java b/core/no_java_path/java
deleted file mode 100755
index f3422f3..0000000
--- a/core/no_java_path/java
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-
-echo "Error: JAVA_NOT_REQUIRED=true, $(basename $0) is unavailable." 1>&2
-exit 1
diff --git a/core/no_java_path/javac b/core/no_java_path/javac
deleted file mode 120000
index 8586397..0000000
--- a/core/no_java_path/javac
+++ /dev/null
@@ -1 +0,0 @@
-java \ No newline at end of file
diff --git a/core/no_java_path/keytool b/core/no_java_path/keytool
deleted file mode 120000
index 8586397..0000000
--- a/core/no_java_path/keytool
+++ /dev/null
@@ -1 +0,0 @@
-java \ No newline at end of file
diff --git a/core/notice_files.mk b/core/notice_files.mk
index f850fff..383d73c 100644
--- a/core/notice_files.mk
+++ b/core/notice_files.mk
@@ -57,7 +57,7 @@ else
# javalib.jar is the default name for the build module (and isn't meaningful)
# If that's what we have, substitute the module name instead. These files
# aren't included on the device, so this name is synthetic anyway.
- ifneq ($(filter javalib.jar classes.jack,$(module_leaf)),)
+ ifneq ($(filter javalib.jar,$(module_leaf)),)
module_leaf := $(LOCAL_MODULE).jar
endif
module_installed_filename := \
diff --git a/core/package_internal.mk b/core/package_internal.mk
index 5c4ad28..80d386d 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -60,10 +60,6 @@ LOCAL_MODULE_CLASS := APPS
intermediates := $(call local-intermediates-dir)
intermediates.COMMON := $(call local-intermediates-dir,COMMON)
-#################################
-include $(BUILD_SYSTEM)/configure_local_jack.mk
-#################################
-
# Package LOCAL_MODULE_TAGS default to optional
LOCAL_MODULE_TAGS := $(strip $(LOCAL_MODULE_TAGS))
ifeq ($(LOCAL_MODULE_TAGS),)
@@ -115,6 +111,8 @@ ifneq ($(PRODUCT_ENFORCE_RRO_TARGETS),)
enforce_rro_enabled :=
else ifeq (true,$(LOCAL_ODM_MODULE))
enforce_rro_enabled :=
+ else ifeq (true,$(LOCAL_PRODUCT_MODULE))
+ enforce_rro_enabled :=
endif
else ifeq ($(filter $(TARGET_OUT)/%,$(LOCAL_MODULE_PATH)),)
enforce_rro_enabled :=
@@ -150,6 +148,10 @@ ifneq ($(all_assets),)
need_compile_asset := true
endif
+ifdef LOCAL_AAPT2_ONLY
+LOCAL_USE_AAPT2 := true
+endif
+
my_res_package :=
ifdef LOCAL_USE_AAPT2
# In aapt2 the last takes precedence.
@@ -259,13 +261,6 @@ endif # need_compile_res
endif # !custom
LOCAL_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_PROGUARD_FLAGS)
-ifdef LOCAL_JACK_ENABLED
-ifndef LOCAL_JACK_PROGUARD_FLAGS
- LOCAL_JACK_PROGUARD_FLAGS := $(LOCAL_PROGUARD_FLAGS)
-endif
-LOCAL_JACK_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_JACK_PROGUARD_FLAGS)
-endif # LOCAL_JACK_ENABLED
-
ifeq (true,$(EMMA_INSTRUMENT))
ifndef LOCAL_EMMA_INSTRUMENT
# No jacoco for test apks.
@@ -279,9 +274,11 @@ endif # EMMA_INSTRUMENT is true
ifeq (true,$(LOCAL_EMMA_INSTRUMENT))
ifeq (true,$(EMMA_INSTRUMENT_STATIC))
-ifneq ($(LOCAL_SRC_FILES)$(LOCAL_STATIC_JAVA_LIBRARIES)$(LOCAL_SOURCE_FILES_ALL_GENERATED),)
+ifneq ($(LOCAL_SRC_FILES)$(LOCAL_SRCJARS)$(LOCAL_STATIC_JAVA_LIBRARIES)$(LOCAL_SOURCE_FILES_ALL_GENERATED),)
# Only add jacocoagent if the package contains some java code
LOCAL_STATIC_JAVA_LIBRARIES += jacocoagent
+# Exclude jacoco classes from proguard
+LOCAL_PROGUARD_FLAGS += -include $(BUILD_SYSTEM)/proguard.jacoco.flags
endif # Contains java code
else
ifdef LOCAL_SDK_VERSION
@@ -292,20 +289,8 @@ ifneq ($(LOCAL_SRC_FILES)$(LOCAL_STATIC_JAVA_LIBRARIES)$(LOCAL_SOURCE_FILES_ALL_
LOCAL_STATIC_JAVA_LIBRARIES += jacocoagent
# Exclude jacoco classes from proguard
LOCAL_PROGUARD_FLAGS += -include $(BUILD_SYSTEM)/proguard.jacoco.flags
-LOCAL_JACK_PROGUARD_FLAGS += -include $(BUILD_SYSTEM)/proguard.jacoco.flags
endif # Contains java code
-else # ! TARGET_BUILD_APPS
-ifdef LOCAL_JACK_ENABLED
-# If build against the SDK in full build, core.jar is not used
-# so coverage classes are not present.
-# Jack needs jacoco on the classpath but we do not want it to be in
-# the final apk. While it is a static library, we add it to the
-# LOCAL_JAVA_LIBRARIES which are only present on the classpath.
-# Note: we have nothing to do for proguard since jacoco will be
-# on the classpath only, thus not modified during the compilation.
-LOCAL_JAVA_LIBRARIES += jacocoagent
-endif # ! LOCAL_JACK_ENABLED
-endif # ! TARGET_BUILD_APPS
+endif # TARGET_BUILD_APPS
endif # LOCAL_SDK_VERSION
endif # EMMA_INSTRUMENT_STATIC
endif # LOCAL_EMMA_INSTRUMENT
@@ -316,7 +301,6 @@ ifeq ($(LOCAL_DATA_BINDING),true)
data_binding_intermediates := $(intermediates.COMMON)/data-binding
LOCAL_JAVACFLAGS += -processorpath $(DATA_BINDING_COMPILER) -s $(data_binding_intermediates)/anno-src
-LOCAL_JACK_FLAGS += --processorpath $(DATA_BINDING_COMPILER)
LOCAL_STATIC_JAVA_LIBRARIES += databinding-baselibrary
LOCAL_STATIC_JAVA_AAR_LIBRARIES += databinding-library databinding-adapters
@@ -330,6 +314,9 @@ LOCAL_RESOURCE_DIR := $(data_binding_res_out)
LOCAL_AAPT_FLAGS += --auto-add-overlay --extra-packages com.android.databinding.library
endif # LOCAL_DATA_BINDING
+# Process Support Library dependencies.
+include $(BUILD_SYSTEM)/support_libraries.mk
+
# If the module is a compressed module, we don't pre-opt it because its final
# installation location will be the data partition.
ifdef LOCAL_COMPRESSED_MODULE
@@ -338,47 +325,11 @@ endif
include $(BUILD_SYSTEM)/android_manifest.mk
-called_from_package_internal := true
-#################################
-include $(BUILD_SYSTEM)/java.mk
-#################################
-called_from_package_internal :=
-
-LOCAL_SDK_RES_VERSION:=$(strip $(LOCAL_SDK_RES_VERSION))
-ifeq ($(LOCAL_SDK_RES_VERSION),)
- LOCAL_SDK_RES_VERSION:=$(LOCAL_SDK_VERSION)
-endif
-
-$(LOCAL_INTERMEDIATE_TARGETS): \
- PRIVATE_ANDROID_MANIFEST := $(full_android_manifest)
-
-ifeq ($(LOCAL_DATA_BINDING),true)
-data_binding_stamp := $(data_binding_intermediates)/data-binding.stamp
-$(data_binding_stamp): PRIVATE_INTERMEDIATES := $(data_binding_intermediates)
-$(data_binding_stamp): PRIVATE_MANIFEST := $(full_android_manifest)
-# Generate code into $(LOCAL_INTERMEDIATE_SOURCE_DIR) so that the generated .java files
-# will be automatically picked up by function compile-java.
-$(data_binding_stamp): PRIVATE_SRC_OUT := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/data-binding
-$(data_binding_stamp): PRIVATE_XML_OUT := $(data_binding_intermediates)/xml
-$(data_binding_stamp): PRIVATE_RES_OUT := $(data_binding_res_out)
-$(data_binding_stamp): PRIVATE_RES_IN := $(data_binding_res_in)
-$(data_binding_stamp): PRIVATE_ANNO_SRC_DIR := $(data_binding_intermediates)/anno-src
+resource_export_package :=
-$(data_binding_stamp) : $(all_res_assets) $(full_android_manifest) \
- $(DATA_BINDING_COMPILER)
- @echo "Data-binding process: $@"
- @rm -rf $(PRIVATE_INTERMEDIATES) $(PRIVATE_SRC_OUT) && \
- mkdir -p $(PRIVATE_INTERMEDIATES) $(PRIVATE_SRC_OUT) \
- $(PRIVATE_XML_OUT) $(PRIVATE_RES_OUT) $(PRIVATE_ANNO_SRC_DIR)
- $(hide) $(JAVA) -classpath $(DATA_BINDING_COMPILER) android.databinding.tool.MakeCopy \
- $(PRIVATE_MANIFEST) $(PRIVATE_SRC_OUT) $(PRIVATE_XML_OUT) $(PRIVATE_RES_OUT) $(PRIVATE_RES_IN)
- $(hide) touch $@
+include $(BUILD_SYSTEM)/java_renderscript.mk
-# Make sure the data-binding process happens before javac and generation of R.java.
-$(R_file_stamp) $(full_classes_compiled_jar) : $(data_binding_stamp)
-# The dependency path when jack is enabled
-$(built_dex_intermediate) : $(data_binding_stamp)
-endif # LOCAL_DATA_BINDING
+include $(BUILD_SYSTEM)/aapt_flags.mk
ifeq ($(need_compile_res),true)
@@ -396,131 +347,162 @@ endif # LOCAL_COMPRESSED_MODULE
my_apk_split_configs := $(LOCAL_PACKAGE_SPLITS)
my_split_suffixes := $(subst $(comma),_,$(my_apk_split_configs))
built_apk_splits := $(foreach s,$(my_split_suffixes),$(intermediates)/package_$(s).apk)
-installed_apk_splits := $(foreach s,$(my_split_suffixes),$(my_module_path)/$(LOCAL_MODULE)_$(s).apk)
endif
+$(R_file_stamp) $(my_res_package): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS)
+$(R_file_stamp) $(my_res_package): PRIVATE_TARGET_AAPT_CHARACTERISTICS := $(TARGET_AAPT_CHARACTERISTICS)
+$(R_file_stamp) $(my_res_package): PRIVATE_MANIFEST_PACKAGE_NAME := $(LOCAL_MANIFEST_PACKAGE_NAME)
+$(R_file_stamp) $(my_res_package): PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(LOCAL_MANIFEST_INSTRUMENTATION_FOR)
+
+###############################
+## AAPT/AAPT2
+
ifdef LOCAL_USE_AAPT2
-my_compiled_res_base_dir := $(intermediates)/flat-res
-renderscript_target_api :=
-ifneq (,$(LOCAL_RENDERSCRIPT_TARGET_API))
-renderscript_target_api := $(LOCAL_RENDERSCRIPT_TARGET_API)
-else
-ifneq (,$(LOCAL_SDK_VERSION))
-# Set target-api for LOCAL_SDK_VERSIONs other than current.
-ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
-renderscript_target_api := $(LOCAL_SDK_VERSION)
-endif
-endif # LOCAL_SDK_VERSION is set
-endif # LOCAL_RENDERSCRIPT_TARGET_API is set
-ifneq (,$(renderscript_target_api))
-ifneq ($(call math_gt_or_eq,$(renderscript_target_api),21),true)
-my_generated_res_dirs := $(rs_generated_res_dir)
-my_generated_res_dirs_deps := $(RenderScript_file_stamp)
-endif # renderscript_target_api < 21
-endif # renderscript_target_api is set
-my_asset_dirs := $(LOCAL_ASSET_DIR)
-my_full_asset_paths := $(all_assets)
-# Add AAPT2 link specific flags.
-$(my_res_package): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) --no-static-lib-packages
-include $(BUILD_SYSTEM)/aapt2.mk
-else # LOCAL_USE_AAPT2
+ my_compiled_res_base_dir := $(intermediates.COMMON)/flat-res
+ ifneq (,$(renderscript_target_api))
+ ifneq ($(call math_gt_or_eq,$(renderscript_target_api),21),true)
+ my_generated_res_zips := $(rs_generated_res_zip)
+ endif # renderscript_target_api < 21
+ endif # renderscript_target_api is set
+ my_asset_dirs := $(LOCAL_ASSET_DIR)
+ my_full_asset_paths := $(all_assets)
+
+ # Add AAPT2 link specific flags.
+ $(my_res_package): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS)
+ ifndef LOCAL_AAPT_NAMESPACES
+ $(my_res_package): PRIVATE_AAPT_FLAGS += --no-static-lib-packages
+ endif
-# Since we don't know where the real R.java file is going to end up,
-# we need to use another file to stand in its place. We'll just
-# copy the generated file to src/R.stamp, which means it will
-# have the same contents and timestamp as the actual file.
-#
-# At the same time, this will copy the R.java file to a central
-# 'R' directory to make it easier to add the files to an IDE.
-#
+ include $(BUILD_SYSTEM)/aapt2.mk
+else # LOCAL_USE_AAPT2
-$(R_file_stamp): PRIVATE_RESOURCE_PUBLICS_OUTPUT := \
+ my_srcjar := $(intermediates.COMMON)/aapt.srcjar
+ LOCAL_SRCJARS += $(my_srcjar)
+ $(R_file_stamp): PRIVATE_SRCJAR := $(my_srcjar)
+ $(R_file_stamp): PRIVATE_JAVA_GEN_DIR := $(intermediates.COMMON)/aapt
+ $(R_file_stamp): .KATI_IMPLICIT_OUTPUTS := $(my_srcjar)
+ # Since we don't know where the real R.java file is going to end up,
+ # we need to use another file to stand in its place. We'll just
+ # copy the generated file to src/R.stamp, which means it will
+ # have the same contents and timestamp as the actual file.
+ #
+ # At the same time, this will copy the R.java file to a central
+ # 'R' directory to make it easier to add the files to an IDE.
+ #
+
+ $(R_file_stamp): PRIVATE_RESOURCE_PUBLICS_OUTPUT := \
$(intermediates.COMMON)/public_resources.xml
-$(R_file_stamp): PRIVATE_PROGUARD_OPTIONS_FILE := $(proguard_options_file)
-$(R_file_stamp): $(all_res_assets) $(full_android_manifest) $(RenderScript_file_stamp) $(AAPT) | $(ACP)
+ $(R_file_stamp): PRIVATE_PROGUARD_OPTIONS_FILE := $(proguard_options_file)
+ $(R_file_stamp): PRIVATE_RESOURCE_LIST := $(all_res_assets)
+ $(R_file_stamp): $(all_res_assets) $(full_android_manifest) $(rs_generated_res_zip) $(AAPT) $(SOONG_ZIP) | $(ACP)
@echo "target R.java/Manifest.java: $(PRIVATE_MODULE) ($@)"
@rm -rf $@ && mkdir -p $(dir $@)
$(create-resource-java-files)
- $(call find-generated-R.java)
+ $(call find-generated-R.java,$(PRIVATE_JAVA_GEN_DIR),$@)
-$(proguard_options_file): $(R_file_stamp)
+ $(proguard_options_file): $(R_file_stamp)
-resource_export_package :=
-ifdef LOCAL_EXPORT_PACKAGE_RESOURCES
-# Put this module's resources into a PRODUCT-agnositc package that
-# other packages can use to build their own PRODUCT-agnostic R.java (etc.)
-# files.
-resource_export_package := $(intermediates.COMMON)/package-export.apk
-$(R_file_stamp): $(resource_export_package)
-
-# add-assets-to-package looks at PRODUCT_AAPT_CONFIG, but this target
-# can't know anything about PRODUCT. Clear it out just for this target.
-$(resource_export_package): PRIVATE_PRODUCT_AAPT_CONFIG :=
-$(resource_export_package): PRIVATE_PRODUCT_AAPT_PREF_CONFIG :=
-$(resource_export_package): $(all_res_assets) $(full_android_manifest) $(RenderScript_file_stamp) $(AAPT)
+ ifdef LOCAL_EXPORT_PACKAGE_RESOURCES
+ # Put this module's resources into a PRODUCT-agnositc package that
+ # other packages can use to build their own PRODUCT-agnostic R.java (etc.)
+ # files.
+ resource_export_package := $(intermediates.COMMON)/package-export.apk
+ $(R_file_stamp): $(resource_export_package)
+
+ # add-assets-to-package looks at PRODUCT_AAPT_CONFIG, but this target
+ # can't know anything about PRODUCT. Clear it out just for this target.
+ $(resource_export_package): PRIVATE_PRODUCT_AAPT_CONFIG :=
+ $(resource_export_package): PRIVATE_PRODUCT_AAPT_PREF_CONFIG :=
+ $(resource_export_package): PRIVATE_RESOURCE_LIST := $(all_res_assets)
+ $(resource_export_package): $(all_res_assets) $(full_android_manifest) $(rs_generated_res_zip) $(AAPT)
@echo "target Export Resources: $(PRIVATE_MODULE) ($@)"
$(create-empty-package)
$(add-assets-to-package)
-endif
+ endif
endif # LOCAL_USE_AAPT2
+endif # need_compile_res
+
+called_from_package_internal := true
+#################################
+include $(BUILD_SYSTEM)/java.mk
+#################################
+called_from_package_internal :=
+
+ifeq ($(need_compile_res),true)
+
# Other modules should depend on the BUILT module if
# they want to use this module's R.java file.
$(LOCAL_BUILT_MODULE): $(R_file_stamp)
-ifdef LOCAL_JACK_ENABLED
-ifneq ($(built_dex_intermediate),)
-$(built_dex_intermediate): $(R_file_stamp)
-endif
-ifneq ($(noshrob_classes_jack),)
-$(noshrob_classes_jack): $(R_file_stamp)
-endif
-ifneq ($(full_classes_jack),)
-$(full_classes_jack): $(R_file_stamp)
-$(jack_check_timestamp): $(R_file_stamp)
-endif
-endif # LOCAL_JACK_ENABLED
+# The R.java file must exist by the time the java source
+# list is generated
+$(java_source_list_file): $(R_file_stamp)
-ifneq ($(full_classes_jar),)
-# If full_classes_jar is non-empty, we're building sources.
-# If we're building sources, the initial javac step (which
-# produces full_classes_compiled_jar) needs to ensure the
-# R.java and Manifest.java files have been generated first.
-$(full_classes_compiled_jar): $(R_file_stamp)
+endif # need_compile_res
+
+LOCAL_SDK_RES_VERSION:=$(strip $(LOCAL_SDK_RES_VERSION))
+ifeq ($(LOCAL_SDK_RES_VERSION),)
+ LOCAL_SDK_RES_VERSION:=$(LOCAL_SDK_VERSION)
endif
-endif # need_compile_res
+$(LOCAL_INTERMEDIATE_TARGETS): \
+ PRIVATE_ANDROID_MANIFEST := $(full_android_manifest)
-ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
-# We need to explicitly clear this var so that we don't
-# inherit the value from whomever caused us to be built.
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_AAPT_INCLUDES :=
-else
+ifeq ($(LOCAL_DATA_BINDING),true)
+data_binding_stamp := $(data_binding_intermediates)/data-binding.stamp
+$(data_binding_stamp): PRIVATE_INTERMEDIATES := $(data_binding_intermediates)
+$(data_binding_stamp): PRIVATE_MANIFEST := $(full_android_manifest)
+# Generate code into $(LOCAL_INTERMEDIATE_SOURCE_DIR) so that the generated .java files
+# will be automatically picked up by function compile-java.
+$(data_binding_stamp): PRIVATE_SRC_OUT := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/data-binding
+$(data_binding_stamp): PRIVATE_XML_OUT := $(data_binding_intermediates)/xml
+$(data_binding_stamp): PRIVATE_RES_OUT := $(data_binding_res_out)
+$(data_binding_stamp): PRIVATE_RES_IN := $(data_binding_res_in)
+$(data_binding_stamp): PRIVATE_ANNO_SRC_DIR := $(data_binding_intermediates)/anno-src
+
+$(data_binding_stamp) : $(all_res_assets) $(full_android_manifest) \
+ $(DATA_BINDING_COMPILER)
+ @echo "Data-binding process: $@"
+ @rm -rf $(PRIVATE_INTERMEDIATES) $(PRIVATE_SRC_OUT) && \
+ mkdir -p $(PRIVATE_INTERMEDIATES) $(PRIVATE_SRC_OUT) \
+ $(PRIVATE_XML_OUT) $(PRIVATE_RES_OUT) $(PRIVATE_ANNO_SRC_DIR)
+ $(hide) $(JAVA) -classpath $(DATA_BINDING_COMPILER) android.databinding.tool.MakeCopy \
+ $(PRIVATE_MANIFEST) $(PRIVATE_SRC_OUT) $(PRIVATE_XML_OUT) $(PRIVATE_RES_OUT) $(PRIVATE_RES_IN)
+ $(hide) touch $@
+
+# Make sure the data-binding process happens before javac and generation of R.java.
+$(R_file_stamp): $(data_binding_stamp)
+$(java_source_list_file): $(data_binding_stamp)
+$(full_classes_compiled_jar): $(data_binding_stamp)
+endif # LOCAL_DATA_BINDING
+
+framework_res_package_export :=
+
+ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
# Most packages should link against the resources defined by framework-res.
# Even if they don't have their own resources, they may use framework
# resources.
-ifneq ($(filter-out current system_current test_current,$(LOCAL_SDK_RES_VERSION))$(if $(TARGET_BUILD_APPS),$(filter current system_current test_current,$(LOCAL_SDK_RES_VERSION))),)
+ifeq ($(LOCAL_SDK_RES_VERSION),core_current)
+# core_current doesn't contain any framework resources.
+else ifneq ($(filter-out current system_current test_current,$(LOCAL_SDK_RES_VERSION))$(if $(TARGET_BUILD_APPS),$(filter current system_current test_current,$(LOCAL_SDK_RES_VERSION))),)
# for released sdk versions, the platform resources were built into android.jar.
framework_res_package_export := \
$(HISTORICAL_SDK_VERSIONS_ROOT)/$(LOCAL_SDK_RES_VERSION)/android.jar
-framework_res_package_export_deps := $(framework_res_package_export)
else # LOCAL_SDK_RES_VERSION
framework_res_package_export := \
$(call intermediates-dir-for,APPS,framework-res,,COMMON)/package-export.apk
-# We can't depend directly on the export.apk file; it won't get its
-# PRIVATE_ vars set up correctly if we do. Instead, depend on the
-# corresponding R.stamp file, which lists the export.apk as a dependency.
-framework_res_package_export_deps := \
- $(dir $(framework_res_package_export))src/R.stamp
endif # LOCAL_SDK_RES_VERSION
+endif # LOCAL_NO_STANDARD_LIBRARIES
+
all_library_res_package_exports := \
$(framework_res_package_export) \
$(foreach lib,$(LOCAL_RES_LIBRARIES),\
$(call intermediates-dir-for,APPS,$(lib),,COMMON)/package-export.apk)
all_library_res_package_export_deps := \
- $(framework_res_package_export_deps) \
+ $(framework_res_package_export) \
$(foreach lib,$(LOCAL_RES_LIBRARIES),\
$(call intermediates-dir-for,APPS,$(lib),,COMMON)/src/R.stamp)
$(resource_export_package) $(R_file_stamp) $(LOCAL_BUILT_MODULE): $(all_library_res_package_export_deps)
@@ -530,7 +512,14 @@ $(LOCAL_INTERMEDIATE_TARGETS): \
ifdef LOCAL_USE_AAPT2
$(my_res_package) : $(all_library_res_package_export_deps)
endif
-endif # LOCAL_NO_STANDARD_LIBRARIES
+
+# These four are set above for $(R_stamp_file) and $(my_res_package), but
+# $(LOCAL_BUILT_MODULE) is not set before java.mk, so they have to be set again
+# here.
+$(LOCAL_BUILT_MODULE): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS)
+$(LOCAL_BUILT_MODULE): PRIVATE_TARGET_AAPT_CHARACTERISTICS := $(TARGET_AAPT_CHARACTERISTICS)
+$(LOCAL_BUILT_MODULE): PRIVATE_MANIFEST_PACKAGE_NAME := $(LOCAL_MANIFEST_PACKAGE_NAME)
+$(LOCAL_BUILT_MODULE): PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(LOCAL_MANIFEST_INSTRUMENTATION_FOR)
ifneq ($(full_classes_jar),)
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
@@ -598,14 +587,19 @@ else
$(my_res_package) $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_PREF_CONFIG := $(PRODUCT_AAPT_PREF_CONFIG)
endif
endif
+
$(LOCAL_BUILT_MODULE): PRIVATE_DONT_DELETE_JAR_DIRS := $(LOCAL_DONT_DELETE_JAR_DIRS)
+$(LOCAL_BUILT_MODULE): PRIVATE_RESOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/resources
+$(LOCAL_BUILT_MODULE): PRIVATE_FULL_CLASSES_JAR := $(full_classes_jar)
$(LOCAL_BUILT_MODULE) : $(jni_shared_libraries)
+$(LOCAL_BUILT_MODULE) : $(JAR_ARGS)
ifdef LOCAL_USE_AAPT2
$(LOCAL_BUILT_MODULE): PRIVATE_RES_PACKAGE := $(my_res_package)
$(LOCAL_BUILT_MODULE) : $(my_res_package) $(AAPT2) | $(ACP)
else
-$(LOCAL_BUILT_MODULE) : $(all_res_assets) $(full_android_manifest) $(AAPT)
-endif
+$(LOCAL_BUILT_MODULE): PRIVATE_RESOURCE_LIST := $(all_res_assets)
+$(LOCAL_BUILT_MODULE) : $(all_res_assets) $(full_android_manifest) $(AAPT) $(ZIPALIGN)
+endif # LOCAL_USE_AAPT2
ifdef LOCAL_COMPRESSED_MODULE
$(LOCAL_BUILT_MODULE) : $(MINIGZIP)
endif
@@ -613,13 +607,9 @@ endif
ifdef LOCAL_USE_AAPT2
$(call copy-file-to-new-target)
else # ! LOCAL_USE_AAPT2
-ifdef LOCAL_JACK_ENABLED
- $(create-empty-package)
-else
$(if $(PRIVATE_SOURCE_ARCHIVE),\
$(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@),\
$(create-empty-package))
-endif
$(add-assets-to-package)
endif # LOCAL_USE_AAPT2
ifneq ($(jni_shared_libraries),)
@@ -630,9 +620,13 @@ ifeq ($(full_classes_jar),)
$(if $(PRIVATE_EXTRA_JAR_ARGS),$(call add-java-resources-to,$@))
else # full_classes_jar
$(add-dex-to-package)
+ifdef LOCAL_USE_AAPT2
+ $(call add-jar-resources-to-package,$@,$(PRIVATE_FULL_CLASSES_JAR),$(PRIVATE_RESOURCE_INTERMEDIATES_DIR))
+endif
endif # full_classes_jar
-ifdef LOCAL_JACK_ENABLED
- $(add-carried-jack-resources)
+ifeq (true, $(LOCAL_UNCOMPRESS_DEX))
+ @# No need to align, sign-package below will do it.
+ $(uncompress-dexs)
endif
ifdef LOCAL_DEX_PREOPT
ifneq ($(BUILD_PLATFORM_ZIP),)
@@ -642,7 +636,7 @@ endif # BUILD_PLATFORM_ZIP
ifneq (nostripping,$(LOCAL_DEX_PREOPT))
$(call dexpreopt-remove-classes.dex,$@)
endif
-endif
+endif # LOCAL_DEX_PREOPT
$(sign-package)
ifdef LOCAL_COMPRESSED_MODULE
$(compress-package)
@@ -666,6 +660,10 @@ $(built_odex): PRIVATE_DEX_FILE := $(built_dex)
$(built_odex) : $(dir $(LOCAL_BUILT_MODULE))% : $(built_dex)
$(hide) mkdir -p $(dir $@) && rm -f $@
$(add-dex-to-package)
+ifeq (true, $(LOCAL_UNCOMPRESS_DEX))
+ $(uncompress-dexs)
+ $(align-package)
+endif
$(hide) mv $@ $@.input
$(call dexpreopt-one-file,$@.input,$@)
$(hide) rm $@.input
@@ -689,6 +687,7 @@ $(built_apk_splits) : $(intermediates)/%.apk : $(LOCAL_BUILT_MODULE)
$(sign-package)
# Rules to install the splits
+installed_apk_splits := $(foreach s,$(my_split_suffixes),$(my_module_path)/$(LOCAL_MODULE)_$(s).apk)
$(installed_apk_splits) : $(my_module_path)/$(LOCAL_MODULE)_%.apk : $(intermediates)/package_%.apk
@echo "Install: $@"
$(copy-file-to-new-target)
diff --git a/core/pdk_config.mk b/core/pdk_config.mk
index e12be29..57afa3f 100644
--- a/core/pdk_config.mk
+++ b/core/pdk_config.mk
@@ -7,12 +7,14 @@ PDK_PLATFORM_JAVA_ZIP_JAVA_HOST_LIB_DIR := \
host/common/obj/JAVA_LIBRARIES/hosttestlib_intermediates
PDK_PLATFORM_JAVA_ZIP_CONTENTS :=
-ifneq (,$(filter platform-java, $(MAKECMDGOALS))$(PDK_FUSION_PLATFORM_ZIP))
+ifneq (,$(filter platform-java, $(MAKECMDGOALS))$(PDK_FUSION_PLATFORM_ZIP)$(PDK_FUSION_PLATFORM_DIR))
# additional items to add to platform.zip for platform-java build
# For these dirs, add classes.jar and javalib.jar from the dir to platform.zip
# all paths under out dir
PDK_PLATFORM_JAVA_ZIP_JAVA_TARGET_LIB_DIR += \
target/common/obj/JAVA_LIBRARIES/android.test.runner_intermediates \
+ target/common/obj/JAVA_LIBRARIES/android.hidl.base-V1.0-java_intermediates \
+ target/common/obj/JAVA_LIBRARIES/android.hidl.manager-V1.0-java_intermediates \
target/common/obj/JAVA_LIBRARIES/android-common_intermediates \
target/common/obj/JAVA_LIBRARIES/android-ex-camera2_intermediates \
target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates \
@@ -24,6 +26,7 @@ PDK_PLATFORM_JAVA_ZIP_JAVA_TARGET_LIB_DIR += \
target/common/obj/JAVA_LIBRARIES/legacy-android-test_intermediates \
target/common/obj/JAVA_LIBRARIES/ext_intermediates \
target/common/obj/JAVA_LIBRARIES/framework_intermediates \
+ target/common/obj/JAVA_LIBRARIES/hwbinder_intermediates \
target/common/obj/JAVA_LIBRARIES/ims-common_intermediates \
target/common/obj/JAVA_LIBRARIES/okhttp_intermediates \
target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates \
@@ -40,39 +43,60 @@ PDK_PLATFORM_JAVA_ZIP_JAVA_LIB_DIR := \
$(PDK_PLATFORM_JAVA_ZIP_JAVA_HOST_LIB_DIR)
PDK_PLATFORM_JAVA_ZIP_CONTENTS += $(foreach lib_dir,$(PDK_PLATFORM_JAVA_ZIP_JAVA_LIB_DIR),\
- $(lib_dir)/classes.jack $(lib_dir)/classes.jar $(lib_dir)/classes.jar.toc \
+ $(lib_dir)/classes.jar $(lib_dir)/classes-header.jar \
$(lib_dir)/javalib.jar $(lib_dir)/classes*.dex \
$(lib_dir)/classes.dex.toc )
# check and override java support level
-ifneq ($(TARGET_BUILD_PDK)$(PDK_FUSION_PLATFORM_ZIP),)
-ifneq ($(wildcard external/proguard),)
-TARGET_BUILD_JAVA_SUPPORT_LEVEL := sdk
-else # no proguard
-TARGET_BUILD_JAVA_SUPPORT_LEVEL :=
-endif
-# platform supprot is set after checking platform.zip
+ifneq ($(TARGET_BUILD_PDK)$(PDK_FUSION_PLATFORM_ZIP)$(PDK_FUSION_PLATFORM_DIR),)
+ ifneq ($(wildcard external/proguard),)
+ TARGET_BUILD_JAVA_SUPPORT_LEVEL := sdk
+ else # no proguard
+ TARGET_BUILD_JAVA_SUPPORT_LEVEL :=
+ endif
+ # platform support is set after checking platform.zip
endif # PDK
-ifdef PDK_FUSION_PLATFORM_ZIP
-_pdk_fusion_intermediates := $(call intermediates-dir-for, PACKAGING, pdk_fusion)
-_pdk_fusion_stamp := $(_pdk_fusion_intermediates)/pdk_fusion.stamp
+ifneq (,$(PDK_FUSION_PLATFORM_DIR)$(PDK_FUSION_PLATFORM_ZIP))
-_pdk_fusion_file_list := $(shell unzip -Z -1 $(PDK_FUSION_PLATFORM_ZIP) \
- '*[^/]' -x 'target/common/*' 2>/dev/null)
-_pdk_fusion_java_file_list := \
- $(shell unzip -Z -1 $(PDK_FUSION_PLATFORM_ZIP) 'target/common/*' 2>/dev/null)
-_pdk_fusion_files := $(addprefix $(_pdk_fusion_intermediates)/,\
- $(_pdk_fusion_file_list) $(_pdk_fusion_java_file_list))
+_pdk_fusion_intermediates :=
+_pdk_fusion_stamp :=
+_pdk_fusion_file_list :=
+_pdk_fusion_java_file_list :=
+PDK_FUSION_SYMLINK_STAMP :=
-ifneq ($(_pdk_fusion_java_file_list),)
-# This represents whether java build can use platform API or not
-# This should not be used in Android.mk
-TARGET_BUILD_PDK_JAVA_PLATFORM := true
-ifneq ($(TARGET_BUILD_JAVA_SUPPORT_LEVEL),)
-TARGET_BUILD_JAVA_SUPPORT_LEVEL := platform
-endif
-endif
+ifdef PDK_FUSION_PLATFORM_DIR
+ _pdk_fusion_intermediates := $(PDK_FUSION_PLATFORM_DIR)
+ _pdk_fusion_file_list := $(sort \
+ $(shell cd $(PDK_FUSION_PLATFORM_DIR); find * -type f))
+ _pdk_fusion_java_file_list := $(filter target/common/%,$(_pdk_fusion_file_list))
+ _pdk_fusion_file_list := $(filter-out target/common/%,$(_pdk_fusion_file_list))
+
+ PDK_FUSION_SYMLINK_STAMP := $(call intermediates-dir-for, PACKAGING, pdk_fusion)/pdk_symlinks.stamp
+
+ symlink_list := $(sort \
+ $(shell cd $(PDK_FUSION_PLATFORM_DIR); find * -type l))
+$(PDK_FUSION_SYMLINK_STAMP): PRIVATE_SYMLINKS := $(foreach s,$(symlink_list),\
+ $(s):$(shell readlink $(PDK_FUSION_PLATFORM_DIR)/$(s)))
+$(PDK_FUSION_SYMLINK_STAMP):
+ $(foreach s,$(PRIVATE_SYMLINKS),\
+ mkdir -p $(PRODUCT_OUT)/$(dir $(call word-colon,1,$(s))) && \
+ ln -sf $(call word-colon,2,$(s)) $(PRODUCT_OUT)/$(call word-colon,1,$(s)) &&) true
+ touch $@
+
+ symlink_list :=
+endif # PDK_FUSION_PLATFORM_DIR
+
+ifdef PDK_FUSION_PLATFORM_ZIP
+ _pdk_fusion_intermediates := $(call intermediates-dir-for, PACKAGING, pdk_fusion)
+ _pdk_fusion_stamp := $(_pdk_fusion_intermediates)/pdk_fusion.stamp
+
+ _pdk_fusion_file_list := $(shell unzip -Z -1 $(PDK_FUSION_PLATFORM_ZIP) \
+ '*[^/]' -x 'target/common/*' 2>/dev/null)
+ _pdk_fusion_java_file_list := \
+ $(shell unzip -Z -1 $(PDK_FUSION_PLATFORM_ZIP) 'target/common/*' 2>/dev/null)
+ _pdk_fusion_files := $(addprefix $(_pdk_fusion_intermediates)/,\
+ $(_pdk_fusion_file_list) $(_pdk_fusion_java_file_list))
$(_pdk_fusion_stamp) : $(PDK_FUSION_PLATFORM_ZIP)
@echo "Unzip $(dir $@) <- $<"
@@ -81,9 +105,17 @@ $(_pdk_fusion_stamp) : $(PDK_FUSION_PLATFORM_ZIP)
$(call split-long-arguments,-touch,$(_pdk_fusion_files))
$(hide) touch $@
-
$(_pdk_fusion_files) : $(_pdk_fusion_stamp)
+endif # PDK_FUSION_PLATFORM_ZIP
+ifneq ($(_pdk_fusion_java_file_list),)
+ # This represents whether java build can use platform API or not
+ # This should not be used in Android.mk
+ TARGET_BUILD_PDK_JAVA_PLATFORM := true
+ ifneq ($(TARGET_BUILD_JAVA_SUPPORT_LEVEL),)
+ TARGET_BUILD_JAVA_SUPPORT_LEVEL := platform
+ endif
+endif
# Implicit pattern rules to copy the fusion files to the system image directory.
# Note that if there is already explicit rule in the build system to generate a file,
@@ -101,74 +133,57 @@ $(HOST_COMMON_OUT_ROOT)/% : $(_pdk_fusion_intermediates)/host/common/% $(_pdk_fu
$(hide) cp -fpPR $< $@
ifeq (true,$(TARGET_BUILD_PDK_JAVA_PLATFORM))
+ PDK_FUSION_OUT_DIR := $(OUT_DIR)
-PDK_FUSION_OUT_DIR := $(OUT_DIR)
-ifeq (debug,$(TARGET_BUILD_TYPE))
-PDK_FUSION_OUT_DIR := $(DEBUG_OUT_DIR)
-endif
+ define JAVA_dependency_template
+ $(call add-dependency,$(PDK_FUSION_OUT_DIR)/$(strip $(1)),\
+ $(foreach d,$(filter $(2),$(_pdk_fusion_java_file_list)),$(PDK_FUSION_OUT_DIR)/$(d)))
+ endef
-define JAVA_dependency_template
-$(call add-dependency,$(PDK_FUSION_OUT_DIR)/$(strip $(1)),\
- $(foreach d,$(filter $(2),$(_pdk_fusion_java_file_list)),$(PDK_FUSION_OUT_DIR)/$(d)))
-endef
-
-# needs explicit dependency as package-export.apk is not explicitly pulled
-$(eval $(call JAVA_dependency_template,\
-target/common/obj/APPS/framework-res_intermediates/src/R.stamp,\
-target/common/obj/APPS/framework-res_intermediates/package-export.apk))
-
-# javalib.jar should pull classes.jar as classes.jar is not explicitly pulled.
-$(foreach lib_dir,$(PDK_PLATFORM_JAVA_ZIP_JAVA_TARGET_LIB_DIR),\
-$(eval $(call JAVA_dependency_template,$(lib_dir)/javalib.jar,\
-$(lib_dir)/classes.jar)))
-
-# pull .jack and .dex files
-$(foreach lib_dir,$(PDK_PLATFORM_JAVA_ZIP_JAVA_TARGET_LIB_DIR),\
- $(eval $(call JAVA_dependency_template,$(lib_dir)/classes.jar.toc,\
- $(lib_dir)/classes.jar $(lib_dir)/classes.jack)))
-$(foreach lib_dir,$(PDK_PLATFORM_JAVA_ZIP_JAVA_TARGET_LIB_DIR),\
- $(eval $(call JAVA_dependency_template,$(lib_dir)/classes.dex.toc,\
- $(lib_dir)/classes.jar $(lib_dir)/classes.jack $(lib_dir)/classes%.dex)))
+ # needs explicit dependency as package-export.apk is not explicitly pulled
+ $(eval $(call JAVA_dependency_template,\
+ target/common/obj/APPS/framework-res_intermediates/src/R.stamp,\
+ target/common/obj/APPS/framework-res_intermediates/package-export.apk))
+
+ # javalib.jar should pull classes.jar as classes.jar is not explicitly pulled.
+ $(foreach lib_dir,$(PDK_PLATFORM_JAVA_ZIP_JAVA_TARGET_LIB_DIR),\
+ $(eval $(call JAVA_dependency_template,$(lib_dir)/javalib.jar,\
+ $(lib_dir)/classes.jar)))
# implicit rules for all other target files
$(TARGET_COMMON_OUT_ROOT)/% : $(_pdk_fusion_intermediates)/target/common/% $(_pdk_fusion_stamp)
@mkdir -p $(dir $@)
$(hide) cp -fpPR $< $@
-endif
+endif # TARGET_BUILD_PDK_JAVA_PLATFORM
ALL_PDK_FUSION_FILES := $(addprefix $(PRODUCT_OUT)/, $(_pdk_fusion_file_list))
-endif # PDK_FUSION_PLATFORM_ZIP
+endif # PDK_FUSION_PLATFORM_ZIP || PDK_FUSION_PLATFORM_DIR
ifeq ($(TARGET_BUILD_PDK),true)
-$(info PDK TARGET_BUILD_JAVA_SUPPORT_LEVEL $(TARGET_BUILD_JAVA_SUPPORT_LEVEL))
-ifeq ($(TARGET_BUILD_PDK_JAVA_PLATFORM),)
-
-# SDK used for Java build under PDK
-PDK_BUILD_SDK_VERSION := $(lastword $(TARGET_AVAILABLE_SDK_VERSIONS))
-$(info PDK Build uses SDK $(PDK_BUILD_SDK_VERSION))
-
-else # PDK_JAVA
-
-$(info PDK Build uses the current platform API)
-
-endif # PDK_JAVA
-
+ $(info PDK TARGET_BUILD_JAVA_SUPPORT_LEVEL $(TARGET_BUILD_JAVA_SUPPORT_LEVEL))
+ ifeq ($(TARGET_BUILD_PDK_JAVA_PLATFORM),)
+ # SDK used for Java build under PDK
+ PDK_BUILD_SDK_VERSION := $(lastword $(TARGET_AVAILABLE_SDK_VERSIONS))
+ $(info PDK Build uses SDK $(PDK_BUILD_SDK_VERSION))
+ else # PDK_JAVA
+ $(info PDK Build uses the current platform API)
+ endif # PDK_JAVA
endif # BUILD_PDK
ifneq (,$(filter platform platform-java, $(MAKECMDGOALS))$(filter true,$(TARGET_BUILD_PDK)))
-# files under $(PRODUCT_OUT)/symbols to help debugging.
-# Source not included to PDK due to dependency issue, so provide symbols instead.
-
-# We may not be building all of them.
-# The platform.zip just silently ignores the nonexistent ones.
-PDK_SYMBOL_FILES_LIST := \
- system/bin/app_process32 \
- system/bin/app_process64
-
-ifdef PDK_FUSION_PLATFORM_ZIP
-# symbols should be explicitly pulled for fusion build
-$(foreach f,$(filter $(PDK_SYMBOL_FILES_LIST), $(_pdk_fusion_file_list)),\
- $(eval $(call add-dependency,$(PRODUCT_OUT)/$(f),$(PRODUCT_OUT)/symbols/$(f))))
-endif # PLATFORM_ZIP
-endif # platform.zip build or PDK
+ # files under $(PRODUCT_OUT)/symbols to help debugging.
+ # Source not included to PDK due to dependency issue, so provide symbols instead.
+
+ # We may not be building all of them.
+ # The platform.zip just silently ignores the nonexistent ones.
+ PDK_SYMBOL_FILES_LIST := \
+ system/bin/app_process32 \
+ system/bin/app_process64
+
+ ifneq (,$(PDK_FUSION_PLATFORM_ZIP)$(PDK_FUSION_PLATFORM_DIR))
+ # symbols should be explicitly pulled for fusion build
+ $(foreach f,$(filter $(PDK_SYMBOL_FILES_LIST), $(_pdk_fusion_file_list)),\
+ $(eval $(call add-dependency,$(PRODUCT_OUT)/$(f),$(PRODUCT_OUT)/symbols/$(f))))
+ endif # PLATFORM_ZIP || PLATFORM_DIR
+endif # platform.zip/dir build or PDK
diff --git a/core/pdk_fusion_modules.mk b/core/pdk_fusion_modules.mk
index 0c03f37..9aabd0f 100644
--- a/core/pdk_fusion_modules.mk
+++ b/core/pdk_fusion_modules.mk
@@ -2,10 +2,16 @@
# We use these rules to rebuild .odex files of the .jar/.apk inside the platform.zip.
#
+ifdef PDK_FUSION_PLATFORM_ZIP
pdk_dexpreopt_config_mk := $(TARGET_OUT_INTERMEDIATES)/pdk_dexpreopt_config.mk
$(shell rm -f $(pdk_dexpreopt_config_mk) && mkdir -p $(dir $(pdk_dexpreopt_config_mk)) && \
unzip -qo $(PDK_FUSION_PLATFORM_ZIP) -d $(dir $(pdk_dexpreopt_config_mk)) pdk_dexpreopt_config.mk 2>/dev/null)
+endif
+
+ifdef PDK_FUSION_PLATFORM_DIR
+pdk_dexpreopt_config_mk := $(PDK_FUSION_PLATFORM_DIR)/pdk_dexpreopt_config.mk
+endif
-include $(pdk_dexpreopt_config_mk)
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index 620c22c..0efda57 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -20,19 +20,19 @@ my_32_64_bit_suffix := $(if $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)IS_64_BIT)
ifdef LOCAL_PREBUILT_MODULE_FILE
my_prebuilt_src_file := $(LOCAL_PREBUILT_MODULE_FILE)
+else ifdef LOCAL_SRC_FILES_$($(my_prefix)$(LOCAL_2ND_A