Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-15981] Fixed bug with custom AndroidManifest.xml where the... #5123

Merged
merged 2 commits into from
Dec 16, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 20 additions & 9 deletions android/cli/commands/_build.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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