Update to Cordova Android 7.1.2

This commit is contained in:
Morgan McMillian 2018-11-10 07:03:05 -08:00
parent 9a02daa626
commit dad8eed809
29 changed files with 240 additions and 227 deletions

View file

@ -98,6 +98,6 @@
<variable name="ANDROID_SUPPORT_VERSION" value="27.+" /> <variable name="ANDROID_SUPPORT_VERSION" value="27.+" />
</plugin> </plugin>
<plugin name="cordova-plugin-filepath" spec="^1.3.0" /> <plugin name="cordova-plugin-filepath" spec="^1.3.0" />
<engine name="android" spec="7.1.0" />
<plugin name="cordova-sqlite-storage" spec="2.5.1" /> <plugin name="cordova-sqlite-storage" spec="2.5.1" />
<engine name="android" spec="~7.1.2" />
</widget> </widget>

117
package-lock.json generated
View file

@ -2017,9 +2017,9 @@
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
}, },
"com-darryncampbell-cordova-plugin-intent": { "com-darryncampbell-cordova-plugin-intent": {
"version": "1.1.0", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/com-darryncampbell-cordova-plugin-intent/-/com-darryncampbell-cordova-plugin-intent-1.1.0.tgz", "resolved": "https://registry.npmjs.org/com-darryncampbell-cordova-plugin-intent/-/com-darryncampbell-cordova-plugin-intent-1.1.1.tgz",
"integrity": "sha512-KPyU4RlOl1ofliMSyHms3eyyzIAvRCEpGda5T8j3XXmYeU0YdLG7UeHat84eJWByjv8K7XhMbVu841DnipPrLg==" "integrity": "sha512-h+V54+qCFY1h5csX8lAKTxBn5DdbP/8/sm7vS6X0WZPI+OTKycxeoJC+oGtPHhlvTh4gSEVW5/MkDqANRcmaug=="
}, },
"combined-stream": { "combined-stream": {
"version": "1.0.6", "version": "1.0.6",
@ -2139,17 +2139,40 @@
"dev": true "dev": true
}, },
"cordova-android": { "cordova-android": {
"version": "7.1.0", "version": "7.1.2",
"resolved": "http://registry.npmjs.org/cordova-android/-/cordova-android-7.1.0.tgz", "resolved": "https://registry.npmjs.org/cordova-android/-/cordova-android-7.1.2.tgz",
"integrity": "sha1-HNNu57nRm61Q0+mEK3Mf5ZCSTdU=", "integrity": "sha512-w28HJGtfAZCT96hVH9BMppWMnmDTZplKu2NRQZN2dCr5e9r7aHpay41MYy9IBkh8+7E7lMo/jZkRwBDNr4VnEg==",
"requires": { "requires": {
"abbrev": "1.1.1",
"android-versions": "1.3.0", "android-versions": "1.3.0",
"cordova-common": "2.2.1", "ansi": "0.3.1",
"balanced-match": "1.0.0",
"base64-js": "1.2.0",
"big-integer": "1.6.32",
"bplist-parser": "0.1.1",
"brace-expansion": "1.1.11",
"concat-map": "0.0.1",
"cordova-common": "2.2.5",
"cordova-registry-mapper": "1.1.15",
"elementtree": "0.1.6", "elementtree": "0.1.6",
"nopt": "3.0.6", "glob": "5.0.15",
"inflight": "1.0.6",
"inherits": "2.0.3",
"minimatch": "3.0.4",
"nopt": "3.0.1",
"once": "1.4.0",
"path-is-absolute": "1.0.1",
"plist": "2.1.0",
"properties-parser": "0.2.3", "properties-parser": "0.2.3",
"q": "1.5.1", "q": "1.4.1",
"shelljs": "0.5.3" "sax": "0.3.5",
"semver": "5.5.0",
"shelljs": "0.5.3",
"underscore": "1.9.1",
"unorm": "1.4.1",
"wrappy": "1.0.2",
"xmlbuilder": "8.2.2",
"xmldom": "0.1.27"
}, },
"dependencies": { "dependencies": {
"abbrev": { "abbrev": {
@ -2172,18 +2195,18 @@
"bundled": true "bundled": true
}, },
"base64-js": { "base64-js": {
"version": "0.0.8", "version": "1.2.0",
"bundled": true "bundled": true
}, },
"big-integer": { "big-integer": {
"version": "1.6.26", "version": "1.6.32",
"bundled": true "bundled": true
}, },
"bplist-parser": { "bplist-parser": {
"version": "0.1.1", "version": "0.1.1",
"bundled": true, "bundled": true,
"requires": { "requires": {
"big-integer": "1.6.26" "big-integer": "1.6.32"
} }
}, },
"brace-expansion": { "brace-expansion": {
@ -2199,7 +2222,7 @@
"bundled": true "bundled": true
}, },
"cordova-common": { "cordova-common": {
"version": "2.2.1", "version": "2.2.5",
"bundled": true, "bundled": true,
"requires": { "requires": {
"ansi": "0.3.1", "ansi": "0.3.1",
@ -2208,12 +2231,10 @@
"elementtree": "0.1.6", "elementtree": "0.1.6",
"glob": "5.0.15", "glob": "5.0.15",
"minimatch": "3.0.4", "minimatch": "3.0.4",
"osenv": "0.1.5", "plist": "2.1.0",
"plist": "1.2.0", "q": "1.4.1",
"q": "1.5.1",
"semver": "5.5.0",
"shelljs": "0.5.3", "shelljs": "0.5.3",
"underscore": "1.8.3", "underscore": "1.9.1",
"unorm": "1.4.1" "unorm": "1.4.1"
} }
}, },
@ -2251,10 +2272,6 @@
"version": "2.0.3", "version": "2.0.3",
"bundled": true "bundled": true
}, },
"lodash": {
"version": "3.10.1",
"bundled": true
},
"minimatch": { "minimatch": {
"version": "3.0.4", "version": "3.0.4",
"bundled": true, "bundled": true,
@ -2263,7 +2280,7 @@
} }
}, },
"nopt": { "nopt": {
"version": "3.0.6", "version": "3.0.1",
"bundled": true, "bundled": true,
"requires": { "requires": {
"abbrev": "1.1.1" "abbrev": "1.1.1"
@ -2276,33 +2293,16 @@
"wrappy": "1.0.2" "wrappy": "1.0.2"
} }
}, },
"os-homedir": {
"version": "1.0.2",
"bundled": true
},
"os-tmpdir": {
"version": "1.0.2",
"bundled": true
},
"osenv": {
"version": "0.1.5",
"bundled": true,
"requires": {
"os-homedir": "1.0.2",
"os-tmpdir": "1.0.2"
}
},
"path-is-absolute": { "path-is-absolute": {
"version": "1.0.1", "version": "1.0.1",
"bundled": true "bundled": true
}, },
"plist": { "plist": {
"version": "1.2.0", "version": "2.1.0",
"bundled": true, "bundled": true,
"requires": { "requires": {
"base64-js": "0.0.8", "base64-js": "1.2.0",
"util-deprecate": "1.0.2", "xmlbuilder": "8.2.2",
"xmlbuilder": "4.0.0",
"xmldom": "0.1.27" "xmldom": "0.1.27"
} }
}, },
@ -2311,7 +2311,7 @@
"bundled": true "bundled": true
}, },
"q": { "q": {
"version": "1.5.1", "version": "1.4.1",
"bundled": true "bundled": true
}, },
"sax": { "sax": {
@ -2327,27 +2327,20 @@
"bundled": true "bundled": true
}, },
"underscore": { "underscore": {
"version": "1.8.3", "version": "1.9.1",
"bundled": true "bundled": true
}, },
"unorm": { "unorm": {
"version": "1.4.1", "version": "1.4.1",
"bundled": true "bundled": true
}, },
"util-deprecate": {
"version": "1.0.2",
"bundled": true
},
"wrappy": { "wrappy": {
"version": "1.0.2", "version": "1.0.2",
"bundled": true "bundled": true
}, },
"xmlbuilder": { "xmlbuilder": {
"version": "4.0.0", "version": "8.2.2",
"bundled": true, "bundled": true
"requires": {
"lodash": "3.10.1"
}
}, },
"xmldom": { "xmldom": {
"version": "0.1.27", "version": "0.1.27",
@ -2356,11 +2349,19 @@
} }
}, },
"cordova-android-support-gradle-release": { "cordova-android-support-gradle-release": {
"version": "1.4.4", "version": "1.4.7",
"resolved": "https://registry.npmjs.org/cordova-android-support-gradle-release/-/cordova-android-support-gradle-release-1.4.4.tgz", "resolved": "https://registry.npmjs.org/cordova-android-support-gradle-release/-/cordova-android-support-gradle-release-1.4.7.tgz",
"integrity": "sha512-DOwZ+MX0CBoagXV6cHqfQacVjsrDea8z2wuM427AIvi2eAFvojw85o1XMCdJ4kSDMbsUUaNPw12h7uY0m+rcvg==", "integrity": "sha512-3hDS3mBjSAEzKM4gZBze8G02/aNQgcww1CyUneuYPOYvleTPk3Q4OYkjmHHuE4FEgr4v9EY6j6bJqoX9pMZHgg==",
"requires": { "requires": {
"semver": "5.1.0",
"xml2js": "0.4.19" "xml2js": "0.4.19"
},
"dependencies": {
"semver": {
"version": "5.1.0",
"resolved": "http://registry.npmjs.org/semver/-/semver-5.1.0.tgz",
"integrity": "sha1-hfLPhVBGXE3wAM99hvawVBBqueU="
}
} }
}, },
"cordova-plugin-device": { "cordova-plugin-device": {

View file

@ -29,9 +29,9 @@
"@ionic-native/splash-screen": "4.9.0", "@ionic-native/splash-screen": "4.9.0",
"@ionic-native/status-bar": "4.9.0", "@ionic-native/status-bar": "4.9.0",
"@ionic/storage": "2.1.3", "@ionic/storage": "2.1.3",
"com-darryncampbell-cordova-plugin-intent": "^1.1.0", "com-darryncampbell-cordova-plugin-intent": "^1.1.1",
"cordova-android": "7.1.0", "cordova-android": "7.1.2",
"cordova-android-support-gradle-release": "^1.4.4", "cordova-android-support-gradle-release": "^1.4.7",
"cordova-plugin-device": "^2.0.2", "cordova-plugin-device": "^2.0.2",
"cordova-plugin-file": "^6.0.1", "cordova-plugin-file": "^6.0.1",
"cordova-plugin-file-transfer": "^1.7.1", "cordova-plugin-file-transfer": "^1.7.1",
@ -42,7 +42,7 @@
"cordova-plugin-splashscreen": "^5.0.2", "cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-telerik-imagepicker": "^2.1.8", "cordova-plugin-telerik-imagepicker": "^2.1.8",
"cordova-plugin-whitelist": "^1.3.3", "cordova-plugin-whitelist": "^1.3.3",
"cordova-sqlite-storage": "2.5.1", "cordova-sqlite-storage": "^2.5.1",
"ionic-angular": "3.9.2", "ionic-angular": "3.9.2",
"ionicons": "4.2.4", "ionicons": "4.2.4",
"moment": "^2.18.1", "moment": "^2.18.1",

View file

@ -24,10 +24,10 @@ ext {
buildscript { buildscript {
repositories { repositories {
jcenter()
maven { maven {
url "https://maven.google.com" url "https://maven.google.com"
} }
jcenter()
} }
dependencies { dependencies {
@ -42,7 +42,7 @@ apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray' apply plugin: 'com.jfrog.bintray'
group = 'org.apache.cordova' group = 'org.apache.cordova'
version = '7.1.0' version = '7.1.2'
android { android {
compileSdkVersion cdvCompileSdkVersion compileSdkVersion cdvCompileSdkVersion
@ -129,9 +129,9 @@ bintray {
licenses = ['Apache-2.0'] licenses = ['Apache-2.0']
labels = ['android', 'cordova', 'phonegap'] labels = ['android', 'cordova', 'phonegap']
version { version {
name = '7.1.0' name = '7.1.2'
released = new Date() released = new Date()
vcsTag = '7.1.0' vcsTag = '7.1.2'
} }
} }
} }

View file

@ -263,6 +263,7 @@ public class CordovaResourceApi {
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
// Will occur if the file is compressed. // Will occur if the file is compressed.
inputStream = assetManager.open(assetPath); inputStream = assetManager.open(assetPath);
length = inputStream.available();
} }
String mimeType = getMimeTypeFromPath(assetPath); String mimeType = getMimeTypeFromPath(assetPath);
return new OpenForReadResult(uri, inputStream, mimeType, length, assetFd); return new OpenForReadResult(uri, inputStream, mimeType, length, assetFd);

View file

@ -31,7 +31,7 @@ import android.webkit.WebChromeClient.CustomViewCallback;
* are not expected to implement it. * are not expected to implement it.
*/ */
public interface CordovaWebView { public interface CordovaWebView {
public static final String CORDOVA_VERSION = "7.1.0"; public static final String CORDOVA_VERSION = "7.1.2";
void init(CordovaInterface cordova, List<PluginEntry> pluginEntries, CordovaPreferences preferences); void init(CordovaInterface cordova, List<PluginEntry> pluginEntries, CordovaPreferences preferences);

View file

@ -97,7 +97,7 @@
], ],
"/manifest/application": [ "/manifest/application": [
{ {
"xml": "<provider android:authorities=\"${applicationId}.provider\" android:exported=\"false\" android:grantUriPermissions=\"true\" android:name=\"android.support.v4.content.FileProvider\"><meta-data android:name=\"android.support.FILE_PROVIDER_PATHS\" android:resource=\"@xml/provider_paths\" /></provider>", "xml": "<provider android:authorities=\"${applicationId}.darryncampbell.cordova.plugin.intent.fileprovider\" android:exported=\"false\" android:grantUriPermissions=\"true\" android:name=\"android.support.v4.content.FileProvider\"><meta-data android:name=\"android.support.FILE_PROVIDER_PATHS\" android:resource=\"@xml/provider_paths\" /></provider>",
"count": 1 "count": 1
} }
] ]
@ -406,12 +406,12 @@
"cordova-plugin-share-content": "1.0.0", "cordova-plugin-share-content": "1.0.0",
"cordova-plugin-file": "6.0.1", "cordova-plugin-file": "6.0.1",
"cordova-plugin-file-transfer": "1.7.1", "cordova-plugin-file-transfer": "1.7.1",
"com-darryncampbell-cordova-plugin-intent": "1.1.0", "com-darryncampbell-cordova-plugin-intent": "1.1.1",
"cordova-plugin-inappbrowser": "3.0.0", "cordova-plugin-inappbrowser": "3.0.0",
"cordova-plugin-whitelist": "1.3.3", "cordova-plugin-whitelist": "1.3.3",
"cordova-plugin-splashscreen": "5.0.2", "cordova-plugin-splashscreen": "5.0.2",
"cordova-plugin-device": "2.0.2", "cordova-plugin-device": "2.0.2",
"cordova-android-support-gradle-release": "1.4.4", "cordova-android-support-gradle-release": "1.4.7",
"cordova-plugin-filepath": "1.4.2", "cordova-plugin-filepath": "1.4.2",
"cordova-sqlite-storage": "2.5.1" "cordova-sqlite-storage": "2.5.1"
} }

View file

@ -22,10 +22,10 @@ apply plugin: 'com.android.application'
buildscript { buildscript {
repositories { repositories {
mavenCentral() mavenCentral()
jcenter()
maven { maven {
url "https://maven.google.com" url "https://maven.google.com"
} }
jcenter()
} }
dependencies { dependencies {
@ -91,7 +91,6 @@ ext {
} }
// PLUGIN GRADLE EXTENSIONS START // PLUGIN GRADLE EXTENSIONS START
apply from: "../cordova-android-support-gradle-release/goober_m-cordova-android-support-gradle-release.gradle"
// PLUGIN GRADLE EXTENSIONS END // PLUGIN GRADLE EXTENSIONS END
def hasBuildExtras = file('build-extras.gradle').exists() def hasBuildExtras = file('build-extras.gradle').exists()
@ -260,9 +259,9 @@ dependencies {
implementation fileTree(dir: 'libs', include: '*.jar') implementation fileTree(dir: 'libs', include: '*.jar')
// SUB-PROJECT DEPENDENCIES START // SUB-PROJECT DEPENDENCIES START
implementation(project(path: ":CordovaLib")) implementation(project(path: ":CordovaLib"))
compile "com.android.support:support-v4:27.1.0" compile "com.android.support:support-v4:27.+"
compile "com.android.support:support-v4:25.+" compile "com.android.support:support-v4:27.+"
compile "com.android.support:appcompat-v7:25.+" compile "com.android.support:appcompat-v7:27.+"
// SUB-PROJECT DEPENDENCIES END // SUB-PROJECT DEPENDENCIES END
} }

View file

@ -13,7 +13,7 @@
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
</activity> </activity>
<provider android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true" android:name="android.support.v4.content.FileProvider"> <provider android:authorities="${applicationId}.darryncampbell.cordova.plugin.intent.fileprovider" android:exported="false" android:grantUriPermissions="true" android:name="android.support.v4.content.FileProvider">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths" /> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths" />
</provider> </provider>
</application> </application>

View file

@ -0,0 +1,31 @@
repositories{
// Google APIs are now hosted at Maven
maven {
url 'https://maven.google.com'
}
}
def PLUGIN_NAME = "cordova-android-support-gradle-release"
// Fetch ANDROID_SUPPORT_VERSION var from properties.gradle
apply from: PLUGIN_NAME + '/properties.gradle'
// List of libs to search for.
def LIBS = [
'com.android.support'
]
def IGNORED = [
'multidex',
'multidex-instrumentation'
]
println("+-----------------------------------------------------------------");
println("| " + PLUGIN_NAME + ": " + ANDROID_SUPPORT_VERSION);
println("+-----------------------------------------------------------------");
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group in LIBS && !(details.requested.name in IGNORED)) { details.useVersion ANDROID_SUPPORT_VERSION }
}
}

View file

@ -250,8 +250,15 @@ public class IntentShim extends CordovaPlugin {
JSONArray extraNames = extras.names(); JSONArray extraNames = extras.names();
for (int i = 0; i < extraNames.length(); i++) { for (int i = 0; i < extraNames.length(); i++) {
String key = extraNames.getString(i); String key = extraNames.getString(i);
String value = extras.getString(key); Object extrasObj = extras.get(key);
result.putExtra(key, value); if (extrasObj instanceof JSONObject) {
// The extra is a bundle
Bundle bundle = toBundle((JSONObject) extras.get(key));
result.putExtra(key, bundle);
} else {
String value = extras.getString(key);
result.putExtra(key, value);
}
} }
} }
} }
@ -309,7 +316,7 @@ public class IntentShim extends CordovaPlugin {
callbackContext.error("File not found: " + uriAsFile.toString()); callbackContext.error("File not found: " + uriAsFile.toString());
return null; return null;
} }
String PACKAGE_NAME = this.cordova.getActivity().getPackageName() + ".provider"; String PACKAGE_NAME = this.cordova.getActivity().getPackageName() + ".darryncampbell.cordova.plugin.intent.fileprovider";
Uri uri = FileProvider.getUriForFile(this.cordova.getActivity().getApplicationContext(), PACKAGE_NAME, uriAsFile); Uri uri = FileProvider.getUriForFile(this.cordova.getActivity().getApplicationContext(), PACKAGE_NAME, uriAsFile);
return uri; return uri;
} }
@ -607,7 +614,7 @@ public class IntentShim extends CordovaPlugin {
/** /**
* Sends the provided Intent to the onNewIntentCallbackContext. * Sends the provided Intent to the onNewIntentCallbackContext.
* *
* @param intent This is the intent to send to the JS layer. * @param intent This is the intent to send to the JS layer.
*/ */
private void fireOnNewIntent(Intent intent) { private void fireOnNewIntent(Intent intent) {

View file

@ -42,7 +42,7 @@
<name>Goober</name> <name>Goober</name>
<description>Goober, a mobile app for pnut.io</description> <description>Goober, a mobile app for pnut.io</description>
<author email="gilag@monkeystew.com" href="https://monkeystew.org">Morgan McMillian</author> <author email="gilag@monkeystew.com" href="https://monkeystew.org">Morgan McMillian</author>
<content original-src="index.html" src="http://192.168.1.72:8100" /> <content src="index.html" />
<access origin="*" /> <access origin="*" />
<allow-navigation href="http://ionic.local/*" /> <allow-navigation href="http://ionic.local/*" />
<allow-intent href="http://*/*" /> <allow-intent href="http://*/*" />
@ -52,7 +52,6 @@
<allow-intent href="mailto:*" /> <allow-intent href="mailto:*" />
<allow-intent href="geo:*" /> <allow-intent href="geo:*" />
<allow-navigation href="http://10.0.0.212:8100" /> <allow-navigation href="http://10.0.0.212:8100" />
<allow-navigation href="http://192.168.1.72:8100" />
<allow-intent href="market:*" /> <allow-intent href="market:*" />
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" /> <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
<icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" /> <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />

View file

@ -20,10 +20,10 @@
buildscript { buildscript {
repositories { repositories {
jcenter()
maven { maven {
url "https://maven.google.com" url "https://maven.google.com"
} }
jcenter()
} }
dependencies { dependencies {
@ -35,10 +35,10 @@ buildscript {
allprojects { allprojects {
repositories { repositories {
jcenter()
maven { maven {
url "https://maven.google.com" url "https://maven.google.com"
} }
jcenter()
} }
//This replaces project.properties w.r.t. build settings //This replaces project.properties w.r.t. build settings
project.ext { project.ext {

View file

@ -248,7 +248,7 @@ Api.prototype.addPlugin = function (plugin, installOptions) {
}).then(function () { }).then(function () {
if (plugin.getFrameworks(this.platform).length === 0) return; if (plugin.getFrameworks(this.platform).length === 0) return;
selfEvents.emit('verbose', 'Updating build files since android plugin contained <framework>'); selfEvents.emit('verbose', 'Updating build files since android plugin contained <framework>');
// This should pick the correct builder, not just get gradle // This should pick the correct builder, not just get gradle
require('./lib/builders/builders').getBuilder(this.builder).prepBuildFiles(); require('./lib/builders/builders').getBuilder(this.builder).prepBuildFiles();
}.bind(this)) }.bind(this))
// CB-11022 Return truthy value to prevent running prepare after // CB-11022 Return truthy value to prevent running prepare after

View file

@ -6,37 +6,6 @@
/* jshint esnext: false */ /* jshint esnext: false */
var path = require('path');
var fs = require('fs');
var CordovaError = require('cordova-common').CordovaError;
module.exports.isAndroidStudioProject = function isAndroidStudioProject (root) { module.exports.isAndroidStudioProject = function isAndroidStudioProject (root) {
var eclipseFiles = ['AndroidManifest.xml', 'libs', 'res']; return true;
var androidStudioFiles = ['app', 'app/src/main'];
// assume it is an AS project and not an Eclipse project
var isEclipse = false;
var isAS = true;
if (!fs.existsSync(root)) {
throw new CordovaError('AndroidStudio.js:inAndroidStudioProject root does not exist: ' + root);
}
// if any of the following exists, then we are not an ASProj
eclipseFiles.forEach(function (file) {
if (fs.existsSync(path.join(root, file))) {
isEclipse = true;
}
});
// if it is NOT an eclipse project, check that all required files exist
if (!isEclipse) {
androidStudioFiles.forEach(function (file) {
if (!fs.existsSync(path.join(root, file))) {
console.log('missing file :: ' + file);
isAS = false;
}
});
}
return (!isEclipse && isAS);
}; };

View file

@ -24,6 +24,7 @@ var path = require('path');
var shell = require('shelljs'); var shell = require('shelljs');
var superspawn = require('cordova-common').superspawn; var superspawn = require('cordova-common').superspawn;
var CordovaError = require('cordova-common').CordovaError; var CordovaError = require('cordova-common').CordovaError;
var events = require('cordova-common').events;
var check_reqs = require('../check_reqs'); var check_reqs = require('../check_reqs');
var GenericBuilder = require('./GenericBuilder'); var GenericBuilder = require('./GenericBuilder');
@ -178,7 +179,7 @@ GradleBuilder.prototype.prepBuildFiles = function () {
}; };
subProjects.forEach(function (p) { subProjects.forEach(function (p) {
console.log('Subproject Path: ' + p); events.emit('log', 'Subproject Path: ' + p);
var libName = p.replace(/[/\\]/g, ':').replace(name + '-', ''); var libName = p.replace(/[/\\]/g, ':').replace(name + '-', '');
depsList += ' implementation(project(path: "' + libName + '"))'; depsList += ' implementation(project(path: "' + libName + '"))';
insertExclude(p); insertExclude(p);

View file

@ -23,6 +23,7 @@ var util = require('util');
var path = require('path'); var path = require('path');
var shell = require('shelljs'); var shell = require('shelljs');
var spawn = require('cordova-common').superspawn.spawn; var spawn = require('cordova-common').superspawn.spawn;
var events = require('cordova-common').events;
var CordovaError = require('cordova-common').CordovaError; var CordovaError = require('cordova-common').CordovaError;
var check_reqs = require('../check_reqs'); var check_reqs = require('../check_reqs');
@ -167,7 +168,7 @@ StudioBuilder.prototype.prepBuildFiles = function () {
} }
}; };
subProjects.forEach(function (p) { subProjects.forEach(function (p) {
console.log('Subproject Path: ' + p); events.emit('log', 'Subproject Path: ' + p);
var libName = p.replace(/[/\\]/g, ':').replace(name + '-', ''); var libName = p.replace(/[/\\]/g, ':').replace(name + '-', '');
if (libName !== 'app') { if (libName !== 'app') {
depsList += ' implementation(project(path: ":' + libName + '"))'; depsList += ' implementation(project(path: ":' + libName + '"))';
@ -214,28 +215,28 @@ StudioBuilder.prototype.prepBuildFiles = function () {
StudioBuilder.prototype.prepEnv = function (opts) { StudioBuilder.prototype.prepEnv = function (opts) {
var self = this; var self = this;
return check_reqs.check_gradle() return check_reqs.check_gradle()
.then(function (gradlePath) { .then(function (gradlePath) {
return self.runGradleWrapper(gradlePath); return self.runGradleWrapper(gradlePath);
}).then(function () { }).then(function () {
return self.prepBuildFiles(); return self.prepBuildFiles();
}).then(function () { }).then(function () {
// If the gradle distribution URL is set, make sure it points to version we want. // If the gradle distribution URL is set, make sure it points to version we want.
// If it's not set, do nothing, assuming that we're using a future version of gradle that we don't want to mess with. // If it's not set, do nothing, assuming that we're using a future version of gradle that we don't want to mess with.
// For some reason, using ^ and $ don't work. This does the job, though. // For some reason, using ^ and $ don't work. This does the job, though.
var distributionUrlRegex = /distributionUrl.*zip/; var distributionUrlRegex = /distributionUrl.*zip/;
var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'https\\://services.gradle.org/distributions/gradle-4.1-all.zip'; var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'https\\://services.gradle.org/distributions/gradle-4.1-all.zip';
var gradleWrapperPropertiesPath = path.join(self.root, 'gradle', 'wrapper', 'gradle-wrapper.properties'); var gradleWrapperPropertiesPath = path.join(self.root, 'gradle', 'wrapper', 'gradle-wrapper.properties');
shell.chmod('u+w', gradleWrapperPropertiesPath); shell.chmod('u+w', gradleWrapperPropertiesPath);
shell.sed('-i', distributionUrlRegex, 'distributionUrl=' + distributionUrl, gradleWrapperPropertiesPath); shell.sed('-i', distributionUrlRegex, 'distributionUrl=' + distributionUrl, gradleWrapperPropertiesPath);
var propertiesFile = opts.buildType + SIGNING_PROPERTIES; var propertiesFile = opts.buildType + SIGNING_PROPERTIES;
var propertiesFilePath = path.join(self.root, propertiesFile); var propertiesFilePath = path.join(self.root, propertiesFile);
if (opts.packageInfo) { if (opts.packageInfo) {
fs.writeFileSync(propertiesFilePath, TEMPLATE + opts.packageInfo.toProperties()); fs.writeFileSync(propertiesFilePath, TEMPLATE + opts.packageInfo.toProperties());
} else if (isAutoGenerated(propertiesFilePath)) { } else if (isAutoGenerated(propertiesFilePath)) {
shell.rm('-f', propertiesFilePath); shell.rm('-f', propertiesFilePath);
} }
}); });
}; };
/* /*
@ -247,33 +248,33 @@ StudioBuilder.prototype.build = function (opts) {
var args = this.getArgs(opts.buildType === 'debug' ? 'debug' : 'release', opts); var args = this.getArgs(opts.buildType === 'debug' ? 'debug' : 'release', opts);
return spawn(wrapper, args, {stdio: 'pipe'}) return spawn(wrapper, args, {stdio: 'pipe'})
.progress(function (stdio) { .progress(function (stdio) {
if (stdio.stderr) { if (stdio.stderr) {
/* /*
* Workaround for the issue with Java printing some unwanted information to * Workaround for the issue with Java printing some unwanted information to
* stderr instead of stdout. * stderr instead of stdout.
* This function suppresses 'Picked up _JAVA_OPTIONS' message from being * This function suppresses 'Picked up _JAVA_OPTIONS' message from being
* printed to stderr. See https://issues.apache.org/jira/browse/CB-9971 for * printed to stderr. See https://issues.apache.org/jira/browse/CB-9971 for
* explanation. * explanation.
*/ */
var suppressThisLine = /^Picked up _JAVA_OPTIONS: /i.test(stdio.stderr.toString()); var suppressThisLine = /^Picked up _JAVA_OPTIONS: /i.test(stdio.stderr.toString());
if (suppressThisLine) { if (suppressThisLine) {
return; return;
}
process.stderr.write(stdio.stderr);
} else {
process.stdout.write(stdio.stdout);
} }
process.stderr.write(stdio.stderr); }).catch(function (error) {
} else { if (error.toString().indexOf('failed to find target with hash string') >= 0) {
process.stdout.write(stdio.stdout); return check_reqs.check_android_target(error).then(function () {
} // If due to some odd reason - check_android_target succeeds
}).catch(function (error) { // we should still fail here.
if (error.toString().indexOf('failed to find target with hash string') >= 0) { return Q.reject(error);
return check_reqs.check_android_target(error).then(function () { });
// If due to some odd reason - check_android_target succeeds }
// we should still fail here. return Q.reject(error);
return Q.reject(error); });
});
}
return Q.reject(error);
});
}; };
StudioBuilder.prototype.clean = function (opts) { StudioBuilder.prototype.clean = function (opts) {
@ -283,16 +284,16 @@ StudioBuilder.prototype.clean = function (opts) {
return Q().then(function () { return Q().then(function () {
return spawn(wrapper, args, {stdio: 'inherit'}); return spawn(wrapper, args, {stdio: 'inherit'});
}) })
.then(function () { .then(function () {
shell.rm('-rf', path.join(builder.root, 'out')); shell.rm('-rf', path.join(builder.root, 'out'));
['debug', 'release'].forEach(function (config) { ['debug', 'release'].forEach(function (config) {
var propertiesFilePath = path.join(builder.root, config + SIGNING_PROPERTIES); var propertiesFilePath = path.join(builder.root, config + SIGNING_PROPERTIES);
if (isAutoGenerated(propertiesFilePath)) { if (isAutoGenerated(propertiesFilePath)) {
shell.rm('-f', propertiesFilePath); shell.rm('-f', propertiesFilePath);
} }
});
}); });
});
}; };
module.exports = StudioBuilder; module.exports = StudioBuilder;

View file

@ -41,17 +41,6 @@ function forgivingWhichSync (cmd) {
} }
} }
function tryCommand (cmd, errMsg, catchStderr) {
var d = Q.defer();
child_process.exec(cmd, function (err, stdout, stderr) {
if (err) d.reject(new CordovaError(errMsg));
// Sometimes it is necessary to return an stderr instead of stdout in case of success, since
// some commands prints theirs output to stderr instead of stdout. 'javac' is the example
else d.resolve((catchStderr ? stderr : stdout).trim());
});
return d.promise;
}
module.exports.isWindows = function () { module.exports.isWindows = function () {
return (os.platform() === 'win32'); return (os.platform() === 'win32');
}; };
@ -207,19 +196,22 @@ module.exports.check_java = function () {
} }
} }
}).then(function () { }).then(function () {
var msg = return Q.denodeify(child_process.exec)('javac -version')
'Failed to run "javac -version", make sure that you have a JDK installed.\n' + .then(outputs => {
'You can get it from: http://www.oracle.com/technetwork/java/javase/downloads.\n'; // outputs contains two entries: stdout and stderr
if (process.env['JAVA_HOME']) { // Java <= 8 writes version info to stderr, Java >= 9 to stdout
msg += 'Your JAVA_HOME is invalid: ' + process.env['JAVA_HOME'] + '\n'; const output = outputs.join('').trim();
} const match = /javac\s+([\d.]+)/i.exec(output);
// We use tryCommand with catchStderr = true, because return match && match[1];
// javac writes version info to stderr instead of stdout }, () => {
return tryCommand('javac -version', msg, true).then(function (output) { var msg =
// Let's check for at least Java 8, and keep it future proof so we can support Java 10 'Failed to run "javac -version", make sure that you have a JDK installed.\n' +
var match = /javac ((?:1\.)(?:[8-9]\.)(?:\d+))|((?:1\.)(?:[1-9]\d+\.)(?:\d+))/i.exec(output); 'You can get it from: http://www.oracle.com/technetwork/java/javase/downloads.\n';
return match && match[1]; if (process.env['JAVA_HOME']) {
}); msg += 'Your JAVA_HOME is invalid: ' + process.env['JAVA_HOME'] + '\n';
}
throw new CordovaError(msg);
});
}); });
}; };
@ -366,8 +358,8 @@ module.exports.run = function () {
console.log('ANDROID_HOME=' + process.env['ANDROID_HOME']); console.log('ANDROID_HOME=' + process.env['ANDROID_HOME']);
console.log('JAVA_HOME=' + process.env['JAVA_HOME']); console.log('JAVA_HOME=' + process.env['JAVA_HOME']);
if (!values[0]) { if (!String(values[0]).startsWith('1.8.')) {
throw new CordovaError('Requirements check failed for JDK 1.8 or greater'); throw new CordovaError('Requirements check failed for JDK 1.8');
} }
if (!values[1]) { if (!values[1]) {

View file

@ -344,7 +344,8 @@ module.exports.wait_for_emulator = function (port) {
}, function (error) { }, function (error) {
if ((error && error.message && if ((error && error.message &&
(error.message.indexOf('not found') > -1)) || (error.message.indexOf('not found') > -1)) ||
(error.message.indexOf('device offline') > -1)) { (error.message.indexOf('device offline') > -1) ||
(error.message.indexOf('device still connecting') > -1)) {
// emulator not yet started, continue waiting // emulator not yet started, continue waiting
return self.wait_for_emulator(port); return self.wait_for_emulator(port);
} else { } else {

View file

@ -20,10 +20,10 @@
buildscript { buildscript {
repositories { repositories {
jcenter()
maven { maven {
url "https://maven.google.com" url "https://maven.google.com"
} }
jcenter()
} }
// Switch the Android Gradle plugin version requirement depending on the // Switch the Android Gradle plugin version requirement depending on the

View file

@ -34,15 +34,7 @@ var handlers = {
// a later plugins release. This is for legacy plugins to work with Cordova. // a later plugins release. This is for legacy plugins to work with Cordova.
if (options && options.android_studio === true) { if (options && options.android_studio === true) {
// If a Java file is using the new directory structure, don't penalize it dest = studioPathRemap(obj);
if (!obj.targetDir.includes('app/src/main')) {
if (obj.src.endsWith('.java')) {
dest = path.join('app/src/main/java', obj.targetDir.substring(4), path.basename(obj.src));
} else if (obj.src.endsWith('.xml')) {
// We are making a huge assumption here that XML files will be going to res/xml or values/xml
dest = path.join('app/src/main', obj.targetDir, path.basename(obj.src));
}
}
} }
if (options && options.force) { if (options && options.force) {
@ -55,10 +47,16 @@ var handlers = {
var dest = path.join(obj.targetDir, path.basename(obj.src)); var dest = path.join(obj.targetDir, path.basename(obj.src));
if (options && options.android_studio === true) { if (options && options.android_studio === true) {
dest = path.join('app/src/main/java', obj.targetDir.substring(4), path.basename(obj.src)); dest = studioPathRemap(obj);
} }
deleteJava(project.projectDir, dest); // TODO: Add Koltin extension to uninstall, since they are handled like Java files
if (obj.src.endsWith('java')) {
deleteJava(project.projectDir, dest);
} else {
// Just remove the file, not the whole parent directory
removeFile(project.projectDir, dest);
}
} }
}, },
'lib-file': { 'lib-file': {
@ -318,3 +316,16 @@ function removeFileAndParents (baseDir, destFile, stopper) {
function generateAttributeError (attribute, element, id) { function generateAttributeError (attribute, element, id) {
return 'Required attribute "' + attribute + '" not specified in <' + element + '> element from plugin: ' + id; return 'Required attribute "' + attribute + '" not specified in <' + element + '> element from plugin: ' + id;
} }
function studioPathRemap (obj) {
// If a Java file is using the new directory structure, don't penalize it
if (!obj.targetDir.includes('app/src/main')) {
if (obj.src.endsWith('.java')) {
return path.join('app/src/main/java', obj.targetDir.substring(4), path.basename(obj.src));
} else {
// For all other files, add 'app/src/main' to the targetDir if it didn't have it already
return path.join('app/src/main', obj.targetDir, path.basename(obj.src));
}
}
}

View file

@ -108,7 +108,7 @@ module.exports.run = function (runOptions) {
// format than emulator.install expects. // format than emulator.install expects.
// TODO: Update emulator/device.install to handle this change // TODO: Update emulator/device.install to handle this change
return build.run.call(self, runOptions, resolvedTarget).then(function (buildResults) { return build.run.call(self, runOptions, resolvedTarget).then(function (buildResults) {
if (resolvedTarget.isEmulator) { if (resolvedTarget && resolvedTarget.isEmulator) {
return emulator.wait_for_boot(resolvedTarget.target).then(function () { return emulator.wait_for_boot(resolvedTarget.target).then(function () {
return emulator.install(resolvedTarget, buildResults); return emulator.install(resolvedTarget, buildResults);
}); });

View file

@ -20,7 +20,7 @@
*/ */
// Coho updates this line: // Coho updates this line:
var VERSION = "7.1.0"; var VERSION = "7.1.2";
module.exports.version = VERSION; module.exports.version = VERSION;

View file

@ -1,5 +1,5 @@
// Platform: android // Platform: android
// 4450a4cea50616e080a82e8ede9e3d6a1fe3c3ec // 9e8e1b716252c4a08abcd31a13013b868d6f4141
/* /*
Licensed to the Apache Software Foundation (ASF) under one Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file or more contributor license agreements. See the NOTICE file
@ -19,7 +19,7 @@
under the License. under the License.
*/ */
;(function() { ;(function() {
var PLATFORM_VERSION_BUILD_LABEL = '7.1.0'; var PLATFORM_VERSION_BUILD_LABEL = '7.1.2';
// file: src/scripts/require.js // file: src/scripts/require.js
/* jshint -W079 */ /* jshint -W079 */
@ -307,6 +307,7 @@ var cordova = {
} catch (err) { } catch (err) {
var msg = 'Error in ' + (isSuccess ? 'Success' : 'Error') + ' callbackId: ' + callbackId + ' : ' + err; var msg = 'Error in ' + (isSuccess ? 'Success' : 'Error') + ' callbackId: ' + callbackId + ' : ' + err;
console && console.log && console.log(msg); console && console.log && console.log(msg);
console && console.log && err.stack && console.log(err.stack);
cordova.fireWindowEvent('cordovacallbackerror', { 'message': msg }); cordova.fireWindowEvent('cordovacallbackerror', { 'message': msg });
throw err; throw err;
} }
@ -326,7 +327,7 @@ module.exports = cordova;
}); });
// file: /Users/steveng/repo/cordova/cordova-android/cordova-js-src/android/nativeapiprovider.js // file: /Users/brodybits/Documents/cordova/cordova-android/cordova-js-src/android/nativeapiprovider.js
define("cordova/android/nativeapiprovider", function(require, exports, module) { define("cordova/android/nativeapiprovider", function(require, exports, module) {
/** /**
@ -349,7 +350,7 @@ module.exports = {
}); });
// file: /Users/steveng/repo/cordova/cordova-android/cordova-js-src/android/promptbasednativeapi.js // file: /Users/brodybits/Documents/cordova/cordova-android/cordova-js-src/android/promptbasednativeapi.js
define("cordova/android/promptbasednativeapi", function(require, exports, module) { define("cordova/android/promptbasednativeapi", function(require, exports, module) {
/** /**
@ -881,7 +882,7 @@ module.exports = channel;
}); });
// file: /Users/steveng/repo/cordova/cordova-android/cordova-js-src/exec.js // file: /Users/brodybits/Documents/cordova/cordova-android/cordova-js-src/exec.js
define("cordova/exec", function(require, exports, module) { define("cordova/exec", function(require, exports, module) {
/** /**
@ -1639,7 +1640,7 @@ exports.reset();
}); });
// file: /Users/steveng/repo/cordova/cordova-android/cordova-js-src/platform.js // file: /Users/brodybits/Documents/cordova/cordova-android/cordova-js-src/platform.js
define("cordova/platform", function(require, exports, module) { define("cordova/platform", function(require, exports, module) {
// The last resume event that was received that had the result of a plugin call. // The last resume event that was received that had the result of a plugin call.
@ -1749,7 +1750,7 @@ function onMessageFromNative(msg) {
}); });
// file: /Users/steveng/repo/cordova/cordova-android/cordova-js-src/plugin/android/app.js // file: /Users/brodybits/Documents/cordova/cordova-android/cordova-js-src/plugin/android/app.js
define("cordova/plugin/android/app", function(require, exports, module) { define("cordova/plugin/android/app", function(require, exports, module) {
var exec = require('cordova/exec'); var exec = require('cordova/exec');
@ -2185,4 +2186,4 @@ window.cordova = require('cordova');
require('cordova/init'); require('cordova/init');
})(); })();

View file

@ -262,12 +262,12 @@ module.exports.metadata =
"cordova-plugin-share-content": "1.0.0", "cordova-plugin-share-content": "1.0.0",
"cordova-plugin-file": "6.0.1", "cordova-plugin-file": "6.0.1",
"cordova-plugin-file-transfer": "1.7.1", "cordova-plugin-file-transfer": "1.7.1",
"com-darryncampbell-cordova-plugin-intent": "1.1.0", "com-darryncampbell-cordova-plugin-intent": "1.1.1",
"cordova-plugin-inappbrowser": "3.0.0", "cordova-plugin-inappbrowser": "3.0.0",
"cordova-plugin-whitelist": "1.3.3", "cordova-plugin-whitelist": "1.3.3",
"cordova-plugin-splashscreen": "5.0.2", "cordova-plugin-splashscreen": "5.0.2",
"cordova-plugin-device": "2.0.2", "cordova-plugin-device": "2.0.2",
"cordova-android-support-gradle-release": "1.4.4", "cordova-android-support-gradle-release": "1.4.7",
"cordova-plugin-filepath": "1.4.2", "cordova-plugin-filepath": "1.4.2",
"cordova-sqlite-storage": "2.5.1" "cordova-sqlite-storage": "2.5.1"
}; };

View file

@ -12,6 +12,5 @@ target=android-27
android.library.reference.1=CordovaLib android.library.reference.1=CordovaLib
android.library.reference.2=app android.library.reference.2=app
cordova.system.library.1=com.android.support:support-v4:27.1.0 cordova.system.library.1=com.android.support:support-v4:27.1.0
cordova.gradle.include.1=cordova-android-support-gradle-release/goober_m-cordova-android-support-gradle-release.gradle
cordova.system.library.2=com.android.support:support-v4:25.+ cordova.system.library.2=com.android.support:support-v4:25.+
cordova.system.library.3=com.android.support:appcompat-v7:25.+ cordova.system.library.3=com.android.support:appcompat-v7:25.+