Compare commits

...

30 Commits
7.1.2 ... 7.1.4

Author SHA1 Message Date
Christopher J. Brody
a68f9fd752 Update VERSION & RELEASENOTES for 7.1.4
NOTE: VERSION was updated based on e1befac.
2018-11-22 22:38:38 -05:00
Christopher J. Brody
84cb08b23e Revert "Other minor dependencies updates in 7.1.x patch"
This reverts commit 5a5f544a48.

Rationale: base64-js update in 5a5f544 causes extra
base64-js version to be installed under plist
(node_modules/plist/node_modules/base64-js),
which would need to be committed to satisfy the needs
of the deprecated Node.js 4 version.

The extra base64-js version in
node_modules/plist/node_modules/base64-js
was missed at the time 5a5f544 was committed.

The base64-js update in 5a5f544 is now deemed as
not wanted due to the extra base64-js version that
would need to be committed.

The other dependencies updates in 5a5f544
may be nice to have but not considered necessary
for the patch release.

Reverting now to unblock the upcoming 7.1.4 patch release.

Note that neither 5a5f544 nor this revert will
show up in the master branch.
2018-11-22 22:18:32 -05:00
Chris Brody
b7643a3712 Merge pull request #573 from brodybits/7.1.4-patch-updates
7.1.4 patch updates
2018-11-22 14:45:04 -05:00
Chris Brody
8586d4a7ba Resolve issue with plugin target-dir="app*" subdirs (#572)
(subdirectories) such as "appco", with unit tests to verify

Needed for @katzer plugins that use de/appplant subdirectory,
for example:
* cordova-plugin-local-notifications
* cordova-plugin-badge
* cordova-plugin-background-mode

Also needed for cordova-plugin-inappbrowser

Co-authored-by: Christopher J. Brody <chris.brody@gmail.com>
Co-authored-by: Julio César <jcesarmobile@gmail.com>
Co-authored-by: Jan Piotrowski <piotrowski+github@gmail.com>
2018-11-22 10:01:27 -05:00
Jan Piotrowski
f2d700515d Output current package name if package name can't be validated (#567)
We have this of the package name. It only outputs that the current one
is bad, not what the current one actually is. Added an output of the
current one to the error.
2018-11-22 10:00:36 -05:00
Christopher J. Brody
5a5f544a48 Other minor dependencies updates in 7.1.x patch 2018-11-22 09:57:22 -05:00
Christopher J. Brody
d918c7a83c android-versions@1.4.0 update in 7.1.x (add Pie) 2018-11-22 09:49:22 -05:00
Christopher J. Brody
afdffe4028 Set Version to 7.1.4-dev
(based on e1befaca5a)
2018-11-22 09:25:57 -05:00
Christopher J. Brody
e1befaca5a Update VERSION & RELEASENOTES for 7.1.3
NOTE: The version was manually updated in the following files:
* RELEASENOTES.md
* VERSION
* bin/templates/cordova/version
* bin/templates/project/assets/www/cordova.js
* framework/build.gradle
* framework/src/org/apache/cordova/CordovaWebView.java
* package.json

with help from git & bash tricks based on changes in the following
commits for 7.1.2 & 7.1.3-dev versions:
- 725e75fa0d
- f86519b158

FUTURE TBD: it is desired that we can set the version in
one place as discussed in: apache/cordova#50
2018-11-19 16:37:39 -05:00
Chris Brody
7b33517339 Mark some 7.1.3 bundled dependency versions (#566)
to resolve red entries from npm outdated
2018-11-19 11:30:29 -05:00
Chris Brody
442734dc47 Merge pull request #555 from brodybits/7.1.3-patch-updates
7.1.3 patch updates
2018-11-17 19:32:57 -05:00
David Boho
32e3eae83e GH-552 (android) check for build-extras.gradle in the app-parent directory (#553)
as documented in https://cordova.apache.org/docs/en/latest/guide/platforms/android/?#extending-buildgradle

and deal with multiple build-extras.gradle locations

Co-authored-by: David Boho <david.boho@tu-ilmenau.de>
Co-authored-by: Christopher J. Brody <chris.brody@gmail.com>
2018-11-16 13:22:43 -05:00
David Boho
0ebc9a6f8d add missing cast for cdvMinSdkVersion (GH-551) 2018-11-16 13:22:43 -05:00
Christopher J. Brody
9848aa885f GH-547 Fix for old plugins with non-Java sources (PR #550)
(source-file entries)

including aidl, aar, jar, and so files
2018-11-16 13:22:43 -05:00
Christopher J. Brody
298f1e3cc8 Fix comments in getInstallDestination (PR #550)
(in pluginHandlers.js)
2018-11-16 13:22:43 -05:00
Christopher J. Brody
07e1fe18ff Cleanup getInstallDestination in pluginHandlers.js (PR #550) 2018-11-16 13:22:43 -05:00
Christopher J. Brody
9537e3468b Test old plugin aidl & lib mapping - repros GH-547 (PR #550)
(reproduces GH-547)
2018-11-16 13:22:43 -05:00
Christopher J. Brody
dea6846918 Check old compat of other extension (CB-14125) (PR #550)
of plugin source file installed into app/src/main with
old target-dir scheme

NOTE: These tests do *not* check compatibility of
plugins with old lib target-dir scheme.
2018-11-16 13:22:43 -05:00
Christopher J. Brody
e3468c66a3 Check target-dir mapping of plugin xml source file (PR #550)
Possibly related to: CB-13830: Add handlers for plugins
that use non-Java source files, such as Camera
2018-11-16 13:22:42 -05:00
Christopher J. Brody
5222a0f605 Fix tests of plugin files with new app dir scheme (PR #542)
(new app target-dir scheme)
2018-11-16 13:22:42 -05:00
Christopher J. Brody
717d768cec GH-540 fix for source-file with app target-dir (PR #542) 2018-11-16 13:22:42 -05:00
Christopher J. Brody
951ff5552e unit test uninstall of <source-file> with app dest (PR #542)
for Java source, JAR, and AAR

Co-authored-by: Christopher J. Brody <chris.brody@gmail.com>
Co-authored-by: Kyle Kirbatski <kkirbatski@gmrmarketing.com>
Co-authored-by: Antonio Facciolo <afdev82@users.noreply.github.com>
2018-11-16 13:22:42 -05:00
Christopher J. Brody
f8584c63e6 unit test source-file with custom lib target-dir (PR #542)
for JAR and AAR

(GH-540)

Co-Authored-By: Kyle Kirbatski <kkirbatski@gmrmarketing.com>
Co-Authored-By: Christopher J. Brody <chris.brody@gmail.com>
Co-Authored-By: @afdev82 (Antonio Facciolo)
2018-11-16 13:22:42 -05:00
Christopher J. Brody
4d151d3057 GH-539 fix destination path fallback (PR #542)
Fallback to old path mapping if no Android Studio path mapping exists

(with slight difference on 7.1.x branch)

Co-authored-by: Christopher J. Brody <chris.brody@gmail.com>
Co-authored-by: Kyle Kirbatski <kkirbatski@gmrmarketing.com>
2018-11-16 13:22:42 -05:00
Christopher J. Brody
55f2986b85 unit test uninstall of <source-file> with app dest (PR #542)
for Java source only (GH-539)

Co-Authored-By: Christopher J. Brody <chris.brody@gmail.com>
Co-Authored-By: Kyle Kirbatski <kkirbatski@gmrmarketing.com>
2018-11-16 13:22:42 -05:00
Kyle Kirbatski
c0e9f25150 Add a unit test to test source-file target-dir /app/src/main/… (PR #542) 2018-11-16 13:22:42 -05:00
Chris Brody
9f6c332b8c Remove obsolete check for JellyBean (GH-534) (#544)
to work properly on Android Pie

was introduced in dc0bfeb0c (CB-11828)

Resolves #534

Co-authored-by: <pradiv-kumar@users.noreply.github.com>
Co-authored-by: Christopher J. Brody <chris.brody@gmail.com>
2018-11-16 13:22:41 -05:00
Chris Brody
dbc99e8f4c Update comments (#496)
as followup to GH-495
2018-11-16 13:22:41 -05:00
Darshan-Chauhan
00134cf9f3 Incorrect default sdk version issue fix (PR #495) 2018-11-16 13:22:37 -05:00
Darryl Pogue
f86519b158 Bump version to 7.1.3-dev 2018-11-05 12:23:23 -08:00
25 changed files with 292 additions and 106 deletions

View File

@@ -20,6 +20,22 @@
-->
## Release Notes for Cordova (Android) ##
### 7.1.4 (Nov 22, 2018)
* Update android-versions to `1.4.0`, with added support for Android Pie ([#573](https://github.com/apache/cordova-android/pull/573))
* Output current package name if package name can't be validated ([#567](https://github.com/apache/cordova-android/pull/567))
* Resolve issue with plugin `target-dir="*app*"` subdirs ([#572](https://github.com/apache/cordova-android/pull/572))
### 7.1.3 (Nov 19, 2018)
* [GH-495](https://github.com/apache/cordova-android/pull/495) Incorrect default sdk version issue fix
* [GH-496](https://github.com/apache/cordova-android/pull/496) update comments in `build.gradle`
* [GH-539](https://github.com/apache/cordova-android/pull/539) Fix dest overwrite, in case of of plugin `source-file` element with `target-dir` that does not need remapping
* [GH-540](https://github.com/apache/cordova-android/issues/540) support plugin `source-file` element with any app `target-dir` value
* [GH-547](https://github.com/apache/cordova-android/issues/547) Compatibility of old plugins with non-Java `source-file` entries (individual files)
* [GH-551](https://github.com/apache/cordova-android/pull/551) add missing cast for cdvMinSdkVersion to `build.gradle`
* [GH-552](https://github.com/apache/cordova-android/issues/552) check for `build-extras.gradle` in the parent app directory
### 7.1.2 (Nov 08, 2018)
* [CB-14127](https://issues.apache.org/jira/browse/CB-14127): Always put the Google repo above jcenter
* [CB-14165](https://issues.apache.org/jira/browse/CB-14165): Emulator: handle "device still connecting" error (#457)

View File

@@ -1 +1 @@
7.1.2
7.1.4

View File

@@ -194,7 +194,7 @@ function validatePackageName (package_name) {
var msg = 'Error validating package name. ';
if (!/^[a-zA-Z][a-zA-Z0-9_]+(\.[a-zA-Z][a-zA-Z0-9_]*)+$/.test(package_name)) {
return Q.reject(new CordovaError(msg + 'Package name must look like: com.company.Name'));
return Q.reject(new CordovaError(msg + 'Must look like: `com.company.Name`. Currently is: `' + package_name + '`'));
}
// Class is a reserved word

View File

@@ -34,7 +34,7 @@ var handlers = {
// a later plugins release. This is for legacy plugins to work with Cordova.
if (options && options.android_studio === true) {
dest = studioPathRemap(obj);
dest = getInstallDestination(obj);
}
if (options && options.force) {
@@ -47,7 +47,7 @@ var handlers = {
var dest = path.join(obj.targetDir, path.basename(obj.src));
if (options && options.android_studio === true) {
dest = studioPathRemap(obj);
dest = getInstallDestination(obj);
}
// TODO: Add Koltin extension to uninstall, since they are handled like Java files
@@ -317,15 +317,29 @@ function generateAttributeError (attribute, element, 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));
function getInstallDestination (obj) {
var APP_MAIN_PREFIX = 'app/src/main';
if (obj.targetDir.startsWith('app')) {
// If any source file is using the new app directory structure,
// don't penalize it
return path.join(obj.targetDir, path.basename(obj.src));
} else if (obj.src.endsWith('.java')) {
return path.join(APP_MAIN_PREFIX, 'java', obj.targetDir.substring(4), path.basename(obj.src));
} else if (obj.src.endsWith('.aidl')) {
return path.join(APP_MAIN_PREFIX, 'aidl', obj.targetDir.substring(4), path.basename(obj.src));
} else if (obj.targetDir.includes('libs')) {
if (obj.src.endsWith('.so')) {
return path.join(APP_MAIN_PREFIX, 'jniLibs', obj.targetDir.substring(5), 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));
return path.join('app', obj.targetDir, path.basename(obj.src));
}
} else if (obj.targetDir.includes('src/main')) {
return path.join('app', obj.targetDir, path.basename(obj.src));
} else {
// For all other source files not using the new app directory structure,
// add 'app/src/main' to the targetDir
return path.join(APP_MAIN_PREFIX, obj.targetDir, path.basename(obj.src));
}
}

View File

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

View File

@@ -69,7 +69,7 @@ ext {
if (!project.hasProperty('cdvBuildMultipleApks')) {
cdvBuildMultipleApks = null
}
// Whether to append a 0 "abi digit" to versionCode when only a single APK is build
// Whether to append a 0 "abi digit" to versionCode when only a single APK is build
if (!project.hasProperty('cdvVersionCodeForceAbiDigit')) {
cdvVersionCodeForceAbiDigit = null
}
@@ -93,11 +93,16 @@ ext {
// PLUGIN GRADLE EXTENSIONS START
// PLUGIN GRADLE EXTENSIONS END
def hasBuildExtras = file('build-extras.gradle').exists()
if (hasBuildExtras) {
def hasBuildExtras1 = file('build-extras.gradle').exists()
if (hasBuildExtras1) {
apply from: 'build-extras.gradle'
}
def hasBuildExtras2 = file('../build-extras.gradle').exists()
if (hasBuildExtras2) {
apply from: '../build-extras.gradle'
}
// Set property defaults after extension .gradle files.
if (ext.cdvCompileSdkVersion == null) {
ext.cdvCompileSdkVersion = privateHelpers.getProjectTarget()
@@ -117,7 +122,7 @@ if (ext.cdvReleaseSigningPropertiesFile == null && file('../release-signing.prop
// Cast to appropriate types.
ext.cdvBuildMultipleApks = cdvBuildMultipleApks == null ? false : cdvBuildMultipleApks.toBoolean();
ext.cdvVersionCodeForceAbiDigit = cdvVersionCodeForceAbiDigit == null ? false : cdvVersionCodeForceAbiDigit.toBoolean();
ext.cdvMinSdkVersion = cdvMinSdkVersion == null ? null : defaultMinSdkVersion
ext.cdvMinSdkVersion = cdvMinSdkVersion == null ? defaultMinSdkVersion : Integer.parseInt('' + cdvMinSdkVersion)
ext.cdvVersionCode = cdvVersionCode == null ? null : Integer.parseInt('' + cdvVersionCode)
def computeBuildTargetName(debugBuild) {
@@ -174,10 +179,11 @@ android {
compileSdkVersion cdvCompileSdkVersion
buildToolsVersion cdvBuildToolsVersion
//This code exists for Crosswalk and other Native APIs.
//By default, we multiply the existing version code in the Android Manifest by 10 and
//add a number for each architecture. If you are not using Crosswalk or SQLite, you can
//ignore this chunk of code, and your version codes will be respected.
// This code exists for Crosswalk and other Native APIs.
// By default, we multiply the existing version code in the
// Android Manifest by 10 and add a number for each architecture.
// If you are not using Crosswalk or SQLite, you can
// ignore this chunk of code, and your version codes will be respected.
if (Boolean.valueOf(cdvBuildMultipleApks)) {
flavorDimensions "default"

View File

@@ -19,7 +19,7 @@
under the License.
*/
;(function() {
var PLATFORM_VERSION_BUILD_LABEL = '7.1.2';
var PLATFORM_VERSION_BUILD_LABEL = '7.1.4';
// file: src/scripts/require.js
/* jshint -W079 */

View File

@@ -109,17 +109,6 @@ function androidExec(success, fail, service, action, args) {
}
androidExec.init = function() {
//CB-11828
//This failsafe checks the version of Android and if it's Jellybean, it switches it to
//using the Online Event bridge for communicating from Native to JS
//
//It's ugly, but it's necessary.
var check = navigator.userAgent.toLowerCase().match(/android\s[0-9].[0-9]/);
var version_code = check && check[0].match(/4.[0-3].*/);
if (version_code != null && nativeToJsBridgeMode == nativeToJsModes.EVAL_BRIDGE) {
nativeToJsBridgeMode = nativeToJsModes.ONLINE_EVENT;
}
bridgeSecret = +prompt('', 'gap_init:' + nativeToJsBridgeMode);
channel.onNativeReady.fire();
};

View File

@@ -42,7 +42,7 @@ apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
group = 'org.apache.cordova'
version = '7.1.2'
version = '7.1.4'
android {
compileSdkVersion cdvCompileSdkVersion
@@ -129,9 +129,9 @@ bintray {
licenses = ['Apache-2.0']
labels = ['android', 'cordova', 'phonegap']
version {
name = '7.1.2'
name = '7.1.4'
released = new Date()
vcsTag = '7.1.2'
vcsTag = '7.1.4'
}
}
}

View File

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

View File

@@ -1,4 +1,5 @@
{
"esversion": 6,
"indent": 2,
"forin": true,
"noarg": true,

View File

@@ -30,35 +30,42 @@
*/
var VERSIONS = {
BASE: { api: 1, ndk: 0, semver: "1.0", name: "(no code name)", versionCode: "BASE" },
BASE_1_1: { api: 2, ndk: 0, semver: "1.1", name: "(no code name)", versionCode: "BASE_1_1" },
CUPCAKE: { api: 3, ndk: 1, semver: "1.5", name: "Cupcake", versionCode: "CUPCAKE" },
DONUT: { api: 4, ndk: 2, semver: "1.6", name: "Donut", versionCode: "DONUT" },
ECLAIR: { api: 5, ndk: 2, semver: "2.0", name: "Eclair", versionCode: "ECLAIR" },
ECLAIR_0_1: { api: 6, ndk: 2, semver: "2.0.1", name: "Eclair", versionCode: "ECLAIR_0_1" },
ECLAIR_MR1: { api: 7, ndk: 3, semver: "2.1", name: "Eclair", versionCode: "ECLAIR_MR1" },
FROYO: { api: 8, ndk: 4, semver: "2.2.x", name: "Froyo", versionCode: "FROYO" },
GINGERBREAD: { api: 9, ndk: 5, semver: "2.3.0 - 2.3.2", name: "Gingerbread", versionCode: "GINGERBREAD" },
GINGERBREAD_MR1: { api: 10, ndk: 5, semver: "2.3.3 - 2.3.7", name: "Gingerbread", versionCode: "GINGERBREAD_MR1" },
HONEYCOMB: { api: 11, ndk: 5, semver: "3.0", name: "Honeycomb", versionCode: "HONEYCOMB" },
HONEYCOMB_MR1: { api: 12, ndk: 6, semver: "3.1", name: "Honeycomb", versionCode: "HONEYCOMB_MR1" },
HONEYCOMB_MR2: { api: 13, ndk: 6, semver: "3.2.x", name: "Honeycomb", versionCode: "HONEYCOMB_MR2" },
ICE_CREAM_SANDWICH: { api: 14, ndk: 7, semver: "4.0.1 - 4.0.2", name: "Ice Cream Sandwich", versionCode: "ICE_CREAM_SANDWICH" },
ICE_CREAM_SANDWICH_MR1: { api: 15, ndk: 8, semver: "4.0.3 - 4.0.4", name: "Ice Cream Sandwich", versionCode: "ICE_CREAM_SANDWICH_MR1" },
JELLY_BEAN: { api: 16, ndk: 8, semver: "4.1.x", name: "Jellybean", versionCode: "JELLY_BEAN" },
JELLY_BEAN_MR1: { api: 17, ndk: 8, semver: "4.2.x", name: "Jellybean", versionCode: "JELLY_BEAN_MR1" },
JELLY_BEAN_MR2: { api: 18, ndk: 8, semver: "4.3.x", name: "Jellybean", versionCode: "JELLY_BEAN_MR2" },
KITKAT: { api: 19, ndk: 8, semver: "4.4.0 - 4.4.4", name: "KitKat", versionCode: "KITKAT" },
KITKAT_WATCH: { api: 20, ndk: 8, semver: "4.4", name: "KitKat Watch", versionCode: "KITKAT_WATCH" },
LOLLIPOP: { api: 21, ndk: 8, semver: "5.0", name: "Lollipop", versionCode: "LOLLIPOP" },
LOLLIPOP_MR1: { api: 22, ndk: 8, semver: "5.1", name: "Lollipop", versionCode: "LOLLIPOP_MR1" },
M: { api: 23, ndk: 8, semver: "6.0", name: "Marshmallow", versionCode: "M" },
N: { api: 24, ndk: 8, semver: "7.0", name: "Nougat", versionCode: "N" },
N_MR1: { api: 25, ndk: 8, semver: "7.1", name: "Nougat", versionCode: "N_MR1" },
O: { api: 26, ndk: 8, semver: "8.0.0", name: "Oreo", versionCode: "O" },
O_MR1: { api: 27, ndk: 8, semver: "8.1.0", name: "Oreo", versionCode: "O_MR1" }
BASE: { api: 1, ndk: 0, semver: "1.0", name: "(no code name)", },
BASE_1_1: { api: 2, ndk: 0, semver: "1.1", name: "(no code name)", },
CUPCAKE: { api: 3, ndk: 1, semver: "1.5", name: "Cupcake", },
DONUT: { api: 4, ndk: 2, semver: "1.6", name: "Donut", },
ECLAIR: { api: 5, ndk: 2, semver: "2.0", name: "Eclair", },
ECLAIR_0_1: { api: 6, ndk: 2, semver: "2.0.1", name: "Eclair", },
ECLAIR_MR1: { api: 7, ndk: 3, semver: "2.1", name: "Eclair", },
FROYO: { api: 8, ndk: 4, semver: "2.2.x", name: "Froyo", },
GINGERBREAD: { api: 9, ndk: 5, semver: "2.3.0 - 2.3.2", name: "Gingerbread", },
GINGERBREAD_MR1: { api: 10, ndk: 5, semver: "2.3.3 - 2.3.7", name: "Gingerbread", },
HONEYCOMB: { api: 11, ndk: 5, semver: "3.0", name: "Honeycomb", },
HONEYCOMB_MR1: { api: 12, ndk: 6, semver: "3.1", name: "Honeycomb", },
HONEYCOMB_MR2: { api: 13, ndk: 6, semver: "3.2.x", name: "Honeycomb", },
ICE_CREAM_SANDWICH: { api: 14, ndk: 7, semver: "4.0.1 - 4.0.2", name: "Ice Cream Sandwich", },
ICE_CREAM_SANDWICH_MR1: { api: 15, ndk: 8, semver: "4.0.3 - 4.0.4", name: "Ice Cream Sandwich", },
JELLY_BEAN: { api: 16, ndk: 8, semver: "4.1.x", name: "Jellybean", },
JELLY_BEAN_MR1: { api: 17, ndk: 8, semver: "4.2.x", name: "Jellybean", },
JELLY_BEAN_MR2: { api: 18, ndk: 8, semver: "4.3.x", name: "Jellybean", },
KITKAT: { api: 19, ndk: 8, semver: "4.4.0 - 4.4.4", name: "KitKat", },
KITKAT_WATCH: { api: 20, ndk: 8, semver: "4.4", name: "KitKat Watch", },
LOLLIPOP: { api: 21, ndk: 8, semver: "5.0", name: "Lollipop", },
LOLLIPOP_MR1: { api: 22, ndk: 8, semver: "5.1", name: "Lollipop", },
M: { api: 23, ndk: 8, semver: "6.0", name: "Marshmallow", },
N: { api: 24, ndk: 8, semver: "7.0", name: "Nougat", },
N_MR1: { api: 25, ndk: 8, semver: "7.1", name: "Nougat", },
O: { api: 26, ndk: 8, semver: "8.0.0", name: "Oreo", },
O_MR1: { api: 27, ndk: 8, semver: "8.1.0", name: "Oreo", },
P: { api: 28, ndk: 8, semver: "9", name: "Pie", }
}
// Add a key to each version of Android for the "versionCode".
// This is the same key we use in the VERSIONS map above.
Object.keys(VERSIONS).forEach(function(version) {
VERSIONS[version].versionCode = version
})
var semver = require('semver');
// semver format requires <major>.<minor>.<patch> but we allow just <major>.<minor> format.
@@ -82,8 +89,8 @@ function getFromDefaultPredicate(arg) {
return true
}
let argSemver = formatSemver(arg);
let versionSemver = formatSemver(version.semver);
var argSemver = formatSemver(arg)
var versionSemver = formatSemver(version.semver)
if (semver.valid(argSemver) && semver.satisfies(argSemver, versionSemver)) {
return true

View File

@@ -1,26 +1,27 @@
{
"_from": "android-versions@1.3.0",
"_id": "android-versions@1.3.0",
"_from": "android-versions@1",
"_id": "android-versions@1.4.0",
"_inBundle": false,
"_integrity": "sha512-d/i1G16Oaw/T1EvskUA7Oo1vIQVK/0ZlpQgZfYVBwg6v/9FBE3QV66g5N1/bTHpRml8tFLxh+KoTw5DokK9c+A==",
"_integrity": "sha512-GnomfYsBq+nZh3c3UH/4r9Jt6FuTxdhUJbeHIdYOH5xBhQ8I0ZzC2/RM5IFFIjrzuNWSHb8JWP1lPK0/a26jrg==",
"_location": "/android-versions",
"_phantomChildren": {},
"_requested": {
"type": "version",
"type": "range",
"registry": true,
"raw": "android-versions@1.3.0",
"raw": "android-versions@1",
"name": "android-versions",
"escapedName": "android-versions",
"rawSpec": "1.3.0",
"rawSpec": "1",
"saveSpec": null,
"fetchSpec": "1.3.0"
"fetchSpec": "1"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://registry.npmjs.org/android-versions/-/android-versions-1.3.0.tgz",
"_shasum": "ce6f3eae2e165ce4ed49b89beb68014741093044",
"_spec": "android-versions@1.3.0",
"_resolved": "https://registry.npmjs.org/android-versions/-/android-versions-1.4.0.tgz",
"_shasum": "807ea2941d7e5780e6dd61c5d9b7b6f3c0706e09",
"_spec": "android-versions@1",
"_where": "/Users/brodybits/Documents/cordova/cordova-android",
"author": {
"name": "dvoiss"
@@ -63,5 +64,5 @@
"jshint": "jshint .",
"test": "tape tests/**/*.js"
},
"version": "1.3.0"
"version": "1.4.0"
}

View File

@@ -1,7 +1,7 @@
"use strict";
var test = require('tape')
var android = require('..')
const test = require('tape')
const android = require('..')
test('get specific version by API level', (t) => {
t.plan(1)
@@ -16,7 +16,7 @@ test('getAll versions by API level', (t) => {
test('get specific version by predicate', (t) => {
t.plan(2)
var actual = android.get((version) => {
let actual = android.get((version) => {
return version.name.indexOf("on") !== -1
})
t.equal(actual.name, "Donut")
@@ -30,7 +30,7 @@ test('get specific version by predicate', (t) => {
test('getAll versions by predicate', (t) => {
t.plan(3)
var actual = android.getAll((version) => {
let actual = android.getAll((version) => {
return version.name.indexOf("on") !== -1
}).map((version) => version.name)
t.deepEqual(actual, ["Donut", "Honeycomb", "Honeycomb", "Honeycomb"])
@@ -43,7 +43,7 @@ test('getAll versions by predicate', (t) => {
actual = android.getAll((version) => {
return version.api > 22
}).map((version) => version.versionCode)
t.deepEqual(actual, ["M", "N", "N_MR1", "O", "O_MR1"])
t.deepEqual(actual, ["M", "N", "N_MR1", "O", "O_MR1", "P"])
})
test('get version by semantic version', (t) => {
@@ -54,32 +54,31 @@ test('get version by semantic version', (t) => {
t.equal(android.get("2.3.3").versionCode, android.GINGERBREAD_MR1.versionCode)
})
test('support major version only', (t) => {
t.plan(2)
t.equal(android.get("9.0").versionCode, android.P.versionCode)
t.equal(android.get("9.0.0").versionCode, android.P.versionCode)
})
test('support version ranges', (t) => {
t.plan(7);
t.equal(android.get("4.4").versionCode, android.KITKAT.versionCode);
t.equal(android.get("4.4.0").versionCode, android.KITKAT.versionCode);
t.equal(android.get("4.4.1").versionCode, android.KITKAT.versionCode);
t.equal(android.get("4.4.2").versionCode, android.KITKAT.versionCode);
t.equal(android.get("4.4.3").versionCode, android.KITKAT.versionCode);
t.equal(android.get("4.4.4").versionCode, android.KITKAT.versionCode);
t.equal(android.get("4.4.5"), null);
t.plan(7)
let tests = [ "4.4", "4.4.0", "4.4.1", "4.4.2", "4.4.3", "4.4.4" ]
tests.forEach((versionCode) => {
t.equal(android.get(versionCode).versionCode, android.KITKAT.versionCode)
})
t.equal(android.get("4.4.5"), null)
})
test('support x-ranges', (t) => {
t.plan(12);
t.equal(android.get("4.1").versionCode, android.JELLY_BEAN.versionCode);
t.equal(android.get("4.1.0").versionCode, android.JELLY_BEAN.versionCode);
t.equal(android.get("4.1.1").versionCode, android.JELLY_BEAN.versionCode);
t.equal(android.get("4.1.2").versionCode, android.JELLY_BEAN.versionCode);
t.equal(android.get("4.1.3").versionCode, android.JELLY_BEAN.versionCode);
t.equal(android.get("4.1.4").versionCode, android.JELLY_BEAN.versionCode);
t.equal(android.get("4.1.5").versionCode, android.JELLY_BEAN.versionCode);
t.equal(android.get("4.1.6").versionCode, android.JELLY_BEAN.versionCode);
t.equal(android.get("4.1.7").versionCode, android.JELLY_BEAN.versionCode);
t.equal(android.get("4.1.8").versionCode, android.JELLY_BEAN.versionCode);
t.equal(android.get("4.1.9").versionCode, android.JELLY_BEAN.versionCode);
t.equal(android.get("4.1.10").versionCode, android.JELLY_BEAN.versionCode);
});
t.plan(12)
let tests = [
"4.1", "4.1.0", "4.1.1", "4.1.2", "4.1.3", "4.1.4",
"4.1.5", "4.1.6", "4.1.7", "4.1.8", "4.1.9", "4.1.10"
]
tests.forEach((versionCode) => {
t.equal(android.get(versionCode).versionCode, android.JELLY_BEAN.versionCode)
})
})
test('access version codes object', (t) => {
t.plan(1)
@@ -87,7 +86,7 @@ test('access version codes object', (t) => {
})
test('access specific versions directly', (t) => {
t.plan(27)
t.plan(28)
t.ok(android.BASE)
t.ok(android.BASE_1_1)
t.ok(android.CUPCAKE)
@@ -115,4 +114,5 @@ test('access specific versions directly', (t) => {
t.ok(android.N_MR1)
t.ok(android.O)
t.ok(android.O_MR1)
t.ok(android.P)
})

View File

@@ -1,6 +1,6 @@
{
"name": "cordova-android",
"version": "7.1.2",
"version": "7.1.4",
"description": "cordova-android release",
"bin": {
"create": "bin/create"
@@ -29,16 +29,19 @@
"author": "Apache Software Foundation",
"license": "Apache-2.0",
"dependencies": {
"android-versions": "1.3.0",
"android-versions": "1.4.0",
"base64-js": "1.2.0",
"big-integer": "1.6.32",
"cordova-common": "2.2.5",
"elementtree": "0.1.6",
"glob": "5.0.15",
"nopt": "3.0.1",
"path-is-absolute": "1.0.1",
"plist": "2.1.0",
"properties-parser": "0.2.3",
"q": "1.4.1",
"sax": "0.3.5",
"semver": "5.5.0",
"shelljs": "0.5.3",
"xmlbuilder": "8.2.2"
},

View File

@@ -70,6 +70,20 @@
<source-file src="src/android/DummyPlugin.java"
target-dir="src/com/phonegap/plugins/dummyplugin" />
<source-file src="src/android/DummyPlugin2.java"
target-dir="app/src/main/src/com/phonegap/plugins/dummyplugin" />
<source-file src="src/android/TestLib.jar"
target-dir="app/libs" />
<source-file src="src/android/TestAar.aar"
target-dir="app/libs" />
<source-file src="src/android/mysettings.xml" target-dir="res/xml" />
<source-file src="src/android/other.extension" target-dir="res/values" />
<source-file src="src/android/myapi.aidl" target-dir="src/com/mytest" />
<source-file src="src/android/testaar2.aar" target-dir="libs" />
<source-file src="src/android/testjar2.jar" target-dir="libs" />
<source-file src="src/android/jniLibs/x86/libnative.so" target-dir="libs/x86" />
<source-file src="src/android/DummyPlugin2.java"
target-dir="src/com/appco" />
<lib-file src="src/android/TestLib.jar" />
</platform>
</plugin>

View File

@@ -0,0 +1 @@
./org.test.plugins.dummyplugin/src/android/DummyPlugin2.java

View File

@@ -0,0 +1 @@
./org.test.plugins.dummyplugin/src/android/TestAar.aar

View File

@@ -0,0 +1 @@
dummy

View File

@@ -0,0 +1 @@
dummy

View File

@@ -0,0 +1 @@
dummy

View File

@@ -0,0 +1 @@
dummy

View File

@@ -0,0 +1 @@
dummy

View File

@@ -0,0 +1 @@
dummy

View File

@@ -108,6 +108,73 @@ describe('android project handler', function () {
android['source-file'].install(valid_source[0], dummyPluginInfo, dummyProject);
}).toThrow(new Error('"' + target + '" already exists!'));
});
// TODO: renumber these tests and other tests below
it('Test#00a6 : should allow installing sources with new app target-dir scheme', function () {
android['source-file'].install(valid_source[1], dummyPluginInfo, dummyProject, {android_studio: true});
expect(copyFileSpy)
.toHaveBeenCalledWith(dummyplugin, 'src/android/DummyPlugin2.java', temp, path.join('app/src/main/src/com/phonegap/plugins/dummyplugin/DummyPlugin2.java'), false);
});
it('Test#006b : should allow installing jar lib file from sources with new app target-dir scheme', function () {
android['source-file'].install(valid_source[2], dummyPluginInfo, dummyProject, {android_studio: true});
expect(copyFileSpy)
.toHaveBeenCalledWith(dummyplugin, 'src/android/TestLib.jar', temp, path.join('app/libs/TestLib.jar'), false);
});
it('Test#006c : should allow installing aar lib file from sources with new app target-dir scheme', function () {
android['source-file'].install(valid_source[3], dummyPluginInfo, dummyProject, {android_studio: true});
expect(copyFileSpy)
.toHaveBeenCalledWith(dummyplugin, 'src/android/TestAar.aar', temp, path.join('app/libs/TestAar.aar'), false);
});
it('Test#006d : should allow installing xml file from sources with old target-dir scheme', function () {
android['source-file'].install(valid_source[4], dummyPluginInfo, dummyProject, {android_studio: true});
expect(copyFileSpy).toHaveBeenCalledWith(dummyplugin,
'src/android/mysettings.xml', temp,
path.join('app/src/main/res/xml/mysettings.xml'), false);
});
it('Test#006e : should allow installing file with other extension from sources with old target-dir scheme', function () {
android['source-file'].install(valid_source[5], dummyPluginInfo, dummyProject, {android_studio: true});
expect(copyFileSpy).toHaveBeenCalledWith(dummyplugin,
'src/android/other.extension', temp,
path.join('app/src/main/res/values/other.extension'), false);
});
it('Test#006f : should allow installing aidl file from sources with old target-dir scheme (GH-547)', function () {
android['source-file'].install(valid_source[6], dummyPluginInfo, dummyProject, {android_studio: true});
expect(copyFileSpy).toHaveBeenCalledWith(dummyplugin,
'src/android/myapi.aidl', temp,
path.join('app/src/main/aidl/com/mytest/myapi.aidl'), false);
});
it('Test#006g : should allow installing aar lib file from sources with old target-dir scheme (GH-547)', function () {
android['source-file'].install(valid_source[7], dummyPluginInfo, dummyProject, {android_studio: true});
expect(copyFileSpy).toHaveBeenCalledWith(dummyplugin,
'src/android/testaar2.aar', temp,
path.join('app/libs/testaar2.aar'), false);
});
it('Test#006h : should allow installing jar lib file from sources with old target-dir scheme (GH-547)', function () {
android['source-file'].install(valid_source[8], dummyPluginInfo, dummyProject, {android_studio: true});
expect(copyFileSpy).toHaveBeenCalledWith(dummyplugin,
'src/android/testjar2.jar', temp,
path.join('app/libs/testjar2.jar'), false);
});
it('Test#006i : should allow installing .so lib file from sources with old target-dir scheme (GH-547)', function () {
android['source-file'].install(valid_source[9], dummyPluginInfo, dummyProject, {android_studio: true});
expect(copyFileSpy).toHaveBeenCalledWith(dummyplugin,
'src/android/jniLibs/x86/libnative.so', temp,
path.join('app/src/main/jniLibs/x86/libnative.so'), false);
});
it('Test#006j : should allow installing sources with target-dir that includes "app"', function () {
android['source-file'].install(valid_source[10], dummyPluginInfo, dummyProject, {android_studio: true});
expect(copyFileSpy)
.toHaveBeenCalledWith(dummyplugin, 'src/android/DummyPlugin2.java', temp, path.join('app/src/main/java/com/appco/DummyPlugin2.java'), false);
});
});
describe('of <framework> elements', function () {
@@ -263,6 +330,66 @@ describe('android project handler', function () {
android['source-file'].uninstall(valid_source[0], dummyPluginInfo, dummyProject, {android_studio: true});
expect(deleteJavaSpy).toHaveBeenCalledWith(temp, path.join('app/src/main/java/com/phonegap/plugins/dummyplugin/DummyPlugin.java'));
});
it('Test#019a : should remove stuff by calling common.deleteJava for Android Studio projects, with specific app target-dir', function () {
android['source-file'].install(valid_source[1], dummyPluginInfo, dummyProject, {android_studio: true});
android['source-file'].uninstall(valid_source[1], dummyPluginInfo, dummyProject, {android_studio: true});
expect(deleteJavaSpy).toHaveBeenCalledWith(temp, path.join('app/src/main/src/com/phonegap/plugins/dummyplugin/DummyPlugin2.java'));
});
it('Test#019b : should remove stuff by calling common.removeFile for Android Studio projects, of jar with new app target-dir scheme', function () {
android['source-file'].install(valid_source[2], dummyPluginInfo, dummyProject, {android_studio: true});
android['source-file'].uninstall(valid_source[2], dummyPluginInfo, dummyProject, {android_studio: true});
expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/libs/TestLib.jar'));
});
it('Test#019c : should remove stuff by calling common.removeFile for Android Studio projects, of aar with new app target-dir scheme', function () {
android['source-file'].install(valid_source[3], dummyPluginInfo, dummyProject, {android_studio: true});
android['source-file'].uninstall(valid_source[3], dummyPluginInfo, dummyProject, {android_studio: true});
expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/libs/TestAar.aar'));
});
it('Test#019d : should remove stuff by calling common.removeFile for Android Studio projects, of xml with old target-dir scheme', function () {
android['source-file'].install(valid_source[4], dummyPluginInfo, dummyProject, {android_studio: true});
android['source-file'].uninstall(valid_source[4], dummyPluginInfo, dummyProject, {android_studio: true});
expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/src/main/res/xml/mysettings.xml'));
});
it('Test#019e : should remove stuff by calling common.removeFile for Android Studio projects, of file with other extension with old target-dir scheme', function () {
android['source-file'].install(valid_source[5], dummyPluginInfo, dummyProject, {android_studio: true});
android['source-file'].uninstall(valid_source[5], dummyPluginInfo, dummyProject, {android_studio: true});
expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/src/main/res/values/other.extension'));
});
it('Test#019f : should remove stuff by calling common.removeFile for Android Studio projects, of aidl with old target-dir scheme (GH-547)', function () {
android['source-file'].install(valid_source[6], dummyPluginInfo, dummyProject, {android_studio: true});
android['source-file'].uninstall(valid_source[6], dummyPluginInfo, dummyProject, {android_studio: true});
expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/src/main/aidl/com/mytest/myapi.aidl'));
});
it('Test#019g : should remove stuff by calling common.removeFile for Android Studio projects, of aar with old target-dir scheme (GH-547)', function () {
android['source-file'].install(valid_source[7], dummyPluginInfo, dummyProject, {android_studio: true});
android['source-file'].uninstall(valid_source[7], dummyPluginInfo, dummyProject, {android_studio: true});
expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/libs/testaar2.aar'));
});
it('Test#019h : should remove stuff by calling common.removeFile for Android Studio projects, of jar with old target-dir scheme (GH-547)', function () {
android['source-file'].install(valid_source[8], dummyPluginInfo, dummyProject, {android_studio: true});
android['source-file'].uninstall(valid_source[8], dummyPluginInfo, dummyProject, {android_studio: true});
expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/libs/testjar2.jar'));
});
it('Test#019i : should remove stuff by calling common.removeFile for Android Studio projects, of .so lib file with old target-dir scheme (GH-547)', function () {
android['source-file'].install(valid_source[9], dummyPluginInfo, dummyProject, {android_studio: true});
android['source-file'].uninstall(valid_source[9], dummyPluginInfo, dummyProject, {android_studio: true});
expect(removeFileSpy).toHaveBeenCalledWith(temp, path.join('app/src/main/jniLibs/x86/libnative.so'));
});
it('Test#019j : should remove stuff by calling common.deleteJava for Android Studio projects, with target-dir that includes "app"', function () {
android['source-file'].install(valid_source[10], dummyPluginInfo, dummyProject, {android_studio: true});
android['source-file'].uninstall(valid_source[10], dummyPluginInfo, dummyProject, {android_studio: true});
expect(deleteJavaSpy).toHaveBeenCalledWith(temp, path.join('app/src/main/java/com/appco/DummyPlugin2.java'));
});
});
describe('of <framework> elements', function () {