breautek commented on code in PR #1431:
URL: https://github.com/apache/cordova-android/pull/1431#discussion_r873203233
##########
lib/check_reqs.js:
##########
@@ -44,6 +44,31 @@ module.exports.get_target = function (projectRoot) {
return `android-${Math.max(userTargetSdkVersion, SDK_VERSION)}`;
};
+/**
+ * @param {string} projectRoot
+ * @returns {string} The android target in format "android-${target}"
+ */
+module.exports.get_compile = function (projectRoot) {
+ const userTargetSdkVersion = getUserTargetSdkVersion(projectRoot) ||
SDK_VERSION;
+ const userCompileSdkVersion = getUserCompileSdkVersion(projectRoot) ||
COMPILE_SDK_VERSION;
+
+ module.exports.isCompileSdkValid(userCompileSdkVersion,
userTargetSdkVersion);
+
+ return userCompileSdkVersion;
+};
+
+module.exports.isCompileSdkValid = (compileSdk, targetSdk) => {
+ compileSdk = (compileSdk || COMPILE_SDK_VERSION);
+ targetSdk = (targetSdk || SDK_VERSION);
Review Comment:
```suggestion
targetSdk = (targetSdk || SDK_VERSION);
compileSdk = (compileSdk || targetSdk);
```
See main comment for feedback.
##########
framework/cdv-gradle-config-defaults.json:
##########
@@ -1,6 +1,7 @@
{
"MIN_SDK_VERSION": 22,
"SDK_VERSION": 32,
+ "COMPILE_SDK_VERSION": 32,
Review Comment:
```suggestion
"COMPILE_SDK_VERSION": null,
```
We probably don't even need the `key` here at all, but might make it more
clear that `COMPILE_SDK_VERSION` is in fact, a valid variable. Unfortunately,
JSON doesn't support comments to really document this.
See main comment for feedback.
##########
lib/check_reqs.js:
##########
@@ -44,6 +44,31 @@ module.exports.get_target = function (projectRoot) {
return `android-${Math.max(userTargetSdkVersion, SDK_VERSION)}`;
};
+/**
+ * @param {string} projectRoot
+ * @returns {string} The android target in format "android-${target}"
+ */
+module.exports.get_compile = function (projectRoot) {
+ const userTargetSdkVersion = getUserTargetSdkVersion(projectRoot) ||
SDK_VERSION;
+ const userCompileSdkVersion = getUserCompileSdkVersion(projectRoot) ||
COMPILE_SDK_VERSION;
Review Comment:
```suggestion
const userCompileSdkVersion = getUserCompileSdkVersion(projectRoot) ||
userTargetSdkVersion;
```
See main comment for feedback.
##########
lib/check_reqs.js:
##########
@@ -24,7 +24,7 @@ const { forgivingWhichSync, isWindows, isDarwin } =
require('./utils');
const java = require('./env/java');
const { CordovaError, ConfigParser, events } = require('cordova-common');
const android_sdk = require('./android_sdk');
-const { SDK_VERSION } = require('./gradle-config-defaults');
+const { SDK_VERSION, COMPILE_SDK_VERSION } =
require('./gradle-config-defaults');
Review Comment:
```suggestion
const { SDK_VERSION } = require('./gradle-config-defaults');
```
See main comment for feedback.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]