You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2020/12/04 09:17:20 UTC

[GitHub] [cordova-android] wedgberto commented on a change in pull request #1140: Mainactivity track packagename change

wedgberto commented on a change in pull request #1140:
URL: https://github.com/apache/cordova-android/pull/1140#discussion_r535950136



##########
File path: bin/templates/cordova/lib/prepare.js
##########
@@ -249,14 +249,18 @@ function updateProjectAccordingTo (platformConfig, locations) {
         events.emit('log', 'Multiple candidate Java files that extend CordovaActivity found. Guessing at the first one, ' + java_files[0]);
     }
 
-    const destFile = java_files[0];
-
-    // var destFile = path.join(locations.root, 'app', 'src', 'main', 'java', androidPkgName.replace(/\./g, '/'), path.basename(java_files[0]));
-    // fs.ensureDirSync(path.dirname(destFile));
-    // events.emit('verbose', java_files[0]);
-    // events.emit('verbose', destFile);
-    // console.log(locations);
-    // fs.copySync(java_files[0], destFile);
+    var destFile = java_files[0];
+
+    // if package name has changed, path to MainActivity.java has to track it
+    var newDestFile = path.join(locations.root, 'app', 'src', 'main', 'java', androidPkgName.replace(/\./g, '/'), path.basename(java_files[0]));
+    if (newDestFile !== destFile) {
+        fs.ensureDirSync(path.dirname(newDestFile));
+        events.emit('verbose', destFile);
+        events.emit('verbose', newDestFile);
+        console.log(locations);

Review comment:
       I was trying to figure out what was going on with the unit test




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org