Due to the version customization, some versions of the resource files (such as style.xml) need different configuration, but the android compiler switch can not be used in XML, and then think of compile-time according to the different compilation switches to compile different files, as follows:
1. Build the A.xml file and compile the file to the specified directory when the compile switch oem_customer_support=22.
Build the B.xml file, and copy the file to the specified directory when the compile switch oem_customer_support not equal to 22 o'clock.
2. Write the copy script file mydefine.sh, as follows:
#!/bin/bash
#
If [$OEM _customer_support-eq 22]; Then
CP Packages/apps/xxx/config/a.xml Packages/apps/xxx/res/values/styles.xml
Else
CP Packages/apps/xxx/config/b.xml Packages/apps/xxx/res/values/styles.xml
Fi
3. Add the Copy script file mydefine.sh to the system compilation BUILD/CORE/MAIN.MK
......
# A Helper Goal printing out install paths
. Phony:get-install-path
Get-install-path:
@$ (foreach m, $ (all_modules), $ (if $ (all_modules.$ (m). Installed), \
Echo ' Install-path: $ (m) $ (all_modules.$ (m). Installed) ';))
else # One_shot_makefile
Ifneq ($ (Dont_bother), true)
#
# Include All of the makefiles in the system
#
# Can ' t use First-makefiles-under here because
#--mindepth=2 makes the prunes isn't work.
$ (Shell chmod 777 packages/apps/peephole/config/peepholestyle.sh)
$ (Shell packages/apps/peephole/config/peepholestyle.sh)
......
The bold part is the new content, the first sentence is to make the SH script has read and write execution permission, the second sentence is the real execution
Android Source compile-time copy replaces specified file