Linux: 时间戳

开发中会存在如下情况,为了防止可能的改动错误,先将要改动的源码备份,新代码有问题时,再还原回原先OK的代码。

如果此时选择仅仅重新build而没有clean,则实际上并没有build原先的代码。

而此时误以为已经还原到原先的代码,就会范很多很傻的错误 ...


这里就是时间戳的问题:只要目标文件比依赖文件(源文件)新,那么就不会重新编译。


比如换回原先的代码,然后执行mmm:

rzzhang@rzzhang-HOME:~/Android/Source$ mmm packages/apps/Settings

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.0.1
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=ITL41D
============================================
make: Entering directory `/home/rzzhang/Android/Source'
make: Nothing to be done for `all_modules'.
make: Leaving directory `/home/rzzhang/Android/Source'

咋办?

要编译的源码里随便找个源文件,改一下,保存,再改回去,OK,重新编译:

rzzhang@rzzhang-HOME:~/Android/Source$ mmm packages/apps/Settings
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.0.1
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=ITL41D
============================================
make: Entering directory `/home/rzzhang/Android/Source'
target Java: Settings (out/target/common/obj/APPS/Settings_intermediates/classes)
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Copying: out/target/common/obj/APPS/Settings_intermediates/classes-jarjar.jar
Copying: out/target/common/obj/APPS/Settings_intermediates/emma_out/lib/classes-jarjar.jar
Copying: out/target/common/obj/APPS/Settings_intermediates/classes.jar
Copying: out/target/common/obj/APPS/Settings_intermediates/noproguard.classes.jar
target Dex: Settings
Copying: out/target/common/obj/APPS/Settings_intermediates/noproguard.classes.dex
target Package: Settings (out/target/product/generic/obj/APPS/Settings_intermediates/package.apk)
    (skipping backup file 'packages/apps/Settings/res/values/strings.xml~')
    (skipping backup file 'packages/apps/Settings/res/xml/sound_settings.xml~')
 'out/target/common/obj/APPS/Settings_intermediates//classes.dex' as 'classes.dex'...
Processing target/product/generic/obj/APPS/Settings_intermediates/package.apk
Done!
Install: out/target/product/generic/system/app/Settings.odex
Install: out/target/product/generic/system/app/Settings.apk
target Java: SettingsTests (out/target/common/obj/APPS/SettingsTests_intermediates/classes)
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Copying: out/target/common/obj/APPS/SettingsTests_intermediates/classes-jarjar.jar
Copying: out/target/common/obj/APPS/SettingsTests_intermediates/emma_out/lib/classes-jarjar.jar
Copying: out/target/common/obj/APPS/SettingsTests_intermediates/classes.jar
Copying: out/target/common/obj/APPS/SettingsTests_intermediates/noproguard.classes.jar
target Dex: SettingsTests
Copying: out/target/common/obj/APPS/SettingsTests_intermediates/noproguard.classes.dex
target Package: SettingsTests (out/target/product/generic/obj/APPS/SettingsTests_intermediates/package.apk)
 'out/target/common/obj/APPS/SettingsTests_intermediates//classes.dex' as 'classes.dex'...
Processing target/product/generic/obj/APPS/SettingsTests_intermediates/package.apk
Done!
Install: out/target/product/generic/data/app/SettingsTests.odex
Install: out/target/product/generic/data/app/SettingsTests.apk
make: Leaving directory `/home/rzzhang/Android/Source'

(待继续求证于验证 ...)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值