You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2015/10/28 10:13:45 UTC
android commit: CB-9844 Remove old .java after renaming activity
Repository: cordova-android
Updated Branches:
refs/heads/master 5a07a51b5 -> c1b389ad9
CB-9844 Remove old .java after renaming activity
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/c1b389ad
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/c1b389ad
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/c1b389ad
Branch: refs/heads/master
Commit: c1b389ad9b75c7029acc33a532f5626692235daf
Parents: 5a07a51
Author: Vladimir Kotikov <v-...@microsoft.com>
Authored: Tue Oct 27 09:12:47 2015 +0300
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Tue Oct 27 11:30:58 2015 +0300
----------------------------------------------------------------------
bin/templates/cordova/lib/prepare.js | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/c1b389ad/bin/templates/cordova/lib/prepare.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/prepare.js b/bin/templates/cordova/lib/prepare.js
index a514c8c..3fba9fd 100644
--- a/bin/templates/cordova/lib/prepare.js
+++ b/bin/templates/cordova/lib/prepare.js
@@ -157,8 +157,23 @@ function updateProjectAccordingTo(platformConfig, locations) {
shell.mkdir('-p', path.dirname(destFile));
shell.sed(/package [\w\.]*;/, 'package ' + pkg + ';', java_files[0]).to(destFile);
events.emit('verbose', 'Wrote out Android package name to "' + pkg + '"');
-}
+ if (orig_pkg !== pkg) {
+ // If package was name changed we need to remove old java with main activity
+ shell.rm('-Rf',java_files[0]);
+ // remove any empty directories
+ var currentDir = path.dirname(java_files[0]);
+ var sourcesRoot = path.resolve(locations.root, 'src');
+ while(currentDir !== sourcesRoot) {
+ if(fs.existsSync(currentDir) && fs.readdirSync(currentDir).length === 0) {
+ fs.rmdirSync(currentDir);
+ currentDir = path.resolve(currentDir, '..');
+ } else {
+ break;
+ }
+ }
+ }
+}
// Consturct the default value for versionCode as
// PATCH + MINOR * 100 + MAJOR * 10000
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org