Workaround Phonegap's inability to distinguish when to rebuild the apk

This commit is contained in:
Slava Kim
2014-10-07 01:13:10 -07:00
parent ea0f431cb3
commit 08a0a59925

View File

@@ -797,13 +797,17 @@ var buildCordova = function (localPath, buildCommand, options) {
// depending on the debug mode build the android part in different modes
if (_.contains(project.getPlatforms(), 'android')) {
var manifestPath =
path.join(cordovaPath, 'platforms', 'android', 'AndroidManifest.xml');
var androidBuildPath = path.join(cordovaPath, 'platforms', 'android');
var manifestPath = path.join(androidBuildPath, 'AndroidManifest.xml');
// XXX a hack to reset the debuggable mode
var manifest = fs.readFileSync(manifestPath, 'utf8');
manifest = manifest.replace(/android:debuggable=.(true|false)./g, '');
manifest = manifest.replace(/<application /g, '<application android:debuggable="' + !!options.debug + '" ');
fs.writeFileSync(manifestPath, manifest, 'utf8');
// XXX workaround the problem of cached apk invalidation
files.rm_recursive(path.join(androidBuildPath, 'ant-build'));
}
if (! options.debug) {