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 2021/04/26 08:10:22 UTC

[GitHub] [cordova-android] raphinesse commented on a change in pull request #1212: breaking: fixes target sdk override

raphinesse commented on a change in pull request #1212:
URL: https://github.com/apache/cordova-android/pull/1212#discussion_r620066627



##########
File path: bin/lib/create.js
##########
@@ -66,8 +66,10 @@ function copyJsAndLibrary (projectPath, shared, projectName, targetAPI) {
     } else {
         fs.ensureDirSync(nestedCordovaLibPath);
         fs.copySync(path.join(ROOT, 'framework', 'AndroidManifest.xml'), path.join(nestedCordovaLibPath, 'AndroidManifest.xml'));
-        TemplateFile.render(path.join(ROOT, 'framework', 'project.properties'), path.join(nestedCordovaLibPath, 'project.properties'), {
-            SDK_VERSION: targetAPI || constants.SDK_VERSION
+        await new Promise((resolve) => {
+            const propertiesEditor = createEditor(path.join(ROOT, 'framework', 'project.properties'));
+            propertiesEditor.set('target', `android-${targetAPI || constants.SDK_VERSION}`);
+            propertiesEditor.save(path.join(nestedCordovaLibPath, 'project.properties'), resolve);

Review comment:
       This code handles no errors. Fortunately, as it turns out, `properties-parser` [supports sync writing](https://github.com/xavi-/node-properties-parser/blob/fb1b7038380fa295ff80ed0d1a1fad3ad1788738/index.js#L367-L371) it is just missing from the documentation. We also already make use of that fact in `GradlePropertiesParser`. So we should probably just use the sync version.




-- 
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