You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bo...@apache.org on 2015/09/23 21:58:35 UTC
[24/45] android commit: CB-9428 update script now bumps up
minSdkVersion to 14 if it is less than that.
CB-9428 update script now bumps up minSdkVersion to 14 if it is less than that.
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/4126d3ec
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/4126d3ec
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/4126d3ec
Branch: refs/heads/5.0.x
Commit: 4126d3ecfeed50f344ddc81ea52f3e54207d84d7
Parents: 0b6909a
Author: Steve Gill <st...@gmail.com>
Authored: Fri Jul 31 16:32:41 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Thu Aug 20 14:22:40 2015 -0700
----------------------------------------------------------------------
bin/lib/create.js | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/4126d3ec/bin/lib/create.js
----------------------------------------------------------------------
diff --git a/bin/lib/create.js b/bin/lib/create.js
index 0815870..e804b6e 100755
--- a/bin/lib/create.js
+++ b/bin/lib/create.js
@@ -290,12 +290,31 @@ function extractProjectNameFromManifest(projectPath) {
return m[1];
}
+// Cordova-android updates sometimes drop support for older versions. Need to update minSDK in existing projects.
+function updateMinSDKInManifest(projectPath) {
+ var manifestPath = path.join(projectPath, 'AndroidManifest.xml');
+ var manifestData = fs.readFileSync(manifestPath, 'utf8');
+ var minSDKVersion = 14;
+
+ //grab minSdkVersion from Android.
+ var m = /android:minSdkVersion\s*=\s*"(.*?)"/i.exec(manifestData);
+ if (!m) {
+ throw new Error('Could not find minSDKVersion in ' + manifestPath);
+ }
+ //if minSDKVersion in Android.manifest is less than our current min, replace it
+ if(Number(m[1]) < minSDKVersion) {
+ console.log('Updating minSdkVersion from ' + m[1] + ' to ' + minSDKVersion + ' in AndroidManifest.xml');
+ shell.sed('-i', /android:minSdkVersion\s*=\s*"(.*?)"/, 'android:minSdkVersion="'+minSDKVersion+'"', manifestPath);
+ }
+}
+
// Returns a promise.
exports.updateProject = function(projectPath, shared) {
return Q()
.then(function() {
var projectName = extractProjectNameFromManifest(projectPath);
var target_api = check_reqs.get_target();
+ updateMinSDKInManifest(projectPath);
copyJsAndLibrary(projectPath, shared, projectName);
copyScripts(projectPath);
copyBuildRules(projectPath);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org