mirror of
https://github.com/apache/cordova-android.git
synced 2026-05-30 00:00:04 +08:00
feat: support custom compileSdk setting (#1431)
* feat: support custom compileSdk setting * chore: apply suggestions from code review * chore: apply cdv-gradle-config-defaults.json suggestion * fix: set compile sdk when null * fix: move compileSdk null check to gradle * fix: compile sdk requirement warning & display in gradle per subproject Co-authored-by: Norman Breau <norman@nbsolutions.ca>
This commit is contained in:
@@ -82,6 +82,14 @@ function updateUserProjectGradleConfig (project) {
|
||||
...getUserGradleConfig(project._config)
|
||||
};
|
||||
|
||||
// Check if compile sdk is valid.
|
||||
// The returned result is iggnored and since we do not need and will not throw an error.
|
||||
// Only using the valid check call for display the warning when target is greater then compiled.
|
||||
checkReqs.isCompileSdkValid(
|
||||
projectGradleConfig.COMPILE_SDK_VERSION,
|
||||
projectGradleConfig.SDK_VERSION
|
||||
);
|
||||
|
||||
// Write out changes
|
||||
const projectGradleConfigPath = path.join(project.root, 'cdv-gradle-config.json');
|
||||
fs.writeJSONSync(projectGradleConfigPath, projectGradleConfig, { spaces: 2 });
|
||||
@@ -92,6 +100,7 @@ function getUserGradleConfig (configXml) {
|
||||
{ xmlKey: 'android-minSdkVersion', gradleKey: 'MIN_SDK_VERSION', type: Number },
|
||||
{ xmlKey: 'android-maxSdkVersion', gradleKey: 'MAX_SDK_VERSION', type: Number },
|
||||
{ xmlKey: 'android-targetSdkVersion', gradleKey: 'SDK_VERSION', type: Number },
|
||||
{ xmlKey: 'android-compileSdkVersion', gradleKey: 'COMPILE_SDK_VERSION', type: Number },
|
||||
{ xmlKey: 'android-buildToolsVersion', gradleKey: 'BUILD_TOOLS_VERSION', type: String },
|
||||
{ xmlKey: 'GradleVersion', gradleKey: 'GRADLE_VERSION', type: String },
|
||||
{ xmlKey: 'AndroidGradlePluginVersion', gradleKey: 'AGP_VERSION', type: String },
|
||||
|
||||
Reference in New Issue
Block a user