Skip to content

Commit

Permalink
Merge pull request #5124 from cb1kenobi/timob-15981_3_2_X
Browse files Browse the repository at this point in the history
[TIMOB-15981] Fixed bug with custom AndroidManifest.xml where the...
  • Loading branch information
ayeung committed Dec 16, 2013
2 parents f8ae2fc + 82b6a9e commit 2a93aca
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
29 changes: 20 additions & 9 deletions android/cli/commands/_build.js
Expand Up @@ -2042,12 +2042,10 @@ AndroidBuilder.prototype.getLastBuildState = function getLastBuildState(next) {
(function walk(dir) {
fs.existsSync(dir) && fs.readdirSync(dir).forEach(function (name) {
var file = path.join(dir, name);
if (fs.existsSync(file)) {
if (fs.statSync(file).isDirectory()) {
walk(file);
} else {
lastBuildFiles[file] = 1;
}
if (fs.existsSync(file) && fs.statSync(file).isDirectory()) {
walk(file);
} else {
lastBuildFiles[file] = 1;
}
});
}(this.buildDir));
Expand Down Expand Up @@ -2910,9 +2908,19 @@ AndroidBuilder.prototype.copyModuleResources = function copyModuleResources(next

AndroidBuilder.prototype.removeOldFiles = function removeOldFiles(next) {
Object.keys(this.lastBuildFiles).forEach(function (file) {
if ((file.indexOf(this.buildAssetsDir) == 0 || file.indexOf(this.buildBinAssetsResourcesDir) == 0 || (this.forceRebuild && file.indexOf(this.buildGenAppIdDir) == 0) || file.indexOf(this.buildResDir) == 0) && fs.existsSync(file)) {
this.logger.debug(__('Removing old file: %s', file.cyan));
fs.unlinkSync(file);
if (path.dirname(file) == this.buildDir || file.indexOf(this.buildAssetsDir) == 0 || file.indexOf(this.buildBinAssetsResourcesDir) == 0 || (this.forceRebuild && file.indexOf(this.buildGenAppIdDir) == 0) || file.indexOf(this.buildResDir) == 0) {
if (fs.existsSync(file)) {
this.logger.debug(__('Removing old file: %s', file.cyan));
fs.unlinkSync(file);
} else {
// maybe it's a symlink?
try {
if (fs.lstatSync(file)) {
this.logger.debug(__('Removing old symlink: %s', file.cyan));
fs.unlinkSync(file);
}
} catch (e) {}
}
}
}, this);

Expand Down Expand Up @@ -3425,6 +3433,9 @@ AndroidBuilder.prototype.generateAndroidManifest = function generateAndroidManif
finalAndroidManifest['uses-permission'].indexOf(perm) == -1 && finalAndroidManifest['uses-permission'].push(perm);
});

// if the AndroidManifest.xml already exists, remove it so that we aren't updating the original file (if it's symlinked)
fs.existsSync(this.androidManifestFile) && fs.unlinkSync(this.androidManifestFile);

fs.writeFileSync(this.androidManifestFile, finalAndroidManifest.toString('xml'));

next();
Expand Down
3 changes: 2 additions & 1 deletion android/cli/locales/en.js
Expand Up @@ -215,7 +215,7 @@
"Processing JavaScript files": "Processing JavaScript files",
"Encrypting JavaScript files: %s": "Encrypting JavaScript files: %s",
"Failed to encrypt JavaScript files": "Failed to encrypt JavaScript files",
"64-bit titanium prep failed, trying again using 32-bit": "64-bit titanium prep failed, trying again using 32-bit",
"32-bit titanium prep failed, trying again using 64-bit": "32-bit titanium prep failed, trying again using 64-bit",
"Adding library %s": "Adding library %s",
"Unknown namespace %s, skipping": "Unknown namespace %s, skipping",
"Adding dependency library %s": "Adding dependency library %s",
Expand All @@ -227,6 +227,7 @@
"Extracting module resources: %s": "Extracting module resources: %s",
"Failed to extract module resource zip: %s": "Failed to extract module resource zip: %s",
"Removing old file: %s": "Removing old file: %s",
"Removing old symlink: %s": "Removing old symlink: %s",
"Copying template %s => %s": "Copying template %s => %s",
"Generating activity class: %s": "Generating activity class: %s",
"Generating interval service class: %s": "Generating interval service class: %s",
Expand Down

0 comments on commit 2a93aca

Please sign in to comment.