Compare commits

...

1231 Commits

Author SHA1 Message Date
dependabot[bot]
4742358601
chore(deps-dev): bump @babel/traverse from 7.22.10 to 7.23.2 (#1677)
Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.22.10 to 7.23.2.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse)

---
updated-dependencies:
- dependency-name: "@babel/traverse"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-20 17:36:12 -03:00
Erisu
e61e271f5b
chore: bump version 12.0.2-dev 2023-08-23 18:39:28 +09:00
Erisu
0c805a0a8e
release(android-v12.0.1): updated version and RELEASENOTES.md 2023-08-23 18:34:34 +09:00
エリス
a7cd4227a4
chore: rebuild package-lock w/ lint corrections (#1649)
* chore: rebuild package-lock.json
* chore: remew file starting new-line
2023-08-23 18:24:41 +09:00
Norman Breau
c9e7c59986
fix(GH-1616): Fix monochrome checks (#1632) 2023-07-13 13:18:54 -03:00
Erisu
94234d988e
chore: bump version 12.0.1-dev 2023-05-20 01:13:49 +09:00
Erisu
b104554877
release(android-v12.0.0): updated version and RELEASENOTES.md 2023-05-20 00:47:09 +09:00
エリス
7da13ccf77
feat: add listTarget api (#1602)
* feat: add listTarget api
* test: write Platform API target list specs
2023-05-08 22:27:17 +09:00
Philip Peitsch
cb48147398
feat: add plugin hooks for WebViewClient.onRenderProcessGone (#1574)
* feat: add plugin hooks for WebViewClient.onRenderProcessGone

* Update framework/src/org/apache/cordova/CordovaPlugin.java

Co-authored-by: Norman Breau <norman@nbsolutions.ca>

---------

Co-authored-by: Norman Breau <norman@nbsolutions.ca>
2023-04-23 23:20:48 -03:00
Norman Breau
6f6717afbd
ci: Added NodeJS 20.x to the workflow matrix (#1607) 2023-04-22 17:01:24 -03:00
Norman Breau
3343c3bb34
fix: Gradle Args parsing (#1606)
* fix: Gradle Args parsing

* refactor: Applied ARGVParser.parseArgsStringToArgv -> parseArgsStringToArgv suggestion

* test: Added deeper testing for gradle argument parsing
2023-04-22 17:00:51 -03:00
Norman Breau
a62f699380
fix!: Make CoreAndroid plugin instantiate on load (#1605)
I don't anticipate breaking changes from this change, however it is a difference
in behaviour since CoreAndroid won't be lazily loaded, therefore I've marked this
commit has a breaking change.
2023-04-21 16:00:11 -03:00
喻志强
7efe90faac
fix(BuildHelper): get package name from ApplicationInfo (#1575) 2023-04-14 10:15:55 -03:00
Norman Breau
5b546a27e6
deprecate: CoreAndroid.getBuildConfigValue (#1597) 2023-04-14 10:15:09 -03:00
Norman Breau
2252c09a49
feat: bump default kotlin to version 1.7.21 (#1594)
The rationale is based on the Gradle Compatibility Matrix: https://docs.gradle.org/current/userguide/compatibility.html

1.7.21 is the current latest version of the 1.7 Kotlin release.
2023-04-14 07:17:15 -03:00
Norman Breau
3a9c87d3b8
fix(test): Native test namespace refactor (#1595) 2023-04-14 18:47:03 +09:00
エリス
a9d4d4ebd2
feat!: bump Gradle 7.6 & AGP 7.4.2 (#1539)
* feat: bump gradle 7.6
* feat: bump android gradle plugin 7.3.1
* feat: bump android gradle plugin 7.4.2
* fix!: move android package name to build.gradle namespace
* fix!: remove deprecated package name from AndroidManifest
* fix: package name
* fix: rename CordovaGradleConfigParser's _save to write
* test: fix CordovaGradleConfigParser related specs
* fix: test refactoring for gradle namespace
* fix: accidental variable naming mixing

---------

Co-authored-by: Norman Breau <norman@nbsolutions.ca>
2023-04-12 14:39:47 +09:00
Alexis THOMAS
841710edf7
fix: ANDROID_HOME is the new default, to check first and give advice (#1471) 2023-04-09 20:43:11 -03:00
Mahendra Liya
016018513e
feat: add monochrome app icon support (#1550)
* Added the monochrome version for Cordova's icon

* android: modified the ic_launcher.xml to include the monochrome drawable

* android: replaced monochrome image with  rasterized images

* android: Added support for custom monochrome icons defined in config.xml

* android: Updated Tests

* android: wrapped inside if(monochrome)

* android: Update templates/project/res/mipmap-hdpi-v26/ic_launcher.xml

Co-authored-by: エリス <erisu@users.noreply.github.com>

* Update lib/prepare.js

Co-authored-by: エリス <erisu@users.noreply.github.com>

* android: Update templates/project/res/mipmap-ldpi-v26/ic_launcher.xml

Co-authored-by: エリス <erisu@users.noreply.github.com>

* android: Update templates/project/res/mipmap-mdpi-v26/ic_launcher.xml

Co-authored-by: エリス <erisu@users.noreply.github.com>

* android Update templates/project/res/mipmap-xhdpi-v26/ic_launcher.xml

Co-authored-by: エリス <erisu@users.noreply.github.com>

* android: Update templates/project/res/mipmap-xxhdpi-v26/ic_launcher.xml

Co-authored-by: エリス <erisu@users.noreply.github.com>

* android: Update templates/project/res/mipmap-xxxhdpi-v26/ic_launcher.xml

Co-authored-by: エリス <erisu@users.noreply.github.com>

* android: Update lib/prepare.js

Co-authored-by: エリス <erisu@users.noreply.github.com>

* Resolved lint errors

* fix: test failure

---------

Co-authored-by: エリス <erisu@users.noreply.github.com>
2023-04-09 20:41:38 -03:00
Norman Breau
a78fad1783
feat: InspectableWebview preference (#1589) 2023-04-09 20:41:00 -03:00
Norman Breau
b91639dbb5
refactor: Removed obsolete version code checks (#1588)
Now that our Min SDK is 24, testing for >= N (API 24) and >= M (API 22) is obsolete as it will always be true.
Simplify the codebase by removing the conditions and keeping only the API 24 or later codepath.
2023-04-08 15:32:19 -03:00
エリス
c2013439bc
dep: bump npm dependencies (#1587)
* dep: bump npm dependencies
  - fs-extra@11.1.1
  - nopt@7.1.0
  - @cordova/eslint-config@5.0.0
  - jasmine@4.6.0
* chore: apply eslint fix
2023-04-06 12:35:00 +09:00
Norman Breau
d4bfd5079b
fix(GH-1432): Default content src when content tag is missing (#1573) 2023-03-21 13:24:13 -03:00
Norman Breau
dbddbf253b
feat!: Bump min SDK to 24 (#1571)
Rationale:
API 22 & API 23 both account for an insignificant part of the market share.
While API 24 - API 26 has similar market share, we felt that bumping to API 26
from API 22 is too large of a jump.

Legacy devices may be completely out of support by Google and may not be able
to receive the latest webview version. As of writing, Chromium's latest
tag shows they are using a Min SDK version of 24. (Ref: https://chromium.googlesource.com/chromium/src/+/refs/tags/113.0.5653.1/build/config/android/config.gni#46)

Based on AOSP emulators, API 24 (Android 7.0) will ship with
Chrome 52 webview, which has good support for ECMAscript 2015 (ES6) (Ref: https://caniuse.com/?search=es6)

While in most cases, app users will likely have a modern webview vesion installed, this means
you can be confident that the app user will have a chrome webview version with good ES6 support,
even if they happen to be running on a factory versioned device.

See the mailing thread for the full discussion:
https://lists.apache.org/thread/zcgof080hdzzo2j96mjz0qpj0gotmn57
2023-03-16 19:45:01 -03:00
エリス
04723eb8f3
feat: bump androidx.appcompat.appcompat 1.6.1 (#1568) 2023-03-11 16:41:38 +09:00
エリス
862d33694e
feat: bump androidx.webkit.webkit 1.6.0 (#1567) 2023-03-11 12:19:16 +09:00
エリス
fe3940a73c
feat: bump androidx.webkit.webkit 1.5.0 (#1545) 2023-03-11 03:07:19 +09:00
エリス
81c678c58d
feat: bump com.google.gms.google-services 4.3.15 (#1547)
* feat: bump com.google.gms.google-services 4.3.14
* feat: bump com.google.gms.google-services 4.3.15
Co-authored-by: jcesarmobile <jcesarmobile@gmail.com>
2023-03-11 03:06:56 +09:00
エリス
bfe086a2d7
feat: bump androidx.core.core-splashscreen 1.0.0 (#1546) 2023-03-11 02:51:33 +09:00
エリス
8fb707567a
feat: bump androidx.appcompat.appcompat 1.5.1 (#1544) 2023-03-11 02:45:42 +09:00
エリス
992a60a434
feat!: bump target sdk & build tools for SDK 33 support (#1538)
* feat!: bump target sdk version 33
* feat!: bump minimum build tools version 33.0.1
* feat!: bump minimum build tools version 33.0.2
2023-03-10 12:12:17 +09:00
エリス
2318ef58ad
dep(npm)!: bump acceptable modules w/ rebuilt package-lock (#1541)
* dep(npm)!: bump acceptable modules
* chore: rebuilt package-lock
2023-03-09 18:57:19 +09:00
エリス
968bd85cc3
feat!: bump node engine requirement >=16.13.0 (#1540) 2023-03-09 18:40:16 +09:00
エリス
9ef3ee9539
dep(npm)!: bump cordova-common@5.0.0 (#1566) 2023-03-09 18:34:31 +09:00
エリス
5347054efb
chore: prepare package version for next major 12.0.0-dev (#1537) 2023-03-09 18:33:28 +09:00
エリス
3340e98519
ci(workflow): update codecov/codecov-action@v3 (#1542) 2023-01-18 23:53:36 +09:00
jcesarmobile
ce19a3b445
chore: add lint:fix script for fixing lint errors (#1493)
* chore: Add fmt command for fixing lint errors
* rename to lint:fix
2023-01-11 10:06:16 +09:00
Jesse MacFadyen
d02f8eafe8
Update codecoverage reporting (#1532) 2022-12-30 12:18:54 -08:00
jcesarmobile
56d4b8312b
fix: only do fadeout animation if FadeSplashScreen is true (#1506) 2022-10-27 23:38:30 +02:00
Darryl Pogue
80f232aa79
fix: correctly flag API dependency on AppCompat for Maven (#1505)
* Correctly flag API dependency on AppCompat for Maven

Currently when cordova-android is published to Maven, it lists no
dependencies. However, `CordovaActivity` extends `AppCompatActivity`
which requires that the AndroidX AppCompat library be available.

Marking this as an API dependency (rather than an implementation/compile
dependency) should cause the AndroidX AppCompat library to be installed
when the cordova-android framework is added to the build.gradle of an
existing Android application.

* Publish to Maven with proper metadata

This allows the Maven publish to pick up information from the android
library component and include things like dependencies in the pom.xml
file.
2022-10-15 13:39:47 +09:00
jcesarmobile
954d3e0e75
fix: Add android prefix to windowSplashScreenBrandingImage (#1487) 2022-09-16 09:34:20 +02:00
jcesarmobile
8a1ffeeafd
chore: Use gradle 7.4.2 distribution url (#1491) 2022-09-16 09:33:15 +02:00
jcesarmobile
7793db97cc
refactor: replace deprecated Handler constructor (#1492) 2022-09-16 09:32:38 +02:00
Philip Peitsch
248257bd37
fix: import type definitions from obsolete cordova-plugin-splashscreen (#1489) 2022-09-13 10:03:53 -03:00
Erisu
60e3803c67
chore: bump version 11.0.1-dev (2) 2022-07-04 23:12:43 +09:00
Erisu
d828785435
release(android-v11.0.0): updated version and RELEASENOTES.md (2) 2022-07-04 22:37:49 +09:00
エリス
e5b7e8ab26
fix(prepare): destFile path separator (#1455) 2022-07-04 22:27:11 +09:00
Erisu
f38e8eb3d0
chore: bump version 11.0.1-dev 2022-06-30 21:53:33 +09:00
Erisu
98895f7d78
release(android-v11.0.0): updated version and RELEASENOTES.md 2022-06-30 21:43:31 +09:00
エリス
e968cac0b9
fix: support installing platfrom from local git checkout (#1453) 2022-06-30 21:35:27 +09:00
エリス
861fec2cc7
dep: bump jasmine@4.2.1 w/ package-lock rebuild (#1452) 2022-06-30 20:25:06 +09:00
エリス
273d1bdecd
chore: display warning on deprecated <splash> tag usage (#1451)
* chore: display warning on deprecated <splash> tag usage
* test: create spy on warnForDeprecatedSplashScreen
2022-06-30 20:00:25 +09:00
エリス
606e9c4826
feat!: android 12 splash screen (#1441)
* chore!: remove old splashscreen logic
* feat(splashscreen): add backwards compatibility
* chore: remove unused method
* chore: prefix splashscreen_background with cdv_
* feat: support android 12 splashscreen api configs
* feat: improve & refactor the logic for android splashscreen api 12
* feat: splashscreen copy image resources
* feat: splashscreen branding image & xml cleanup
* fix: splashscreen cleanup & branding conditions
* fix: splashscreen @color usage
* feat: update default Apache Cordova splash screen
* chore: add missing asf header
* fix: splashscreen image size
* chore: use Theme.SplashScreen.IconBackground as default parent to support windowSplashScreenIconBackgroundColor
* fix: center default test image by correct pivot
* fix: fs-extra copySync
* feat: re-add AutoHideSplashScreen and SplashScreenDelay preference support
* chore: move splashscreen into CordovaActivity
* feat: support splashscreen.hide & centralize to SplashScreenPlugin
* chore: cleanup SplashScreenPlugin
* feat: support fade, default auto hide on onPageFinished, support delays, refactor
* refactor: cleanup splash screen
* refactor: cleanup remove unused import
* chore: add show method as unsupported
* test: create a spy on updateProjectSplashScreen
* style: add ending new line
* chore: improve logging to warn when image path is missing
* chore: split windowSplashScreenAnimatedIcon and windowSplashScreenBrandingImage case and added branding warning
* chore: improve when to display warning
* fix: add splashscreen dependency to app as well
* chore: move the core-splashscreen dep lower

Co-authored-by: Niklas Merz <niklasmerz@linux.com>
2022-06-30 10:49:10 +09:00
jcesarmobile
2d2ad4cb81
fix: accept file cookies only if AndroidInsecureFileModeEnabled (#1449) 2022-06-29 11:36:55 +09:00
jcesarmobile
26b21219f7
feat: Update androidx.appcompat version (#1448) 2022-06-29 11:34:08 +09:00
jcesarmobile
8d6e41fd77
feat: Update gradle plugin version (#1446) 2022-06-28 12:23:42 +09:00
jcesarmobile
262a314c72
feat: Update google services pluging (#1447) 2022-06-28 12:23:10 +09:00
エリス
bf9e4d8aab
fix!: set & use ANDROID_HOME as default (#1444)
* fix: remove ANDROID_HOME's DEPRECATED text
* fix: check_gradle to check ANDROID_HOME first ANDROID_SDK_ROOT last
* fix: set ANDROID_HOME
* chore: deprecate flag on ANDROID_SDK_ROOT
2022-06-27 22:07:32 +09:00
エリス
4916e1db51
fix: force hostname to lowercase (#1443) 2022-06-20 23:25:57 +09:00
エリス
68a9a3181a
ci: update github action workflow (#1439)
* ci: bump actions/checkout dependency
* ci: bump actions/setup-node dependency
* ci: bump codecov/codecov-action dependency
* ci: migrate from adopt to temurin
2022-06-03 15:05:38 +09:00
jcesarmobile
ba032df665
chore: Remove unneeded deprecated annotation (#1430) 2022-06-02 01:13:25 +02:00
エリス
53d39fb135
fix: restore checkReqs in prepare.js (#1434) 2022-05-19 00:49:52 +09:00
エリス
4744bfe6bf
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>
2022-05-18 23:18:33 +09:00
wedgberto
cb494ff9b1
fix(android): move MainActivity.java to folder that tracks the app package name (widget id) (#1154)
* move mainactivity.java

* unit test for moving mainactivity.java

* fix new unit test

* eslint fixes

* add explicit elementtree npm dependency

Co-authored-by: David Wedgbury <david.wedgbury@telent.com>
2022-05-18 11:11:31 -03:00
ebhsgit
bd0c8ce639
[Android] Added support for BoM imports (#1311)
* Added support for BoM imports

https://docs.gradle.org/current/userguide/platforms.html#sub:bom_import

Changes

* propertiesObj.systemLibs regex - exclude the value contains (
* added propertiesObj.bomPlatforms - any value which matches platform("...")

* Fix eslint style issues

Co-authored-by: 8bhsolutions <48874658+8bhsolutions@users.noreply.github.com>
2022-05-18 01:10:15 -03:00
Norman Breau
e73000023b
feat: API 32 support (#1427) 2022-05-03 20:13:17 -03:00
Norman Breau
087e9e6178
ci: Added Node 18 to test matrix (#1424) 2022-04-22 11:58:44 -03:00
エリス
a2bb7f1173
chore(npm): bump @cordova/eslint-config@^4.0.0 (#1421)
* chore(npm): bump @cordova/eslint-config@^4.0.0
* style(lint): apply auto corrections
* style(lint): convert hasAndroidHome var to let and hoisted
2022-04-18 10:39:54 +09:00
エリス
62ed71c539
chore(npm): bump dependencies (#1420)
* chore(npm): bump dev dependencies
* chore(npm): bump release dependencies
2022-04-17 22:02:40 +09:00
Norman Breau
5704ef9ea5
feat!: API 31 support (#1410)
* feat(breaking): API 31 support
* ci: bump actions/setup-java@3 w/ java 11
* ci: set setup-java distribution to adopt

Co-authored-by: Erisu <erisu@apache.org>
2022-04-17 19:43:45 +09:00
Norman Breau
adcd9d9ff8
chore(breaking): Drop Node 12 support (#1411) 2022-04-17 19:43:11 +09:00
エリス
f3c75a89b5
chore: bump for next major 11.0.0-dev (#1419) 2022-04-17 19:06:51 +09:00
Erisu
21e7c2f661
chore: bump version 10.1.3-dev 2022-04-11 22:10:31 +09:00
Erisu
f12080b7e2
android-v10.1.2 Updated version and RELEASENOTES.md for release 10.1.2 2022-04-11 22:01:02 +09:00
Norman Breau
51291f8985
chore: update package-lock to satisfy npm audit (#1413) 2022-04-06 11:59:21 -03:00
Lars Mikkelsen
112f0a61a8
fix: detect JAVA_HOME with Java 11 (#1406) 2022-03-17 20:38:04 -03:00
Norman Breau
6d3ce211dd
fix(GH-1391): Reword minimum build tools version to make it more clear what is actually required. (#1401) 2022-02-22 10:14:22 -04:00
Tiago Pereira
f100809bf3
fix: escape strings.xml app name (#1384) 2022-02-08 11:29:36 +09:00
エリス
a1ed1c0af7
feat(AndroidManifest): explicitly define the activity attribute android:exported (#1372) 2021-10-28 17:29:55 +09:00
Norman Breau
05e3e3cf8d
chore: npmrc (#1348) 2021-09-17 09:54:59 -03:00
Erisu
8a957fb9c9
chore: bump version 10.1.2-dev 2021-09-13 20:17:31 +09:00
Erisu
e188c61c86
android-v10.1.1 Updated version and RELEASENOTES.md for release 10.1.1 2021-09-13 15:56:27 +09:00
エリス
ca19084b1c
fix(PluginManager): AllowNavigation default policy to handle scheme & hostname (#1349) 2021-09-13 15:48:02 +09:00
Joel Skrepnek
aea6b7f6f4
fix(AllowListPlugin): Safely handle default allow navigation policy in allow request (#1342) 2021-09-09 14:58:58 +09:00
エリス
7a67e00b9f
fix(PluginManager): AllowBridgeAccess default policy to handle scheme & hostname (#1332) 2021-09-07 19:52:23 +09:00
Erisu
dc4e065f61
chore: bump version 10.1.1-dev 2021-08-13 13:42:59 +09:00
Erisu
c3fd6bca4a
android-v10.1.0 Updated version and RELEASENOTES.md for release 10.1.0 2021-08-13 13:26:31 +09:00
Alexis THOMAS
13bd3f4a9f
feat: unify create default values & stop project name transform (#1213) 2021-08-13 12:52:30 +09:00
Alexis THOMAS
09c75237d9
fix: display project name in Android Studio (#1214) 2021-08-13 12:08:18 +09:00
Alexis THOMAS
b5e79b5a4d
doc: update README about development & testing (#1308)
Co-authored-by: エリス <erisu@users.noreply.github.com>
2021-08-13 11:28:47 +09:00
Mosab A
5db850890d
feat: bump ANDROIDX_APP_COMPAT@1.3.1 (#1306) 2021-08-02 16:34:06 +09:00
Mosab A
b6c5db3e37
feat: bump Google Services Gradle Plugin@4.3.8 (#1303) 2021-08-02 14:21:11 +09:00
Mosab A
cba3410b17
feat: bump kotlin@1.5.21 (#1302) 2021-08-02 14:21:02 +09:00
エリス
565ac9c7b1
fix: fall back to project root repositories.gradle (#1300) 2021-08-02 14:19:40 +09:00
エリス
1636d70f25
feat: support http w/ content src fix (#1298) 2021-07-30 17:08:23 +09:00
エリス
4e5892c5ed
chore: bump version 10.1.0-dev (#1301) 2021-07-30 17:08:04 +09:00
Erisu
e69ab6a687
chore: bump version 10.0.2-dev 2021-07-27 23:23:36 +09:00
Erisu
a9171c3db6
android-v10.0.1 Updated version and RELEASENOTES.md for release 10.0.1 2021-07-27 22:50:34 +09:00
エリス
90271301fb
fix: maven-publish setup (#1295) 2021-07-27 21:03:14 +09:00
Norman Breau
c11fcc10e8
fix: gradle build tools config (#1293) 2021-07-26 13:26:42 -03:00
Norman Breau
5e50c1d611
fix: automatic latest build tools finding (#1294) 2021-07-26 13:17:25 -03:00
エリス
38ca895459
fix: add missing release notes (#1291)
* CB-14203 Update RELEASENOTES & version for 7.1.1
* Update RELEASENOTES & version for v7.1.2
* Update VERSION & RELEASENOTES for 7.1.3
* Update VERSION & RELEASENOTES for 7.1.4

Co-authored-by: Christopher J. Brody <chris.brody@gmail.com>
Co-authored-by: Darryl Pogue <darryl@dpogue.ca>
2021-07-24 21:44:17 +09:00
エリス
0ce66249da
fix: Google Services Gradle Plugin version check failure (#1287) 2021-07-20 17:49:21 +09:00
エリス
291edcd24e
chore: update readme requirements (#1286) 2021-07-20 17:49:13 +09:00
エリス
4f44036d0a
chore: set version for patch release (#1285) 2021-07-20 17:49:04 +09:00
Erisu
6081cc7442
Set VERSION to 10.1.0-dev (via coho) 2021-07-17 16:24:18 +09:00
Erisu
7572fc4912
android-v10.0.0 Updated version and RELEASENOTES.md for release 10.0.0 2021-07-17 13:56:20 +09:00
エリス
9286496378
fix: add missing apache-license header to getASPath.bat (#1283) 2021-07-16 17:59:30 +09:00
エリス
9d3d8d0521
chore!: bump all dependencies (#1279)
* chore: bump jasmine@^3.8.0
* chore!: bump release dependencies

- android-versions@^1.7.0
- execa@^5.1.1
- fast-glob@^3.2.7
- fs-extra@^10.0.0

* chore: rebuilt package-lock.json
2021-07-15 21:02:32 +09:00
エリス
636136c88e
chore!: drop node 10 support (#1278) 2021-07-15 12:32:56 +09:00
Niklas Merz
bedb4427f4
fix: add WebViewAssetloader to default allow list (#1275) 2021-07-14 22:29:15 +09:00
Raphael von der Grün
35f0d07521
build: build cordova.js during npm prepare (#1271) 2021-07-14 10:25:34 +02:00
エリス
b94409ffe0
Remove gradle.daemon from default forced settings (#1276)
Co-authored-by: Fernando Serboncini <fserb@fserb.com.br>
2021-07-14 17:22:11 +09:00
エリス
adc380cf9f
cleanup!: remove deprecated settings & add todo comments (#1274)
* chore: add todo task for setSaveFormData
* cleanup!: remove deprecated setSavePassword
* cleanup!: remove deprecated setDatabasePath
* chore: add todo task for setGeolocationDatabasePath
2021-07-14 15:37:12 +09:00
エリス
7da531ced5
chore: remove old VERSION file (#1273) 2021-07-14 15:34:27 +09:00
Dominik Hendrix
3e870e3a04
fix: request focus after custom view hided (#1216)
Co-authored-by: Dominik Hendrix <hendrix@schaffrath-digital.de>
2021-07-14 11:42:19 +09:00
エリス
f15fec81cf
cleanup: delete old ANT & Eclipse files (#1272) 2021-07-14 11:38:40 +09:00
Raphael von der Grün
53d60dd707
refactor(Api)!: use version from package.json (#1270) 2021-07-13 12:27:25 +02:00
hiepxanh
68a302e9d2
fix(build): support tilde expansion on windows (#563)
Co-authored-by: Raphael von der Grün <raphinesse@gmail.com>
2021-07-13 19:02:09 +09:00
Raphael von der Grün
16ff6e1b2f
refactor!: do not copy JS lib to platform project (#1269) 2021-07-13 11:01:50 +02:00
エリス
f6d1deeff6
feat!: release build defaults to aab package type (#1268) 2021-07-13 16:34:38 +09:00
Raphael von der Grün
1f0ea173b0
refactor: do not infer project root from script location (#1265)
* fix(Api): do not infer project root from script location

* fix(builders): do not infer project root from script location

* fix(target): do not infer project root from script location

* test(e2e): cleanup and extend E2E tests

- Renames the file with the only existing E2E test
- Makes existing test use the API instance returned by
  `Api.createPlatform`
- Adds another test that ensures we can still require the API from
  `platformProjectPath/cordova/Api.js`

* fix(check_reqs): do not infer project root from script location
2021-07-13 08:51:20 +02:00
Raphael von der Grün
70a1eff705
refactor: use target SDK of built APK to determine best emulator (#1267)
* refactor(emulator): require emulatorId in emulator.run

* refactor: use effective targetSdk to find best emulator
2021-07-12 09:48:36 +02:00
Raphael von der Grün
fb36e03aeb
refactor(run)!: cleanup run method (#1266)
* refactor(run)!: get rid of emit-and-throw & throw-literal antipatterns

* refactor(run)!: convert run method to async/await

* refactor(run): require build module in advance

* refactor(run): minor cleanup

* refactor(run): drop always-undefined option arch

`parseBuildOptions` only sets `arch` if something truthy is passed for
parameter `resolvedTarget` to which we pass `null`.

* refactor(run): destructure buildOptions
2021-07-11 15:47:07 +02:00
jcesarmobile
8a9cb8f6b7
feat: remove java 1.8 version check (#1241) 2021-07-07 13:19:09 +02:00
エリス
b31e024dbb
fix: missing super.onRequestPermissionsResult error (MissingSuperCall) (#1264) 2021-07-07 19:57:33 +09:00
エリス
422ce4f6bf
feat: bump appcompat@1.3.0 (#1262) 2021-07-07 11:17:05 +09:00
エリス
b8d32d7c60
feat: bump gradle@7.1.1 (#1257) 2021-07-07 11:11:24 +09:00
エリス
83b3998801
feat: bump android-gradle-plugin@4.2.2 (#1255) 2021-07-07 11:08:03 +09:00
エリス
180a1a39f0
feat: bump kotlin@1.5.20 (#1256)
* feat: bump kotlin@1.5.10
* fix: kotlin@1.5.20 (applied suggestion)

Co-authored-by: jcesarmobile <jcesarmobile@gmail.com>
2021-07-07 10:55:47 +09:00
エリス
a1ed525a0b
feat: bump android.webkit@1.4.0 (#1258) 2021-07-07 10:55:17 +09:00
Raphael von der Grün
2037b62f99
test(check_reqs): do not hardcode DEFAULT_TARGET_API (#1263)
Should have been part of #1212
2021-07-06 18:12:00 +02:00
エリス
21f64806c0
feat: support webkit version override (#1254) 2021-07-06 23:39:12 +09:00
エリス
e8cbeaaa1b
refactor: gradle cleanup (#1253)
* refactor: move androidx.webkit version to cdv-gradle-config-defaults
* chore: remove unnecessary cordova.gradle apply
* refactor: maven publish to use version info from package.json
* refactor: separate framwork publishing outside of app dev scope
2021-07-06 22:38:16 +09:00
Raphael von der Grün
facffb0809
refactor!: remove most platform binaries (#1100)
* Remove binaries cordova/lib/*

* Remove binary bin/android_sdk_version

* Remove binary bin/update script

* Remove binary bin/check_reqs

* Remove binary bin/create script

* Remove binary cordova/build

* Remove binary cordova/run

* Remove binary cordova/clean

* Remove binary cordova/log

* Remove unused module cordova/loggingHelper

* Update README

* Restore target-listing binaries used by CLI

Usage: cordova-lib/src/cordova/targets.js

* Restore binary bin/android_sdk_version for CLI compatibility

This is used in CLI to implement an Android SDK version check for plugins.
See https://cordova.apache.org/docs/en/latest/plugin_ref/spec.html#engines-and-engine

* Remove version.bat
2021-07-06 15:37:46 +02:00
Raphael von der Grün
6f35d0b2b7
refactor(check_reqs): drop originalError param from check_android_target (#1260) 2021-07-06 13:33:26 +02:00
Raphael von der Grün
334d02d26e
tests(prepare): factor out common vars (#1259) 2021-07-06 13:01:37 +02:00
エリス
69b24dbf6a
feat!: drop abandoned com.github.dcendents:android-maven-gradle-plugin (#1252)
* feat: use maven-publish plugin (mavenCentral)
* fix: Apache License url
* fix: framework build failure without useAndroidX
* fix: add aar build artifact
2021-07-06 15:57:40 +09:00
Norman Breau
510596f515
feat!: unify & fix gradle library/tooling overrides (#1212)
* enhancement: Control SDK versions and other default projects in one place
* fix: target/compile sdk usage
* refactor: cleanup gradle process
* chore: cleanup and remove unused changes
* chore: remove more unneeded FILE_PATH
* chore: fix lint error
* revert change intended to be part of a different PR
* chore: apply changes to revert to fit new changes
* fix: Ensure proper types
* breaking: Removed TempateFile class
  * Replaced the one and only usage of it with the properties-parser editor.
  * Breaking change because we are converting a method into an asynchronous method.
* refactor: Use the sync version of properties editor
* Gh 1178 fix sdk use gradlearg fix (#2)
* fix: readd gradleArg support
* fix: variable name
* refactor: remove unused mock variables
* Update bin/templates/cordova/lib/builders/ProjectBuilder.js
* Update bin/lib/create.js
* fix: const naming (review suggestion)
* fix: use defaults for framework building
* chore: apply review suggestion
* chore: rename config.json & defaults.json (review suggestions)
* refactor: updateUserProjectGradleConfig method
* refactor: minor changes in updateUserProjectGradleConfig
* refactor: major changes in updateUserProjectGradleConfig
* fix: wrong handling of missing preferences
* fix: usage of undefined this
* fix(create.spec): mocking of getPreference
* test(check_reqs): reduce diff size
* refactor: add wrapper to load gradle config defaults
* fix(check_reqs): get_target
  * Reads default SDK from default gradle config now
* fix(check_reqs.spec): return correct types from mocks
* revert to using get_target in create
* fix: e2e test

Co-authored-by: Erisu <ellis.bryan@gmail.com>
Co-authored-by: Raphael von der Grün <raphinesse@gmail.com>
2021-07-06 15:38:28 +09:00
エリス
47aa116b1d
breaking: drop jcenter & update dependencies (#1251) 2021-07-03 13:04:13 +09:00
エリス
015db819ae
feat(allow-list)!: integrate and refactor core plugin (#1138)
* refactor!: naming to allow list
* feat(allow-list): integrate core plugin
* refactor(allow-list): cleanup
* refactor: drop deprecated launch-external case for CustomConfigParser::handleStartTag
* fix: apply review comments
2021-07-02 11:52:05 +09:00
jcesarmobile
01569ce71a
feat!: upgrade android gradle plugin to 4.2.1 (#1232) 2021-07-01 16:50:39 +09:00
Raphael von der Grün
0f13f4a5ac
refactor(env/java): improve tests and implementation (#1246)
This basically fixes up the changes from #1220.

* test(env/java): replace test that duplicates implementation
* test(env/java): stub _ensure to focus on unit under test
* test(env/java): add test for invalid output
* refactor(env/java): keep try block small
* refactor(env/java): shorten excessive comment
2021-06-23 18:22:04 +02:00
Norman Breau
6d803e2f72
Bugfix/java checks (#1228)
* fix: Java version parsing if java executable prints out additional information with --version

* fix: Ensure JAVA_HOME path comes first in the PATH environment

* refactor: Removed redundent code in favour of keeping a change introduced from another PR
2021-05-09 17:52:35 -03:00
Norman Breau
ae4dba2bb8
feat: CORDOVA_JAVA_HOME env variable (#1229)
* feat: CORDOVA_JAVA_HOME env variable

* refactor: Improve CORDOVA_JAVA_HOME env test

* fix(test) path separator issue
2021-05-09 17:02:25 -03:00
David
a45804329b
fix(requirements check): use regex to get java version from javac output (#1220)
* fix(requirements check): use regex to get java version from javac output

* fix(lint): format code

* fix(node 10): remove optional chaining from version check
2021-05-09 09:33:08 -03:00
Raphael von der Grün
1b7874607e
fix(prepare): delete splash screens if none are used (#1227)
Currently, we copy default splash screens to the platform folder during platform creation, but then we do not delete them when the user uses no splash screens at all. This causes #1226 and what is described in #689.

The new implementation does not return early when updating splashes and none are defined. Instead, we let the cleanup map we create initially take care of deleting all unused splash screens. This also deletes the default splashes during the first prepare after platform creation.

Fixes #1226
2021-05-06 09:30:19 +02:00
Niklas Merz
ff1ae2125a
feat: add backwards compatibility mode for WebViewAssetLoader (#1222) 2021-05-06 08:17:58 +02:00
Norman Breau
f9e8ce8fab
ci: Add Node16 to CI matrix (#1218) 2021-04-26 12:47:22 -03:00
Niklas Merz
5e7be8e1d6
breaking: implement WebViewAssetLoader (#1137)
Implement AndroidX WebViewAssetLoader with hook for plugins


Co-authored-by: エリス <erisu@users.noreply.github.com>
2021-04-22 14:32:14 +02:00
Jakub Blejder
b2d9d639b4
feat: overload PluginEntry constructor to set onload property (#1166)
Co-authored-by: Erisu <ellis.bryan@gmail.com>
2021-04-19 07:51:18 +09:00
エリス
8d407708d4
feat: allow appcompat version to be configurable (#1208) 2021-04-19 07:30:06 +09:00
エリス
19bbf1e8c1
test(AndroidManifest): update theme to Theme.AppCompat.NoActionBar (#1207) 2021-04-16 18:32:46 +09:00
Hans Krywalsky
2a84d7c44d
breaking: only support androidx (#1052)
* GH-841 only support androix
2021-04-16 06:52:14 +09:00
エリス
eeb645c886
chore! (npm): update all dependencies (#1205) 2021-04-15 08:23:41 +09:00
Mosab A
676f98d82d
feat!: upgrade kotlin@1.4.32 (#1204) 2021-04-14 11:29:09 +09:00
Raphael von der Grün
9c3195c1ee
refactor!: drop support for android SDK tool (#1083)
* refactor(emulator)!: remove support for legacy `android` binary
`emulator.list_images` now always uses the `avdmanager` binary.
* refactor(android_sdk)!: remove support for legacy `android` binary
`android_sdk.list_targets` now always uses the `avdmanager` binary.
* refactor(check_reqs)!: do not look for legacy `android` binary
* refactor: replace installation instructions involving `android` binary
2021-04-13 19:16:43 +09:00
Niklas Merz
2a92c77772
remove app cache settings (#1141) 2021-04-13 19:14:37 +09:00
Norman Breau
eefa91b3ea
breaking: remove keystore password prompt (#1048) 2021-04-13 19:13:01 +09:00
Norman Breau
6b33772613
feat: Deprecated onRequestPermissionResult in favour for onRequestPermissionsResult for consistency (#1047) 2021-04-13 18:56:04 +09:00
エリス
cab9840a03
feat!: upgrade jfrog gradle-bintray-plugin@1.8.5 (#1201)
* breaking: upgrade jfrog gradle-bintray-plugin@1.8.5
* original contribution PR: #1079

Co-authored-by: Mosab A <47486787+mosabab@users.noreply.github.com>
2021-04-13 18:10:07 +09:00
エリス
63b2356575
feat!: upgrade kotlin@1.4.31 (#1200)
* feat: upgrade kotlin@1.4.31 (#1176)

Co-authored-by: Mosab A <47486787+mosabab@users.noreply.github.com>
2021-04-13 17:50:05 +09:00
エリス
a9ee9196bd
feat!: upgrade Google Services Gradle Plugin@4.3.5 (#1199)
* feat: upgrade Google Services Gradle Plugin google-services@4.3.5 (#1177)

Co-authored-by: Mosab A <47486787+mosabab@users.noreply.github.com>
2021-04-13 17:20:54 +09:00
エリス
6588994586
feat!: upgrade android gradle plugin@4.1.3 (#1198)
* feat: upgrade gradle-plugin@4.1.3 (#1175)

Co-authored-by: Mosab A <47486787+mosabab@users.noreply.github.com>
2021-04-13 16:43:30 +09:00
エリス
46d4d924cc
feat!: upgrade gradle@6.8.3 (#1197)
* [Frequent Updates] Gradle 6.6.1 & Android Gradle Plugin 4.0.1 & com.jfrog.bintray.gradle 1.8.5 (#1079)
* Update ProjectBuilder.js
* Update build.gradle
* Update wrapper.gradle
* chore: remove non-gradle wrapper changes
* feat: upgrade gradle@6.8.3 (#1174)

Co-authored-by: Mosab A <47486787+mosabab@users.noreply.github.com>
2021-04-13 15:35:34 +09:00
エリス
dc8854d16c
feat: target sdk 30 w/ build-tool 30.0.3 (#1182) 2021-04-13 15:34:21 +09:00
エリス
a33044921d
feat: bump version to 10.0.0-dev (#1181) 2021-04-13 15:34:00 +09:00
Erisu
9c165cb94f
chore: set package-lock.json to 9.2.0-dev 2021-04-10 01:55:22 +09:00
Erisu
e0d5d14895
Update JS snapshot to version 9.2.0-dev (via coho) 2021-04-10 00:26:30 +09:00
Erisu
35bc354531
Set VERSION to 9.2.0-dev (via coho) 2021-04-10 00:26:26 +09:00
Erisu
ac4d3d1d45
android-v9.1.0 Updated version and RELEASENOTES.md for release 9.1.0 2021-04-10 00:25:19 +09:00
エリス
be9abf5f91
chore: add missing header license (#1196) 2021-04-09 23:44:50 +09:00
Raphael von der Grün
c04ea9b1c0
refactor: unify target resolution for devices & emulators (#1101)
* refactor: unify target resolution for devices & emulators
* fix: use unified target methods in platform-centric bins
2021-04-09 15:37:56 +09:00
anasofiagribeiro
c774bf3311
feat: support gzip encoding requests & use GZIPInputStream (#1104) 2021-04-09 11:26:23 +09:00
エリス
9071d5131a
Revert "[Frequent Updates] Gradle 6.6.1 & Android Gradle Plugin 4.0.1 & com.jfrog.bintray.gradle 1.8.5 (#1079)" (#1193)
This reverts commit 33476b4754.
2021-04-09 11:23:23 +09:00
エリス
c676ca98ff
revert: feat: upgrade kotlin@1.4.31 #1176 (#1194) 2021-04-09 11:23:09 +09:00
エリス
690ff3f364
Revert "feat: upgrade Google Services Gradle Plugin google-services@4.3.5 (#1177)" (#1191)
This reverts commit e8ec3b1e37.
2021-04-08 14:04:52 +09:00
エリス
04b0106bca
Revert "feat: upgrade gradle-plugin@4.1.3 (#1175)" (#1189)
This reverts commit 1430304d36.
2021-04-08 14:04:26 +09:00
エリス
31233089f1
Revert "feat: upgrade gradle@6.8.3 (#1174)" (#1190)
This reverts commit fe4d4aeff0.
2021-04-08 14:03:34 +09:00
エリス
1f5426f939
fix: copy repositories.gradle to project on create (#1186) 2021-03-30 22:57:14 +09:00
Norman Breau
1ec87634d4
fix(regression): Cannot read version of undefined caused by Java refactor (https://github.com/apache/cordova-android/pull/1130#discussion_r563597125) (#1185) 2021-03-30 22:40:34 +09:00
Alexander
d22af021ee
feat: handle intent:// scheme links with browser_fallback_url param (#1167)
* fix showWebPage url intent:// now works
* android handle external url `intent://` scheme
* code refactoring

Co-authored-by: Андреянов Александр Николаевич <a.andreyanov@sevstar.net>
Co-authored-by: Tim Brust <github@timbrust.de>
2021-03-30 21:43:27 +09:00
エリス
c9ab33eded
chore: rebuilt package-lock (#1183) 2021-03-30 19:41:21 +09:00
エリス
6dcd67a902
fix: unit-test failure (#1184) 2021-03-30 18:46:43 +09:00
Daniel Stone
cb1cf4dc8e
fix(splashscreen): nav & title bar showing in fullscreen mode (#733)
Co-authored-by: Daniel Stone <daniel.stone@powerdms.com>
Co-authored-by: distinctdan <distinctdan@users.noreply.github.com>
2021-03-30 14:55:16 +09:00
goffioul
6cbf69d109
fix: restore key event handlers when DOM element is fullscreen (#1157)
* GH-1156: Restore key event handlers when a DOM element is fullscreen

Make sure to call dispatchKeyEvent from base class in WrapperView, if
the event hasn't been handled by the engine.

* Remove unwanted whitespace in condition

Co-authored-by: エリス <erisu@users.noreply.github.com>
Co-authored-by: Michael Goffioul <michael.goffioul@lincor.com>
2021-03-30 14:54:43 +09:00
Mosab A
e8ec3b1e37
feat: upgrade Google Services Gradle Plugin google-services@4.3.5 (#1177) 2021-03-30 14:44:08 +09:00
Guillem Perez
f927014d06
fix(android): Avoid Crash Report: ConcurrentModificationException (#1073)
Authored-by: lempere <lempere@lempere.com>
2021-03-28 09:49:39 -03:00
Rick Habets
19a5feb875
fix: add not null checks to prevent running on destroyed activity (#1148)
* (android) #1002: Add Null Pointer Checks to prevent Cordova from running on a destroyed activity

* (android) Add logging statements if Cordova Activity does not exist anymore (i.e. is destroyed)

Co-authored-by: Habets Rick <rick.habets@kbc.be>
2021-03-27 12:19:46 -03:00
ebhsgit
9dcf3eb68b
Fix for #924 - Concurrent Modification Exception (#1091)
Co-authored-by: 8bhsolutions <48874658+8bhsolutions@users.noreply.github.com>
2021-03-27 12:17:39 -03:00
Norman Breau
11364918b2
add repositories support (#1179)
Authored-by: Engin Diri <engin.diri@lidl.com>
2021-03-27 12:11:56 -03:00
Mosab A
1430304d36
feat: upgrade gradle-plugin@4.1.3 (#1175)
* Update build.gradle

* Update build.gradle

* Update build.gradle

* Update build.gradle

* Update build.gradle

* Update build.gradle
2021-03-27 10:36:39 -03:00
Mosab A
2a92c2e595
feat: upgrade kotlin@1.4.31 (#1176)
* Update build.gradle

* Update build.gradle
2021-03-27 10:36:09 -03:00
Mosab A
fe4d4aeff0
feat: upgrade gradle@6.8.3 (#1174)
* Gradle Update to 6.8.3

* Update build.gradle

* Update wrapper.gradle

* Update wrapper.gradle
2021-03-27 10:35:27 -03:00
Shashank Agrawal
23a1710557
feat(android-studio): display app name as project name (#1173)
* (android) Feature: Write name of the Android app to .idea/.name for Android Studio #1172

* Missing space before function parentheses.

* Add test for writeNameForAndroidStudio #1172

* Use ES6 for new code. Code DRYness in test spec. #1172
2021-03-27 10:06:26 -03:00
Norman Breau
774de78691
refactor: java checks (#1130)
Co-authored-by: エリス <erisu@users.noreply.github.com>
Co-authored-by: Raphael von der Grün <raphinesse@gmail.com>

Update spec/unit/java.spec.js

Co-authored-by: Raphael von der Grün <raphinesse@gmail.com>

Update spec/unit/java.spec.js

Co-authored-by: Raphael von der Grün <raphinesse@gmail.com>

Update bin/templates/cordova/lib/utils.js

Co-authored-by: Raphael von der Grün <raphinesse@gmail.com>

Update bin/templates/cordova/lib/check_reqs.js

Co-authored-by: Raphael von der Grün <raphinesse@gmail.com>

Update spec/unit/check_reqs.spec.js

Co-authored-by: Raphael von der Grün <raphinesse@gmail.com>

Update spec/unit/check_reqs.spec.js

Co-authored-by: Raphael von der Grün <raphinesse@gmail.com>

Co-authored-by: Raphael von der Grün <raphinesse@gmail.com>
2021-03-27 10:05:50 -03:00
Norman Breau
3081e5e6e9
fix: optional arch parameter (#1153) 2021-01-19 21:33:06 -04:00
Pieter Van Poyer
7428bd3a7f
Features/webp support for splashscreen (#1113)
* - linting
- platform independent paths in testing
- addes some unittest
- remove duplication + add comments
- delete webp's if png's added, delete png's if webp' added.
- Update bin/templates/cordova/lib/prepare.js Co-authored-by: エリス <erisu@users.noreply.github.com>
- fix https://github.com/apache/cordova-plugin-splashscreen/issues/257 webp support for android

* revert changes

* refactor: use source extension for target in getImageResourcePath

* fix(prepare): include more extensions in initial splash-screen resource map

* tests(prepare): quick-fix for tests

* backward slashes must be changed to forward slashes for fast-glob package.

Co-authored-by: Raphael von der Grün <raphinesse@gmail.com>
2020-12-16 17:21:35 -04:00
Raphael von der Grün
55feadff05
fix(prepare): mapImageResources always returning [] (#1136) 2020-12-04 09:14:19 +01:00
Norman Breau
97e2d15634
test(java): remove duplicate code in BackButtonMultipageTest (#1129)
* Removed duplicate code in test

* test: Remove duplicate code in BackButtonMultipageTest

Authored-by: leofernandesmo <leonardo.fernandes@ifal.edu.br>
Co-authored-by: breautek <norman@nbsolutions.ca>
2020-11-21 09:10:07 -04:00
Raphael von der Grün
b245337501
refactor(ProjectBuilder): clean up output file collection code (#1099)
* refactor(ProjectBuilder): less repetitive fileSorter

This reverts the fileSorter to the state from before #937, but using our
own simple re-implementation of `compare-func`.

* fix(ProjectBuilder): apply sort RegExp to basename only

* refactor(ProjectBuilder): use fast-glob instead of hand-rolled equivalent

* refactor(ProjectBuilder): factor out common isPathArchSpecific

* refactor(ProjectBuilder): use includes instead of indexOf

* refactor(ProjectBuilder): move sorting into findOutputFilesHelper

* refactor(ProjectBuilder): simplify findOutputFiles signature
2020-11-21 10:44:56 +01:00
Raphael von der Grün
bb7d733cde
refactor: unify installation on devices & emulators (#1123)
* refactor: unify installation on devices & emulators

This change replaces the almost identical methods `device.install` and
`emulator.install` with the generic `target.install`.

* fix: use unified installation in platform-centric bins
2020-11-20 22:12:18 +01:00
Raphael von der Grün
aa679ea1d6
feat(Adb): list devices _and_ emulators in one go (#1125) 2020-11-19 21:30:56 +01:00
Raphael von der Grün
0e8234abfd
refactor(check_reqs): cleanup default Java location detection on Windows (#1102)
* test(check_reqs): test default Java location detection on Windows

* refactor(check_reqs): use glob for default Java location detection on Windows

This changes the implementation to be closer to what it was before #842
with everything being in one place.

* fix: remove always-taken if statement

* feat: take both Program Files variants from env

* refactor(check_reqs): cosmetic changes
2020-11-19 21:08:43 +01:00
Pieter Van Poyer
d5b9029a23
Android - allow changing min sdk version (#1117)
* try to allow changing min sdk version

* undo testing with cdvMinSdkVersion=21

* Update framework/build.gradle

No printing of default behaviour

Co-authored-by: Norman Breau <norman@nbsolutions.ca>

* Update framework/build.gradle

typo + match case of cdvMinSdkVersion

Co-authored-by: Norman Breau <norman@nbsolutions.ca>

* resolve PR feedback timbru

Co-authored-by: Norman Breau <norman@nbsolutions.ca>
2020-11-18 13:48:46 -04:00
Raphael von der Grün
671e1fd1c6
refactor: remove copied Adb.install from emulator.install (#1108)
`emulator.install` contains a copy of the code of `Adb.install` just to
be able to pass custom options to `execa`.

This change removes that duplicated code in favor of a new option in
`Adb.install` that allows to pass options through to `execa`.
2020-11-17 09:06:44 +01:00
エリス
c144c08112
fix(android): allow file access for existing behavior (#1111) 2020-11-04 14:15:26 +09:00
Raphael von der Grün
aada3e813d
refactor: do not kill adb on UNIX-like systems (#1103) 2020-10-22 18:03:28 +02:00
Raphael von der Grün
335b0f2575
test: fix unit test failures for certain random orders (#1094)
* test(Api): do not clobber global events.emit w/ spy

* test(Api): remove unnecessary rewiring

* test(check_reqs): add missing spyOn call

* test(check_reqs): fix process.env restoration

* test(check_reqs): restore module under test before each test
2020-10-19 10:38:37 +02:00
Raphael von der Grün
b1f01d7a65 test: ensure single top-level describe block in test file (#1094)
This makes it easier to map test output to files and allows for common
setup & teardown of all tests in a file.

* test(prepare): wrap in top-level describe block
* test(Api): wrap in top-level describe block
2020-10-19 10:01:09 +02:00
Darryl Pogue
3b56160d38
chore(asf): Update GitHub repo metadata 2020-10-06 20:24:23 -07:00
Norman Breau
39e315628e
fix: Reflect minimum required NodeJS (#1045)
Project uses APIs only added in 10.10, namely ProjectBuilder.js readdirSync(), with `withFileTypes` option.
https://nodejs.org/api/fs.html#fs_fs_readdirsync_path_options
2020-10-06 10:12:04 -03:00
Raphael von der Grün
e125ab1b9a
refactor(retry): simplify retryPromise using modern JS (#1086) 2020-10-06 10:56:21 +02:00
Raphael von der Grün
5d3591b853
refactor(utils): reduce number of utils (#1085)
* refactor(utils): remove utils.grep

* refactor(utils): replace utils.scanDirectory w/ fast-glob

Note that fast-glob is already in our dependency graph anyway.
2020-10-06 09:04:48 +02:00
Raphael von der Grün
206238893b
fix(prepare): fix pattern used to collect image resources (#1084)
The pattern contained an additional plus that slipped in during the
refactoring done in #842. See [the diff][1] for details.

[1]: 09e8248d1f (diff-26c51bfaa44eff1e46fd61ec3225ec13L640-R650)
2020-10-06 08:38:09 +02:00
Mosab A
33476b4754
[Frequent Updates] Gradle 6.6.1 & Android Gradle Plugin 4.0.1 & com.jfrog.bintray.gradle 1.8.5 (#1079)
* Update ProjectBuilder.js

* Update build.gradle

* Update build.gradle

* Update build.gradle

* Update build.gradle

* Update build.gradle

* Update wrapper.gradle

* Update build.gradle

* Update wrapper.gradle

* Update wrapper.gradle

* Update wrapper.gradle

* Update build.gradle

* Update build.gradle

* Update ProjectBuilder.js

* Update ProjectBuilder.js
2020-10-05 21:26:59 -03:00
Raphael von der Grün
2c888f418b
chore(pkg): remove deprecated no-op field "engineStrict" (#1081)
See https://docs.npmjs.com/files/package.json#enginestrict

Related to https://github.com/apache/cordova/issues/55
2020-10-04 13:32:28 +02:00
Norman Breau
565106fc1f
refactor: Stop suppressing un-needed TruelyRandom lints (#1046) 2020-08-11 10:13:33 -03:00
Norman Breau
a45217e6b9
ci: Added Node 14.x (#975) 2020-07-24 14:02:13 -03:00
Raphael von der Grün
d7790ca8bc
chore: remove unused emulator.create_image and its dependencies (#1019) 2020-07-09 00:07:33 +02:00
Raphael von der Grün
8ef8d994df
fix(pluginHandlers): properly check if path is inside another (#1014) 2020-07-08 23:31:16 +02:00
Raphael von der Grün
80ad635348
test(pluginHandlers/common): better setup & teardown (#1013) 2020-07-08 15:15:53 +02:00
Norman Breau
ec944cf068
fix: gradle ignore properties (#1018) 2020-07-05 11:19:56 -03:00
Raphael von der Grün
ba5781c3bf
refactor: save ProjectBuilder instance in Api instance (#1016)
This reduces dependence on the `builders` module and reduces repitition.

This also facilitates another WIP refactoring I am working on.
2020-07-03 18:54:24 +02:00
Raphael von der Grün
d86cb99dd5
Remove unnecessary stuff (#1015)
* Remove licenses for previously bundled packages

* Remove utils module with duplicate function

* Remove unused function check_reqs.check_ant

* Remove unused test helper
2020-07-03 18:53:10 +02:00
Raphael von der Grün
3204b9804b
test(java): fix, improve and move clean script (#1017)
This includes the following changes:

- move this developer-only script to test/ where it conceptually belongs
  - this also prevents it from being distributed with this package
- fix paths for `android` and `androidx` variants
- make paths relative to the script, not to CWD
- use `removeSync` instead of `existsSync` and `existsSync`
- rename npm script to `clean:java-unit-tests` to clarify scope
2020-07-03 18:50:53 +02:00
Raphael von der Grün
ce735256d3
test: fix missing stack traces in jasmine output (#1012)
`true` is not a valid value for the `displayStacktrace` option of
jasmine-spec-reporter.
2020-07-02 22:39:03 +02:00
Erisu
cccf812454
Set package-lock.json to 9.1.0-dev 2020-06-24 12:28:24 +09:00
Erisu
f7e1979665
Update JS snapshot to version 9.1.0-dev (via coho) 2020-06-23 18:33:24 +09:00
Erisu
49fc5da207
Set VERSION to 9.1.0-dev (via coho) 2020-06-23 18:33:21 +09:00
Erisu
5276f56cc4
android-v9.0.0 Updated version and RELEASENOTES.md for release 9.0.0 2020-06-23 18:31:47 +09:00
エリス
9df6793f34
chore: set AndroidX off by default (#1005) 2020-06-23 16:13:04 +09:00
Duy Mac Van
d90e191837
Accept multiple mime types on file input (#971) 2020-06-18 09:59:44 -03:00
Norman Breau
d5d448888d
fix: support both adaptive and standard icons at the same time (#1001) 2020-06-18 09:58:42 -03:00
Norman Breau
8d8600b442
fix: Plugin install fails when preview sdk is installed (#985) 2020-06-18 09:58:14 -03:00
Chris Brody
0bf6455153
cleanup yaml files (#994)
* remove trailing spaces from .asf.yaml
* remove trailing spaces from .eslintrc.yml
* add newline to end of .eslintrc.yml
2020-06-16 19:34:10 -04:00
Chris Brody
80b7a7f6ac
cleanup: remove trailing spaces from Java sources (#999)
* remove trailing spaces from framework/src/org/apache/cordova/*.java
* remove trailing spaces from framework/src/org/apache/cordova/engine/*.java
2020-06-16 19:26:48 -04:00
Chris Brody
6b789c57e8
update some dependencies (#992)
* update cordova-common -> ^4.0.1
* update execa -> ^4.0.2
* update fs-extra -> ^9.0.1
2020-06-10 11:47:17 -04:00
Chris Brody
b8a344fc17
cleanup: remove trailing spaces from framework build files (#998)
* remove trailing spaces from framework/build.xml
* remove trailing spaces from framework/cordova.gradle
2020-06-10 09:32:43 -04:00
Chris Brody
1b6319e9cf
cleanup: remove trailing spaces from project template (#997)
* remove trailing spaces from bin/templates/project/AndroidManifest.xml
* remove trailing spaces from bin/templates/project/assets/www/css/index.css
2020-06-10 09:31:51 -04:00
Chris Brody
2cc81253ff
cleanup: remove trailing spaces from bat files (#996)
* remove trailing spaces from bin/*.bat
* remove trailing spaces from bin/templates/cordova/lib/*.bat
2020-06-10 09:30:51 -04:00
Chris Brody
499c694146
remove trailing spaces from markdown files (#995)
* remove trailing spaces from .github/ISSUE_TEMPLATE.md
* remove trailing spaces from .github/ISSUE_TEMPLATE/BUG_REPORT.md
* remove trailing spaces from .github/ISSUE_TEMPLATE/FEATURE_REQUEST.md
* remove trailing spaces from CONTRIBUTING.md
2020-06-10 09:29:14 -04:00
Chris Brody
bc32cca281
update devDependencies (#993)
* update jasmine-spec-reporter -> ^5.0.2 in devDependencies

* update nyc -> ^15.1.0 in devDependencies
2020-06-10 09:27:11 -04:00
Chris Brody
dead4b4ab6
breaking: reduce combined response cutoff to 16 MB (#987)
* breaking: reduce combined response cutoff to 16 MB
* rename `MAX_PAYLOAD_SIZE` to `COMBINED_RESPONSE_CUTOFF`
* update some comments
* cleanup: split `if` statements into multiple lines
2020-06-09 19:48:33 -04:00
Chris Brody
305cb2cdd5
major: Gradle 6.5 & Android Gradle plugin 4.0.0 updates (#988)
* feat: Gradle 6.5 & Android Gradle plugin 4.0.0 updates

* update test/android/wrapper.gradle to reference Gradle 6.5

* update test/androidx/wrapper.gradle to reference Gradle 6.5

* update spec/fixtures/android_studio_project/build.gradle
  to reference com.android.tools.build:gradle:4.0.0

* update test/android/build.gradle
  to reference com.android.tools.build:gradle:4.0.0

* update test/androidx/build.gradle
  to reference com.android.tools.build:gradle:4.0.0
2020-06-08 20:47:10 -04:00
Chris Brody
287bfcbaa3
cleanup: remove trailing spaces from app/build.gradle (#990)
(in the template)
2020-06-08 12:42:38 -04:00
Chris Brody
2a61b751ab
breaking: remove legacy/build.gradle from template (#989) 2020-06-08 10:42:15 -04:00
Norman Breau
a830145f36
fix: wait_for_boot waiting forever (#978) 2020-05-22 15:07:18 -03:00
GimpArm
08dc1dd9b9
Increased detectArchitecture() timeout (#965)
The timeout for detechArchitecture() is sometimes too low when devices are on wifi network connections and even sometimes over USB. The command can take up to 3 seconds to execute and return. Currently the timeout is set to 1000 ms and setting it to 5000 ms seems to be a good compromise.

Co-authored-by: Scott Downing <Scott.Downing@marc-cain.de>
2020-05-22 15:06:11 -03:00
Norman Breau
e86b211cd1
breaking: Bump android gradle plugin to 3.6.0 (#962) 2020-04-25 14:34:15 -03:00
Erisu
6c5febc189
chore(asf): update git notification settings 2020-04-22 13:29:31 +09:00
Norman Breau
4d0d60c294
Feature: JVM Args flag (#948)
* feat: JVM args flag

* test: JVM args flag

* feat: Do not display recommended memory warning unless if memory is less than cordova default
2020-04-16 09:39:22 -03:00
Norman Breau
16a88ec631
fix: ANDROID_SDK_ROOT variable (#951)
This commit does the following:
- Makes ANDROID_SDK_ROOT the primary variable to look for the Android SDK location.
- Makes ANDROID_HOME the fallback variable, if ANDROID_SDK_ROOT is not present/valid.

Gradle updates:
Note that the following gradle updates were required, otherwise the android gradle plugin did not honour the ANDROID_SDK_ROOT variable.

- Updates the framework's android studio's gradle plugin from version 3.3.0 to 3.5.3.
	Not only this is required for android's gradle to obey ANDROID_SDK_ROOT, it is now in sync with the Android test project/
- Updates the Androidx test project to use gralde plugin from version 3.3.0 to 3.5.3, to match Android Test & framework.
	- Consequentially, this required to also upgrade AndroidX test project to use Gradle 6.1, which also matches both the Android test project & framework

These changes above fixes #949

Additionally, since we update the environment variables dynamically, the environment variable printout produced misleading information.
The environment variable printout will now print out the variable as defined by the user (before the tooling messes with them). An additional log
is printed that tells the user exactly what Cordova is going to use for the Android SDK path. This should fix #670
2020-04-15 23:43:17 -03:00
Norman Breau
1ce2b6b315
test: synced androidx gradle versions to the same version as the android test (#959) 2020-04-15 23:42:33 -03:00
Norman Breau
43a6805902
feat: com.android.tools.build:gradle:3.5.3 (#960) 2020-04-15 23:42:15 -03:00
エリス
566262c923
chore(npm): add package-lock.json (#956) 2020-04-15 12:46:23 +09:00
エリス
e4bff281b2
chore(npm): add ignore list (#958) 2020-04-15 12:41:24 +09:00
エリス
9a675912f8
chore: various cleanup (#957)
* chore: various cleanup
  * update LICENSE year
  * update third-party appended licenses
  * update NOTICE year & format
  * use correct CI badges on README.md
  * remove extra markdown from RELEASENOTES.md
* chore: update reviewboard url
2020-04-15 12:40:59 +09:00
エリス
f86044e6ce
chore(eslint): bump package & apply eslint fix (#955) 2020-04-15 12:36:40 +09:00
エリス
43fdaa91a3
breaking(npm): bump packages (#954)
* breaking(npm): bump dev dependencies
  * jasmine-spec-reporter@^5.0.1
  * nyc@^15.0.1
  * rewire@^5.0.0

* breaking(npm): bump dependencies
  * android-versions@^1.5.0
  * cordova-common@^4.0.0
  * execa@^4.0.0
  * fs-extra@^9.0.0
  * nopt@^4.0.3
  * which@^2.0.2
2020-04-15 12:20:28 +09:00
エリス
80f46aefcd
chore(npm): use short notation in package.json (#953) 2020-04-15 11:53:22 +09:00
João Gonçalves
71f63d7b33
Prevent exit fullscreen mode from closing application (#823)
* (android) wrap custom view in FrameLayout

Wraps the custom view in a FrameLayout in order
to capture key events and redirect them to SystemWebView's
dispatchKeyEvent.

* Update framework/src/org/apache/cordova/CordovaWebViewImpl.java

Co-Authored-By: エリス <erisu@users.noreply.github.com>

* Update framework/src/org/apache/cordova/CordovaWebViewImpl.java

Co-Authored-By: エリス <erisu@users.noreply.github.com>

* Update framework/src/org/apache/cordova/CordovaWebViewImpl.java

Co-Authored-By: エリス <erisu@users.noreply.github.com>

* remove empty line below @override

Co-authored-by: Norman Breau <norman@normanbreau.com>
Co-authored-by: エリス <erisu@users.noreply.github.com>
2020-04-14 18:48:06 +00:00
Niklas Merz
8d47cd73c0 Update CONTRIBUTING.md 2020-04-13 13:56:17 +02:00
Norman Breau
6d451bc6f9
fix: Removed redundent logcat print (#950)
The chromium webview will print an informational log already,
we don't need to override the method to do what the webview will already.
2020-04-11 23:25:20 -03:00
Bas Bosman
6402e7b755
Bump minSdkVersion to 22 and drop pre-Lollipop specific code (#915)
* feat: bump minSdkVersion to 22

BREAKING CHANGE: drop KitKat support

* chore: remove obsolete comment

* feat: remove pre-Lollipop specific code

* chore: remove KitKat from needsKitKatContentUrlFix

* chore: other minor cleanup
2020-04-03 19:54:08 +02:00
Norman Breau
c93f93f637
fix: GH-873 App bundle builds to obey command-line arguments (#941) 2020-04-01 01:59:39 -03:00
エリス
6e51943d15
ci: drop travis & move codecov to gh-actions (#940) 2020-04-01 13:35:07 +09:00
Norman Breau
c81cd871f8
Updated README to reflect what Android requires more accurately, which is Java 8, not anything less, not anything greater. Java 1.8.x is required. (#929) 2020-04-01 00:55:47 -03:00
Norman Breau
8ab1dbc373
fix: GH-935 replaced compare-func with native sort method (#937) 2020-04-01 00:43:36 -03:00
エリス
fb26050fab
fix: test failure with shebang interpreter in rewired files (#939)
* breaking: remove shebang from create
* breaking: remove shebang from version
* breaking: remove shebang from logical files
2020-04-01 12:04:35 +09:00
Sukant Pal
c56cd4d5a8
refactor: use es6 class (#911)
Refactored to Classes:
* Api
* AndroidManifest
* AndroidProject
2020-02-01 17:34:51 +09:00
エリス
de105e8651
refactor (eslint): use cordova-eslint (#910) 2020-01-31 22:02:48 +09:00
エリス
8e98de6e7c
chore: remove appveyor residual (#909) 2020-01-29 19:28:07 +09:00
エリス
6372ca3fac
feat: add github actions (#895) 2020-01-29 14:29:05 +09:00
Norman Breau
3712619f5c
refactor: remove shelljs dependency (#842)
Co-authored-by: エリス <erisu@users.noreply.github.com>
2020-01-29 10:12:55 +09:00
エリス
dee1e77d0b
feat: add kotlin support (#896)
Co-authored-by: Joshua Chandler <joshchandler88@gmail.com>
2020-01-27 16:14:58 +09:00
エリス
d01ed80a61
feat: add androidx support (#901) 2020-01-27 15:52:08 +09:00
Norman Breau
92268b2e76 fix: cordova requirements consider the android-targetSdkVersion (#849)
* Made cordova requirements consider the android-targetSdkVersion preference
* refator: get_target method
Added comments.
Added JSDoc block
Reduced error exit point to one spot

Co-authored-by: エリス <erisu@users.noreply.github.com>
2020-01-24 10:53:49 +09:00
エリス
0924654a47
fix (adb): shell to return expected stdout (#904) 2020-01-21 23:37:22 +09:00
Norman Breau
8ef742e79d feat: upgrade gradle to 6.1 & gradle build tools to 3.5.3 (#792)
* feat!: upgrade gradle to 6.1
* feat!: upgrade gradle build tools to 3.5.3
* feat: added `npm run clean-tests`
* fix!: Removed useDeprecatedNdk as this option is now completely removed from gradle.
* feat!: bump gradle to 6.1 & gradle build tools to 3.5.3

Co-authored-by: エリス <erisu@users.noreply.github.com>
2020-01-21 19:24:00 +09:00
エリス
64ef13c6e0
chore: remove .project file & add .settings to gitignore (#902) 2020-01-20 11:41:56 +09:00
Raphael von der Grün
66ad2c948e
refactor: simplify doFindLatestInstalledBuildTools (#900)
* chore: update com.g00fy2:versioncompare to 1.3.4

* refactor: flatten error handling in doFindLatestInstalledBuildTools

* refactor: inline & simplify getAvailableBuildTools

* refactor: use string interpolation for error messages
2020-01-17 13:43:25 +01:00
Kristian Heljas
60e022fedd feat: use java package name for loading BuildConfig (#751) 2020-01-17 20:46:45 +09:00
エリス
09256b766f
chore: rename gradle plugin google services preference options (#898) 2020-01-17 08:22:06 +09:00
エリス
a951793431
feat: add google services support (#893)
* feat: Add support for GoogleServicesEnabled preference option
* fix: wrap google-services classpath with GoogleServicesEnabled flag
* chore: bump google-services version to 4.2.0
* feat: Add support for GoogleServicesVersion preference option

Co-authored-by: Maksim Chemerisuk <chemerisuk@users.noreply.github.com>
2020-01-16 08:40:54 +09:00
Ramazan VAPURCU
f4b8f44d4a feat: add version-compare library to compare build-tools versions properly. (#709)
Closes #708
2020-01-15 07:28:54 +09:00
Norman Breau
08ab7d4b59
Ignore auto-generated eclipse buildship files (#831)
* git ignore eclipse build ship files that gets auto-generated in Eclipse and some other code editors.

* Changed **./project to .project as suggested

Co-Authored-By: Raphael von der Grün <raphinesse@gmail.com>

Co-authored-by: Raphael von der Grün <raphinesse@gmail.com>
2020-01-07 15:32:19 -04:00
Norman Breau
5889001465
Increased default target sdk to 29 (#848)
* (android) increased default target sdk to 29

* Updated travis and appveyor to use build tools/api level 29

* Fixed two other files that was missing the API 29 update
2020-01-07 11:47:27 -04:00
Norman Breau
91d2716122
[Major] Removed unnecessary project name restriction (#859)
* removed unnecessary restriction that prevented project names from starting with a number. Project names starting with a number is perfectly valid.

* Reworded validateProjectName jsdoc

Co-Authored-By: Raphael von der Grün <raphinesse@gmail.com>

Co-authored-by: Raphael von der Grün <raphinesse@gmail.com>
2020-01-07 10:10:04 -04:00
エリス
0e6ad28e56
chore: drop q module (#833)
* chore: drop q module
* chore: fix & complete dropping q
* Fix faulty transformation of Q.when
* Simplify thenResolve transformation
  * Removes unnecesary Promise wrapping in onFulfilled callback.
* Transform .done calls to .then or .catch
  * The important thing is that we always handle rejections.
* Remove Q from specs
Requires Jasmine 3.5
* Replace Q.timeout w/ Promise.race & custom function

Co-authored-by: Raphael von der Grün <raphinesse@gmail.com>
2020-01-07 21:22:59 +09:00
Raphael von der Grün
fd57909730
chore: replace superspawn & child_process with execa (#862)
* chore: added execa dependency

Co-authored-by: Raphael von der Grün <raphinesse@gmail.com>

* chore: execa - drop superspawn in android_sdk

Co-authored-by: Raphael von der Grün <raphinesse@gmail.com>

* chore: execa - drop superspawn in build

* chore: execa - drop superspawn in check_reqs

Plus: Remove useless trimming of execa output

Co-authored-by: Raphael von der Grün <raphinesse@gmail.com>

* chore: execa - drop superspawn in emulator

Co-authored-by: Raphael von der Grün <raphinesse@gmail.com>

* chore: execa - drop superspawn in device

Co-authored-by: Raphael von der Grün <raphinesse@gmail.com>

* chore: execa - drop superspawn in run_java_unit_tests

* chore: execa - drop superspawn in ProjectBuilder

Co-authored-by: Raphael von der Grün <raphinesse@gmail.com>

* chore: execa - drop superspawn in adb

* chore: execa - drop superspawn in plugin.spec

* chore: execa - replace child_process in log

* chore: execa - replace child_process in check_reqs

* chore: execa - replace child_process in emulator

Co-authored-by: エリス <erisu@users.noreply.github.com>
2020-01-06 23:15:22 +01:00
Raphael von der Grün
e3cc75caff feat: don't filter gradle's stderr anymore (#860) 2020-01-06 12:15:25 +09:00
エリス
e26142f43b
chore: drop node 6 and 8 support (#832) 2020-01-06 12:10:03 +09:00
エリス
d0f972e128
chore: bump version to 9.0.0-dev (#890) 2020-01-06 12:07:05 +09:00
任跃兵
e42fedc820 Optimization code (#697)
This judgment condition has no use.
2019-11-14 19:24:10 +00:00
Adri Van Houdt
f0c9814c04 chore: removed comment that serves no purpose (#863) 2019-11-04 15:42:49 +00:00
Raphael von der Grün
529278190c
Update jasmine to 3.5.0 (#861) 2019-11-03 21:44:16 +01:00
Raphael von der Grün
fcaab36484
Modernize our one E2E test (#858)
The test should still do the same thing as before.
No change tested code intended.

This also gets rid of the barely used and outdated E2E helpers
2019-10-30 16:24:32 +01:00
Raphael von der Grün
5dfa995a4b
Ensure to lint as many files as possible (#854)
* Lint everything, including bins w/out extension

* Apply eslint --fix to all linted files

* Manually fix all remaining lint rule violations

* Remove ESLint inline config
2019-10-21 18:26:17 +02:00
Erisu
c35a990c09
Update JS snapshot to version 8.2.0-dev (via coho) 2019-09-11 13:58:08 +09:00
Erisu
11f40bd2cc
Set VERSION to 8.2.0-dev (via coho) 2019-09-11 13:58:04 +09:00
Erisu
7e8b47d012
minor-8.1.0 Updated version and RELEASENOTES.md for release 8.1.0 2019-09-11 12:41:25 +09:00
エリス
902aa32dda
chore: bump dependencies for release 8.1.0 (#827) 2019-09-11 11:34:33 +09:00
MatusFiala
42c0cba7f7 feat: added multiple selection for filepicker (#651)
* GH-621 (Cordova-Android)
2019-09-09 08:44:40 +09:00
Jan Piotrowski
f2b84d8d83 chore: compress files in /res with tinypng.com (#672) 2019-09-07 22:45:43 +09:00
Norman Breau
1b11206174 fix: clean command (#815)
* fix clean command
* added unit tests for the getArgs clean
* Cleaned up ProjectBuilder.getArgs for readability
2019-09-07 13:54:32 +09:00
Darryl Pogue
c93e3e9f6f
Merge pull request #750 from goffioul/patch-1
Don't request focus explicitly if not needed
2019-08-28 15:31:25 -07:00
Norman Breau
9808a0d4d3 GH-799 (android) Stop webview from restarting when activity resizes (#800) 2019-08-26 19:57:11 +00:00
Norman Breau
bd1697dbd2 feat: Build app bundles (.aab files) (#764)
* (android) Added android bundle support

  with some corrected tests

  added bundle specific output

* with --packageType flag to have consistency with cordova-ios

* warn about missing required signing params only if at least one signing param is present

* produce error on run if packageType = bundle

* added comments relating to shelljs as suggested

* unit test case added by @brodybits - Chris Brody

* Filled in error message and unit test spec

Primary author: @breautek - Norman Breau <norman@normanbreau.com>

Co-authored-by: Norman Breau <norman@normanbreau.com>
Co-authored-by: Chris Brody <chris@brody.consulting>
2019-08-08 12:53:10 -04:00
Raphael von der Grün
b3b8690bbd
Simplify apkSorter using compare-func package (#788) 2019-07-18 11:59:54 +02:00
Raphael von der Grün
ad742ec93c
Simplify and fix promise handling in specs (#787) 2019-07-17 14:56:36 +02:00
Raphael von der Grün
1de7c38134
Properly handle promise in create script (#784)
* Properly handle promise in create script

* Add regression test
2019-07-17 09:52:19 +02:00
Raphael von der Grün
997943a194
Do not clobber process properties with test mocks (#783) 2019-07-17 03:01:56 +02:00
Raphael von der Grün
47c6048d53
Do not clobber console.log to spy on it (#782) 2019-07-17 00:18:12 +02:00
エリス
a64d459c8e Add Node.js 12 to CI Services (#724)
and remove trailing whitespace from .travis.yml

Co-authored-by: エリス <erisu@users.noreply.github.com>
Co-authored-by: Christopher J. Brody <brodybits@users.noreply.github.com>
2019-07-14 17:20:47 -04:00
Chris Brody
a5ad440f17
ci(travis): set dist: trusty in .travis.yml (#777)
to avoid errored Travis CI build on Node.js 12

including NOTE with a TODO item
2019-07-14 16:54:26 -04:00
Chris Brody
acad24d62a
Consistent order from ProjectBuilder.apkSorter (#779)
This function used to give a different order depending on the behavior
of Array.prototype.sort(), which led to a test failure on Node.js 12
(see apache/cordova-android#767).

This update gives a consistent sort order, regardless of the
JavaScript engine implementation, now succeeds on Node.js
versions 6, 8, 10, and 12.

Resolves #767

For reference:
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort
2019-07-14 16:35:44 -04:00
Chris Brody
989b4cc913
test: use verbose spec reporter (#778)
Co-authored-by: Christopher J. Brody <chris@brody.consulting>
Co-authored-by: Raphael von der Grün <raphinesse@users.noreply.github.com>
2019-07-14 15:36:46 -04:00
Norman Breau
38c6627999 rewire workaround for NodeJS 12 (#774)
* rewire workaround for NodeJS 12

* additional comment with a link to the underlying issue in jhnns/rewire#167
2019-07-12 02:09:57 -04:00
Chris Brody
4b9e18c6b8
nyc@14 update in devDependencies (#772) 2019-07-12 01:46:55 -04:00
Jan Piotrowski
906f8cc002
ci(travis): Fix Android SDK (#765)
* add node 12

* try to cleanup and fix

* fix

* fix

* no node 12 then...
2019-07-11 12:16:29 +02:00
goffioul
01ab11644c
Don't request focus explicitly if not needed
Requesting the focus explicitly actually makes the child WebView to move the focus to the first visible focusable element on the page. This makes it impossible to simply let the WebView restore the focus to the last focused element, before the activity was paused. To prevent this problem on devices other that the Samsung Galaxy Note 3, only request the focus if necessary (it might as well be possible that the original fix is not needed anymore on newer versions of Android and/or WebView).
2019-06-20 15:28:08 -04:00
Raphael von der Grün
4cf3dcfaae
Do not explicitly require modules from project directory (#713)
* Allow to pass-through projectPath to Builder

* Do not explicitly require modules from project directory
2019-04-13 17:34:59 +02:00
エリス
b177f84825
Added allprojects repositories for Framework Release Builds (#676) 2019-04-06 13:33:04 +09:00
エリス
485e6e0e4d
Improve Gradle Build Arguments (#699)
* Remove `uses-sdk` from AndroidManifest
* Remove dependency `elementtree`
* Updated Build Command Help Menu Printout
  * Cleanup `minSdkVersion` printout
  * Added  `maxSdkVersion`, but not recommended to set.
  * Added `targetSdkVersion`
* Update the `GradlePropertiesParser` & Test Spec
  * Always Set Overriding Changes
  * Update existing properties
  * Update configure method
2019-04-06 13:28:25 +09:00
Darryl Pogue
516c3411aa
Merge pull request #710 from dpogue/cookie-deprecation
Fix deprecation warning in SystemCookieManager
2019-04-02 13:27:20 -07:00
Darryl Pogue
908354e7fa
Fix deprecation warning in SystemCookieManager 2019-04-02 07:16:08 -07:00
Darryl Pogue
9531dbbc7b
Merge pull request #691 from dpogue/common-configparser
Run prepare with the correct ConfigParser version
2019-03-15 11:08:35 -07:00
Darryl Pogue
d10dd1c0b4
Remove unused browserify paths 2019-03-14 23:03:14 -07:00
Darryl Pogue
6533474070
GH-690: Run prepare with the correct ConfigParser 2019-03-14 23:02:53 -07:00
エリス
576edb53bb
Updated ANDROID_HOME Test to Follow #656 Change (#673) 2019-02-18 09:34:55 +09:00
エリス
20e390af85
Update JS snapshot to version 8.1.0-dev (via coho) 2019-02-13 15:22:10 +09:00
エリス
931251a5a8
Set VERSION to 8.1.0-dev (via coho) 2019-02-13 15:22:06 +09:00
エリス
9697550488
GH-10 Updated version and RELEASENOTES.md for release 8.0.0 2019-02-13 15:19:45 +09:00
エリス
3dac984613
Added Missing License Headers (#669) 2019-02-13 11:35:43 +09:00
Chris Brody
867da56e2e
Use custom Gradle properties to read minSdkVersion value from config.xml (#655)
Co-authored-by: エリス <ellis.bryan@gmail.com>
Co-authored-by: Christopher J. Brody <chris.brody@gmail.com>
2019-02-12 20:11:32 -05:00
Chris Brody
719acd3ab1
Merge pull request #668 from brodybits/revert-pr-664
Revert "Remove uses-sdk from AndroidManifest.xml (#664)"
2019-02-12 19:05:51 -05:00
Christopher J. Brody
549cae0a06 Revert "Remove uses-sdk from AndroidManifest.xml (#664)"
This reverts commit bb45f4f3ba.

Resolves #666
2019-02-12 19:01:07 -05:00
Chris Brody
bb45f4f3ba
Remove uses-sdk from AndroidManifest.xml (#664)
* Remove uses-sdk from AndroidManifest.xml

    since uses-sdk values are now superseded by Gradle files

* remove elementtree no longer needed

* remove internal capitalize function no longer needed

* remove AndroidManifest SDK version tests no longer needed

resolves #629
2019-02-12 11:22:49 -05:00
Chris Brody
b4de6f55c4
Quick fix to support ANDROID_SDK_ROOT (#656)
resolves #617
2019-02-12 09:20:17 -05:00
Chris Brody
e99c145d55
Ignore more Gradle build artifacts in Android project (#632)
including a couple suggestions from:
- https://github.com/github/gitignore/blob/master/Gradle.gitignore
2019-02-11 14:58:20 -05:00
Jan Piotrowski
9cb9f32fbb Add or update GitHub pull request and issue template 2019-02-11 18:36:02 +01:00
Chris Brody
a6f30b6977
Android tools 3.3 & Gradle 4.10.3 update (#642)
Gradle 4.10.1 or higher is needed for Android Studio 3.3.0 ref:
- https://developer.android.com/studio/releases/gradle-plugin#3-3-0

Resolves #634 (Update Gradle classpath for Android Studio 3.3)
Resolves #596 (Support gradle 4.9+)
2019-02-09 19:35:46 -05:00
Chris Brody
73692e60d8
Quick updates to top-level project.properties (#654)
* Update header comments according to reality, in a similar fashion to
  bin/templates/project/project.properties

* update default target API to 28
  this change updates the target SDK value to 28 in both generated
  platforms/android/CordovaLib/AndroidManifest.xml and
  the resulting Android build, if not overridden by the Cordova user

Co-authored-by: Christopher J. Brody <chris.brody@gmail.com>
Co-authored-by: Joe Bowser <bowserj@apache.org>
2019-02-08 13:23:16 -05:00
Chris Brody
4abe3d3a49
Ignore Android Studio .idea files in project (#635) 2019-02-08 13:13:59 -05:00
Fabian Te
54df4a116c Add missing log to Java version check (#624)
* Add missing log to Java version check
* Simplify version check output

Resolves #623
2019-01-27 10:52:22 -05:00
Keith Lord
715ce2f9ac Update emulator.js to fix issue #608 (#630)
Fixes  "Device still authorizing issue" #608 (https://github.com/apache/cordova-android/issues/608)

Resolves #608
2019-01-18 15:24:28 -05:00
Chris Brody
7a98708eef
.gitignore add package-lock.json (#626) 2019-01-17 19:23:55 -05:00
Chris Brody
d9c08f12a7
Fix requirements error messages for JDK 8 (#620) 2019-01-17 10:13:00 -05:00
Chris Brody
e41fbc5708
javac error message fixes in requirements check (#619)
- fix download link
- put download link on its own line
- no punctuation at the end of the download link
  (fixes #618)
- no extra newline at the end
- extra newline spacing in case JAVA_HOME is invalid
2019-01-16 22:51:45 -05:00
エリス
634f92efb6 Update Bug Issue Tracker 2019-01-15 21:57:08 -08:00
エリス
98a7b759e8 Remove unused dependecy promise-matchers 2019-01-15 21:57:08 -08:00
エリス
3976685e4e Cleanup package scripts 2019-01-15 21:57:08 -08:00
エリス
f7688bc64e Replaced code coverage istanbul with nyc 2019-01-15 21:57:08 -08:00
エリス
18e28294d6 Updated Dependencies 2019-01-15 21:57:08 -08:00
エリス
39bd0d6463 Bumped Dev Dependencies + ESLint Correction 2019-01-15 21:57:08 -08:00
エリス
c1819cc027 Bumped cordova-common@^3.1.0 2019-01-15 21:57:08 -08:00
エリス
f228d90ca2
Copy node_modules if the directory exists (#607) 2018-12-19 10:33:16 +09:00
Jan Piotrowski
5f44af3757
improve test readme (#582)
<!--
Please make sure the checklist boxes are all checked before submitting the PR. The checklist
is intended as a quick reference, for complete details please see our Contributor Guidelines:

http://cordova.apache.org/contribute/contribute_guidelines.html

Thanks!
-->

### Platforms affected


### What does this PR do?


### What testing has been done on this change?


### Checklist
- [ ] [Reported an issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database
- [ ] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected.
- [ ] Added automated test coverage as appropriate for this change.
2018-12-04 20:38:31 +01:00
Jule-
8a4ae311ce Rewrite install dir resolution for legacy plugins (#589)
* Improve target-dir restriction for detecting new android project structure used in plugin.xml. (#575)

* Clarify old source-file declaration way from the new one and improve ambiguous code.

* Better check `src/main` forms.

* Replace path search with RegExp vars.

* Fix RegExp in order to match `/` or `EOL`.

* Remove template strings for NodeJS 4 support (wanted in case we port these changes to `7.1.x` at some point).

* Add pointer to deprecation plan in GH-580.
2018-11-28 06:46:45 -05:00
Chris Brody
ef2434188e
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 08:59:33 -05:00
Jan Piotrowski
a014228f7c Output current package name if package name can't be validated
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-20 21:54:55 -08:00
エリス
2163c8ae05
Merge pull request #507 from dpogue/gradle-updates
Gradle Updates
2018-11-21 14:44:00 +09:00
Darryl Pogue
47bb5184a0
Silence some deprecation linter warnings 2018-11-20 21:13:02 -08:00
Darryl Pogue
f1f1ac3cbd
Updates for latest gradle/build tools
Ref GH-504.
2018-11-20 21:12:59 -08:00
Chris Brody
f1396c7aad
eslint ignore version file (#559)
Quick workaround to resolve build error

needed since cordova-coho generates version file with double-quotes
2018-11-14 20:35:47 -05:00
Chris Brody
21ae48eada
Merge pull request #550 from brodybits/gh-547-bugfix
Fix for old plugins with non-Java sources (GH-547)
2018-11-14 17:44:31 -05:00
Christopher J. Brody
53e1c1b65c Set version & VERSION to 8.0.0-dev (coho) 2018-11-14 15:37:22 -05:00
Christopher J. Brody
858611f95e Update JS to version 8.0.0-dev (via coho) 2018-11-14 15:37:22 -05:00
Christopher J. Brody
5c334b6c10 CB-9366 cordova.js log error.stack (cordova-js@4.2.4)
(Update cordova.js from cordova-js@4.2.4, using coho copy-js)
2018-11-14 15:30:26 -05:00
Christopher J. Brody
cf5a02ea0f Update cordova.js from cordova-js@4.2.3
using coho copy-js

with the following change from cordova-js-src:
* Remove obsolete check for JellyBean to work properly on Android Pie
  (GH-534)
2018-11-14 15:24:48 -05:00
Christopher J. Brody
a67bc75b93 GH-547 Fix for old plugins with non-Java sources
(source-file entries)

including aidl, aar, jar, and so files
2018-11-14 13:19:58 -05:00
Christopher J. Brody
895ab0c970 Fix comments in getInstallDestination
(in pluginHandlers.js)
2018-11-14 11:40:33 -05:00
Christopher J. Brody
21f84732c8 Cleanup getInstallDestination in pluginHandlers.js 2018-11-14 11:38:39 -05:00
David Boho
7eed65e9b4 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-14 08:00:36 -05:00
Darryl Pogue
cf5915ad01
Merge pull request #551 from DavidWiesner/cast-min-sdk-version
(android) add missing cast for cdvMinSdkVersion
2018-11-13 23:06:38 -08:00
David Boho
a4caa87d29 add missing cast for cdvMinSdkVersion 2018-11-14 06:18:53 +01:00
Christopher J. Brody
bbb3913a36 Test old plugin aidl & lib mapping - repros GH-547
(reproduces GH-547)
2018-11-13 13:06:48 -05:00
Christopher J. Brody
92f07d0418 Check old compat of other extension (CB-14125)
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-12 23:27:59 -05:00
Christopher J. Brody
578a642209 Check target-dir mapping of plugin xml source file
Possibly related to: CB-13830: Add handlers for plugins
that use non-Java source files, such as Camera
2018-11-12 23:27:53 -05:00
Christopher J. Brody
9d03e4ec0a Fix tests of plugin files with new app dir scheme
(new app target-dir scheme)
2018-11-12 22:54:40 -05:00
Chris Brody
576ad183e7
Merge pull request #542 from brodybits/gh-540-hotfix
Resolve GH-539 & GH-540 on master
2018-11-12 13:23:23 -05:00
Chris Brody
e31596f60e
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-12 12:06:45 -05:00
Christopher J. Brody
ef493b4c0f GH-540 fix for source-file with app target-dir 2018-11-11 15:26:04 -05:00
Christopher J. Brody
c15312ee70 unit test uninstall of <source-file> with app dest
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-11 15:19:13 -05:00
Christopher J. Brody
3caefcae49 unit test source-file with custom lib target-dir
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-11 15:18:00 -05:00
Christopher J. Brody
c2f6631f91 GH-539 fix destination path fallback
Fallback to old path mapping if no Android Studio path mapping exists

Co-authored-by: Christopher J. Brody <chris.brody@gmail.com>
Co-authored-by: Kyle Kirbatski <kkirbatski@gmrmarketing.com>
2018-11-11 15:16:19 -05:00
Christopher J. Brody
fb1dfb27df unit test uninstall of <source-file> with app dest
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-11 15:15:36 -05:00
Kyle Kirbatski
898a6a8d8d Add a unit test to test source-file target-dir /app/src/main/… 2018-11-11 15:15:35 -05:00
Darryl Pogue
7da53741cd
Merge pull request #538 from erisu/bump-common-3x
Dependency bump cordova-common@^3.0.0
2018-11-07 18:04:28 -08:00
エリス
47aabc631d
Dependency bump cordova-common@^3.0.0 2018-11-08 09:23:01 +09:00
Darryl Pogue
fb75ac371d
Merge pull request #536 from erisu/remove-node_module-copy
Only copy platform node_modules when created by binary
2018-11-06 10:06:46 -08:00
エリス
98c866704a
Only copy platform node_modules when create by bin 2018-11-06 16:08:34 +09:00
Darryl Pogue
e58453d3e6
Merge pull request #465 from erisu/CB-14201
CB-14201: (android) Removes Gradle property in-line command arguments…
2018-10-31 21:25:26 -07:00
Darryl Pogue
03c62e1ce2
Merge pull request #523 from dpogue/gradle-repo-order
Always put the Google repo above jcenter
2018-10-23 10:33:57 -07:00
Darryl Pogue
2c10545cd8
Always put the Google repo above jcenter 2018-10-23 08:21:05 -07:00
Jan Piotrowski
ff2ec7eed1
remove JIRA link 2018-10-04 01:12:02 +02:00
Darryl Pogue
8dfddef6f9
Merge pull request #486 from jedrivisser/7.1.x
GH-485: (android) Replace deprecated "compile" with "implementation"
2018-09-25 22:30:46 -07:00
Chris Brody
73edf4de7b
Update comments (#496)
as followup to GH-495
2018-09-12 07:52:11 -04:00
Chris Brody
cfa58a5661
Merge pull request #495 from Darshan-Chauhan/incorrect-default-sdk-version
Incorrect default sdk version issue fix
2018-09-12 07:17:16 -04:00
Darshan-Chauhan
905bff3d59 Incorrect default sdk version issue fix 2018-09-12 15:34:00 +05:30
Darryl Pogue
eadcd33e84
Merge pull request #493 from raphinesse/remove-bundled-dependencies
Remove bundled dependencies
2018-09-11 13:30:12 -07:00
Raphael von der Grün
76fe89dd1f Remove bundled node_modules 2018-09-11 21:23:24 +02:00
Raphael von der Grün
3f487c5c28 Ignore the whole node_modules folder 2018-09-11 21:20:47 +02:00
Raphael von der Grün
c35a46ec45 Remove bundledDependencies key from package.json 2018-09-11 21:18:18 +02:00
Jedri Visser
e3eb933182 GH-485: (android) Change deprecated "compile" to "implementation" 2018-09-06 22:54:26 +02:00
エリス
dacb0e5c72
CB-14201: (android) Removes Gradle property in-line command arguments for gradle.properties 2018-09-06 14:16:05 +09:00
エリス
23b24491c3
Fixes build & run related bugs from builder refactor PR #461 (#490)
- General Code Refactor
- Removed builder type argument from getBuilder API
- Removed any reference of conditional statements around builder type
- Remove plugin handler install and uninstall option flag android_studio
- Remove --gradle flag references
- Fixed plugin handler install and uninstall pathing issues
- Added parseBuildOptions export so run can get build related options.
- Use the nobuild flag option to control the run build.
- Updated test spec to reflect the changes.
2018-09-06 11:06:18 +09:00
Gearóid
7ab0cf123d Unit tests for android_sdk and AndroidProject (#464)
<!--
Please make sure the checklist boxes are all checked before submitting the PR. The checklist
is intended as a quick reference, for complete details please see our Contributor Guidelines:

http://cordova.apache.org/contribute/contribute_guidelines.html

Thanks!
-->

### Platforms affected
Android

### What does this PR do?
This is the last unit test PR for today, I promise! The `AndroidProject` tests were originally in #458. This PR also contains increased test coverage for `android_sdk.js`. I have also refactored that to remove `Q`, as with the other PRs I submitted today.

### What testing has been done on this change?
Run unit tests

### Checklist
- [x] [Reported an issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database
- [x] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected.
- [x] Added automated test coverage as appropriate for this change.
2018-09-02 04:44:37 +02:00
エリス
8f2a4c7231 CB-13685 android: Adaptive Icon Support
- Update default project template's icons to be adaptive.
- Added backwards support for non-adaptive icon supported devices.
2018-08-29 10:13:14 -07:00
Darryl Pogue
ce53154555
GH-473: Do not attempt an activity for internal url loads
Merge pull request #487 from joeljeske/bugfix/473-crash-on-android-7
2018-08-29 10:10:23 -07:00
Joel Jeske
c0188ab95a Fixes apache/cordova-android#473: Do not attempt an activity intent AND a url load into the webview, return from the internal webview load. 2018-08-29 10:52:12 -05:00
Raphael von der Grün
ebbd91f87d
Merge pull request #461 from Menardi/refactor_builders_with_tests
Remove old builders code
2018-07-21 16:43:34 +02:00
Gearoid M
4b0725dfc2 Remove no longer needed AndroidStudio.js 2018-07-10 11:53:52 +09:00
Gearoid M
350d35fb24 Refactor ProjectBuilder to use class instead of prototype 2018-07-10 11:53:52 +09:00
Gearoid M
8ee3a73dd1 Remove unused builders and add unit tests 2018-07-10 11:53:52 +09:00
Darryl Pogue
b6e4598e7c
Merge pull request #463 from Menardi/emulator_tests
Emulator: Add unit tests and remove Q
2018-07-02 21:21:43 -07:00
Darryl Pogue
bd2ad99402
Merge pull request #462 from Menardi/device_tests
Device: Add unit tests and remove Q
2018-07-02 21:19:05 -07:00
Gearoid M
d26c1199ab Increase unit test coverage for emulator 2018-07-03 11:39:29 +09:00
Gearoid M
1ea7c1366a CB-14158: Refactor emulator to remove Q 2018-07-03 11:19:17 +09:00
Gearoid M
b2263fe35e Add unit tests for device 2018-07-03 10:43:30 +09:00
Gearoid M
bd07907a4c CB-14158: Refactor device to remove Q 2018-07-03 10:43:30 +09:00
Gearóid
ca8931c8af Remove mention of ICLA from contribution guidelines (#460) 2018-06-29 08:47:34 +08:00
Rizal M. S
46a036ef26 CB-14165 Emulator: handle "device still connecting" error (#457)
Keep waiting for emulator when connection fails with "device still connecting" error
2018-06-25 08:44:37 +02:00
Raphael von der Grün
e9750b5cab
Merge pull request #456 from Menardi/more_android_tests
More android tests
2018-06-22 03:17:19 +02:00
Gearoid M
0bf0e48698 Prevent Api.js tests from polluting the reporter output 2018-06-22 10:02:31 +09:00
Gearoid M
4f1aa97ea9 Add unit tests for AndroidManifest.js 2018-06-22 10:02:31 +09:00
Gearoid M
f90f004dea Add unit tests for Adb.js 2018-06-22 10:02:31 +09:00
Gearoid M
559b0833b4 Add unit tests for run and retryPromise
Co-authored-by: Raphael von der Grün <raphinesse@gmail.com>
2018-06-20 13:24:50 +02:00
Raphael von der Grün
31bad290d5 Allow mocks to reject without a reason 2018-06-20 13:24:50 +02:00
Gearoid M
2e88f7ead2 Update Jasmine to support automatic promise handling 2018-06-20 13:24:50 +02:00
Gearoid M
1a8154c90e Fix unsafe property access 2018-06-20 13:24:50 +02:00
Gearoid M
8fb49ec7ec Fix typo in variable name in retry.js 2018-06-20 13:24:50 +02:00
Raphael von der Grün
393dad6349
Lint JS files w/out extension too (#453)
Prior to this change, JS files without extension had not been linted.

To match them, we need a combination of positive and negative globbing
that does not mix well with the existing file selection for linting. Thus, we use
npm-run-all to run two ESLint invocations unconditionally in sequence
while still preserving the error code.

* Lint JS w/out extension too
* Fix newly surfaced linting errors
* Make use of npm-run-all for test script too
2018-06-18 23:48:02 +02:00
Raphael von der Grün
2c3db19310 Emit log event instead of logging directly 2018-06-16 20:08:44 +02:00
jcesarmobile
472ab626d6
Merge pull request #449 from jcesarmobile/CB-14125
CB-14125:(android) Increase old plugin compatibility
2018-06-13 23:00:55 +02:00
Raphael von der Grün
2106e2e081
Merge pull request #442 from raphinesse/fix-tests
Fixes and cleanup for Java tests and CI
2018-06-13 16:28:29 +02:00
Raphael von der Grün
d3c80ea5d5 CB-14072 Update supported Node.js versions 2018-06-13 16:09:12 +02:00
Raphael von der Grün
6dad25668c Delete unused gradle-wrapper.properties for Java tests 2018-06-13 16:09:11 +02:00
Raphael von der Grün
d862d42e76 Unignore tracked build.gradle for Java tests 2018-06-13 16:09:10 +02:00
Raphael von der Grün
828b5f053a Cleanup CI configurations
* Use latest Android SDK tools for easier license handling
* Reduce installed SDK components to minimum (tools & build tools)
* Reduce unnecessary PATH manipulation
* Use preinstalled Gradle on Travis CI
* Improve Gradle output on Travis CI
* Use default image on AppVeyor
* Improve formatting & other minor tweaks
2018-06-13 16:09:09 +02:00
Raphael von der Grün
032d1fa9cb Cleanup Java tests runner
* Print Gradle version used for Java tests during build
* Allow Java tests to be run from any directory
* Simplify Promise wrapping in Java tests runner
* Minor improvements
2018-06-13 16:09:08 +02:00
Raphael von der Grün
83ad646734 Fix Java tests on AppVeyor by disabling Gradle daemon 2018-06-13 16:09:07 +02:00
Raphael von der Grün
88c25a6a6a Quick fix for Java tests on Travis CI
This accepts any unaccepted Android SDK licenses in Travis.
2018-06-13 16:09:06 +02:00
Raphael von der Grün
a254cfc841 Fix Java tests for older Gradle versions
Before this, Gradle 4.4 was required to build the Gradle wrapper and
thus run the Java tests. This was because of all the stuff that had to
be configured when running the wrapper task using the build.gradle file.

Now we use a config file that only specifies the required Gradle version
and nothing else to run the wrapper task. This allows tests to be run
with Gradle versions beginning with 2.
2018-06-13 16:09:04 +02:00
Raphael von der Grün
0d4b9f4ba6 Fix output and exit code for Java tests
This fixes the following issues:
* run_java_unit_tests.js always has exit code of 0 thus never failing
  the npm tests.
* "Tests completed successfully" is printed after failing to create the
  Gradle wrapper and never running the tests.
* Gradle errors are printed twice
2018-06-13 16:09:03 +02:00
Raphael von der Grün
bf29fe0e10
CB-14101 Fix Java version check for Java >= 9 (#446)
This also checks that we have exactly 1.8 since nothing else works with
the Android SDK. The user facing error was updated accordingly.
2018-06-12 22:18:55 +02:00
jcesarmobile
3df8f8b120
Merge pull request #450 from jcesarmobile/CB-14127
CB-14127: (android) Move google maven repo ahead of jcenter
2018-06-12 11:46:50 +02:00
Julio César
38d0e684f1 CB-14127: (android) Move google maven repo ahead of jcenter 2018-06-11 23:12:58 +02:00
Julio César
83e9aefff5 CB-14125:(android) Increase old plugin compatibility 2018-06-11 00:48:24 +02:00
Raphael von der Grün
02ee925103 Remove obsolete jshint comments (#444) 2018-05-21 18:02:14 +08:00
Shazron Abdullah
fc69da7a42
Merge pull request #443 from raphinesse/eslint
Improve ESLint script
2018-05-21 18:00:44 +08:00
Raphael von der Grün
5dc179ebef Improve ESLint script
It now lints all files in one go and lints a few extra files.
2018-05-19 23:15:15 +02:00
Joe Bowser
59e3b907e9
Merge pull request #437 from jcesarmobile/CB-14038
CB-14038 (android): fix false positive detecting project type

I agree @jcesarmobile, it can wait for a future release.
2018-04-19 11:08:54 -07:00
Julio César
fe7629e8fc CB-14038 (android): fix false positive detecting project type 2018-04-18 13:52:04 +02:00
Joe Bowser
76180d3ea1
Merge pull request #436 from infil00p/update_gradle_deps
CB-14008: Updating Gradle Libraries to work with Android Studio 3.1.0
2018-04-10 13:58:31 -07:00
Joe Bowser
5c4f8ca246 CB-14008: Updating Gradle Libraries to work with Android Studio 3.1.0 2018-04-04 13:54:39 -07:00
Joe Bowser
b8530a6b70
Merge pull request #435 from richturner/master
CB-13975: (android) Fix to fire pause event when cdvStartInBackground=true
2018-03-27 13:50:26 -07:00
Joe Bowser
83686542b2
Merge pull request #434 from infil00p/CB-13830
CB-13830: Add handlers for plugins that use non-Java source files
2018-03-26 16:08:22 -07:00
Rich Turner
b1551cad98 CB-13975: (android) Fix to fire pause event when cdvStartInBackground=true 2018-03-23 20:19:52 +00:00
Joe Bowser
5af6b016c1 CB-13830: Add handlers for plugins that use non-Java source files, such as Camera 2018-03-19 13:20:09 -07:00
Joe Bowser
6abd6d6b47
Merge pull request #433 from AnthonyWard/master
CB-13923 (android) fix -1 length for compressed files
2018-03-07 13:26:28 -08:00
Anthony Ward
e456a325f9 CB-13923 (android) fix -1 length for compressed files 2018-02-27 12:39:30 +00:00
Steve Gill
eddad666ff Update JS snapshot to version 7.2.0-dev (via coho) 2018-02-21 10:52:02 -08:00
Steve Gill
ca9a25e860 Set VERSION to 7.2.0-dev (via coho) 2018-02-21 10:52:01 -08:00
Steve Gill
8d9a1b82dd CB-13912 Updated RELEASENOTES and Version for release 7.1.0 2018-02-21 10:50:50 -08:00
Steve Gill
f1b57dd9b4 CB-13912: updated .ratignore to include build diectory 2018-02-20 11:36:55 -08:00
Steve Gill
d2a0323ae4 CB-13912 Updated checked-in node_modules 2018-02-20 11:17:05 -08:00
Simon MacDonald
3a339ba37f ⬆️ Bump gradle tools dependency to 3.0.1 for project template 2018-02-15 17:42:10 -05:00
Steve Gill
e9603b0738 CB-13879 updated gradle plugin 2018-02-14 16:54:06 -08:00
Joe Bowser
3d83fd784b
Merge pull request #431 from sunday18/patch-1
CB-13818: (android) Update android_sdk.js to support Android Oreo 8.0 (API 26) emulator
2018-01-26 12:32:53 -08:00
Joe Bowser
38a5f891a4
Merge pull request #430 from abernix/abernix/bump-android-versions
CB-13831: (android) Update `android-versions` to 1.3.0 to support SDK 27.
2018-01-26 08:02:35 -08:00
sunday18
8563c8beef
Update android_sdk.js
Update `android_sdk.js` to support Android Oreo (API 26) emulator
2018-01-26 06:21:53 +00:00
Jesse Rosenberger
f91102ee07
CB-13831: (android) Update android-versions to 1.3.0 to support SDK 27.
The `android-versions@1.3.0` version now has support for Android SDK level
27 thanks to 230957205e.

As the `android-versions` npm is a "bundled dependency" this will only
take effect when a new version of `cordova-android` is published, since
bundled dependencies are packed within the npm at publish time, not
automatically fetched as dependencies at publish time (which would have
normally been covered for new installations of cordova-android@7.0.0
thanks to semver caret notation).
2018-01-25 20:08:10 +02:00
Joe Bowser
cc08e9d84a
Merge pull request #429 from BBosman/cb13800
CB-13800: Drop pre-KitKat specific code
2018-01-19 11:09:40 -08:00
Bas Bosman
075d38117a CB-13800: (android) Drop pre-KitKat specific code 2018-01-19 13:58:24 +01:00
Joe Bowser
6cc4896690
Merge pull request #426 from infil00p/api_level_bump
CB-13724: Bump Target SDK to API 27
2018-01-17 11:48:51 -08:00
Joe Bowser
673a6773b2
Merge pull request #427 from infil00p/deleteDeprecatedNdk
CB-13646: End of an era.  Using the deprecated NDK by default breaks …
2018-01-10 12:08:46 -08:00
Joe Bowser
3a6923988d CB-13646: End of an era. Using the deprecated NDK by default breaks the build. Crosswalk users need to specify the Gradle parameters to keep it working. 2018-01-08 14:52:46 -08:00
Joe Bowser
0d1692681f CB-13724: Updated the Android Tooling required for the latest version on both the test project, and the template 2018-01-04 15:35:04 -08:00
Joe Bowser
fcf705e007
Merge pull request #425 from deton/fix-nullresult-fromthread
CB-12218: (android) Fix consistency of null result message
2018-01-03 11:24:24 -08:00
Joe Bowser
5c93c214b9 CB-13724: Bump Target SDK to API 27 2018-01-02 14:38:03 -08:00
Joe Bowser
7cbb8401a2
Merge pull request #422 from themightychris/patch-2
Prevent crash when unrecognized android version encounterd
2018-01-02 14:34:17 -08:00
Joe Bowser
b3c262cd47
Merge pull request #424 from jcesarmobile/CB-13721
CB-13721 (Android): fix build apps that use cdvHelpers.getConfigPreference
2018-01-02 13:41:45 -08:00
KIHARA Hideto
45a7b90c6c CB-12218: (android) Fix consistency of null result message
Fix problem that JavaScript receives ""(empty string) instead of null
if plugin sends null result from new thread.
2018-01-02 12:41:17 +09:00
Julio César
e1c3b4fd94 CB-13721 (Android): fix build apps that use cdvHelpers.getConfigPreference 2017-12-30 01:07:45 +01:00
Chris Alfano
109112ae75 CB-13571: (android) Prevent crash with unrecognized android version
Fixes issue where commands that list images will crash when an image with a version not present in `android-versions` is encountered, as is presently the case with API 27:

```
cordova run android --list
Available android devices:
Available android virtual devices:
LEVEL: null
ERROR: TypeError: Cannot read property 'semver' of null
An unexpected error has occured while running list-emulator-images with code 2: Error: /home/chris/Repositories/acp-guidelines/cordova/platforms/android/cordova/lib/list-emulator-images: Command failed with exit code 2
```

Signed-off-by: Chris Alfano <chris@jarv.us>
2017-12-22 15:56:26 -05:00
Joe Bowser
a24ba41eda
Merge pull request #421 from infil00p/test-sdk-bump
CB-12914: Test needs SDK bumps
2017-12-18 12:19:24 -08:00
Joe Bowser
be3f8ef80d CB-12914: Test needs SDK bumps 2017-12-14 13:48:19 -08:00
Joe Bowser
d50dedb5d0
Merge pull request #420 from infil00p/CB12914
CB-12914: Forgot to bump AndroidManifest.xml for play store reasons
2017-12-14 09:58:18 -08:00
Joe Bowser
74e9e213d6 Forgot to bump AndroidManifest.xml for play store reasons 2017-12-12 12:49:54 -08:00
Joe Bowser
d8d92cae61 CB-13621: eslint error 2017-11-30 11:08:39 -08:00
Joe Bowser
99d5b4d982 CB-13622: Testing commit 2017-11-30 10:56:28 -08:00
Joe Bowser
52fd32c837 CB-13621: Wrote similar warning to CB-12948 on iOS. We no longer support update. 2017-11-30 10:40:07 -08:00
Joe Bowser
061f08bc03 Update JS snapshot to version 7.1.0-dev (via coho) 2017-11-30 10:01:30 -08:00
Joe Bowser
735bc98243 Set VERSION to 7.1.0-dev (via coho) 2017-11-30 10:01:28 -08:00
Joe Bowser
e53a65ef07 CB-13620 Updated RELEASENOTES and Version for release 7.0.0 2017-11-30 09:42:11 -08:00
Joe Bowser
3642ffb57a CB-13741: Updating checked-in node_modules, otherwise plugin installation fails 2017-11-29 13:32:44 -08:00
Joe Bowser
3dcc319cd2
Merge pull request #419 from dpogue/signing-fix
CB-13615: Fix paths to signing properties files
2017-11-29 12:21:53 -08:00
Darryl Pogue
8484f7b906
CB-13615: Fix paths to signing properties files 2017-11-29 10:56:05 -08:00
Joe Bowser
59018ab632
Merge pull request #389 from infil00p/StudioProjectCompat
CB-11244: Studio Project Compatibility: Now with merge commit
2017-11-29 09:55:37 -08:00
Joe Bowser
c6cfeb15f4 Fixed typo in the gradle file 2017-11-28 14:59:50 -08:00
Joe Bowser
adc7dab377 CB-13612: eslint fix 2017-11-28 13:09:07 -08:00
Joe Bowser
a9e01f4309 CB-13612: Fix the remapper so that XML files copy over and the Camera works again. 2017-11-28 12:57:00 -08:00
Joe Bowser
0269e532df CB-13741: Bump package.json so we can install plugins 2017-11-28 11:31:04 -08:00
Joe Bowser
4863320e45 Merge branch 'master' into StudioProjectCompat 2017-11-28 10:35:45 -08:00
Joe Bowser
3ad1ed7dbc
Merge pull request #418 from dpogue/splash-compress
CB-13610: Compress the default app assets
2017-11-28 10:35:04 -08:00
Joe Bowser
ae823e6c4e
Merge pull request #385 from dreifachstein/master
CB-12835: add a Context getter in CordovaInterface
2017-11-28 10:34:19 -08:00
Darryl Pogue
9056e5a2dc
CB-13610: Compress the default app assets 2017-11-27 22:46:02 -08:00
Joe Bowser
2b20802dbb Merge branch 'master' into StudioProjectCompat
Merge by hand CB-8976
2017-11-27 14:10:59 -08:00
Joe Bowser
a972d1ef62
Merge pull request #401 from fabulant/CB-8976
CB-8976: Added the `cdvVersionCodeForceAbiDigit` property
2017-11-27 14:02:20 -08:00
Joe Bowser
30c3713dca Merge branch 'master' into StudioProjectCompat 2017-11-27 11:42:25 -08:00
Joe Bowser
6f58d4c474
Merge pull request #352 from Icenium/include-armeabi-dir
CB-12291: (android) Add x86_64, arm64 and armeabi architecture flavors
2017-11-27 11:35:47 -08:00
Joe Bowser
9d9bac397b CB-13602: We were setting the path wrong, this is hacky but it works 2017-11-22 13:18:38 -08:00
Joe Bowser
d8f10c33dc CB-13601: Fixing lint error and mis-spelling of variable 2017-11-22 11:47:05 -08:00
Joe Bowser
5d57eff612 CB-13601: Fixing the standalone run scripts to make sure this works without using the CLI 2017-11-22 11:39:40 -08:00
Joe Bowser
43956c1bc8 Merge branch 'master' into StudioProjectCompat
Fixing conflict caused by merging #417 into master
2017-11-20 18:21:49 -08:00
Joe Bowser
2930900963 Merge branch 'master' into StudioProjectCompat 2017-11-20 13:53:00 -08:00
Joe Bowser
6404780186
Merge pull request #417 from DavidStrausz/master
CB-13580: (android) fix build for multiple apks (different product flavors)
2017-11-16 10:13:50 -08:00
David Strauß
5d99e50c4a CB-13580: (android) fix lint errors 2017-11-16 01:54:04 +01:00
David Strauß
aaeb630eb1 CB-13580: fix build for multiple apks (different product flavors) 2017-11-16 01:27:20 +01:00
Joe Bowser
3acba59494 CB-13297: This just works once you bump the project structure. Java 1.8 compatibility baked-in 2017-11-15 11:39:32 -08:00
Joe Bowser
3760616639
Merge pull request #416 from infil00p/bintray_fix
CB-13558: Upgrading the gradle so we can upload the AAR
2017-11-15 10:42:00 -08:00
Joe Bowser
026dce563b CB-13558: Upgrading the gradle so we can upload the AAR 2017-11-09 11:14:47 -08:00
Joe Bowser
b77febc7a7 Merge branch 'master' into StudioProjectCompat 2017-11-07 10:52:37 -08:00
Joe Bowser
83601dca2f Update JS snapshot to version 6.5.0-dev (via coho) 2017-11-06 11:44:23 -08:00
Joe Bowser
05aeaf1bd2 Set VERSION to 6.5.0-dev (via coho) 2017-11-06 11:44:20 -08:00
Joe Bowser
b138867b78 CB-13528 Updated RELEASENOTES and Version for release 6.4.0 2017-11-06 11:43:47 -08:00
Joe Bowser
a1195cefd5
Merge pull request #415 from infil00p/CB-13530
CB-13530: Fix the utility method for finding the built APK for generic APKs
2017-11-03 16:50:32 -07:00
Joe Bowser
b83c3b3684 CB-13530: Removing debug console.logs 2017-11-02 14:45:51 -07:00
Joe Bowser
5502ddaf0d CB-13530: This fixes the basic APK installation 2017-11-02 14:42:39 -07:00
Joe Bowser
f54336eb61 eslint fix 2017-11-01 17:18:41 -07:00
Joe Bowser
18d6884522 CB-11244: Android Studio 3 work, things have changed with how the platform is built 2017-11-01 17:09:00 -07:00
Joe Bowser
8ba0109e55 Completing merge which includes the fix for Android Studio 3.0 2017-11-01 13:46:23 -07:00
Joe Bowser
f50ca85a95 CB-11244: Found bug where the gradle subproject changes weren't actually getting written to the correct gradle file 2017-11-01 13:22:22 -07:00
Joe Bowser
39e6765e64
Merge pull request #413 from infil00p/StudioThreeFix
CB-13289: This fixes the Cordova-Android build on cordova-android 6.x
2017-11-01 10:26:53 -07:00
Joe Bowser
47e20da631 CB-13289: Updating Travis and appveyor 2017-10-31 10:48:19 -07:00
Audrey
bb7b47b063
Merge pull request #414 from audreyso/CB-13501
CB-13501 : update appveyor to support node 8
2017-10-30 16:11:50 -07:00
Joe Bowser
a2618dcde5 CB-13289: eslint fix 2017-10-30 13:17:18 -07:00
Joe Bowser
9fdb126715 CB-13289: Fixing build problems with Studio Three, but keeping Windows Gradle fix for now, will be deprecated 2017-10-30 10:39:59 -07:00
Audrey So
b2a81c09ec :CB-13501 : update appveyor node versions to support node 8 2017-10-30 10:01:50 -07:00
Jan Piotrowski
04fa5d3feb CB-13499: Remove duplicate "setting" in error strings 2017-10-26 22:28:38 +02:00
Joe Bowser
d73108cc13 CB-13289: Fix test to work with new Google Android Gradle DSL 2017-10-25 11:38:07 -07:00
Joe Bowser
3ba00f91bb eslint errors 2017-10-19 13:37:43 -07:00
Joe Bowser
cbee8580d0 CB-13470: Fix Clean so that it cleans the Android Studio structure 2017-10-19 13:31:16 -07:00
Joe Bowser
6ccd6b009b Redoing PR #411 over here because the changes were obliterated from earlier 2017-10-18 11:09:08 -07:00
Joe Bowser
6cf6e20d2e Merge branch 'master' into StudioProjectCompat, fixing conflicts, need
to re-add previous PR fix on the branch
2017-10-18 11:04:44 -07:00
Joe Bowser
93efe71080 Merge pull request #411 from Keyclic/master
CB-12802: (android) Fix build.gradle to sign when building with multiple APK is enable.
2017-10-16 11:23:29 -07:00
Joe Bowser
697c8f129c Merge pull request #410 from filmaj/emu-fixes
CB-13404, CB-13406: `best_image` function fixes when choosing emulator images to deploy to
2017-10-16 10:37:30 -07:00
Joe Bowser
c12f7fef76 Close #379 2017-10-13 11:08:01 -07:00
Kevin
cde238de94 Include missing values for task.name when 'cdvBuildMultipleApks' option is true, 'task.name' can have 'validateSigningArmv7Release' or 'validateSigningX86Release' values too. 2017-10-09 09:17:40 +02:00
filmaj
ec83d481fa CB-13406: Fixed AVD API level comparison when choosing sub-par API level match. Added tests for the best_image method. 2017-10-05 15:18:42 -05:00
filmaj
1f12fdbeea CB-13404: add android-versions to bundledDependencies. Ignore best emulator selection when parsed AVD information does not include API level in the target 2017-10-05 15:17:31 -05:00
Joe Bowser
8743e88550 CB-11244: Fixing eslint errors 2017-10-03 15:06:54 -07:00
Joe Bowser
f3c238db1c CB-11244: Adding specs for resource files inside an Android Studio Project 2017-10-03 14:16:27 -07:00
Joe Bowser
2534a3c767 CB-11244: Added remapping for drawables 2017-10-02 19:04:40 -07:00
Joe Bowser
b1f527e682 Merge branch 'master' into StudioProjectCompat 2017-09-28 10:21:49 -07:00
Audrey
6fa16b615b Merge pull request #408 from audreyso/CB-12895-eslint
CB-12895 : eslint ignoring cordova.js
2017-09-28 08:47:50 -07:00
Audrey So
e5c90badba CB-12895 : eslint ignoring cordova.js 2017-09-26 17:15:30 -07:00
Joe Bowser
be6c6ba976 CB-12895: Temporarily disabling eslint since cordova-js does not have eslint yet. 2017-09-25 14:00:38 -07:00
Joe Bowser
7f3be98199 Update JS snapshot to version 6.4.0-dev (via coho) 2017-09-25 11:37:52 -07:00
Joe Bowser
0e498db735 Set VERSION to 6.4.0-dev (via coho) 2017-09-25 11:37:51 -07:00
Joe Bowser
7203b740fd CB-13323 Updated RELEASENOTES and Version for release 6.3.0 2017-09-25 11:35:59 -07:00
Joe Bowser
97aab900da CB-13323 Updated checked-in node_modules 2017-09-25 11:17:24 -07:00
Joe Bowser
dddb2837dd CB-6936: Merge pull request #304 from uareurapid/master
CB-6936: fix crash when calling methods on a destroyed webview
2017-09-15 13:26:21 -07:00
Joe Bowser
7d282426c4 Merge branch 'master' into StudioProjectCompat
Another merge commit to track master changes
2017-09-14 11:45:57 -07:00
filmaj
1637937664 CB-12981: handle SDK 26.0.2 slightly different AVD list output for Android 8+ AVDs. Would cause "cannot read property replace of undefined" errors when trying to deploy an Android 8 emulator. 2017-09-14 11:26:18 -07:00
filmaj
03144eb160 Add a node and npm package.json script for running java unit tests. Include them in the top-level npm test script. Run java unit tests in travis. Small refactor in gradlebuilder to support building gradle wrapper more easily. Don't explicitly build gradlew on appveyor CI as now npm test will do it for you. 2017-09-14 09:57:37 -07:00
Joe Bowser
53210710ba Merge pull request #404 from mediathand/maven-repo-fix
Update maven repo to include most recent lib versions
2017-09-11 10:04:48 -07:00
Joe Bowser
0d98e09fb1 Merge branch 'master' into StudioProjectCompat 2017-09-05 11:05:42 -07:00
Steve Gill
e7a972df77 updated bundled node_modules 2017-09-05 11:04:12 -07:00
Gil Pedersen
cb2f396e33 Update maven repo to include most recent lib versions 2017-08-29 17:27:02 +02:00
Martin Bektchiev
2940d05209 CB-12291: (android) Add x86_64, arm64 and armeabi architecture flavors 2017-08-16 09:35:33 +03:00
Joe Bowser
2377aa7ac2 Merge pull request #403 from infil00p/api26
CB-13177: Updating to API Level 26
2017-08-15 14:17:09 -07:00
Joe Bowser
f18086f83a Merge branch 'master' into StudioProjectCompat 2017-08-15 13:29:44 -07:00
Joe Bowser
dce3b7ed6c Merge pull request #402 from macdonst/master
Revert CB-12015: initial-scale values less than 1.0 are ignored on Android
2017-08-15 13:22:22 -07:00
Simon MacDonald
5bda4df7fa Revert CB-12015: initial-scale values less than 1.0 are ignored on Android 2017-08-14 20:57:44 -04:00
Joe Bowser
1a8e36ccd3 CB-13177: Updating to API Level 26 2017-08-14 11:41:46 -07:00
Simon MacDonald
14816c7c81 Merge pull request #399 from macdonst/CB-12730
CB-12730: Compat - INTEGRATE
2017-08-11 10:38:06 -04:00
Joe Bowser
8fdb16c555 Fixing cordova-cli related bug 2017-08-04 12:00:39 -07:00
Fabian Eichinger
940439866e CB-8976: Added the cdvVersionCodeForceAbiDigit flag to the template build.gradle that appends 0 to the versionCode when cdvBuildMultipleApks is not set 2017-08-04 18:28:06 +02:00
Joe Bowser
e91b19d006 Fixing error caused by merge commit 2017-07-31 14:10:14 -07:00
Joe Bowser
46905ebe99 Merge branch 'master' into StudioProjectCompat. Dealing with latest
commits merged into master.
2017-07-31 13:43:21 -07:00
Simon MacDonald
d364f46baa CB-12730: Compat - INTEGRATE 2017-07-28 08:56:19 -04:00
Nikita Matrosov
2b53c98cf5 CB-12453: Remove unnecessary double quotes from .bat files which are the causes of crash if project path contains spaces
this closes #362
2017-07-28 14:23:53 +03:00
Nikita Matrosov
36d07d7a15 CB-13031: Fix bug with case-sensitivity of android-packageName
this closes #397
2017-07-28 14:05:53 +03:00
filmaj
458e479681 Trying AppVeyor-supplied workaround for current appveyor time out issues. See http://help.appveyor.com/discussions/problems/7159-builds-timing-out-after-an-hour 2017-07-27 14:33:16 -07:00
Joe Bowser
5fe95570d2 Merge branch 'master' into StudioProjectCompat 2017-07-25 15:07:56 -07:00
filmaj
c3ce2f8a07 Closes #398 2017-07-24 10:11:21 -07:00
Joe Bowser
d0dab4bb09 Merge branch 'master' into StudioProjectCompat
I fixed the master so it passes eslint.
2017-07-18 14:25:56 -07:00
Joe Bowser
893356abcd CB-13034: Fixing eslint error 2017-07-18 14:13:53 -07:00
Joe Bowser
00c879e27d It passed then failed. I'll change the test for now, because perfect is the enemy of good. 2017-07-18 11:53:44 -07:00
Joe Bowser
b65af106ff Make the tests pass 2017-07-17 13:07:32 -07:00
Joe Bowser
fdd7eb3446 Linting fix 2017-07-14 16:51:10 -07:00
Darryl Pogue
22645d9158
[CB-10916] Support display name for Android 2017-07-14 17:37:15 -02:30
filmaj
76dd8613ca CB-12423: make explicit JDK 1.8 or greater is needed in the README. 2017-07-14 11:13:52 -05:00
Joe Bowser
99f15c507d Updating paths in the unit tests, leaving the failing test and coding against that 2017-07-12 11:13:20 -07:00
Joe Bowser
849b887e20 Merge branch 'master' into StudioProjectCompat 2017-07-12 09:39:55 -07:00
Joe Bowser
245d9a1e46 Merge branch 'master' into StudioProjectCompat 2017-07-12 09:33:37 -07:00
filmaj
5917d4ef0b CB-13006: removed create and update end-to-end tests, and instead added more unit test coverage. tweaked code coverage invocation so that we get coverage details on the create.js module. slight changes to the create.js module so that it is slightly easier to test. 2017-07-11 12:54:15 -05:00
filmaj
90053eb9df CB-12950: lots of tweaks for end-to-end test runs, especially on CI:
- rename npm tasks to reflect what they do (npm run unit-tests, npm run e2e-tests). main `npm test` runs linter, unit tests and e2e tests now.
- locked jasmine down to ~2.6.0.
- consolidate gitignores.
- updated travis to run `npm test`. add android sdk installation to appveyor ci run.align android dpendencies across travis and appveyor. have appveyor install gradle. force gradle to version 3.4.1 in appveyor, as that seems to be the only version choco has. explicitly invoke sdkmanager to move license accepting process along.
2017-06-27 15:59:16 -05:00
Joe Bowser
a7304b9a19 Finishing the linting 2017-06-27 13:15:04 -07:00
Nikita Matrosov
540929c6a0 CB-9971: Suppressed unwanted java stderr output when running gradle wrapper
this closes #388
2017-06-26 21:17:58 +03:00
Joe Bowser
e456175a81 Merge branch 'master' into StudioProjectCompat
This will have to be linted
2017-06-26 10:29:31 -07:00
filmaj
3ff32092a3 CB-12954 🔪 remove jshint leftovers 2017-06-26 12:26:53 -05:00
Audrey So
55d7cf3865 CB-12895 : updated .eslintrc file in spec dir and set jasmine true and removed root is true 2017-06-23 08:44:08 -07:00
Audrey So
ac4ac935f6 CB-12895 : added .eslintrc files to set up jasmine environment 2017-06-23 08:07:08 -07:00
Audrey So
d83d49d83b CB-12895 : fixed eslint errors 2017-06-23 08:07:08 -07:00
Audrey So
e36158a0da CB-12895 : added eslint and removed jshint 2017-06-23 08:07:07 -07:00
Joe Bowser
b20028c42b The prepare step was broken, which breaks the CLI workflow. This was caused by hardcoding the Java directory, which is a very bad idea. 2017-06-22 13:46:18 -07:00
Jesse MacFadyen
5cc14b8031 CB-12605 In Windows get Android studio path from the registry
This closes #387
2017-06-22 10:55:39 -07:00
Joe Bowser
1cda7a9de0 CB-11244: Found bug in Api.js where xml/strings.xml is used instead of values/strings.xml 2017-06-19 14:34:03 -07:00
Joe Bowser
49b76f5c71 Fixing mangled commits that crept into this branch 2017-06-14 11:36:43 -07:00
Joe Bowser
c0474e811d Bump for travis test 2017-06-14 10:16:05 -07:00
Joe Bowser
40c9709445 OK, Going back to the old build.gradle for legacy projects 2017-06-14 09:57:29 -07:00
Joe Bowser
b67e9905bc This is probably a bad idea, but we need to split the gradle files into legacy and new style 2017-06-14 09:57:28 -07:00
Joe Bowser
c74192d578 Adding conditional code into Gradle, this is a bit dirty since we can't explicitly test it but we'll just have to rely on jasmine 2017-06-14 09:57:28 -07:00
Joe Bowser
33feb00e8f Adding the if statement to see if we can support both structures with minimal editing, TODO: actually write tests for this somehow 2017-06-14 09:57:28 -07:00
Joe Bowser
8f16df4c90 Adding logic to upgrade both Classic and Android Studio style project structures 2017-06-14 09:57:28 -07:00
Joe Bowser
fb6cb51e64 Fixing lint errors 2017-06-14 09:57:28 -07:00
Joe Bowser
28ebbb8f02 CB-11244: Setup Api.js to support multiple builders based on project structure 2017-06-14 09:57:28 -07:00
Joe Bowser
bd4ddcdedd Updated AndroidStudio to only look for the app directory to determine studio status 2017-06-14 09:57:28 -07:00
Joe Bowser
e621edfba7 Fixing the Android Studio detection and making it automatically pick the right builder, good for upgrading Cordova 2017-06-14 09:57:27 -07:00
Joe Bowser
304a899114 Fixed the specification of the builders in the run command by getting build to check what was being passed from run 2017-06-14 09:57:27 -07:00
Joe Bowser
8391af2e8f JsHint Fixes, deleting unused methods 2017-06-14 09:57:27 -07:00
Joe Bowser
69ab6a0e0d Changing the project to add the app directory as a dependency 2017-06-14 09:57:27 -07:00
Joe Bowser
a216f0db75 CB-11244: Changing directory creation, will most likely hide this behind a flag for the next release of Cordova-Android, and then make it default in the next major pending feedback 2017-06-14 09:57:27 -07:00
Joe Bowser
69260fb96a Fix the overwriting of Fil's fix, blargh 2017-06-14 09:57:27 -07:00
Joe Bowser
db87e0ae6a Made changes so cordova/build builds with the new project. Need to work on plugin installation. 2017-06-14 09:57:26 -07:00
Joe Bowser
8ead919fae Managed to get the project to mostly compile, still need to re-work the build command to add the app project 2017-06-14 09:57:26 -07:00
Joe Bowser
b73c04f3c8 Updating gradle version in the build file 2017-06-14 09:57:26 -07:00
Joe Bowser
f790aeb8f6 Setting up the create command so we actually have all the directories in the right place, and define default variables in the top level build.gradle 2017-06-14 09:57:26 -07:00
Joe Bowser
7b17abc555 Fixing linting issues 2017-06-14 09:57:26 -07:00
Joe Bowser
ffadf5dd51 Changing this so we pass lint 2017-06-14 09:57:25 -07:00
Joe Bowser
23d8d99925 Moving Android Manifest finding to the Gradle and Studio builders. 2017-06-14 09:57:25 -07:00
Joe Bowser
d88df59c32 Adding the Studio Builder to build a project based on Android Studio,
and deleting Ant, since Google does not support Ant Builds anymore.
Sorry guys!
2017-06-14 09:57:25 -07:00
Xiaolei Yu
17906735df CB-12835: add a Context getter in CordovaInterface
A custom engine may live outside of the Activity's lifecycle and the
Activity instance may not always be available. This getter allows
Context accesses in all cases.
2017-06-11 17:51:19 +08:00
Audrey So
3a6e898b12 CB-12762 : pointed package.json repo items to github mirrors instead of apache repos site
This closes #383
2017-06-07 09:28:22 -07:00
filmaj
0cc3df3747 CB-12859: document how to run the native tests. add a README to the test/ project. 2017-06-06 14:37:57 -05:00
Joe Bowser
2bc842a2b3 This commit should exist on the Crosswalk Plugin, Close #357 2017-05-29 13:04:17 -07:00
Joe Bowser
1c6f640026 Commit already merged, Close #378 2017-05-29 13:02:35 -07:00
Joe Bowser
6daad829cc Close #283 2017-05-29 09:53:49 -07:00
Darryl Pogue
7d926822ed CB-8980: Ensure copied resource-files are cleaned
This closes #377
2017-05-25 16:11:20 -07:00
Audrey So
d4dcbb13fc CB-12617 : removed node0.x support for platforms and added engineStrict
This closes #372
2017-05-25 14:09:55 -07:00
filmaj
f396712f59 CB-12847: added bugs entry to package.json. 2017-05-24 00:54:03 +02:00
filmaj
d97250f968 Update JS snapshot to version 6.3.0-dev (via coho) 2017-05-02 16:19:21 -07:00
filmaj
e7e8e95242 Set VERSION to 6.3.0-dev (via coho) 2017-05-02 16:19:19 -07:00
filmaj
d518a655a8 CB-12746: updated release notes for impending 6.2.3 release, since some of the reported changes did not make it into 6.2.2. 2017-05-02 16:04:20 -07:00
filmaj
b6a5844027 CB-12746: decrement working dev version on master to 6.2.4-dev, to align with impending patch release. 2017-05-02 16:04:20 -07:00
filmaj
9d9abea157 Start of GradleBuilder.js specs - puts it on the code coverage radar. 2017-05-02 15:31:26 -07:00
Simon MacDonald
ee1165ea33 CB-12015: initial-scale values less than 1.0 are ignored on Android
This closes #376
2017-05-01 11:20:25 -07:00
Joe Bowser
2704ee54cf This closes #374 2017-05-01 10:51:50 -07:00
Steve Gill
ad01d28351 Set VERSION to 6.3.0-dev (via coho) 2017-04-24 22:05:43 -07:00
Steve Gill
a215c1cf30 CB-12697 Updated RELEASENOTES and Version for release 6.2.2 2017-04-24 22:04:56 -07:00
Steve Gill
cadea2f6c3 CB-12697 Updated checked-in node_modules 2017-04-24 21:56:28 -07:00
filmaj
e13e15d3e9 CB-12640: better handling of unrecognized commands on windows. removed error checking in emulator image listing when shelling out, as we already defensively dont shell out if the program is not on the PATH / not recognized. added additional test for windows unrecognized command errors for target listing. fixed up spying in a test. 2017-04-10 12:12:46 -07:00
filmaj
6ef2f67ae8 CB-12640: flipped avd parsing logic so that it always tries to use avdmanager to retrieve avds first, then falls back to android command if avdmanager cannot be found (and errors with ENOENT). updated tests - and added explicit tests to ensure to shell out to singular forms of sub-commands when executing android 2017-04-10 12:12:46 -07:00
filmaj
765c4ee9f6 CB-12640: support for android sdk tools 26.0.1. simplified target parsing by using avdmanager instead of sdkmanager. flipped target parsing logic so that it always tries to use avdmanager to retrieve targets first, then falls back to android command if avdmanager cannot be found (and errors with ENOENT). updated tests. 2017-04-10 12:12:46 -07:00
Steve Gill
a4103d8dc8 updated version in build.gradle 2017-04-07 10:56:39 -07:00
Steve Gill
8e0f021cad Set VERSION to 6.3.0-dev (via coho) 2017-04-02 17:43:13 -05:00
Steve Gill
002ab85f76 CB-12627 Updated RELEASENOTES and Version for release 6.2.1 2017-04-02 17:40:35 -05:00
Steve Gill
4a0f69a3f0 CB-12621: reverted elementtree dep to 0.1.6 2017-04-02 17:11:17 -05:00
Steve Gill
8a2e96d995 Update JS snapshot to version 6.3.0-dev (via coho) 2017-03-28 15:23:50 -07:00
Steve Gill
13dbd2f5d4 Set VERSION to 6.3.0-dev (via coho) 2017-03-28 15:18:35 -07:00
Steve Gill
6d084428a8 CB-12609 Updated RELEASENOTES and Version for release 6.2.0 2017-03-28 15:17:52 -07:00
Steve Gill
312efc3878 CB-12609: added missing license headers 2017-03-28 15:03:47 -07:00
Joe Bowser
301faebfcc CB-12614: Adding headers to tests 2017-03-28 14:27:57 -07:00
Steve Gill
a8af103ff4 CB-12609: checking in updated node_modules 2017-03-27 22:23:09 -07:00
Darryl Pogue
0df50c3f33 CB-8978 Prepare copy resource-files from config.xml
This closes #321
2017-03-27 22:13:13 -07:00
Alexander Sorokin
08c80f77a9 CB-12605 Fix a requirements check failure on Windows 2017-03-27 11:47:32 +03:00
Joe Bowser
ea8d65d7fc CB-12595: Remove the console.log stuff
This closes #370
2017-03-24 10:22:11 -07:00
Joe Bowser
e3198b0f6b CB-12595: Ugly code, but this should find an Android Studio installation and use the sweet gradle center found inside 2017-03-24 10:22:07 -07:00
Josh Jackson
19220de388 testMultipartPopAndEncodeAsJs under newer test system
This closes #358
2017-03-22 10:54:48 -07:00
Josh Jackson
52878d6c5b MultipartMessageTest 2017-03-22 10:54:42 -07:00
Josh Jackson
abfece70c1 Shorter method name 2017-03-22 10:54:41 -07:00
Josh Jackson
33da6e9eb8 Fix encoding of multipart messages. 2017-03-22 10:54:41 -07:00
Joe Bowser
4919a2d2a8 Bumping up the test gradle versions 2017-03-22 10:53:58 -07:00
filmaj
2f2e8a560d CB-12546: account for quotes when detecting android command error for Windows. 2017-03-20 10:09:46 -07:00
filmaj
884818934f CB-12546: on create, update the require path for certain helper modules as directory structure differs. big ol TODO dropped as it _is_ kinda weird. 2017-03-20 10:09:45 -07:00
filmaj
1d8e6f53a1 CB-12546: sort detected targets by numerical suffix when reporting most recent version of android sdk target installed. 2017-03-20 10:09:45 -07:00
filmaj
3554267adf CB-12546: more specs for android_sdk and check_reqs. added fixtures for sdk targets. refactored target listing. 2017-03-20 10:09:45 -07:00
filmaj
f7687a2567 CB-12546: use android_sdk list_targets instead of rewriting the same thing again. 2017-03-20 10:09:45 -07:00
filmaj
ebd4a02d2c CB-12546: switch to superspawn for shelling out where possible. rework android sdk module to work with new sdk. 2017-03-20 10:09:45 -07:00
filmaj
4a354bba86 CB-12546: based on android command exit code and stdout, conditionally try to invoke avdmanager to list out AVD images. tweak relevant test to match behaviour. small tweak to use exposed methods for checking platform (for easier future stubbing). 2017-03-20 10:08:36 -07:00
filmaj
d40c22441f CB-12546: move check_reqs to templates directory and update module references. 2017-03-20 10:08:36 -07:00
filmaj
6395eda0c8 CB-12546: emulator specs. 2017-03-20 10:08:36 -07:00
filmaj
eb6ada8091 CB-12546: more robust sdk location detection. ANDROID_HOME now can be set from location of either of adb, android or avdmanager commands. slightly rework logic of infering ANDROID_HOME + setting up PATH to hopefully separate the logic into clearer sections. check_reqs.check_android now validates SDK Tools 25.3.1 binaries/structure. added specs for check_reqs.check_android. move android sdk version script. expose some helper functions as module methods to help with mocking. 2017-03-20 10:08:35 -07:00
filmaj
a7ef686a27 CB-12546: leverage avdmanager if android warns it is no longer
useful, which happens in Android SDK Tools 25.3.1.
explicitly set the CWD of the spawned emulator process to workaround a recent google android sdk bug.
rename android_sdk_version.js to android_sdk.js, to better reflect its contents.
have create.js copy over the android_sdk_version batch file.
2017-03-20 10:08:35 -07:00
Alexander Sorokin
e2af492a63 CB-12587 A (not so) quick fix for get_gradle_wrapper() call 2017-03-20 15:22:37 +03:00
Joe Bowser
84de9ee0da CB-12574 - Bumping Version
This closes #368
2017-03-15 13:31:24 -07:00
Joe Bowser
e182e669f0 CB-12524: Put the script in the wrong spot, oops
This closes #367
2017-03-13 13:51:37 -07:00
Joe Bowser
a9a28d3e77 CB-12524: Workaround for obsolete gradle on integration servers 2017-03-13 13:51:37 -07:00
Joe Bowser
6a77acdbf2 CB-12524: Thwarted by JSHint again, accidentally deleted the wrong message 2017-03-13 13:51:37 -07:00
Joe Bowser
028725468a CB-12524: Removing the downgrade test, because thanks to Google's Tool Change, this will forever fail. 2017-03-13 13:51:37 -07:00
Joe Bowser
9dbffa6ee8 CB-12524: Forgot to check for the android command on the target check 2017-03-13 13:51:37 -07:00
Joe Bowser
2d3f3cae13 CB-12524: Set Gradle to always build in the project directory since our tests don't run scripts from the project directory by default 2017-03-13 13:51:36 -07:00
Joe Bowser
fb9f0f3ee8 CB-12524: I need travis to install a wrapper on this, since travis fails the gradle check 2017-03-13 13:51:36 -07:00
Joe Bowser
ab276504fd CB-12524: Windows functionality for Gradle execution 2017-03-13 13:51:36 -07:00
Joe Bowser
3cc4e5b440 CB-12524: This now fetches the template from inside of the Android Studio directory, and falls back to a locally installed Gradle instance 2017-03-13 13:51:36 -07:00
Joe Bowser
b2664bc469 CB-12524: Test distributing a wrapper in the framework directory 2017-03-13 13:51:36 -07:00
Bharath Hariharan
7d5afdebe1 Updating version
This closes #364
2017-02-27 16:03:44 -08:00
Joe Bowser
3bbc7fb328 CB-12465: Writing new JUnit Test Instrumentation to replace tests and retire problmatic tests
This closes #363
2017-02-27 09:28:02 -08:00
Bharath Hariharan
ac6ad2dea1 Adding Binary plugin to class path
This closes #361
2017-02-22 16:47:59 -08:00
Bharath Hariharan
0b116f1b5c Updating Maven settings 2017-02-14 16:31:27 -08:00
Bharath Hariharan
acdb934ef9 Add the ability to publish to Bintray jCenter repo 2017-02-13 16:37:39 -08:00
Steve Gill
5591a1a4e8 Update JS snapshot to version 6.2.0-dev (via coho) 2017-01-26 16:30:33 -08:00
Steve Gill
124574bb3a Set VERSION to 6.2.0-dev (via coho) 2017-01-26 16:30:31 -08:00
Steve Gill
a2cfaab7f4 CB-12403 Updated RELEASENOTES and Version for release 6.1.2 2017-01-26 15:21:50 -08:00
Joe Bowser
6355425a6f Change to https by default 2017-01-20 09:31:31 -08:00
audreyso
2d96995801 CB:12018 : added dev dependencies to gitignore
This closes #355
2017-01-17 09:38:14 -08:00
audreyso
3fc4daa447 CB-12018 : updated tests to work with jasmine (promise matcher tests commented out for now) 2017-01-11 17:07:17 -08:00
Julio César
c7ff24b983 Closing invalid pull request: close #350 2017-01-10 19:22:44 +01:00
Jesse MacFadyen
3f674faf30 Merge branch 'CB-5968' of https://github.com/sterlingann/cordova-android 2017-01-08 22:42:18 -08:00
Steve Gill
b9ad1b6b26 Update JS snapshot to version 6.2.0-dev (via coho) 2017-01-03 17:45:55 -08:00
Steve Gill
676f0ddc2e CB-12314 updated release notes for 6.1.1 release 2017-01-03 17:45:15 -08:00
daserge
6c60dc5dc8 CB-12159 Android: Keystore password prompt won't show up
This closes #351
2016-12-08 09:51:24 -08:00
Joe Bowser
1af5ade39a Adding isClean to the spec, this really should have failed a few commits ago
This closes #349
2016-12-05 15:32:18 -08:00
Joe Bowser
ad40d33400 Need to pass lint 2016-11-21 16:36:20 -08:00
Joe Bowser
5017e2302b CB-12169: Check for build directory before running a clean 2016-11-21 14:46:09 -08:00
Joe Bowser
3bfeda4a3b Updating the timeout due to known travis issues 2016-11-03 11:35:42 -07:00
Jesse MacFadyen
348b1b4dda Do not test for non-existent build folder
This closes #348
2016-11-03 11:23:05 -07:00
Jesse MacFadyen
0fd7e7f040 Fixed AndroidStudio tests to actually run, removed app/src/main/assets/ as a requirement and added app/src/main/res instead, added placeholder for build/ folder, Removed dupe gitignore 2016-11-02 19:46:33 -07:00
Joe Bowser
cfa0fa7243 Update JS snapshot to version 6.2.0-dev (via coho) 2016-11-02 16:32:16 -07:00
Joe Bowser
6a63d9df0a Set VERSION to 6.2.0-dev (via coho) 2016-11-02 16:32:15 -07:00
Jesse MacFadyen
36646eb527 rewrite to use retro js
This closes #347
2016-11-02 16:30:14 -07:00
Joe Bowser
48940bf4c0 CB-12109 Updated RELEASENOTES and Version for release 6.1.0 2016-11-02 14:29:49 -07:00
Joe Bowser
5346a386f7 CB-12108: Updating gradle files to work with the latest version of Android Studio, since a patch release breaks this, and Gradle complains if you add the plus 2016-11-02 14:19:21 -07:00
Joe Bowser
b3201ad073 CB-12102: Bump travis to build to API 25 2016-11-01 16:39:09 -07:00
Joe Bowser
35b0ba6d07 Bumping up the version 2016-11-01 16:39:09 -07:00
Joe Bowser
3c087c6716 CB-12101: Spot fix to go into next patch release
This closes #346
2016-11-01 16:37:39 -07:00
Darryl Pogue
854946e313 CB-12077: Fix paths for Android icons/splashscreens
This closes #343
2016-10-31 11:31:26 -07:00
Sterling
d6a1d7a913 updated xxhdpi mipmap icon to 144x144 2016-10-28 21:57:54 -07:00
Sterling
700b425774 replaced with unstretched images 2016-10-28 17:20:56 -07:00
Sterling
e31634b0fb created directories and corresponding images for xxhdpi and xxxhdpi, both drawables and mipmaps 2016-10-28 17:03:45 -07:00
Steve Gill
1f06176149 added framework/build to .ratignore 2016-10-24 11:54:00 -07:00
Joe Bowser
e628026cf0 Fix for broken testUrl test 2016-10-20 12:47:33 -07:00
Joe Bowser
3a512c300e Last minute change of test targets 2016-10-20 12:25:47 -07:00
Joe Bowser
7f9e7c73ab Update JS snapshot to version 6.1.0-dev (via coho) 2016-10-20 11:49:04 -07:00
Joe Bowser
3e7be6cc0f Set VERSION to 6.1.0-dev (via coho) 2016-10-20 11:49:03 -07:00
Joe Bowser
81dfe96355 CB-12038 Updated RELEASENOTES and Version for release 6.0.0 2016-10-20 11:48:20 -07:00
Joe Bowser
efa23bd39b Updating the gradle build for test to use the latest 2016-10-20 11:25:06 -07:00
Joe Bowser
6aa4b1b301 CB-11083: Fixing syncronous file check and future-proofing the JS for Travis
This closes #323
2016-10-19 09:49:42 -07:00
Joe Bowser
304cbef5ed CB-11083: Reading files to check for CordovaLib dependency, if so, we exclude CordovaLib to be safe 2016-10-19 09:49:39 -07:00
Joe Bowser
263968e019 CB-11083: Plugin build script for dependencies without a gradle file 2016-10-19 09:49:39 -07:00
Joe Bowser
c05521e55a CB-11083: The GradleBuidler can tell the difference between a Cordova Plugin Framework and a regular framework based on the name 2016-10-19 09:49:39 -07:00
Joe Bowser
2f3c71feaa CB-11083 Fix to deal with custom frameworks with their own Gradle configuration 2016-10-19 09:49:39 -07:00
Steve Gill
0b710a86a9 CB-12003 updated node_modules 2016-10-17 10:50:30 -07:00
Martin Bektchiev
2e37d2c253 CB-11771 Deep symlink directories to target project instead of linking the directory itself
When installing a plugin with custom library using the --link option the whole directory is symlinked and temporary
files leak into the original plugin directory on build. This leads to broken builds if the same plugin is linked in
2 projects targeting different Cordova versions.

 This closes #326
2016-10-13 18:39:27 -07:00
Steve Gill
d7c1dc5517 updated .gitignore to include dev dep 2016-10-13 18:29:22 -07:00
Simon MacDonald
77b9fd62a7 Fix tab/space issue 2016-10-12 22:21:14 -04:00
Thomas Raffray
f838db4e18 CB-11880 android: Fail-safe for cordova.exec()
- added preliminary sanity check on args variable
- replication of iosExec() behaviour
- allows to call cordova.exec() without args variable

This closes #334
2016-10-12 15:20:40 -07:00
Jesse MacFadyen
b2d7124424 CB-11999 add message, catch exception if require fails 2016-10-12 11:48:06 -07:00
Joe Bowser
2532c4a39e This closes #308 2016-10-11 15:50:54 -07:00
Joe Bowser
be19585c68 Merge branch 'fix-appname-apostrophe' of https://github.com/revolunet/cordova-android
Using a merge commit to merge in a PR
This closes #272
2016-10-11 15:49:20 -07:00
Darryl Pogue
ca0cbad1c7 CB-8722 - Move icons from drawable to mipmap
This closes #340
2016-10-11 13:29:15 -07:00
Joe Bowser
fb53452d37 Unused requires cause AppVeyor to not work
This closes #339
2016-10-07 18:14:36 -07:00
Joe Bowser
b5246f3f09 Clean also wipes out the www directory, which was causing the strange errors that were happening when building 2016-10-07 18:14:36 -07:00
Joe Bowser
4be413af79 Removing try/catch now that we have the new tests and committing latest 2016-10-07 18:14:36 -07:00
Alexander Sorokin
5db2de95f5 CB-11964 Call clean after plugin install and mock it in tests 2016-10-07 18:14:36 -07:00
Joe Bowser
6418add83d Did a try/catch to deal with the unit tests vs actual project environment, code duplication is needed because of builderEnv 2016-10-07 18:14:36 -07:00
Joe Bowser
7d26c51da6 CB-11964: Do a clean when installing a plugin to et around the bug 2016-10-07 18:14:36 -07:00
Shazron Abdullah
dcada79e06 CB-11921 - Add github pull request template 2016-10-04 21:49:55 -07:00
Simon Pireyn
37384c583d CB-11935 Does a best-effort attempt to pause any processing that can be paused safely, such as animations and geolocation.
This closes #337
2016-10-03 16:16:52 -07:00
Joe Bowser
9544783b5e CB-11640: Fixing check_reqs.js so it actually works
This closes #338
2016-10-03 14:41:14 -07:00
Joe Bowser
eaf9b319ca Tweaking the regex 2016-10-03 14:41:14 -07:00
Joe Bowser
47abde2f8d CB-11640: Changing requirements check to ask for Java 8 2016-10-03 14:41:14 -07:00
daserge
30325e4f32 CB-11869 Fix cordova-js android exec tests
Useragent Regexp result is null in node environment - add a check for it
Updated cordova-js
Increased e2e create specs timeout
2016-09-29 12:24:52 +03:00
Joe Bowser
9cf38f8705 CB-11907: Bumping Gradle to work with Android Studio 2.2 and the Gradle Plugin, I should have done this last commit
This closes #336
2016-09-26 15:28:02 -07:00
Joe Bowser
7de4803e21 CB-11907: Bumping Gradle to work with Android Studio 2.2 and the Android Gradle Plugin 2016-09-26 15:06:44 -07:00
Joe Bowser
9586a7ddcd CB-11907: Bumping Android Gradle Plugin version to 2.2 so this works with Android Studio 2016-09-26 15:06:44 -07:00
Simon MacDonald
a4f6c8bf7b Enable background start of Cordova Android apps
This closes #322
2016-09-23 09:12:18 -07:00
Anis Kadri
f5ab6fc602 adding tests for Android Studio
This closes #331
2016-09-20 19:54:38 -07:00
Anis Kadri
222fb1c0e7 adding tests for AndroidStudio 2016-09-20 19:54:34 -07:00
Anis Kadri
511fe7c51e fixing jshint issues 2016-09-20 19:54:34 -07:00
Anis Kadri
acb3cc80b7 First attempt at supporting Android Studio 2016-09-20 19:54:34 -07:00
Pierre-Alexis de Solminihac
23fd0982b0 replace Integer.parseInt with BigInteger so that you can use longer Android version codes
I used to have DNS like version codes (YYYYmmmddXX format) for my apps builds, and I can't go back in older apps because Google Play wont allow me to upload inferior version codes, so I thing we should to use BigInteger instead of Integer.parseInt

This closes #298
2016-09-12 10:39:34 -07:00
Joe Bowser
d2a159d2dc Close #280 2016-09-09 14:23:33 -07:00
Joe Bowser
dc0bfeb0cc CB-11828: Adding dirty userAgent checking to see if we're running Jellybean or not for bridge modes 2016-09-09 12:05:19 -07:00
Joe Bowser
deea0f7e4f CB-11828: Switching default bridge back to ONLINE_BRIDGE 2016-09-09 12:05:19 -07:00
Simon MacDonald
3a33f4c0a6 Add gradle build flag to enable dex in process for large projects 2016-09-08 19:00:55 -04:00
Or Arnon
312872adaf added ability for cordova activity to be viewed in a real full screen regardless of android version (as was the case in previous cordova versions)
This closes #279
This closes #218

PR #218 didn't cleanly merge
2016-09-08 11:02:17 -07:00
Joe Bowser
ba5e3a81e0 Updating travis
This closes #328
2016-09-06 10:42:59 -07:00
Joe Bowser
bf5c32d780 Adding Static Method to CoreAndroid Plugin so we can get the BuildConfig data from other plugins 2016-09-06 10:42:51 -07:00
Joe Bowser
d3cb38de29 Bump Target and Min API levels 2016-09-06 10:42:51 -07:00
Simon MacDonald
047ed52d60 Make evaluateJavaScript brige default
This closes #320
2016-09-01 08:50:29 -07:00
Joe Bowser
bb96bb9a88 Creating an evaluateJavascript branch 2016-09-01 08:49:32 -07:00
Joe Bowser
0ee672d2b0 Close #253
I can't reproduce this issue, and the issue has been closed for a while,
closing the PR makes sense
2016-08-31 14:40:10 -07:00
dheeran1
2a8a6b3970 Update CoreAndroid.java
No modifier (package-private) class to public class

This closes #293
2016-08-30 12:55:12 -07:00
Joe Bowser
5dbc51da59 Close #262 2016-08-29 15:51:32 -07:00
Joe Bowser
f1a6d938cd Close #243 2016-08-29 15:50:06 -07:00
Joe Bowser
991a2b1873 Close #242 2016-08-29 15:49:03 -07:00
Joe Bowser
172c01561b Close #227 2016-08-29 15:48:26 -07:00
Joe Bowser
b2f061cbaf Close #219 2016-08-29 15:47:44 -07:00
Joe Bowser
1f1b2977a4 Close #185 2016-08-29 15:46:23 -07:00
Simon MacDonald
4a0a7bc424 Cordova-Android should use org.apache.cordova.LOG for logging
* Read LogLevel preference from config.xml
* Replace Log with LOG
* Add addition warning method to LOG
2016-08-22 13:19:51 -04:00
Shazron Abdullah
8fbb6d7c62 CB-11727 - travis ci setup is still using 0.10.32 node
This closes #325
2016-08-19 15:50:38 -07:00
Shazron Abdullah
0299467831 CB-11726 - Update appveyor node versions to 4 and 6, so they will always use the latest versions
This closes #324
2016-08-19 15:49:56 -07:00
Steve Gill
2efe240617 updated bundled cordova-common to 1.4.1 2016-08-16 13:23:10 -07:00
Vladimir Kotikov
ed543dc648 Close invalid PRs
This closes #317, closes #318
2016-08-11 14:53:22 +03:00
Szymon Drosdzol
db6295c917 CB-11683 Fixed linking to directories during plugin installation.
This closes #322
2016-08-11 14:47:36 +03:00
akilawickey
d54a42f0f0 fixed CB-11078 Empty string for BackgroundColor preference crashes application
This closes #316
2016-08-02 22:38:58 -07:00
Steve Gill
74ae6651c8 Update JS snapshot to version 5.3.0-dev (via coho) 2016-07-26 14:57:29 -07:00
Steve Gill
f33f352501 Set VERSION to 5.3.0-dev (via coho) 2016-07-26 14:57:28 -07:00
Steve Gill
39c17e71ef CB-11626 Updated RELEASENOTES and Version for release 5.2.2 2016-07-26 13:06:08 -07:00
Steve Gill
081637134f updated cordoova-common to 1.4.0 2016-07-22 12:24:27 -07:00
Joe Bowser
39165a8694 This closes #195 2016-07-11 15:30:10 -07:00
Joe Bowser
ad163ce244 Updaing the gradle for the tests to the latest 2016-07-11 14:26:36 -07:00
Vladimir Kotikov
a7176d39f0 CB-11550 Updated RELEASENOTES for release 5.2.1 2016-07-11 14:06:55 +03:00
Alexander Sorokin
f1c185b771 CB-9489 Fixed "endless waiting for emulator" issue 2016-07-06 15:12:36 +03:00
Steve Gill
103e1e8d24 Update JS snapshot to version 5.3.0-dev (via coho) 2016-06-29 15:04:55 -07:00
Steve Gill
30198c4bdd Set VERSION to 5.3.0-dev (via coho) 2016-06-29 15:04:55 -07:00
Steve Gill
841f02f43f CB-11444 Updated RELEASENOTES and Version for release 5.2.0 2016-06-29 15:04:55 -07:00
Joe Bowser
a5e9861440 Close #288 2016-06-29 14:48:50 -07:00
Vivek Kiran
d69698c23f Update plugin-build.gradle. This closes #312 2016-06-29 14:40:20 -07:00
Vivek Kiran
d763f14ffe CB-11481: android-library is deprecated use com.android.library instead 2016-06-29 12:10:51 -07:00
Joe Bowser
22918152cc Close #178 2016-06-28 10:49:49 -07:00
Joe Bowser
1fcee242dc Close #311 2016-06-27 16:00:39 -07:00
Joe Bowser
3f99c15338 Close #290 2016-06-27 15:58:49 -07:00
Joe Bowser
f496f015b6 Close #275 2016-06-27 15:58:27 -07:00
Joe Bowser
5e7e9d5b6c Close #266 2016-06-27 15:57:47 -07:00
Joe Bowser
8bd4ca49a8 Close #225 2016-06-27 15:54:26 -07:00
Joe Bowser
d33f7e08a8 We already implemented this, Close #222 2016-06-27 15:53:36 -07:00
Joe Bowser
d46ad592b5 Close #196 2016-06-27 15:53:00 -07:00
Joe Bowser
eda765453b Close #183 2016-06-27 15:50:51 -07:00
Joe Bowser
b295fc6687 Close #181 2016-06-27 15:49:10 -07:00
Joe Bowser
0959608ab9 Close #177 2016-06-27 15:46:23 -07:00
Joe Bowser
6db94dbb9a Close #172 2016-06-27 15:41:59 -07:00
Joe Bowser
04a3c9d9ee Adding mavenCentral just in case
This closes #309
2016-06-09 10:50:00 -07:00
Joe Bowser
db4d1f5768 CB-11383: Update to gradle for using jcenter and correct Application plugin 2016-06-06 11:21:30 -07:00
Steve Gill
81d6219663 CB-11365 fixed plugin rm issue with emit being undefined 2016-06-02 11:32:21 -07:00
Jason Ginchereau
3a1b4ffcb8 Use platform config.xml for clean
This closes #295
2016-05-31 10:27:40 -07:00
Jason Ginchereau
d6fe1a65eb Bundle updated node modules 2016-05-31 10:27:39 -07:00
Jason Ginchereau
72bbe9fdf0 CB-11117: Use FileUpdater to optimize prepare for android platform 2016-05-31 10:27:37 -07:00
Tony Homer
d125ece9e9 CB-10096: Upgrade test project to Gradle Plugin 2.1.0
This closes #306
2016-05-25 14:49:13 -07:00
Tony Homer
ecb99c963d CB-11292 fix broken MessageChannel after plugins are recreated
This closes #307
2016-05-25 14:49:13 -07:00
Richard Knoll
9738079c42 CB-11259: Improving build output
This closes #305
2016-05-17 13:31:12 -07:00
Joe Bowser
e9e27ca47c CB-10096: Upgrading to Gradle Plugin 2.1.0 2016-05-09 10:59:36 -07:00
Nikhil Khandelwal
5d21fb26e6 CB-11198 Skip android target sdk check. This closes #303. 2016-05-06 10:44:14 -07:00
PC Dreams (Paulo Cristo)
bcf3f8611a fix crash when calling methods on a destroyed webview 2016-05-04 08:42:14 +01:00
Vladimir Kotikov
d351e316bf CB-11138 Reuse PluginManager from common to add/rm plugins
This closes #301
2016-04-29 15:07:05 +03:00
Vladimir Kotikov
dc6384d063 CB-11138 Bump cordova-common to 1.2.0 2016-04-29 15:07:01 +03:00
daserge
914e2fa35f CB-11163 Android Builds are failing in CI
CB-11133 Handle android emulator start failure (reverted from commit abcaee24f9)
2016-04-28 17:25:39 +03:00
Nikhil Khandelwal
8b96081579 CB-11153 Move to gradle version 2.13
This closes #299
2016-04-26 14:56:02 -07:00
Nikhil Khandelwal
f3e0623d1d CB-11153 Use Gradle 2.8 correctly for building Android projects 2016-04-26 14:55:55 -07:00
daserge
abcaee24f9 CB-11133 Handle android emulator start failure 2016-04-26 19:54:34 +03:00
daserge
8951660393 CB-11132 Fix Error: Cannot read property 'match' of undefined in cordova-android emulator.js 2016-04-21 15:40:33 +03:00
Nikhil Khandelwal
e4ecbad3cb Add simple log for package name being deployed 2016-04-20 09:36:02 -07:00
daserge
40a740b45c CB-11015 Error adding plugin with gradle extras 2016-04-18 13:20:25 +03:00
Vladimir Kotikov
9af7f506f0 CB-11095 Fix plugin add/removal when running on Node v.010 2016-04-18 12:26:39 +03:00
Vladimir Kotikov
9b8558dbde CB-11022 Duplicate www files to both destinations on plugin operations
This closes #289
2016-04-14 12:03:44 +03:00
daserge
d28ca67edb CB-10964 Handle build.json file starting with a BOM. This closes #286 2016-04-08 15:32:04 -07:00
Omar Mefire
0deaba0920 Revert "CB-10881: Logging to further investigations"
This reverts commit 1b43bc99a1.
2016-04-06 10:21:40 -07:00
Joe Bowser
bcb10ba6da Modified build.gradle so that the tests run again 2016-04-04 14:14:57 -07:00
Richard Knoll
ef268e2320 CB-10963: Handle overlapping permission requests from plugins
This closes #285
2016-03-29 15:14:41 -07:00
daserge
d9814c5542 CB-8582 Obscure INSTALL_FAILED_VERSION_DOWNGRADE error when installing app 2016-03-28 13:22:22 +03:00
daserge
dd3b9dd01c CB-10862 Cannot set minsdkversion 2016-03-28 11:35:40 +03:00
Omar Mefire
1b43bc99a1 CB-10881: Logging to further investigations 2016-03-25 08:57:09 -07:00
Joe Bowser
eccde6c0c0 CB-10896: We never enabled cookies on the WebView proper 2016-03-22 12:45:23 -07:00
Vladimir Kotikov
69a2a5b551 CB-10837 Support platform-specific orientation on Android
Remove processing of "orientation" preference and let
user to specify any platform-specific value for Android

 This closes #281
2016-03-21 18:30:20 +03:00
daserge
bc9e895e25 CB-10600 'cordova run android --release' does not use signed and zip-aligned version of APK
De-prioritize unsigned builds
Adds an actionable hint for INSTALL_PARSE_FAILED_NO_CERTIFICATES error
Removes filtering by architecture when not specified
2016-03-18 08:59:59 +03:00
Roberto Andrade
457c5b8b3b CB-9710: Fixing issues parsing android avd list output for certain AVDs which resulted in them not being included in the selection process even if they are the best match.
This closes 221
2016-03-16 09:32:24 -07:00
Vladimir Kotikov
9f1aedb56d CB-10888 Enable coverage reports collection via codecov 2016-03-16 17:42:01 +03:00
Julien Bouquillon
2cefb42559 fix issue with app_name containing apostrophes 2016-03-14 14:01:43 +01:00
Vladimir Kotikov
a048aa94ec CB-10846 Add Travis and AppVeyor badges to readme 2016-03-11 13:35:14 +03:00
Vladimir Kotikov
27d359bd43 CB-10846 Add AppVeyor configuration 2016-03-11 13:03:18 +03:00
Julien Bouquillon
456b4801af add JIRA issue tracker link. This closes #213 2016-03-11 11:40:00 +03:00
daserge
82582e5a5b CB-10749 Use cordova-common.CordovaLogger in cordova-android
Added -d shorthand to all platform scripts
2016-03-09 18:54:05 +03:00
Byoungro So
18e81c4b90 CB-10673 fixed conflicting plugin install issue with overlapped <source-file> tag. Add --force flag. This closes #264. 2016-03-07 23:02:19 -08:00
Joe Bowser
bad0034e5d CB-8976: I wish there was an easier way to test gradle stuff then check it in without having to remember to delete imports
This closes #270
2016-03-04 09:53:01 -08:00
Joe Bowser
99d5ff7347 CB-8976: Accidentally left in the crosswalk build from when I was experimenting with this file 2016-03-04 09:53:00 -08:00
Joe Bowser
dc579417fe CB-8976: Removing the auto-version for non-Crosswalk applications 2016-03-04 09:53:00 -08:00
daserge
fe906dabda CB-10768 Use cordova-common.superspawn in GradleBuilder 2016-03-03 21:12:28 +03:00
Vladimir Kotikov
8ab75e7109 CB-10729 Move plugin handlers tests for into platform's repo 2016-03-01 11:31:14 +03:00
daserge
aa2b3d3da1 CB-10669 cordova run --list cannot find 'adb' 2016-02-26 13:29:26 +03:00
Byoungro So
0a1b71f125 CB-10660 fixed the exception when removing a non-existing directory. This closes #261 2016-02-26 10:40:33 +03:00
Steve Gill
757a3685f2 Update JS snapshot to version 5.2.0-dev (via coho) 2016-02-24 11:50:08 -08:00
Steve Gill
fd2c3c9857 Set VERSION to 5.2.0-dev (via coho) 2016-02-24 11:50:06 -08:00
Steve Gill
84477ff212 CB-10687 Updated RELEASENOTES and Version for release 5.1.1 2016-02-24 11:49:48 -08:00
Steve Gill
1d7ccaece6 updated cordova-common dependnecy to 1.1.0 2016-02-24 09:50:07 -08:00
daserge
ce2525d4d8 CB-10628 Fix emulate android --target
Added a test case
2016-02-18 21:27:40 +03:00
Vladimir Kotikov
7be9e880c2 CB-10618 Handle gradle frameworks on plugin installation/uninstallation
This closes #259
2016-02-17 17:56:09 +03:00
riknoll
7233931681 CB-10510: Add an optional timeout to emu start script
The script used to wait forever for the emulator to boot.
If the emulator got stuck, it would never terminate.
This timeout is being added to support cordova-medic and
the CI.
2016-02-11 13:37:00 -08:00
riknoll
d7e111fb71 CB-10498: Resume event should be sticky if it has a plugin result 2016-02-03 13:25:56 -08:00
Tony Homer
2ac191fbb8 fix HtmlNotFoundTest so that it passes when file not found is handled correctly
This Closes #256
2016-02-01 16:11:17 -05:00
Carlos Santana
088140aca4 CB-10472 NullPointerException: org.apache.cordova.PluginManager.onSaveInstanceState
check if pluginManager is null before using it
This closes #255
2016-01-29 13:19:00 -05:00
Vladimir Kotikov
e08d0671ab CB-10138 Adds missing plugin metadata to plugin_list module. This closes #254 2016-01-28 12:45:19 +03:00
Dimitar Kerezov
7669378c6e CB-10443 Pass original options instead of remaining
Nopt parses all options regardless of what is passed as "knownOpts". This leaves the remain property an emtpy array.
This ultimately leads to a bug in the parseOpts function where the options undergo a second parsing from nopt.
The end result is - this options are not respected at all..
This closes #248
2016-01-28 11:55:29 +03:00
Dimitar Kerezov
1494082a2a CB-10443 Fix this.root null reference
parseOpts function referenced this.root but the this object is not the new Api as expected. This leads to an exception upon calling path.relative(this.root, ...).
2016-01-28 11:55:15 +03:00
Vladimir Kotikov
233c2bd882 CB-10421 Fixes exception when calling run script with --help option 2016-01-26 14:56:29 +03:00
Steve Gill
9c4f09a50a updated .gitignore 2016-01-22 11:59:43 -08:00
Vladimir Kotikov
89d982a8e4 CB-10406 Fixes an exception, thrown when building using Ant. This closes #250 2016-01-22 13:29:50 +03:00
Vladimir Kotikov
9d3ee3d56e CB-10157 Uninstall app from device/emulator only when signed apk is already installed 2016-01-22 12:36:48 +03:00
Steve Gill
44421bbc79 added missing node_modules 2016-01-20 17:07:49 -08:00
Steve Gill
320558a782 Update JS snapshot to version 5.2.0-dev (via coho) 2016-01-20 16:18:53 -08:00
Steve Gill
9ef7ddbf20 Set VERSION to 5.2.0-dev (via coho) 2016-01-20 16:18:52 -08:00
Steve Gill
603f994f3f Updated RELEASENOTES and Version for release 5.1.0 2016-01-20 15:49:00 -08:00
Nikhil Khandelwal
ada35e0e00 Fix jshint issues 2016-01-19 12:01:44 -08:00
Nikhil Khandelwal
fc778006ef CB-10386 Add android.useDeprecatedNdk=true to support NDK in gradle 2016-01-19 11:36:39 -08:00
Joe Bowser
11760afddd CB-8864: Fixing this to mitigate CB-8685 and CB-10104 2016-01-12 10:39:55 -08:00
Joe Bowser
d78ae309f1 CB-10105: Spot fix for tilde errors on paths. 2016-01-11 15:53:00 -08:00
Darryl Pogue
73fd9e4dfa Update theme to Theme.DeviceDefault.NoActionBar
This uses the device system theme instead of the old Gingerbread-era theme for dialogs and alerts.

Available as of API 14, which is now the minSDK version for cordova-android.

This closes 245
2016-01-04 12:31:56 -08:00
Darryl Pogue
fb9cf60c41 CB-10014: Set gradle applicationId to package name.
This closes 247
2016-01-04 12:18:55 -08:00
Keith Wong
b6a329d479 CB-9949: Fixing menu button event not fired in Android
This closes 246
2015-12-16 13:25:19 -08:00
Joe Bowser
70bc7b39b7 CB-9479: Fixing the conditionals again, we should be more vigilant on the gradle versions. 2015-12-07 15:03:02 -08:00
Vladimir Kotikov
03777067cd CB-10112 Parse additional CLI arguments properly. This closes #241 2015-12-03 13:54:59 +03:00
riknoll
f5271431fb CB-8917: New Plugin API for passing results on resume after Activity destruction 2015-12-02 09:49:49 -08:00
Vladimir Kotikov
c30eeee5d8 CB-9971 Suppress gradlew _JAVA_OPTIONS output during build 2015-11-20 11:57:18 +03:00
daserge
dac02bef8c CB-9836 Add .gitattributes to prevent CRLF line endings in repos
Normalizes plist line endings to be LF

github: close #231
2015-11-12 18:34:41 +03:00
Alexander Sorokin
32edaee3a2 CB-9831 CB-9835 CB-9932 Added e2e tests 2015-11-11 14:06:43 +03:00
Steve Gill
ff1c58def4 added node_modules back into .gitignore 2015-11-02 17:08:55 -08:00
Steve Gill
f9372f5578 checked in missing node_module dependencies that are required 2015-11-02 17:07:12 -08:00
Steve Gill
6afc16c33b Update JS snapshot to version 5.1.0-dev (via coho) 2015-11-01 23:43:03 -08:00
Steve Gill
74a3d2028f Set VERSION to 5.1.0-dev (via coho) 2015-11-01 23:43:00 -08:00
Steve Gill
dfe468f335 CB-9922 Updated RELEASENOTES and Version for release 5.0.0 2015-11-01 23:41:46 -08:00
Steve Gill
4f7721b405 updated node_modules 2015-10-30 19:43:08 -07:00
TyIsI
3abd12aee3 Update CordovaWebViewEngine.java
Fixed typo. This closes #234
2015-10-30 05:08:18 -07:00
Tim Barham
1c90a77325 CB-9909 Shouldn't escape spaces in paths on Windows.. This closes #237 2015-10-30 04:58:26 -07:00
Steve Gill
671219ae56 CB-9870 updated hello world template 2015-10-29 15:33:43 -07:00
Vladimir Kotikov
78fa7374d9 CB-9880 Fixes platform update failure when upgrading from android@<4.1.0 2015-10-28 12:42:35 +03:00
Vladimir Kotikov
c1b389ad9b CB-9844 Remove old .java after renaming activity 2015-10-27 11:30:58 +03:00
Joe Bowser
5a07a51b5d Checked the notice file, updating to 2015 2015-10-26 16:42:06 -07:00
Dmitry Blotsky
824b9803d2 CB-9800 Fixing contribute link. 2015-10-23 15:16:41 -07:00
Vladimir Kotikov
ab72e48431 CB-9782 Check in cordova-common dependency 2015-10-22 22:43:39 +03:00
Vladimir Kotikov
78b7ae72c9 Adds licence header to Adb to pass rat audit 2015-10-22 14:06:20 +03:00
Vladimir Kotikov
1151856d38 CB-9835 Downgrade properties-parser to prevent failures in Node < 4.x 2015-10-21 13:24:30 +03:00
Steve Gill
12c282ce5c reverted fixed line endings in check_reqs.bat 2015-10-20 16:48:59 -07:00
Steve Gill
0ac822c577 Fixed line endings 2015-10-20 16:15:57 -07:00
Vladimir Kotikov
400282282f CB-9782 Implements PlatformApi contract for Android platform.
This closes #226
2015-10-20 12:21:30 +03:00
Alexander Sorokin
789c505a88 CB-9826 Fixed 'test-build' script on windows. This closes #228 2015-10-20 12:02:27 +03:00
fujunwei
0429bb0ab8 The extra digit need to be added to the end of the version code
The version code of default config is generated by the environment variable
and the value from AndroidManifest.xml.
The test case is using the command line "cordova build -- --versionCode=100".. This closes #211
2015-10-19 11:25:33 -07:00
Joe Bowser
000eb0916e Incrementing Travis to 23 2015-10-19 10:31:56 -07:00
Joe Bowser
4db1fecba8 You can't easily abstract out this variable because this can crash Cordova due to the plugin design. 2015-10-19 10:31:56 -07:00
Joe Bowser
013ad94af0 Refactor of the Cordova Plugin/Permissions API 2015-10-19 10:31:56 -07:00
Joe Bowser
2ceb8030ee Manually updating version to 5.0.0-dev for engine tags 2015-10-19 10:31:55 -07:00
Joe Bowser
47ac514835 Working on getting the Geolocation Plugin to work by default with the default WebView. Crosswalk will need to make similar modifications. 2015-10-19 10:31:55 -07:00
Joe Bowser
5e0c9595c3 Got the PoC working with the Contacts plugin, going to work through all the plugins 2015-10-19 10:31:55 -07:00
Joe Bowser
a0747aa960 Refactoring based on feedback from Andrew 2015-10-19 10:31:55 -07:00
Joe Bowser
07912fdecd Bump up to API level 23 2015-10-19 10:31:54 -07:00
Joe Bowser
9a33943783 Finally got it kinda working, Geolocation is not going to work in browser anymore 2015-10-19 10:31:54 -07:00
Joe Bowser
8981ddb681 Commiting code to handle permissions, and the special case of the Geolocation Plugin 2015-10-19 10:31:54 -07:00
daserge
7d61a79a78 CB-9608 cordova-android no longer builds on Node 0.10 or below
Replaced path.isAbsolute usage with path.resolve. This closes #217
2015-09-29 09:45:48 +03:00
daserge
afa61aeb09 CB-9080 Cordova CLI run for Android versions 4.1.1 and lower throws error 2015-09-23 18:44:41 +03:00
Vladimir Kotikov
bf57aa1df0 CB-9557 Fixes apk install failure when switching from debug to release build 2015-08-27 09:46:58 +03:00
Tommy-Carlos Williams
055e3bf609 CB-9496 removed permissions added for crosswalk
These would better live in the actual crosswalk plugin

https://github.com/crosswalk-project/cordova-plugin-crosswalk-webview

I have also submit a PR to that repo adding them to its `plugin.xml`

github: close #206
2015-08-24 23:17:03 +10:00
Alexander Lebedev
b1dadaf15d CB-9402 Allow to set gradle distubutionUrl via env variable CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL
This closes #205
2015-08-14 11:28:35 -07:00
Joe Bowser
9e400911f5 Make Cordova pass the Lint step 2015-08-10 16:43:41 -07:00
Steve Gill
892b875867 updated release notes 2015-07-31 16:54:52 -07:00
Steve Gill
8f7bc1ffbb CB-9428 update script now bumps up minSdkVersion to 14 if it is less than that. 2015-07-31 16:32:51 -07:00
Vladimir Kotikov
e5506d40bc CB-9430 Fixes check_reqs failure when javac returns an extra line 2015-07-31 16:37:21 +03:00
alsorokin
64f89c5eda CB-9172 Improved emulator deploy stability. This closes #188.
- Use UUID to distinguish between launched emulators
- Wait for android.process.acore instead of init.svc.bootanim on emulator boot
- Increased retry timeout when installing app to the emulator
- If there is already a started/starting emulator, wait for it's boot instead of trying to deploy to it right away
2015-07-31 03:59:53 -07:00
alsorokin
1ad0665eb5 CB-9404 Fixed an exception when path contained -debug or -release 2015-07-23 18:55:11 +03:00
Joe Bowser
37309c23c2 CB-8320: Setting up gradle so we can use CordovaLib as a standard Android Library 2015-07-22 13:23:28 -07:00
alsorokin
8983ddbdcc CB-9185 Fixed an issue when unsigned apks couldn't be found. This closes #202 2015-07-22 11:00:07 -07:00
Vladimir Kotikov
d99a21eb8d CB-9397 Fixes minor issues with cordova requirements android 2015-07-22 16:45:49 +03:00
Vladimir Kotikov
f9ce1c607b CB-9389 Fixes build/check_reqs hang
This removes gradle version check since it requires downloading and
installing of gradle distributive if it is not installed yet.

Partial revert of 4bf705a
2015-07-22 13:20:39 +03:00
Nikhil Khandelwal
847312fcf9 Update JS snapshot to version 4.2.0-dev (via coho) 2015-07-20 09:52:18 -07:00
Nikhil Khandelwal
b770076b7f Set VERSION to 4.2.0-dev (via coho) 2015-07-20 09:52:14 -07:00
Nikhil Khandelwal
dc9413258e CB-9394 Updated RELEASENOTES - Fixing typo 2015-07-20 09:44:06 -07:00
Nikhil Khandelwal
4b574a2863 CB-9394 Updated RELEASENOTES 2015-07-20 09:40:18 -07:00
Jose Pereira
4b3cc67353 CB-9392 Fixed printing flavored versions. This closes #184 2015-07-20 16:52:28 +03:00
sgrebnov
32b72756f3 CB-9382 [Android] Fix KeepRunning setting when Plugin activity is showed. This closes #200 2015-07-20 16:02:21 +03:00
Malte Legenhausen
2fc86e2833 CB-9391 Fixes cdvBuildMultipleApks option casting
This closes #199
2015-07-20 15:59:27 +03:00
Simon Pireyn
fab472859d CB-9343 Split the Content-Type to obtain a clean mimetype
This closes #197
2015-07-20 13:28:40 +03:00
Connor Pearson
92caa3a186 CB-9255 Make getUriType case insensitive.
This closes #186
2015-07-20 13:14:31 +03:00
Vladimir Kotikov
26c7a96255 CB-9149 Fixes JSHint issue introduced by 899daa9 2015-07-20 13:00:17 +03:00
Omar Mefire
e170e463fe CB-9372: Remove unused files: 'main.js' & 'master.css'. This closes #198 2015-07-20 12:42:38 +03:00
Tony Homer
899daa9ea7 CB-9149 Make gradle alias subprojects in order to handle libs that depend on libs. This closes #182 2015-07-17 16:10:16 -04:00
Simon MacDonald
6d334c05e9 Update min SDK version to 14 2015-07-07 14:29:45 -07:00
Nikhil Khandelwal
5ac0cc51d3 Update licenses. This closes #190 2015-07-07 11:38:17 -07:00
Joe Schneider
f93c2b161d CB-9185 Fix signed release build exception. This closes #193. 2015-07-07 11:35:53 -07:00
Vladimir Kotikov
6b071c0fb2 CB-9286 Fixes build failure when ANDROID_HOME is not set. 2015-07-03 09:46:39 +03:00
Nikhil Khandelwal
d3245a43d3 CB-9284 Fix for handling absolute path for keystore in build.json 2015-07-02 15:13:31 -07:00
alsorokin
90a51c2cc1 CB-9260 Install Android-22 on Travis-CI 2015-06-30 11:35:28 +03:00
Dmitry Blotsky
61df5e0a37 Adding .ratignore file. 2015-06-16 21:30:59 -07:00
Dmitry Blotsky
c0312f9b50 CB-9119 Adding lib/retry.js for retrying promise-returning functions. Retrying 'adb install' in emulator.js because it sometimes hangs. 2015-06-12 11:50:15 -07:00
Volker Braun
eb70f05168 CB-9115 android: Grant Lollipop permission req
This patch overrides onPermissionRequest so that getUserMedia can be
used inside the browser.

Since a hybrid app has to request permissions anyways via
AndroidManifest.xml, I think it is unnecessary to have any further
configuration for onPermissionRequest. Anything that the app is allowed
to do should be possible from the JS side. Hence all requests are
granted. This enables getUserMedia (and WebRTC) on Android Lollipop,
without resorting to crosswalk.

The docs say that request.grant has to be called from the UI thread, but
don't explicitly spell out whether onPermissionRequest is called from
the UI thread. I think that this is so, the WebChromeClient of course
makes its calls from the UI thread unless otherwise noted. So there is
no need to post a runnable to the UI thread.

This closes 178
https://github.com/apache/cordova-android/pull/178
2015-06-10 11:53:03 -07:00
Nikhil Khandelwal
505db38232 Remove extra console message 2015-06-05 10:21:53 -07:00
Vladimir Kotikov
096e1e3caa CB-8898 Report expected gradle location properly 2015-06-03 21:57:50 +03:00
Vladimir Kotikov
b5d8b51310 CB-8898 Fixes gradle check failure due to missing quotes 2015-06-03 12:37:25 +03:00
Joe Bowser
c9e7201058 CB-9080: -d option is not supported on Android 4.1.1 and lower, removing 2015-06-02 07:43:33 -07:00
Vladimir Kotikov
4bf705a3d3 CB-8954 Adds requirements command support to check_reqs module 2015-05-29 13:00:38 +03:00
Steve Gill
ce42568721 Update JS snapshot to version 4.1.0-dev (via coho) 2015-05-20 13:12:35 -07:00
Joe Bowser
eb956b2449 Updating Release Notes 2015-05-19 08:14:04 -07:00
Steve Gill
1bf4e93da1 CB-8417 updated platform specific files from cordova.js repo 2015-05-18 18:41:53 -07:00
Joe Bowser
aba0a8421b Adding tests to confirm that preferences aren't changed by Intents 2015-05-15 14:13:18 -07:00
Joe Bowser
b5a58e6ca0 updating existing test code 2015-05-15 14:13:18 -07:00
Joe Bowser
44aa7464e1 Forgot to remove the method that copied over the intent data 2015-05-15 14:13:18 -07:00
Joe Bowser
4ea684dd7a Getting around to removing this old Intent code 2015-05-15 14:13:18 -07:00
Steve Gill
215b7e08f8 Update JS snapshot to version 4.1.0-dev (via coho) 2015-05-08 15:33:05 -07:00
Andrew Grieve
754911f346 Fix CordovaPluginTest on KitKat (start-up events seem to change) 2015-05-06 09:59:22 -04:00
Bochun Bai
9873106785 CB-3360 Allow setting a custom User-Agent (close #162) 2015-05-06 09:59:22 -04:00
Kenneth Chan
d005359f89 CB-8902 Use immersive mode when available when going fullscreen (close #175) 2015-05-06 09:46:35 -04:00
Andrew Grieve
1ce52a2845 Make BridgeMode methods public (they were always supposed to be) 2015-04-23 16:07:20 -04:00
Andrew Grieve
7e480d1ff9 Simplify: EncodingUtils.getBytes(str) -> str.getBytes() 2015-04-23 15:58:56 -04:00
Andrew Grieve
85877d259c Don't show warning when gradlew file is read-only 2015-04-23 15:38:48 -04:00
Andrew Grieve
0b86db8748 Don't show warning when prepEnv copies gradlew and it's read-only 2015-04-23 15:34:25 -04:00
Andrew Grieve
bca7f62efd Make gradle wrapper prepEnv code work even when android-sdk is read-only 2015-04-23 15:18:01 -04:00
Andrew Grieve
4953ae84cd CB-8897 Delete drawable/icon.png since it duplicates drawable-mdpi/icon.png 2015-04-22 21:59:02 -04:00
Joe Bowser
e96a5a0b3e Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/cordova-android 2015-04-22 14:19:03 -07:00
Joe Bowser
e4678f4709 CB-8894: Updating the template to target mininumSdkTarget=14 2015-04-22 14:18:41 -07:00
Joe Bowser
1def13deb3 Updating the template to target mininumSdkTarget=14 2015-04-22 14:15:18 -07:00
Andrew Grieve
bce4283239 CB-8891 Add a note about when the gradle helpers were added 2015-04-22 09:53:13 -04:00
Andrew Grieve
9ff786d021 CB-8891 Add a gradle helper for retrieving config.xml preference values 2015-04-22 09:51:16 -04:00
Andrew Grieve
ee14a67795 CB-8884 Delete Eclipse tweaks from create script 2015-04-21 14:24:15 -04:00
Andrew Grieve
b63a2e37be CB-8834 Don't fail to install on VERSION_DOWNGRADE 2015-04-09 11:28:55 -04:00
Andrew Grieve
84274b4259 Update JS snapshot to version 4.1.0-dev (via coho) 2015-04-09 11:05:48 -04:00
Andrew Grieve
b6bf5298e6 Set VERSION to 4.1.0-dev (via coho) 2015-04-09 11:05:47 -04:00
Andrew Grieve
b0d5ffec8f Delete unused packate "which" from package.json 2015-04-09 11:03:36 -04:00
Andrew Grieve
09ff81c411 Add some missing license headers 2015-04-09 10:56:33 -04:00
Andrew Grieve
a0293578b1 CB-8829 Set targetSdk to 22 2015-04-08 21:34:15 -04:00
Andrew Grieve
4595403a99 CB-8828 Delete onScrollChanged event 2015-04-08 21:34:15 -04:00
Andrew Grieve
0f73884c8d CB-8827 Call onResume for plugins on start-up
As a result, simplifies CordovaActivity by removing the now unused "activityState" field
2015-04-08 21:06:23 -04:00
Andrew Grieve
2e9cbdcb0d Remove unused CordovaWebViewImpl parameter, and make pluginManager private
It was public by accident - with the final design leaving it public does
not help with backwards-compatibility.
2015-04-08 21:01:50 -04:00
Tony Homer
a652d892ca CB-8684 Add onStart/onStop hooks for plugins (close #173) 2015-04-08 20:33:31 -04:00
Andrew Grieve
581252febc CB-8814 Deprecate ScrollEvent 2015-04-07 21:15:33 -04:00
Andrew Grieve
b27d283f21 CB-8548 Fix keystore type detection (broken by 97718a0a25) 2015-04-07 20:36:13 -04:00
Andrew Grieve
f2d7c49acf Fix manual tests not finding activity plugin
Was broken by recent refactor: 5b87380749
2015-04-07 13:30:26 -04:00
Andrew Grieve
a397a23a9c Update Android Studio test instructions 2015-04-07 10:12:20 -04:00
Andrew Grieve
9f7e179288 Update test/README.md to say they are no longer in disrepair, and that robotium isn't used. 2015-04-07 09:52:12 -04:00
Nikhil Khandelwal
ad1c3d2438 CB-8484 Add signing flags to build and run scripts
Parameters for creating signed archives can be specified using command line or build.json file as part of the --buildConfig argument.
close #164
2015-04-01 19:53:56 -04:00
Andrew Grieve
51adf81918 CB-8781 Add building of .so files within libs/ to gradle rules 2015-04-01 13:33:48 -04:00
Andrew Grieve
97718a0a25 CB-8548 Allow ant-style property key for key.store.type
Other properties already allowed ant-style. This one was missed.
2015-03-31 20:42:26 -04:00
Serge Huijben
1aaba440b5 CB-8768 Fix onActivityResult called before plugins are loaded (after MainActivity gets killed)
situation: one of the plugins launches startActivityForResult and the Android OS decides to kill our MainActivity.
once the launched activity is fulfilled it comes back to our MainActivity, which has to be recreated first.
unfortunately Android calls onActivityResult before our Activity has fully loaded our installed plugins.

close #171
2015-03-31 13:58:22 -04:00
Andrew Grieve
b8f2b8948f Fix lint errors breaking travis CI 2015-03-31 10:07:27 -04:00
Andrew Grieve
d96d49329b CB-8717 Add note to releasenotes about removal of hidekeyboard and showkeyboard events 2015-03-30 10:33:29 -04:00
Andrew Grieve
4db421ca36 CB-8717 Add OkHttp removal to RELEASENOTES 2015-03-27 16:33:43 -04:00
Andrew Grieve
c3991c8164 CB-8717 Tweak RELEASENOTES.md 2015-03-27 16:30:21 -04:00
Jason Chase
e904bab206 CB-8717 Write cordova-android@4.0.0 release notes (close #167) 2015-03-27 16:21:17 -04:00
Serge Huijben
500ccd8e80 CB-8764 Store serviceName instead of class (close #169) 2015-03-27 10:15:48 -04:00
Serge Huijben
7cf7311a9d CB-8764 Save instanceState before calling super 2015-03-27 10:15:41 -04:00
Andrew Grieve
0669edddae Notify plugins of pause/resume before queing JS event (no-op)
This is actually already the order things happen in since JS events are async. Might as well be clearer about it.
2015-03-25 22:07:50 -04:00
Jason Chase
38a8d7742e CB-8715 Update comments to match whitelist code (close #166) 2015-03-25 09:34:13 -04:00
Tim Lancina
32e84d2316 CB-7085 Add onConfigurationChanged hook for plugins (close #165) 2015-03-24 13:36:25 -04:00
Joe Bowser
151b86cb7b CB-8735: Adding link as per Ian's suggestion 2015-03-23 15:54:05 -07:00
Joe Bowser
e4c9bebe34 CB-8735: Fixing the regex so that it's more compliant with Java package rules 2015-03-23 15:23:30 -07:00
Andrew Grieve
8d5cb00bec CB-8702 Add API for plugins to override shouldInterceptRequest with a stream 2015-03-18 11:02:27 -04:00
Andrew Grieve
15530a4820 Add CordovaPlugin.getServiceName() 2015-03-18 10:47:23 -04:00
Andrew Grieve
f6e56b345d CB-8699 Fix CordovaResourceApi copyResource creating zero-length files when src=uncompressed asset 2015-03-17 21:36:11 -04:00
Andrew Grieve
56d61eb44f Delete a couple of unreferenced .java files 2015-03-17 11:58:19 -04:00
Andrew Grieve
2103da7b9d CB-8693 Delete framework/res and framework/assets
They were being merged into apps unwantingly.
2015-03-17 11:56:02 -04:00
Andrew Grieve
679069729c CB-7747 When both allow-navigation and allow-external are set, navigate instead of opening external
Also: Move shouldOverrideUrlLoading logic into CordovaWebViewEngine.Client
2015-03-13 11:32:54 -04:00
Andrew Grieve
f764448ccc Tweak PluginManager.setPluginEntries() to create startup plugins when called post init() 2015-03-12 16:33:55 -04:00
Andrew Grieve
e1828696f7 CB-8295 Update app template with fix to CSP string 2015-03-11 21:14:39 -04:00
Joe Bowser
5b87380749 Updating use case to use ConfigXmlParser() instead of deprecated config class 2015-03-11 15:08:06 -07:00
Andrew Grieve
917d0dfc49 XmlPullParserFactory -> XmlPullParser in ConfigXmlParser
This allows clients to parse non-resourse XML
2015-03-06 16:16:06 -05:00
Andrew Grieve
191839f764 Tweak CSP of default template 2015-03-06 09:54:48 -05:00
Andrew Grieve
316cf057f3 Update project template with new whitelist defaults 2015-03-05 22:31:48 -05:00
Andrew Grieve
55be212594 CB-7747 Update default network whitelist to allow for ChromVox scripts 2015-03-05 21:38:21 -05:00
Andrew Grieve
489e63f8e7 CB-8608 Add blob: to default shouldAllowRequest policy 2015-03-04 11:09:38 -05:00
Andrew Grieve
62c081dc85 CB-8592 Fix NPE if lifecycle events reach CordovaWebView before init() has been called 2015-03-03 09:51:39 -05:00
Andrew Grieve
023ad9ddf8 CB-8510 Enforce that CordovaWebViewImpl is instantiated with an Engine
No reason to not enforce this.
2015-03-03 09:51:03 -05:00
Andrew Grieve
eccf486162 Add about:blank and data: to default shouldAllowNavigation() 2015-03-02 21:40:28 -05:00
Andrew Grieve
a6da46a00e CB-8510 Remove shouldOverrideUrlLoading from CordovaWebViewEngine.Client.
It's logic that's pretty webview-specific, so it doesn't make sense to
share.
2015-03-02 21:04:21 -05:00
Andrew Grieve
747d2c97cd CB-8588 Add CATEGORY_BROWSABLE to intents from showWebPage openExternal=true 2015-03-02 21:04:20 -05:00
Andrew Grieve
af2969dec5 CB-8587 Don't allow webview navigations within showWebPage that are not whitelisted 2015-03-02 21:04:20 -05:00
Andrew Grieve
53dba8678c Delete no longer relevant comments about <url-filter> 2015-03-02 20:43:10 -05:00
Andrew Grieve
afdac9b413 Split out shouldAllowBridgeAccess from shouldAllowNavigation
This will allow a plugin to be created that allows iframes to be
navigated to, but disallow them from accessing the bridge.

Note: This isn't a configuration that we're planning on supporting with
the default whitelist plugin, but still does make sense to enable for
the experts in the room
2015-03-02 20:40:08 -05:00
Andrew Grieve
1ad280db98 Add an isSecretEstablished() getter to CordovaBridge
Not being used, but might be of use to an Engine plugin or a Whitelist
plugin.
2015-03-02 20:37:33 -05:00
Andrew Grieve
035c3ad319 Simplify default navigation policy to allow navigations within /app_webview/
It's really on XHRs to it that are an issue.
2015-02-27 15:46:17 -05:00
Andrew Grieve
c237a1c0d2 Log a warning when a navigation is blocked by the whitelist 2015-02-27 15:45:37 -05:00
Andrew Grieve
f1d093548e Make ConfigXmlParser take a Context rather than Activity 2015-02-27 15:45:16 -05:00
Andrew Grieve
beab74adf5 CB-8548 Allow ant-style property keys in signing.properties files
Provides easier backwards compatibility
close #155
2015-02-25 15:41:58 -05:00
Nikhil Khandelwal
2a49e8a931 CB-8520 Fix for extra args being added twice for build command (close #159) 2015-02-25 14:28:06 -05:00
Andrew Grieve
395857c37c close #160 2015-02-25 14:27:40 -05:00
Andrew Grieve
9a34f25edc close #161 2015-02-25 14:27:18 -05:00
Andrew Grieve
0af02fb9ae close #161 2015-02-25 14:25:48 -05:00
Connor Pearson
dcff8794ad CB-7827 Add --activity-name for bin/create
Also adds in nopt
2015-02-25 14:23:26 -05:00
Andrew Grieve
1b4f5b13f1 CB-8548 Use debug-signing.properties and release-signing.properties when they exist 2015-02-25 14:16:29 -05:00
Andrew Grieve
3950818030 CB-8545 Don't add a layout as a parent of the WebView
Sanity checked mobilespec with --thirdpartyplugins that this doesn't
break any of them.
2015-02-25 12:27:48 -05:00
Andrew Grieve
d6da2ef096 CB-8510 Fix back button not exiting activity in manual tests 2015-02-25 12:27:06 -05:00
Andrew Grieve
455298d736 CB-8510 CB-7159 Fix background color manual test page not showing flash of green 2015-02-25 12:26:11 -05:00
Andrew Grieve
d99856c52b CB-8510 Move requestFocusFromTouch into createViews from init()
Makes more sense there since it's view-creation-related
2015-02-25 12:14:39 -05:00
Andrew Grieve
087ec11e6a CB-8510 Create a new abstraction for sharing common logic of WebView engines
Having CordovaWebViewImpl separate from CordovaWebViewEngine is helpful because
now each webview doesn't have to re-implement non-webview-specific
featrues. e.g.:
1. load timeout
2. keyboard events
3. showCustomView
4. lifecycle events

Moved AndroidWebView into its own package to ensure that it doesn't use
any package-private symbols (since plugins cannot use them).
2015-02-19 12:21:30 -05:00
Andrew Grieve
00c0a84e4e Remove unused imports from MainTestActivity 2015-02-19 11:33:32 -05:00
Andrew Grieve
be229b1ac6 Make ErrorUrlTest INVALID_URL point to an existing file to make it test the right thing 2015-02-19 11:32:54 -05:00
Andrew Grieve
8106981bb6 Extract alert, confirm, prompt Dialog logic into a helper for use by other engines 2015-02-19 10:43:25 -05:00
Andrew Grieve
de4d7cd10d Deprecate custom view methods in CordovaWebView.
They are just helper methods that plugins should just be implementing
for themselves.
2015-02-19 10:33:06 -05:00
Andrew Grieve
804dcac12f Address TODO: Move requestFocusFromTouch() to CordovaActivity rather than AndroidWebView 2015-02-19 10:32:29 -05:00
Andrew Grieve
fb0987b824 Delete some dead code. Add a license header. 2015-02-19 10:31:44 -05:00
Andrew Grieve
88f50a66ff Make showWebPage() take a Map instead of a HashMap 2015-02-19 10:30:26 -05:00
Andrew Grieve
7be600d8e9 Make cookieManager a field in AndroidCookieManager rather than using getInstance() every time 2015-02-19 10:28:18 -05:00
Andrew Grieve
11d6b8029f Remove explicit whitelisting of content: in CordovaBridge
It was redundant since we now check if the URL should be allowed to
be navigated to.
2015-02-19 10:06:36 -05:00
Andrew Grieve
f1d4c01190 Merge IceCreamCordovaWebViewClient into AndroidWebViewClient.
There was no reason to have it separate.
2015-02-19 10:03:50 -05:00
Andrew Grieve
c12d93e77f Move newly added should* methods of CordovaUriHelper into PluginManager
Doing this so that clients won't mistakenly call the wrong one.
2015-02-19 10:00:56 -05:00
Andrew Grieve
204130a598 Remove stale info from README.md (close #156) 2015-02-18 21:37:59 -05:00
Murat Sutunc
dbd45d4173 fix jshint errors (close #157) 2015-02-18 21:31:43 -05:00
Ian Clelland
7e0bfbbad2 Merge branch 'unplug-whitelist' 2015-02-18 09:37:00 -05:00
Andrew Grieve
db18e1480e CB-8469 Create gradle build files as part of create script
Makes project imporatable by Android Studio before first build
2015-02-12 16:15:43 -05:00
Andrew Grieve
9baa27508a Add back a test that url (and errorUrl) are not settable via Intent extras 2015-02-12 15:03:44 -05:00
Andrew Grieve
c3267def97 Revert "Reverting the refactor. I'd rather have 4 failures due to timing than tests completely disappear"
This reverts commit 390927772e.
2015-02-12 14:48:49 -05:00
Joe Bowser
390927772e Reverting the refactor. I'd rather have 4 failures due to timing than tests completely disappear 2015-02-11 14:28:50 -08:00
Ian Clelland
a8bec4ec9c Remove redundant whitelist checks 2015-02-11 16:19:54 -05:00
Ian Clelland
167e283450 Update native tests 2015-02-11 14:01:11 -05:00
Ian Clelland
0c3254fd48 Remove whitelist config.xml parsing 2015-02-11 14:01:11 -05:00
Ian Clelland
0faf2f0461 Remove whitelists from WebView classes 2015-02-11 14:01:11 -05:00
Ian Clelland
dd6e42aacc Remove unused Config methods (Breaking Change) 2015-02-11 14:01:11 -05:00
Ian Clelland
18e5e9dcc5 Refactor ConfigXmlParser to allow subclasses 2015-02-11 14:01:11 -05:00
Ian Clelland
c8f44ab460 Use /app_webview/ rather than app_webview to filter bad requests 2015-02-11 14:01:11 -05:00
Ian Clelland
ac1f9c790a Defer whitelist decisions to plugins
There is a default policy, which is implemented in the case where no plugins override any of the whitelist methods:
 * Error URLs must start with file://
 * Navigation is allowed to file:// and data: URLs which do not contain "app_webview"
 * External URLs do not launch intents
 * XHRs are allowed to file:// and data: URLs which do not contain "app_webview"
2015-02-11 14:01:11 -05:00
Ian Clelland
7533996fac Add hooks in CordovaPlugin and PluginManager for whitelist plugins
This adds three hooks to CordovaPlugin objects. In each case, a null
value can be returned to indicate "I don't care". This null value is
the default.

    public Boolean shouldAllowRequest(String url)
    public Boolean shouldAllowNavigation(String url)
    public Boolean shouldOpenExternalUrl(String url)
2015-02-11 10:03:34 -05:00
Andrew Grieve
1721571012 Delete unused field in CordovaActivity 2015-02-10 22:06:07 -05:00
Andrew Grieve
4358a04730 Big Refactor of integration tests: use locks rather than timeouts, deleted disabled tests, Use same activity for most tests 2015-02-10 22:04:42 -05:00
Andrew Grieve
c552d912a0 Add gradlew.bat to .gitignore 2015-02-10 20:14:05 -05:00
Steve Gill
ad7ce085f7 CB-8417 renamed platform_modules into cordova-js-src 2015-02-06 17:35:35 -08:00
Steve Gill
828edb3a43 CB-8417 moved platform specific js into platforms 2015-02-06 16:40:15 -08:00
Andrew Grieve
4cb64580fd Separate the registering of BridgeModes from NativeToJsMessageQueue
This makes the class usable no matter how a webview's bridge is
implemented under-the-hood.
This also deletes the PrivateApi bridge mode, which has never been a
good idea to use, and which we should replace with a Lollipop
"evaluateJavascript"-based bridge.
2015-02-06 14:03:10 -05:00
Andrew Grieve
5b2fa128a4 AndroidCookieManager: flush is a level 21 API. Add a missing API level guard 2015-02-06 13:50:03 -05:00
Andrew Grieve
b7abb64661 Make CoreAndroid package-private
Since we're renaming it anyways, makes sense to just remove it from the
public API.
2015-02-06 13:49:00 -05:00
Andrew Grieve
66424b7ed5 Update JS snapshot (was missing "CoreAndroid" name change) 2015-02-05 20:45:14 -05:00
Andrew Grieve
81dafb7b3f CB-8415 updated RELEASENOTES 2015-02-03 20:49:48 -05:00
Joe Bowser
cea81c2dc1 CB-8382: Fixed type mismatch that caused the build breakage 2015-02-03 17:24:00 -08:00
Joe Bowser
4b1e99ef93 Reverting the change to CordovaActivity.java for now until we fix the init() problem that appeared when fixing 3.7.0 bug 2015-02-03 17:01:04 -08:00
Andrew Grieve
83120a5bea CB-8382 Make CordovaActivity not implement CordovaInterface
Instead, use a CordovaInterfaceImpl class. This also makes it easier
for apps to implement the interface without extending CordovaActivity.
2015-02-03 16:27:16 -05:00
Andrew Grieve
20723896e1 CB-8411 Initialize plugins only after createViews() is called 2015-02-03 16:03:15 -05:00
Murat Sutunc
aed4859642 CB-8410 Fix all jshint issues for Android platform (close #153) 2015-02-03 15:21:57 -05:00
Murat Sutunc
d0ade1d190 CB-8410 Enable jshint for Android platform 2015-02-03 15:21:56 -05:00
Andrew Grieve
fb8e35bb44 Prune 3.7.0 RELEASENOTES to a more glanceable list 2015-02-03 14:47:42 -05:00
Andrew Grieve
ce351f5c38 CB-8390 Add Gradle support for Play Services and Support libraries 2015-02-02 23:26:53 -05:00
Andrew Grieve
26ee1c4547 CB-8389 Allow plugins to handle exit and onReceivedError messages before CordovaInterface
Also switches to LinkedHashMap for plugins so that activity can insert a
plugin and have it be the first one to receive messages
2015-01-30 11:59:30 -05:00
Andrew Grieve
bf327f3916 Allow cdvMinSdkVersion and cdvVersionCode to be set to ints (instead of just strings) 2015-01-30 11:42:56 -05:00
Andrew Grieve
e3dd6d8c88 CB-8387 Address TODO and have DisallowOverscroll preference set by AndroidWebView instead of CordovaActivity
Now the preference will work even when not using CordovaActivity
2015-01-30 11:18:41 -05:00
Andrew Grieve
137fe12c43 CB-8386 Don't fallback on system webview if custom webview fails to construct 2015-01-30 11:03:56 -05:00
Andrew Grieve
a2fed200fe CB-8378 Remove reference to LinearLayoutSoftKeyboardDetect from unit tests 2015-01-30 10:26:33 -05:00
Andrew Grieve
efeeef214b Paste in the command for downloading robotium in tests readme 2015-01-30 10:17:18 -05:00
Andrew Grieve
37617c67f8 CB-8378 Delete LinearLayoutSoftKeyboardDetect (hidekeyboard and showkeyboard events) 2015-01-29 15:13:58 -05:00
Joe Bowser
56f675f188 Updating RELASENOTES.md, this is in a weird spot, since you need the branch to exist to generate the notes
(This didn't get updated with the 3.7.0 release)
2015-01-29 09:08:55 -08:00
Andrew Grieve
7e7dc7694c CB-8373 Add gradle plugin includes based on project.properties (where plugman now puts them) 2015-01-28 16:27:05 -05:00
Darryl Pogue
8cf8da5776 CB-5059 Adds CookieManager abstraction for pluggable webviews (close #151)
Crosswalk and GeckoView implementations of CordovaWebView can provide
their own ICordovaCookieManager implementation for plugins to use.
2015-01-28 10:17:05 -05:00
Andrew Grieve
b59705bed4 CB-7947 Don't force-pauseTimers() for startActivityForResult 2015-01-26 21:26:47 -05:00
Andrew Grieve
3b909253bb Merge branch 'master' into 4.0.x (gradle plugin extension) 2015-01-26 16:28:31 -05:00
Andrew Grieve
98f90340f3 Make plugin .gradle extensions run at the same point as build-extras.gradle
This lets them change cdv* property defaults, and allows modifying
values at the end as well.
2015-01-26 16:26:57 -05:00
Andrew Grieve
a4c9bf7d30 CB-8358 Make --link an alias for --shared for create/update. Make it work with gradle 2015-01-26 10:07:14 -05:00
Marcel Kinard
f459eaa5ea Add missing license to gradle file. 2015-01-22 15:22:55 -05:00
Andrew Grieve
8d8b874c20 Merge branch 'master' into 4.0.x (about:blank)
Conflicts:
	framework/src/org/apache/cordova/CordovaWebView.java
2015-01-20 19:47:48 -05:00
shingotoda
ccceaeaca2 CB-8317 Make it work to load about:blank and to dispatch exit message (close #149) 2015-01-20 19:45:43 -05:00
Andrew Grieve
076e93184b Make unit tests compile on 4.0.x (couple APIs changed) 2015-01-20 15:03:46 -05:00
Andrew Grieve
c352b296da Merge branch 'master' into 4.0.x (gradlify tests)
Conflicts:
	test/androidTest/src/org/apache/cordova/test/junit/MenuTest.java
2015-01-20 14:55:44 -05:00
Andrew Grieve
9e04eec9dd Make BackButtonMultiPageTest tests not hang forever.
They still don't pass, but at least fail now.
2015-01-20 14:53:31 -05:00
Andrew Grieve
0e19f88a04 Make unit tests work with Gradle
Had to split the test app from the tests, since that's how gradle forces
you to do it.
2015-01-20 14:31:59 -05:00
Andrew Grieve
e788e8fa0f Delete test/ ant files and cordova scripts 2015-01-20 14:14:39 -05:00
Andrew Grieve
a56c406aa3 Made check_reqs script echo ANDROID_HOME and JAVA_HOME when run directly 2015-01-20 14:14:39 -05:00
Andrew Grieve
a3457d9408 CB-8026 Remove default target value from gradle file
Wasn't being used anyways, and it still referenced android-19
This also switches to using a Properties object rather than a RegEx
for parsing project.properties
2015-01-20 11:33:55 -05:00
Andrew Grieve
b69fed18e2 Move cordova.gradle from project template to CordovaLib
Make it easier to share with tests project.
Also, one less file in the project template is a good thing.
2015-01-20 11:04:40 -05:00
Andrew Grieve
2964aea447 gradle: Fix incorrect buildTools dependencies in framework's build.gradle
(although it didn't seem to hurt anything?)
2015-01-20 10:49:19 -05:00
Andrew Grieve
587488a1b1 Merge branch 'master' into 4.0.x (cert challenges)
Conflicts:
	framework/src/org/apache/cordova/AndroidWebViewClient.java
2015-01-19 22:22:02 -05:00
Marcus Pridham
623b394c83 CB-8328 Allow plugins to handle certificate challenges (close #150)
This is a new API for Lollipop
2015-01-19 22:17:39 -05:00
Andrew Grieve
e671ffdab1 Merge branch 'master' into 4.0.x (gradle fixes) 2015-01-19 22:04:10 -05:00
Andrew Grieve
92d1080b2f Adds cdvPrintProps gradle task: dumps out all cdv properties
Useful for debugging.
2015-01-19 21:59:02 -05:00
Andrew Grieve
893c0e9b67 CB-8255 Pass arch to gradle regardless of cdvBuildMultipleApks
This also pushes the "which target to build" logic into gradle, since
build.js doesn't actually know the value of `cdvBuildMultipleApks`.
2015-01-19 21:56:46 -05:00
Andrew Grieve
af60f71ea3 CB-8255 Fix cordova/build --gradleVar=--foo=bar stripping off =bar 2015-01-19 21:54:29 -05:00
Andrew Grieve
9a952f1004 Fix cordova/build not printing out all gradle args in console message 2015-01-19 21:53:08 -05:00
Andrew Grieve
3ec7dfff8b Fix cordova/run not finding apk when multi-arch is specified but only arch-independent apk exists 2015-01-19 21:51:57 -05:00
Andrew Grieve
d30a5e0388 Fix exception for unknown flag in cordova/run 2015-01-19 21:50:14 -05:00
Andrew Grieve
fcece7e189 Allow --ant, --gradle for cordova/run 2015-01-19 21:49:36 -05:00
Andrew Grieve
3949d9633c Merge branch 'master' into 4.0.x (file input, auth dialogs)
Conflicts:
	framework/src/org/apache/cordova/AndroidChromeClient.java
	framework/src/org/apache/cordova/CordovaActivity.java
	framework/src/org/apache/cordova/SplashScreenInternal.java
2015-01-19 16:34:06 -05:00
Andrew Grieve
62c1c5f38b CB-8017 Add support for <input type=file> for Lollipop
Also refactors a bit to remove related special-case code from CordovaActivity
2015-01-19 16:15:25 -05:00
Andrew Grieve
56204c5748 CB-8329 Cancel outstanding ActivityResult requests when a new startActivityForResult occurs 2015-01-19 16:13:48 -05:00
Andrew Grieve
34c163be88 CB-8280 android: Don't apply SplashScreenDelay when .show() is called explicitly 2015-01-19 13:42:11 -05:00
sgrebnov
11002d4a56 CB-8201 Add support for auth dialogs into Cordova Android 2015-01-16 13:06:10 +03:00
Bas Bosman
240f27ce97 CB-8314 Speed up Travis CI (close #148) 2015-01-15 20:36:30 -05:00
Andrew Grieve
5295be1c25 Revert "Delete VERSION file (superseded by package.json)"
This reverts commit 238a67af3a.

cordova-lib depends on the file:
0f5dbaffac/cordova-lib/src/cordova/platform.js (L495)
2015-01-13 15:35:25 -05:00
Andrew Grieve
238a67af3a Delete VERSION file (superseded by package.json) 2015-01-13 10:02:00 -05:00
Andrew Grieve
4382234676 Merge branch 'master' into 4.0.x (fix windows space-in-path bug)
close #147
Conflicts:
	VERSION
	bin/templates/cordova/version
	framework/assets/www/cordova.js
	framework/src/org/apache/cordova/CordovaWebView.java
	package.json
2015-01-13 10:01:31 -05:00
Murat Sutunc
8e5c93a31f CB-4914 Fix build whitespace issue 2015-01-13 09:59:29 -05:00
Joe Bowser
0e5d72dc5d Update JS snapshot to version 3.8.0-dev (via coho) 2015-01-12 14:55:49 -08:00
Joe Bowser
4b8069f5ec Set VERSION to 3.8.0-dev (via coho) 2015-01-12 14:55:48 -08:00
Andrew Grieve
a816a48416 Merge branch 'master' into 4.0.x (delete onDestroy)
Conflicts:
	framework/assets/www/cordova.js
	framework/src/org/apache/cordova/CordovaWebView.java
2015-01-12 10:58:00 -05:00
Jason Chase
5415440829 CB-8210 Remove unused onDestroy channel (close #146)
- Channel was defined as internal event and fired by javascript eval()
- Rather than change firing of event, simpler to remove as was not used
2015-01-12 10:50:36 -05:00
Joe Bowser
9668272b80 Merge branch 'master' into 4.0.x
* Fix CB-8062 on 4.0.x branch

Conflicts:
	framework/src/org/apache/cordova/CordovaWebView.java
2015-01-09 13:38:38 -08:00
Joe Bowser
15e19489e3 CB-8026: Bumping up Android Version and setting it up to allow third-party cookies. This might change later. 2015-01-09 11:31:29 -08:00
Andrew Grieve
2083f683ad Merge branch 'master' into 4.0.x (gradle properties)
Conflicts:
	bin/templates/cordova/lib/build.js
2015-01-08 15:43:22 -05:00
Andrew Grieve
c3610aa43c CB-8255 Use properties rather than environment variables for gradle settings 2015-01-08 15:26:24 -05:00
Andrew Grieve
df4fbc272a CB-8210 Update JS snapshot with 4.0.x-specific platformVersion to fix CoreAndroid vs App plugin name 2015-01-05 22:09:12 -05:00
Andrew Grieve
9698a995fb Merge branch 'master' into 4.0.x (drop events before startup) 2015-01-05 16:33:05 -05:00
Andrew Grieve
c1ac3aa483 CB-8210 Drop events from native that occur before start-up 2015-01-05 16:32:39 -05:00
Andrew Grieve
311bdbd360 Merge branch 'master' into 4.0.x (loadUrl->sendEvent)
Conflicts:
	framework/src/org/apache/cordova/CordovaWebView.java
2015-01-05 16:26:58 -05:00
Jason Chase
291f111913 CB-8210 Use PluginResult for various events from native (close #144)
- Change to send events via plugin message channel: various buttons, pause/resume
2015-01-05 16:15:17 -05:00
Andrew Grieve
95e10bdb9e Merge branch 'master' into 4.0.x (run --list) 2015-01-03 21:06:07 -05:00
Murat Sutunc
c2a6dcb6bd CB-8168 Add support for cordova/run --list (closes #139) 2015-01-03 21:05:52 -05:00
Andrew Grieve
61c4bb9888 Merge branch 'master' into 4.0.x (keyboard events via PluginResult)
Conflicts:
	framework/src/org/apache/cordova/CordovaWebView.java
2014-12-30 23:30:42 -05:00
Jason Chase
3439746645 CB-8210 Use PluginResult instead of sendJavascript() for keyboard events (close #142)
- Initialize a message channel for native -> Javascript in the core App plugin
- Change keyboard detection to send events via plugin message channel, instead
  using eval() (i.e. webView.sendJavascript())
2014-12-30 23:25:56 -05:00
Andrew Grieve
b10fe465ab Closing stale pull request: close #114 2014-12-30 23:20:52 -05:00
Andrew Grieve
c6b171ba95 CB-6630 Delete bundled (and outdated) copy of OkHttp
Those that want to use OkHttp can use a plugin.
2014-12-30 23:00:18 -05:00
Andrew Grieve
5a17d6cd5f Merge branch 'master' into 4.0.x (gradle - maven and CordovaLib dep) 2014-12-30 22:59:50 -05:00
Andrew Grieve
480af2644c CB-8228 Gradle: Allow plugins to use Maven dependencies 2014-12-30 22:57:53 -05:00
Andrew Grieve
ecd2e06883 CB-8229 Gradle: Add CordovaLib as a dependency to all plugin sub-projects 2014-12-30 22:56:43 -05:00
Andrew Grieve
4f3ae23170 Merge branch 'master' into 4.0.x (--minSdkVersion and --versionCode)
Conflicts:
	bin/templates/project/build.gradle
2014-12-24 13:35:39 -05:00
Andrew Grieve
7cfb33d0ef CB-7980 Add --minSdkVersion and --versionCode flags to cordova/build command
These are also exposed via environment variables: ANDROID_VERSION_CODE, ANDROID_MIN_SDK_VERSION
This also fixes build.gradle modifying the value set by ANDROID_VERSION_CODE when multi-apk is enabled (override should never be modified)
2014-12-23 16:26:43 -05:00
Mark Koudritsky
9224ab1592 CB-7980: Add 9 to versionCode for minSdk 20+ if not multiarch 2014-12-23 15:29:40 -05:00
Ian Clelland
a696ff37f1 Merge branch 'master' into 4.0.x (Plugin set multiarach) 2014-12-22 23:19:56 -05:00
fujunwei
931a996dab Allow plugins to set ext.multiarch to enable multiple APK building
The xwalk webView need build multiple apks by default after install
cordova-crosswalk-engine plugin, we can set ext.multiarch=true to open
the flag in plugin, it don't necessary set system environment BUILD_MULTIPLE_APKS
manually.

This closes #141
2014-12-22 23:19:27 -05:00
Ian Clelland
68c03090a3 Merge branch 'master' into 4.0.x (Gradle lint stages) 2014-12-22 13:29:50 -05:00
Ian Clelland
98fe46757f CB-8204: Reinstate link tasks to avoid gradle build failures 2014-12-22 13:24:58 -05:00
Andrew Grieve
cefd137634 Merge branch 'master' into 4.0.x (gradle version bump) 2014-12-22 11:45:02 -05:00
Andrew Grieve
6b6e887c2f CB-8143 Use gradle 2.2.1 instead of 1.12 to appease Android Studio 1.0 warning-on-startup 2014-12-22 11:37:06 -05:00
Andrew Grieve
20cd4f806a Merge branch 'master' into 4.0.x (gradle version for Android Studio) 2014-12-22 11:25:59 -05:00
Andrew Grieve
b92303b1c9 CB-8143 Use gradle plugin 1.0.0 for Android Studio 1.0.0 2014-12-22 11:19:21 -05:00
Andrew Grieve
59d23e05b1 Merge branch 'master' into 4.0.x (apk signing with interactive passwords) 2014-12-22 10:22:41 -05:00
Andrew Grieve
731a36d3a0 CB-8202 Fix gradle build signing when passwords provided interactively 2014-12-22 10:21:17 -05:00
Andrew Grieve
162fc0720e Merge branch 'master' into 4.0.x (SDK search path) 2014-12-16 14:18:58 -05:00
Andrew Grieve
342bbaa3ae CB-8176 Update Android SDK search path for Android Studio 1.0 2014-12-16 14:17:55 -05:00
Andrew Grieve
f086ef5cad Merge branch 'master' into 4.0.x (adb CWD & build --unknown-flag)
Conflicts:
	framework/src/org/apache/cordova/SplashScreenInternal.java
2014-12-11 13:47:07 -05:00
Daniel Toplak
56a3ee5fe6 CB-8079 Use activity class package name, but fallback to application
package name when looking for splash screen drawable

Close #136
2014-12-10 21:19:28 -05:00
Andrew Grieve
d80d532a2a Fix syntax error in 3aca14d530 2014-12-10 21:16:54 -05:00
Andrew Grieve
3aca14d530 CB-8147 Have corodva/build warn about unrecognized flags rather than fail
Close #127
2014-12-10 21:02:57 -05:00
Andrew Grieve
aa2d3962bf Close #126 (not-a-problem) 2014-12-10 21:02:57 -05:00
Andrew Grieve
f7c717e393 Close #137 (already merged). 2014-12-10 21:02:57 -05:00
sgrebnov
268fea58ee CB-7881 Android tooling shouldn't lock application directory
Close #130
2014-12-10 21:02:48 -05:00
Andrew Grieve
87cdc5ad1c Merge branch 'master' into 4.0.x (SplashScreen breakout)
Conflicts:
	framework/src/org/apache/cordova/CordovaActivity.java
	framework/src/org/apache/cordova/CordovaWebView.java
2014-12-10 16:09:22 -05:00
fujunwei
ba140a8a84 Add a section for plugin extensions
The build.gradle will apply gradle srcipte from plugin extension
When install the plugin with "gradleReference" framework.
The gradle can set ext.multiarch=true to support multiple APKs by
default, so add this section in here.
2014-12-10 15:44:39 -05:00
Andrew Grieve
27f1181d53 CB-3679 Move splashscreen logic into splashscreen plugin
Tried as hard as possible for this not to be a breaking change (all
symbols were preserved). Planning to remove delegating symbols in 4.0.x
though.

Also for backwards compatability - a copy of the plugin is bundled. It
will likewise be removed in 4.0.x
2014-12-10 15:40:03 -05:00
Ian Clelland
f953e6adb8 CB-8143: Use the correct Android Gradle plugin for the installed Gradle version 2014-12-10 10:07:05 -05:00
Brian Geppert
ffd14fe7d9 Revert Gradle distributionUrlRegex cleanup.
This reverts commit 75a0a6752a.
2014-12-09 14:23:38 -05:00
Ian Clelland
3206c2100d Merge branch 'plugin-gradle' into 4.0.x 2014-12-09 09:43:37 -05:00
Andrew Grieve
66fa12a091 CB-8119 Restart adb when we detect it's hung 2014-12-04 10:00:26 -05:00
Andrew Grieve
b1bdf23d9c Switch default build type to gradle (4.0.x only) 2014-12-03 10:12:31 -05:00
Andrew Grieve
12bf07d560 Merge branch 'master' into 4.0.x (volume stream & setMediaPlaybackRequiresUserGesture)
Conflicts:
	framework/src/org/apache/cordova/CordovaActivity.java
	framework/src/org/apache/cordova/CordovaWebView.java
2014-12-03 10:09:05 -05:00
Andrew Grieve
132650df28 CB-8112 Turn off mediaPlaybackRequiresUserGesture 2014-12-03 10:04:54 -05:00
Andrew Grieve
81a77949fc CB-6153 Add a preference for controlling hardware button audio stream (DefaultVolumeStream)
This, along with the commit to the audio plugin, makes it so that by
default apps control the ringer volume, but when any audio players are
active, the media volume is controlled.
2014-11-27 10:52:19 -05:00
Andrew Grieve
e597f98c62 Merge branch 'master' into 4.0.x (gradle java 6 & PluginManager race fix) 2014-11-26 11:48:08 -05:00
Andrew Grieve
7fbb2b195f CB-8081 Allow gradle builds to use Java 6 instead of requiring 7 2014-11-26 11:44:49 -05:00
Andrew Grieve
1feaa7fed7 CB-8031 Fix race condition that shows as ConcurrentModificationException 2014-11-17 22:11:21 -08:00
fujunwei
9b82ae19b0 Add a section for plugin extensions
The build.gradle will apply gradle srcipte from plugin extension
When install the plugin with "gradleReference" framework.
The gradle can set ext.multiarch=true to support multiple APKs by
default, so add this section in here.
2014-11-17 15:52:40 +08:00
Mark Koudritsky
9d3c13065b CB-7980: Add 9 to versionCode for minSdk 20+ if not multiarch 2014-11-06 18:27:36 -05:00
Andrew Grieve
4859f8f759 Merge branch 'master' into 4.0.x (receiver context) 2014-11-06 16:23:49 -05:00
Andrew Grieve
ac284fd39c CB-7976 Use webView's context rather than Activity's context for intent receiver 2014-11-06 16:23:32 -05:00
Andrew Grieve
fdef0db87c Merge branch 'master' into 4.0.x (Load timeout, bridge secret, content: URI)
Conflicts:
	framework/src/org/apache/cordova/CordovaWebView.java
2014-11-06 15:37:30 -05:00
Andrew Grieve
e78db000c6 CB-7974 Cancel timeout timer if view is destroyed 2014-11-06 15:33:10 -05:00
Andrew Grieve
032ea8a8d3 CB-7940 Disable exec bridge if bridgeSecret is wrong 2014-11-04 15:57:51 -05:00
Ian Clelland
fc63f66e89 CB-7758: Allow content-url-hosted pages to access the bridge
This allows e.g. jsHybugger to create pages with access to Cordova APIs.
We restrict access to content provider URLs which are at subdomains of the application itself, ie, begin with "content://com.your.package.id."
2014-10-27 15:26:38 -04:00
Chris Alfano
832e626573 CB-7726 fix typo in gitignore: ant-built -> ant-build
github: close #131
2014-10-27 12:33:09 -04:00
605 changed files with 29182 additions and 40637 deletions

46
.asf.yaml Normal file
View File

@ -0,0 +1,46 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
github:
description: Apache Cordova Android
homepage: https://cordova.apache.org/
labels:
- cordova
- cordova-platform
- android
- java
- mobile
- javascript
- nodejs
- hacktoberfest
features:
wiki: false
issues: true
projects: true
enabled_merge_buttons:
squash: true
merge: false
rebase: false
notifications:
commits: commits@cordova.apache.org
issues: issues@cordova.apache.org
pullrequests_status: issues@cordova.apache.org
pullrequests_comment: issues@cordova.apache.org

3
.eslintignore Normal file
View File

@ -0,0 +1,3 @@
templates/project/assets/www/cordova.js
test/android/app
test/androidx/app

27
.eslintrc.yml Normal file
View File

@ -0,0 +1,27 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
extends: '@cordova/eslint-config/node'
overrides:
- files: [spec/**/*.js]
extends: '@cordova/eslint-config/node-tests'
rules:
prefer-promise-reject-errors: off
- files: [cordova-js-src/**/*.js]
extends: '@cordova/eslint-config/browser'

94
.gitattributes vendored Normal file
View File

@ -0,0 +1,94 @@
* text eol=lf
# source code
*.php text
*.css text
*.sass text
*.scss text
*.less text
*.styl text
*.js text
*.coffee text
*.json text
*.htm text
*.html text
*.xml text
*.svg text
*.txt text
*.ini text
*.inc text
*.pl text
*.rb text
*.py text
*.scm text
*.sql text
*.sh text
*.bat text
# templates
*.ejs text
*.hbt text
*.jade text
*.haml text
*.hbs text
*.dot text
*.tmpl text
*.phtml text
# server config
.htaccess text
# git config
.gitattributes text
.gitignore text
.gitconfig text
# code analysis config
.jshintrc text
.jscsrc text
.jshintignore text
.csslintrc text
# misc config
*.yaml text
*.yml text
.editorconfig text
# build config
*.npmignore text
*.bowerrc text
# Heroku
Procfile text
.slugignore text
# Documentation
*.md text
LICENSE text
AUTHORS text
#
## These files are binary and should be left untouched
#
# (binary is a macro for -text -diff)
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.mov binary
*.mp4 binary
*.mp3 binary
*.flv binary
*.fla binary
*.swf binary
*.gz binary
*.zip binary
*.7z binary
*.ttf binary
*.eot binary
*.woff binary
*.pyc binary
*.pdf binary

42
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,42 @@
<!--
Please have a look at the issue templates you get when you click "New issue" in the GitHub UI.
We very much prefer issues created by using one of these templates.
-->
### Issue Type
<!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
- [ ] Bug Report
- [ ] Feature Request
- [ ] Support Question
## Description
## Information
<!-- Include all relevant information that might help understand and reproduce the problem -->
### Command or Code
<!-- What command or code is needed to reproduce the problem? -->
### Environment, Platform, Device
<!-- In what environment, on what platform or on which device are you experiencing the issue? -->
### Version information
<!--
What are relevant versions you are using?
For example:
Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins
Other Frameworks: Ionic Framework and CLI version
Operating System, Android Studio, Xcode etc.
-->
## Checklist
<!-- Please check the boxes by putting an `x` in the `[ ]` like so: `[x]` -->
- [ ] I searched for already existing GitHub issues about this
- [ ] I updated all Cordova tooling to their most recent version
- [ ] I included all the necessary information above

50
.github/ISSUE_TEMPLATE/BUG_REPORT.md vendored Normal file
View File

@ -0,0 +1,50 @@
---
name: 🐛 Bug Report
about: If something isn't working as expected.
---
# Bug Report
## Problem
### What is expected to happen?
### What does actually happen?
## Information
<!-- Include all relevant information that might help understand and reproduce the problem -->
### Command or Code
<!-- What command or code is needed to reproduce the problem? -->
### Environment, Platform, Device
<!-- In what environment, on what platform or on which device are you experiencing the issue? -->
### Version information
<!--
What are relevant versions you are using?
For example:
Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins
Other Frameworks: Ionic Framework and CLI version
Operating System, Android Studio, Xcode etc.
-->
## Checklist
<!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
- [ ] I searched for existing GitHub issues
- [ ] I updated all Cordova tooling to most recent version
- [ ] I included all the necessary information above

View File

@ -0,0 +1,29 @@
---
name: 🚀 Feature Request
about: A suggestion for a new functionality
---
# Feature Request
## Motivation Behind Feature
<!-- Why should this feature be implemented? What problem does it solve? -->
## Feature Description
<!--
Describe your feature request in detail
Please provide any code examples or screenshots of what this feature would look like
Are there any drawbacks? Will this break anything for existing users?
-->
## Alternatives or Workarounds
<!--
Describe alternatives or workarounds you are currently using
Are there ways to do this with existing functionality?
-->

View File

@ -0,0 +1,27 @@
---
name: 💬 Support Question
about: If you have a question, please check out our Slack or StackOverflow!
---
<!------------^ Click "Preview" for a nicer view! -->
Apache Cordova uses GitHub Issues as a feature request and bug tracker _only_.
For usage and support questions, please check out the resources below. Thanks!
---
You can get answers to your usage and support questions about **Apache Cordova** on:
* Slack Community Chat: https://cordova.slack.com (you can sign-up at http://slack.cordova.io/)
* StackOverflow: https://stackoverflow.com/questions/tagged/cordova using the tag `cordova`
---
If you are using a tool that uses Cordova internally, like e.g. Ionic, check their support channels:
* **Ionic Framework**
* [Ionic Community Forum](https://forum.ionicframework.com/)
* [Ionic Worldwide Slack](https://ionicworldwide.herokuapp.com/)
* **PhoneGap**
* [PhoneGap Developer Community](https://forums.adobe.com/community/phonegap)

35
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,35 @@
<!--
Please make sure the checklist boxes are all checked before submitting the PR. The checklist is intended as a quick reference, for complete details please see our Contributor Guidelines:
http://cordova.apache.org/contribute/contribute_guidelines.html
Thanks!
-->
### Platforms affected
### Motivation and Context
<!-- Why is this change required? What problem does it solve? -->
<!-- If it fixes an open issue, please link to the issue here. -->
### Description
<!-- Describe your changes in detail -->
### Testing
<!-- Please describe in detail how you tested your changes. -->
### Checklist
- [ ] I've run the tests to see all new and existing tests pass
- [ ] I added automated test coverage as appropriate for this change
- [ ] Commit is prefixed with `(platform)` if this change only applies to one platform (e.g. `(android)`)
- [ ] If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct [keyword to close issues using keywords](https://help.github.com/articles/closing-issues-using-keywords/))
- [ ] I've updated the documentation if necessary

64
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,64 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name: Node CI
on: [push, pull_request]
jobs:
test:
name: NodeJS ${{ matrix.node-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
- name: Environment Information
run: |
node --version
npm --version
gradle --version
- name: npm install and test
run: |
npm i
npm t
env:
CI: true
- name: upload coverage
if: success()
uses: codecov/codecov-action@v3
with:
name: ${{ runner.os }} node.js ${{ matrix.node-version }}

79
.gitignore vendored
View File

@ -1,32 +1,6 @@
.DS_Store
default.properties
gen
assets/www/cordova.js
framework/assets/www/.tmp*
local.properties
framework/lib
proguard.cfg
proguard.cfg
proguard-project.txt
framework/bin
framework/test/org/apache/cordova/*.class
framework/assets/www/.DS_Store
framework/assets/www/cordova-*.js
framework/assets/www/phonegap-*.js
framework/libs
framework/javadoc-public
framework/javadoc-private
test/libs
example
./test
test/bin
test/assets/www/.tmp*
test/assets/www/cordova.js
test/cordova/plugins/org.apache.cordova.device/www/device.js
test/cordova/plugins/org.apache.cordova.device/src/android/Device.java
tmp/**
.gradle
.metadata
tmp/**/*
Thumbs.db
Desktop.ini
*.tmp
@ -34,9 +8,50 @@ Desktop.ini
*.swp
*.class
*.jar
# IntelliJ IDEA files
*.iml
.idea
npm-debug.log
/node_modules
default.properties
gen
assets/www/cordova.js
local.properties
proguard.cfg
proguard-project.txt
example
/coverage
/framework/lib
/framework/build
/framework/bin
/framework/assets/www/.DS_Store
/framework/assets/www/cordova-*.js
/framework/assets/www/phonegap-*.js
/framework/libs
/framework/javadoc-public
/framework/javadoc-private
**/assets/www/cordova.js
/test/.externalNativeBuild
/test/androidx/gradle
/test/androidx/gradlew
/test/androidx/gradlew.bat
/test/androidx/cdv-gradle-config.json
/test/assets/www/.tmp*
/test/assets/www/cordova.js
/test/bin
/test/build
/test/captures
/test/libs
tmp/**
tmp/**/*
!/spec/fixtures/org.test.plugins.dummyplugin/src/android/TestLib.jar
# IntelliJ IDEA files
**/.idea/**/*
*.iml
npm-debug.log
node_modules/
coverage/
.nyc_output/
# Eclipse Buildship files
.project
.settings
.classpath

6
.npmignore Normal file
View File

@ -0,0 +1,6 @@
.*
coverage
test
spec
framework/build
cordova-js-src

2
.npmrc Normal file
View File

@ -0,0 +1,2 @@
registry=https://registry.npmjs.org

8
.ratignore Normal file
View File

@ -0,0 +1,8 @@
*.properties
templates
gen
proguard-project.txt
spec
framework/build
ic_launcher.png
build

View File

@ -4,5 +4,5 @@
GUESS_FIELDS = True
OPEN_BROWSER = True
TARGET_GROUPS = 'cordova'
REVIEWBOARD_URL = 'http://reviews.apache.org'
REVIEWBOARD_URL = 'https://reviews.apache.org'

View File

@ -1,5 +0,0 @@
language: android
install: npm install
script:
- npm test
- npm run test-build

View File

@ -27,11 +27,11 @@ There are multiple ways to contribute: report bugs, improve the docs, and
contribute code.
For instructions on this, start with the
[contribution overview](http://cordova.apache.org/#contribute).
[contribution overview](http://cordova.apache.org/contribute/).
The details are explained there, but the important items are:
- Sign and submit an Apache ICLA (Contributor License Agreement).
- Have a Jira issue open that corresponds to your contribution.
- Check for Github issues that corresponds to your contribution and link or create them if necessary.
- Run the tests so your patch doesn't break existing functionality.
We look forward to your contributions!

87
LICENSE
View File

@ -187,7 +187,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Copyright 2015-2020 Apache Cordova
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -200,88 +200,3 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
ADDITIONAL LICENSES:
================================================================================
bin/node_modules/q
================================================================================
Copyright 20092012 Kristopher Michael Kowal. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
================================================================================
bin/node_modules/shelljs
================================================================================
Copyright (c) 2012, Artur Adib <aadib@mozilla.com>
All rights reserved.
You may use this project under the terms of the New BSD license as follows:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Artur Adib nor the
names of the contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL ARTUR ADIB BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
================================================================================
bin/node_modules/shelljs
================================================================================
Copyright 2009, 2010, 2011 Isaac Z. Schlueter.
All rights reserved.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

16
NOTICE
View File

@ -1,17 +1,5 @@
Apache Cordova
Copyright 2014 The Apache Software Foundation
Copyright 2015-2020 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org)
=========================================================================
== NOTICE file corresponding to the section 4 d of ==
== the Apache License, Version 2.0, ==
== in this case for the Android-specific code. ==
=========================================================================
This product includes software developed as part of
The Android Open Source Project (http://source.android.com).
This software includes software developed at Square, Inc.
Copyright (C) 2013 Square, Inc.
The Apache Software Foundation (http://www.apache.org/).

View File

@ -18,74 +18,54 @@
# under the License.
#
-->
Cordova Android
===
Cordova Android is an Android application library that allows for Cordova-based
projects to be built for the Android Platform. Cordova based applications are,
at the core, applications written with web technology: HTML, CSS and JavaScript.
# Cordova Android
[Apache Cordova](http://cordova.io) is a project of The Apache Software Foundation (ASF).
[![NPM](https://nodei.co/npm/cordova-android.png)](https://nodei.co/npm/cordova-android/)
[![Node CI](https://github.com/apache/cordova-android/workflows/Node%20CI/badge.svg?branch=master)](https://github.com/apache/cordova-android/actions?query=branch%3Amaster)
[![codecov.io](https://codecov.io/github/apache/cordova-android/coverage.svg?branch=master)](https://codecov.io/github/apache/cordova-android?branch=master)
Requires
---
Cordova Android is an Android application library that allows for Cordova-based projects to be built for the Android Platform. Cordova based applications are, at the core, applications written with web technology: HTML, CSS and JavaScript.
- Java JDK 1.5 or greater
- Apache Ant 1.8.0 or greater
- Android SDK [http://developer.android.com](http://developer.android.com)
[Apache Cordova](https://cordova.apache.org/) is a project of [The Apache Software Foundation (ASF)](https://apache.org/).
## Requirements
Cordova Android Developer Tools
---
* Java Development Kit (JDK) 11
* [Android SDK](https://developer.android.com/)
* [Node.js](https://nodejs.org)
The Cordova developer tooling is split between general tooling and project level tooling.
## Create a Cordova project
General Commands
Follow the instructions in the [**Create your first Cordova app**](https://cordova.apache.org/docs/en/latest/guide/cli/index.html) section of [Apache Cordova Docs](https://cordova.apache.org/docs/en/latest/)
./bin/create [path package activity] ... creates the ./example app or a cordova android project
./bin/check_reqs ....................... checks that your environment is set up for cordova-android development
./bin/update [path] .................... updates an existing cordova-android project to the version of the framework
To use a **shared framework**, for example in development, link the appropriate cordova-android platform folder path:
Project Commands
```bash
cordova platform add --link /path/to/cordova-android
```
These commands live in a generated Cordova Android project. Any interactions with the emulator require you to have an AVD defined.
## Updating a Cordova project
./cordova/clean ........................ cleans the project
./cordova/build ........................ calls `clean` then compiles the project
./cordova/log ........................ streams device or emulator logs to STDOUT
./cordova/run ........................ calls `build` then deploys to a connected Android device. If no Android device is detected, will launch an emulator and deploy to it.
./cordova/version ...................... returns the cordova-android version of the current project
When you install a new version of the [`Cordova CLI`](https://www.npmjs.com/package/cordova) that pins a new version of the [`Cordova-Android`](https://www.npmjs.com/package/cordova-android) platform, you can follow these simple upgrade steps within your project:
Importing a Cordova Android Project into Eclipse
----
```bash
cordova platform rm android
cordova platform add android
```
1. File > New > Project...
2. Android > Android Project
3. Create project from existing source (point to the generated app found in tmp/android)
4. Right click on libs/cordova.jar and add to build path
5. Right click on the project root: Run as > Run Configurations
6. Click on the Target tab and select Manual (this way you can choose the emulator or device to build to)
## Debugging in Android Studio
Building without the Tooling
---
Note: The Developer Tools handle this. This is only to be done if the tooling fails, or if
you are developing directly against the framework.
Import project in Android Studio through _File > Open_ and targeting `/path/to/your-cdv-project/platforms/android/`.
## How to Test Repo Development
To create your `cordova.jar` file, run in the framework directory:
```bash
npm install
npm test
```
android update project -p . -t android-19
ant jar
## Further reading
Running Tests
----
Please see details under test/README.md.
Further Reading
----
- [http://developer.android.com](http://developer.android.com)
- [http://cordova.apache.org/](http://cordova.apache.org)
- [http://wiki.apache.org/cordova/](http://wiki.apache.org/cordova/)
* [Apache Cordova](https://cordova.apache.org/)

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
4.0.0-dev

View File

@ -1,26 +0,0 @@
:: Licensed to the Apache Software Foundation (ASF) under one
:: or more contributor license agreements. See the NOTICE file
:: distributed with this work for additional information
:: regarding copyright ownership. The ASF licenses this file
:: to you under the Apache License, Version 2.0 (the
:: "License"); you may not use this file except in compliance
:: with the License. You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing,
:: software distributed under the License is distributed on an
:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
:: KIND, either express or implied. See the License for the
:: specific language governing permissions and limitations
:: under the License.
@ECHO OFF
SET script_path="%~dp0android_sdk_version"
IF EXIST %script_path% (
node "%script_path%" %*
) ELSE (
ECHO.
ECHO ERROR: Could not find 'android_sdk_version' script in 'bin' folder, aborting...>&2
EXIT /B 1
)

View File

@ -1,31 +0,0 @@
#!/usr/bin/env node
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
var check_reqs = require('./lib/check_reqs');
check_reqs.run().done(
function success() {
console.log('Looks like your environment fully supports cordova-android development!');
}, function fail(err) {
console.log(err);
process.exit(2);
}
);

View File

@ -1,26 +0,0 @@
:: Licensed to the Apache Software Foundation (ASF) under one
:: or more contributor license agreements. See the NOTICE file
:: distributed with this work for additional information
:: regarding copyright ownership. The ASF licenses this file
:: to you under the Apache License, Version 2.0 (the
:: "License"); you may not use this file except in compliance
:: with the License. You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing,
:: software distributed under the License is distributed on an
:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
:: KIND, either express or implied. See the License for the
:: specific language governing permissions and limitations
:: under the License.
@ECHO OFF
SET script_path="%~dp0check_reqs"
IF EXIST %script_path% (
node "%script_path%" %*
) ELSE (
ECHO.
ECHO ERROR: Could not find 'check_reqs' script in 'bin' folder, aborting...>&2
EXIT /B 1
)

View File

@ -1,36 +0,0 @@
#!/usr/bin/env node
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
var path = require('path');
var create = require('./lib/create');
var args = require('./lib/simpleargs').getArgs(process.argv);
if (args['--help'] || args._.length === 0) {
console.log('Usage: ' + path.relative(process.cwd(), path.join(__dirname, 'create')) + ' <path_to_new_project> <package_name> <project_name> [<template_path>] [--shared]');
console.log(' <path_to_new_project>: Path to your new Cordova Android project');
console.log(' <package_name>: Package name, following reverse-domain style convention');
console.log(' <project_name>: Project name');
console.log(' <template_path>: Path to a custom application template to use');
console.log(' --shared will use the CordovaLib project directly instead of making a copy.');
process.exit(1);
}
create.createProject(args._[0], args._[1], args._[2], args._[3], args['--shared'], args['--cli']).done();

View File

@ -1,26 +0,0 @@
:: Licensed to the Apache Software Foundation (ASF) under one
:: or more contributor license agreements. See the NOTICE file
:: distributed with this work for additional information
:: regarding copyright ownership. The ASF licenses this file
:: to you under the Apache License, Version 2.0 (the
:: "License"); you may not use this file except in compliance
:: with the License. You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing,
:: software distributed under the License is distributed on an
:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
:: KIND, either express or implied. See the License for the
:: specific language governing permissions and limitations
:: under the License.
@ECHO OFF
SET script_path="%~dp0create"
IF EXIST %script_path% (
node %script_path% %*
) ELSE (
ECHO.
ECHO ERROR: Could not find 'create' script in 'bin' folder, aborting...>&2
EXIT /B 1
)

View File

@ -1,65 +0,0 @@
#!/usr/bin/env node
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
var shell = require('shelljs'),
child_process = require('child_process'),
Q = require('q');
get_highest_sdk = function(results){
var reg = /\d+/;
var apiLevels = [];
for(var i=0;i<results.length;i++){
apiLevels[i] = parseInt(results[i].match(reg)[0]);
}
apiLevels.sort(function(a,b){return b-a});
console.log(apiLevels[0]);
}
get_sdks = function() {
var d = Q.defer();
child_process.exec('android list targets', function(err, stdout, stderr) {
if (err) d.reject(stderr);
else d.resolve(stdout);
});
return d.promise.then(function(output) {
var reg = /android-\d+/gi;
var results = output.match(reg);
if(results.length===0){
return Q.reject(new Error('No android sdks installed.'));
}else{
get_highest_sdk(results);
}
return Q();
}, function(stderr) {
if (stderr.match(/command\snot\sfound/) || stderr.match(/'android' is not recognized/)) {
return Q.reject(new Error('The command \"android\" failed. Make sure you have the latest Android SDK installed, and the \"android\" command (inside the tools/ folder) is added to your path.'));
} else {
return Q.reject(new Error('An error occurred while listing Android targets'));
}
});
}
module.exports.run = function() {
return Q.all([get_sdks()]);
}

View File

@ -1,236 +0,0 @@
#!/usr/bin/env node
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
var shelljs = require('shelljs'),
child_process = require('child_process'),
Q = require('q'),
path = require('path'),
fs = require('fs'),
which = require('which'),
ROOT = path.join(__dirname, '..', '..');
var isWindows = process.platform == 'win32';
function forgivingWhichSync(cmd) {
try {
return fs.realpathSync(which.sync(cmd));
} catch (e) {
return '';
}
}
function tryCommand(cmd, errMsg) {
var d = Q.defer();
child_process.exec(cmd, function(err, stdout, stderr) {
if (err) d.reject(new Error(errMsg));
else d.resolve(stdout);
});
return d.promise;
}
// Get valid target from framework/project.properties
module.exports.get_target = function() {
function extractFromFile(filePath) {
var target = shelljs.grep(/\btarget=/, filePath);
if (!target) {
throw new Error('Could not find android target within: ' + filePath);
}
return target.split('=')[1].trim();
}
if (fs.existsSync(path.join(ROOT, 'framework', 'project.properties'))) {
return extractFromFile(path.join(ROOT, 'framework', 'project.properties'));
}
if (fs.existsSync(path.join(ROOT, 'project.properties'))) {
// if no target found, we're probably in a project and project.properties is in ROOT.
return extractFromFile(path.join(ROOT, 'project.properties'));
}
throw new Error('Could not find android target. File missing: ' + path.join(ROOT, 'project.properties'));
}
// Returns a promise. Called only by build and clean commands.
module.exports.check_ant = function() {
return tryCommand('ant -version', 'Failed to run "ant -version", make sure you have ant installed and added to your PATH.');
};
// Returns a promise. Called only by build and clean commands.
module.exports.check_gradle = function() {
var sdkDir = process.env['ANDROID_HOME'];
var wrapperDir = path.join(sdkDir, 'tools', 'templates', 'gradle', 'wrapper');
if (!fs.existsSync(wrapperDir)) {
return Q.reject(new Error('Could not find gradle wrapper within android sdk. Might need to update your Android SDK.\n' +
'Looked here: ' + wrapperDir));
}
return Q.when();
};
// Returns a promise.
module.exports.check_java = function() {
var javacPath = forgivingWhichSync('javac');
var hasJavaHome = !!process.env['JAVA_HOME'];
return Q().then(function() {
if (hasJavaHome) {
// Windows java installer doesn't add javac to PATH, nor set JAVA_HOME (ugh).
if (!javacPath) {
process.env['PATH'] += path.delimiter + path.join(process.env['JAVA_HOME'], 'bin');
}
} else {
if (javacPath) {
// OS X has a command for finding JAVA_HOME.
if (fs.existsSync('/usr/libexec/java_home')) {
return tryCommand('/usr/libexec/java_home', 'Failed to run: /usr/libexec/java_home')
.then(function(stdout) {
process.env['JAVA_HOME'] = stdout.trim();
});
} else {
// See if we can derive it from javac's location.
// fs.realpathSync is require on Ubuntu, which symplinks from /usr/bin -> JDK
var maybeJavaHome = path.dirname(path.dirname(javacPath));
if (fs.existsSync(path.join(maybeJavaHome, 'lib', 'tools.jar'))) {
process.env['JAVA_HOME'] = maybeJavaHome;
} else {
throw new Error('Could not find JAVA_HOME. Try setting the environment variable manually');
}
}
} else if (isWindows) {
// Try to auto-detect java in the default install paths.
var oldSilent = shelljs.config.silent;
shelljs.config.silent = true;
var firstJdkDir =
shelljs.ls(process.env['ProgramFiles'] + '\\java\\jdk*')[0] ||
shelljs.ls('C:\\Program Files\\java\\jdk*')[0] ||
shelljs.ls('C:\\Program Files (x86)\\java\\jdk*')[0];
shelljs.config.silent = oldSilent;
if (firstJdkDir) {
// shelljs always uses / in paths.
firstJdkDir = firstJdkDir.replace(/\//g, path.sep);
if (!javacPath) {
process.env['PATH'] += path.delimiter + path.join(firstJdkDir, 'bin');
}
process.env['JAVA_HOME'] = firstJdkDir;
}
}
}
}).then(function() {
var msg =
'Failed to run "java -version", make sure that you have a JDK installed.\n' +
'You can get it from: http://www.oracle.com/technetwork/java/javase/downloads.\n';
if (process.env['JAVA_HOME']) {
msg += 'Your JAVA_HOME is invalid: ' + process.env['JAVA_HOME'] + '\n';
}
return tryCommand('java -version', msg)
.then(function() {
return tryCommand('javac -version', msg);
});
});
}
// Returns a promise.
module.exports.check_android = function() {
return Q().then(function() {
var androidCmdPath = forgivingWhichSync('android');
var adbInPath = !!forgivingWhichSync('adb');
var hasAndroidHome = !!process.env['ANDROID_HOME'] && fs.existsSync(process.env['ANDROID_HOME']);
function maybeSetAndroidHome(value) {
if (!hasAndroidHome && fs.existsSync(value)) {
hasAndroidHome = true;
process.env['ANDROID_HOME'] = value;
}
}
if (!hasAndroidHome && !androidCmdPath) {
if (isWindows) {
// Android Studio installer.
maybeSetAndroidHome(path.join(process.env['LOCALAPPDATA'], 'Android', 'android-studio', 'sdk'));
maybeSetAndroidHome(path.join(process.env['ProgramFiles'], 'Android', 'android-studio', 'sdk'));
// Stand-alone installer.
maybeSetAndroidHome(path.join(process.env['LOCALAPPDATA'], 'Android', 'android-sdk'));
maybeSetAndroidHome(path.join(process.env['ProgramFiles'], 'Android', 'android-sdk'));
} else if (process.platform == 'darwin') {
maybeSetAndroidHome('/Applications/Android Studio.app/sdk');
// Stand-alone zip file that user might think to put under /Applications
maybeSetAndroidHome('/Applications/android-sdk-macosx');
maybeSetAndroidHome('/Applications/android-sdk');
}
if (process.env['HOME']) {
// or their HOME directory.
maybeSetAndroidHome(path.join(process.env['HOME'], 'android-sdk-macosx'));
maybeSetAndroidHome(path.join(process.env['HOME'], 'android-sdk'));
}
}
if (hasAndroidHome && !androidCmdPath) {
process.env['PATH'] += path.delimiter + path.join(process.env['ANDROID_HOME'], 'tools');
}
if (androidCmdPath && !hasAndroidHome) {
var parentDir = path.dirname(androidCmdPath);
var grandParentDir = path.dirname(parentDir);
if (path.basename(parentDir) == 'tools') {
process.env['ANDROID_HOME'] = path.dirname(parentDir);
hasAndroidHome = true;
} else if (fs.existsSync(path.join(grandParentDir, 'tools', 'android'))) {
process.env['ANDROID_HOME'] = grandParentDir;
hasAndroidHome = true;
} else {
throw new Error('ANDROID_HOME is not set and no "tools" directory found at ' + parentDir);
}
}
if (hasAndroidHome && !adbInPath) {
process.env['PATH'] += path.delimiter + path.join(process.env['ANDROID_HOME'], 'platform-tools');
}
if (!process.env['ANDROID_HOME']) {
throw new Error('ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.');
}
if (!fs.existsSync(process.env['ANDROID_HOME'])) {
throw new Error('ANDROID_HOME is set to a non-existant path: ' + process.env['ANDROID_HOME']);
}
// Check that the target sdk level is installed.
return module.exports.check_android_target(module.exports.get_target());
});
};
module.exports.getAbsoluteAndroidCmd = function() {
return forgivingWhichSync('android').replace(/(\s)/g, '\\$1');
};
module.exports.check_android_target = function(valid_target) {
// valid_target can look like:
// android-19
// android-L
// Google Inc.:Google APIs:20
// Google Inc.:Glass Development Kit Preview:20
var msg = 'Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.';
return tryCommand('android list targets --compact', msg)
.then(function(output) {
if (output.split('\n').indexOf(valid_target) == -1) {
var androidCmd = module.exports.getAbsoluteAndroidCmd();
throw new Error('Please install Android target: "' + valid_target + '".\n\n' +
'Hint: Open the SDK manager by running: ' + androidCmd + '\n' +
'You will require:\n' +
'1. "SDK Platform" for ' + valid_target + '\n' +
'2. "Android SDK Platform-tools (latest)\n' +
'3. "Android SDK Build-tools" (latest)');
}
});
};
// Returns a promise.
module.exports.run = function() {
return Q.all([this.check_java(), this.check_android()]);
}

View File

@ -1,322 +0,0 @@
#!/usr/bin/env node
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
var shell = require('shelljs'),
child_process = require('child_process'),
Q = require('q'),
path = require('path'),
fs = require('fs'),
check_reqs = require('./check_reqs'),
ROOT = path.join(__dirname, '..', '..');
// Returns a promise.
function exec(command, opt_cwd) {
var d = Q.defer();
console.log('Running: ' + command);
child_process.exec(command, { cwd: opt_cwd }, function(err, stdout, stderr) {
stdout && console.log(stdout);
stderr && console.error(stderr);
if (err) d.reject(err);
else d.resolve(stdout);
});
return d.promise;
}
function setShellFatal(value, func) {
var oldVal = shell.config.fatal;
shell.config.fatal = value;
func();
shell.config.fatal = oldVal;
}
function getFrameworkDir(projectPath, shared) {
return shared ? path.join(ROOT, 'framework') : path.join(projectPath, 'CordovaLib');
}
function copyJsAndLibrary(projectPath, shared, projectName) {
var nestedCordovaLibPath = getFrameworkDir(projectPath, false);
shell.cp('-f', path.join(ROOT, 'framework', 'assets', 'www', 'cordova.js'), path.join(projectPath, 'assets', 'www', 'cordova.js'));
// Don't fail if there are no old jars.
setShellFatal(false, function() {
shell.ls(path.join(projectPath, 'libs', 'cordova-*.jar')).forEach(function(oldJar) {
console.log("Deleting " + oldJar);
shell.rm('-f', oldJar);
});
// Delete old library project if it existed.
if (shared) {
shell.rm('-rf', nestedCordovaLibPath);
} else {
// Delete only the src, since eclipse can't handle its .project file being deleted.
shell.rm('-rf', path.join(nestedCordovaLibPath, 'src'));
}
});
if (!shared) {
shell.mkdir('-p', nestedCordovaLibPath);
shell.cp('-f', path.join(ROOT, 'framework', 'AndroidManifest.xml'), nestedCordovaLibPath);
shell.cp('-f', path.join(ROOT, 'framework', 'project.properties'), nestedCordovaLibPath);
shell.cp('-f', path.join(ROOT, 'framework', 'build.gradle'), nestedCordovaLibPath);
shell.cp('-r', path.join(ROOT, 'framework', 'src'), nestedCordovaLibPath);
// Create an eclipse project file and set the name of it to something unique.
// Without this, you can't import multiple CordovaLib projects into the same workspace.
var eclipseProjectFilePath = path.join(nestedCordovaLibPath, '.project');
if (!fs.existsSync(eclipseProjectFilePath)) {
var data = '<?xml version="1.0" encoding="UTF-8"?><projectDescription><name>' + projectName + '-' + 'CordovaLib</name></projectDescription>';
fs.writeFileSync(eclipseProjectFilePath, data, 'utf8');
}
}
}
function extractSubProjectPaths(data) {
var ret = {};
var r = /^\s*android\.library\.reference\.\d+=(.*)(?:\s|$)/mg
var m;
while (m = r.exec(data)) {
ret[m[1]] = 1;
}
return Object.keys(ret);
}
function writeProjectProperties(projectPath, target_api, shared) {
var dstPath = path.join(projectPath, 'project.properties');
var templatePath = path.join(ROOT, 'bin', 'templates', 'project', 'project.properties');
var srcPath = fs.existsSync(dstPath) ? dstPath : templatePath;
var data = fs.readFileSync(srcPath, 'utf8');
data = data.replace(/^target=.*/m, 'target=' + target_api);
var subProjects = extractSubProjectPaths(data);
subProjects = subProjects.filter(function(p) {
return !(/^CordovaLib$/m.exec(p) ||
/[\\\/]cordova-android[\\\/]framework$/m.exec(p) ||
/^(\.\.[\\\/])+framework$/m.exec(p)
);
});
subProjects.unshift(shared ? path.relative(projectPath, path.join(ROOT, 'framework')) : 'CordovaLib');
data = data.replace(/^\s*android\.library\.reference\.\d+=.*\n/mg, '');
if (!/\n$/.exec(data)) {
data += '\n';
}
for (var i = 0; i < subProjects.length; ++i) {
data += 'android.library.reference.' + (i+1) + '=' + subProjects[i] + '\n';
}
fs.writeFileSync(dstPath, data);
}
function copyBuildRules(projectPath) {
var srcDir = path.join(ROOT, 'bin', 'templates', 'project');
shell.cp('-f', path.join(srcDir, 'build.gradle'), projectPath);
shell.cp('-f', path.join(srcDir, 'cordova.gradle'), projectPath);
}
function copyScripts(projectPath) {
var srcScriptsDir = path.join(ROOT, 'bin', 'templates', 'cordova');
var destScriptsDir = path.join(projectPath, 'cordova');
// Delete old scripts directory if this is an update.
shell.rm('-rf', destScriptsDir);
// Copy in the new ones.
shell.cp('-r', srcScriptsDir, projectPath);
shell.cp('-r', path.join(ROOT, 'bin', 'node_modules'), destScriptsDir);
shell.cp(path.join(ROOT, 'bin', 'check_reqs'), path.join(destScriptsDir, 'check_reqs'));
shell.cp(path.join(ROOT, 'bin', 'lib', 'check_reqs.js'), path.join(projectPath, 'cordova', 'lib', 'check_reqs.js'));
shell.cp(path.join(ROOT, 'bin', 'android_sdk_version'), path.join(destScriptsDir, 'android_sdk_version'));
shell.cp(path.join(ROOT, 'bin', 'lib', 'android_sdk_version.js'), path.join(projectPath, 'cordova', 'lib', 'android_sdk_version.js'));
}
/**
* Test whether a package name is acceptable for use as an android project.
* Returns a promise, fulfilled if the package name is acceptable; rejected
* otherwise.
*/
function validatePackageName(package_name) {
//Make the package conform to Java package types
//Enforce underscore limitation
if (!/^[a-zA-Z]+(\.[a-zA-Z0-9][a-zA-Z0-9_]*)+$/.test(package_name)) {
return Q.reject('Package name must look like: com.company.Name');
}
//Class is a reserved word
if(/\b[Cc]lass\b/.test(package_name)) {
return Q.reject('class is a reserved word');
}
return Q.resolve();
}
/**
* Test whether a project name is acceptable for use as an android class.
* Returns a promise, fulfilled if the project name is acceptable; rejected
* otherwise.
*/
function validateProjectName(project_name) {
//Make sure there's something there
if (project_name === '') {
return Q.reject('Project name cannot be empty');
}
//Enforce stupid name error
if (project_name === 'CordovaActivity') {
return Q.reject('Project name cannot be CordovaActivity');
}
//Classes in Java don't begin with numbers
if (/^[0-9]/.test(project_name)) {
return Q.reject('Project name must not begin with a number');
}
return Q.resolve();
}
/**
* $ create [options]
*
* Creates an android application with the given options.
*
* Options:
*
* - `project_path` {String} Path to the new Cordova android project.
* - `package_name`{String} Package name, following reverse-domain style convention.
* - `project_name` {String} Project name.
* - 'project_template_dir' {String} Path to project template (override).
*
* Returns a promise.
*/
exports.createProject = function(project_path, package_name, project_name, project_template_dir, use_shared_project, use_cli_template) {
var VERSION = fs.readFileSync(path.join(ROOT, 'VERSION'), 'utf-8').trim();
// Set default values for path, package and name
project_path = typeof project_path !== 'undefined' ? project_path : "CordovaExample";
project_path = path.relative(process.cwd(), project_path);
package_name = typeof package_name !== 'undefined' ? package_name : 'my.cordova.project';
project_name = typeof project_name !== 'undefined' ? project_name : 'CordovaExample';
project_template_dir = typeof project_template_dir !== 'undefined' ?
project_template_dir :
path.join(ROOT, 'bin', 'templates', 'project');
var package_as_path = package_name.replace(/\./g, path.sep);
var activity_dir = path.join(project_path, 'src', package_as_path);
// safe_activity_name is being hardcoded to avoid issues with unicode app name (https://issues.apache.org/jira/browse/CB-6511)
// TODO: provide option to specify activity name via CLI (proposal: https://issues.apache.org/jira/browse/CB-7231)
var safe_activity_name = 'MainActivity';
var activity_path = path.join(activity_dir, safe_activity_name + '.java');
var target_api = check_reqs.get_target();
var manifest_path = path.join(project_path, 'AndroidManifest.xml');
// Check if project already exists
if(fs.existsSync(project_path)) {
return Q.reject('Project already exists! Delete and recreate');
}
//Make the package conform to Java package types
return validatePackageName(package_name)
.then(function() {
validateProjectName(project_name);
}).then(function() {
// Log the given values for the project
console.log('Creating Cordova project for the Android platform:');
console.log('\tPath: ' + project_path);
console.log('\tPackage: ' + package_name);
console.log('\tName: ' + project_name);
console.log('\tAndroid target: ' + target_api);
console.log('Copying template files...');
setShellFatal(true, function() {
// copy project template
shell.cp('-r', path.join(project_template_dir, 'assets'), project_path);
shell.cp('-r', path.join(project_template_dir, 'res'), project_path);
shell.cp('-r', path.join(ROOT, 'framework', 'res', 'xml'), path.join(project_path, 'res'));
shell.cp(path.join(project_template_dir, 'gitignore'), path.join(project_path, '.gitignore'));
// Manually create directories that would be empty within the template (since git doesn't track directories).
shell.mkdir(path.join(project_path, 'libs'));
// Add in the proper eclipse project file.
if (use_cli_template) {
var note = 'To show `assets/www` or `res/xml/config.xml`, go to:\n' +
' Project -> Properties -> Resource -> Resource Filters\n' +
'And delete the exclusion filter.\n';
shell.cp(path.join(project_template_dir, 'eclipse-project-CLI'), path.join(project_path, '.project'));
fs.writeFileSync(path.join(project_path, 'assets', '_where-is-www.txt'), note);
} else {
shell.cp(path.join(project_template_dir, 'eclipse-project'), path.join(project_path, '.project'));
}
// copy cordova.js, cordova.jar
copyJsAndLibrary(project_path, use_shared_project, safe_activity_name);
// interpolate the activity name and package
shell.mkdir('-p', activity_dir);
shell.cp('-f', path.join(project_template_dir, 'Activity.java'), activity_path);
shell.sed('-i', /__ACTIVITY__/, safe_activity_name, activity_path);
shell.sed('-i', /__NAME__/, project_name, path.join(project_path, 'res', 'values', 'strings.xml'));
shell.sed('-i', /__NAME__/, project_name, path.join(project_path, '.project'));
shell.sed('-i', /__ID__/, package_name, activity_path);
shell.cp('-f', path.join(project_template_dir, 'AndroidManifest.xml'), manifest_path);
shell.sed('-i', /__ACTIVITY__/, safe_activity_name, manifest_path);
shell.sed('-i', /__PACKAGE__/, package_name, manifest_path);
shell.sed('-i', /__APILEVEL__/, target_api.split('-')[1], manifest_path);
copyScripts(project_path);
copyBuildRules(project_path);
});
// Link it to local android install.
writeProjectProperties(project_path, target_api, use_shared_project);
}).then(function() {
console.log('Project successfully created.');
});
}
// Attribute removed in Cordova 4.4 (CB-5447).
function removeDebuggableFromManifest(projectPath) {
var manifestPath = path.join(projectPath, 'AndroidManifest.xml');
shell.sed('-i', /\s*android:debuggable="true"/, '', manifestPath);
}
function extractProjectNameFromManifest(projectPath) {
var manifestPath = path.join(projectPath, 'AndroidManifest.xml');
var manifestData = fs.readFileSync(manifestPath, 'utf8');
var m = /<activity[\s\S]*?android:name\s*=\s*"(.*?)"/i.exec(manifestData);
if (!m) {
throw new Error('Could not find activity name in ' + manifestPath);
}
return m[1];
}
// Returns a promise.
exports.updateProject = function(projectPath, shared) {
var newVersion = fs.readFileSync(path.join(ROOT, 'VERSION'), 'utf-8').trim();
return Q()
.then(function() {
var projectName = extractProjectNameFromManifest(projectPath);
var target_api = check_reqs.get_target();
copyJsAndLibrary(projectPath, shared, projectName);
copyScripts(projectPath);
copyBuildRules(projectPath);
removeDebuggableFromManifest(projectPath);
writeProjectProperties(projectPath, target_api, shared);
console.log('Android project is now at version ' + newVersion);
console.log('If you updated from a pre-3.2.0 version and use an IDE, we now require that you import the "CordovaLib" library project.');
});
};
// For testing
exports.validatePackageName = validatePackageName;
exports.validateProjectName = validateProjectName;

1
bin/node_modules/.bin/shjs generated vendored
View File

@ -1 +0,0 @@
../shelljs/bin/shjs

40
bin/node_modules/q/CONTRIBUTING.md generated vendored
View File

@ -1,40 +0,0 @@
For pull requests:
- Be consistent with prevalent style and design decisions.
- Add a Jasmine spec to `specs/q-spec.js`.
- Use `npm test` to avoid regressions.
- Run tests in `q-spec/run.html` in as many supported browsers as you
can find the will to deal with.
- Do not build minified versions; we do this each release.
- If you would be so kind, add a note to `CHANGES.md` in an
appropriate section:
- `Next Major Version` if it introduces backward incompatibilities
to code in the wild using documented features.
- `Next Minor Version` if it adds a new feature.
- `Next Patch Version` if it fixes a bug.
For releases:
- Run `npm test`.
- Run tests in `q-spec/run.html` in a representative sample of every
browser under the sun.
- Run `npm run cover` and make sure you're happy with the results.
- Run `npm run minify` and be sure to commit the resulting `q.min.js`.
- Note the Gzipped size output by the previous command, and update
`README.md` if it has changed to 1 significant digit.
- Stash any local changes.
- Update `CHANGES.md` to reflect all changes in the differences
between `HEAD` and the previous tagged version. Give credit where
credit is due.
- Update `README.md` to address all new, non-experimental features.
- Update the API reference on the Wiki to reflect all non-experimental
features.
- Use `npm version major|minor|patch` to update `package.json`,
commit, and tag the new version.
- Use `npm publish` to send up a new release.
- Send an email to the q-continuum mailing list announcing the new
release and the notes from the change log. This helps folks
maintaining other package ecosystems.

19
bin/node_modules/q/LICENSE generated vendored
View File

@ -1,19 +0,0 @@
Copyright 20092012 Kristopher Michael Kowal. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.

813
bin/node_modules/q/README.md generated vendored
View File

@ -1,813 +0,0 @@
[![Build Status](https://secure.travis-ci.org/kriskowal/q.png?branch=master)](http://travis-ci.org/kriskowal/q)
<a href="http://promises-aplus.github.com/promises-spec">
<img src="http://promises-aplus.github.com/promises-spec/assets/logo-small.png"
align="right" alt="Promises/A+ logo" />
</a>
If a function cannot return a value or throw an exception without
blocking, it can return a promise instead. A promise is an object
that represents the return value or the thrown exception that the
function may eventually provide. A promise can also be used as a
proxy for a [remote object][Q-Connection] to overcome latency.
[Q-Connection]: https://github.com/kriskowal/q-connection
On the first pass, promises can mitigate the “[Pyramid of
Doom][POD]”: the situation where code marches to the right faster
than it marches forward.
[POD]: http://calculist.org/blog/2011/12/14/why-coroutines-wont-work-on-the-web/
```javascript
step1(function (value1) {
step2(value1, function(value2) {
step3(value2, function(value3) {
step4(value3, function(value4) {
// Do something with value4
});
});
});
});
```
With a promise library, you can flatten the pyramid.
```javascript
Q.fcall(promisedStep1)
.then(promisedStep2)
.then(promisedStep3)
.then(promisedStep4)
.then(function (value4) {
// Do something with value4
})
.catch(function (error) {
// Handle any error from all above steps
})
.done();
```
With this approach, you also get implicit error propagation, just like `try`,
`catch`, and `finally`. An error in `promisedStep1` will flow all the way to
the `catch` function, where its caught and handled. (Here `promisedStepN` is
a version of `stepN` that returns a promise.)
The callback approach is called an “inversion of control”.
A function that accepts a callback instead of a return value
is saying, “Dont call me, Ill call you.”. Promises
[un-invert][IOC] the inversion, cleanly separating the input
arguments from control flow arguments. This simplifies the
use and creation of APIs, particularly variadic,
rest and spread arguments.
[IOC]: http://www.slideshare.net/domenicdenicola/callbacks-promises-and-coroutines-oh-my-the-evolution-of-asynchronicity-in-javascript
## Getting Started
The Q module can be loaded as:
- A ``<script>`` tag (creating a ``Q`` global variable): ~2.5 KB minified and
gzipped.
- A Node.js and CommonJS module, available in [npm](https://npmjs.org/) as
the [q](https://npmjs.org/package/q) package
- An AMD module
- A [component](https://github.com/component/component) as ``microjs/q``
- Using [bower](http://bower.io/) as ``q``
- Using [NuGet](http://nuget.org/) as [Q](https://nuget.org/packages/q)
Q can exchange promises with jQuery, Dojo, When.js, WinJS, and more.
## Resources
Our [wiki][] contains a number of useful resources, including:
- A method-by-method [Q API reference][reference].
- A growing [examples gallery][examples], showing how Q can be used to make
everything better. From XHR to database access to accessing the Flickr API,
Q is there for you.
- There are many libraries that produce and consume Q promises for everything
from file system/database access or RPC to templating. For a list of some of
the more popular ones, see [Libraries][].
- If you want materials that introduce the promise concept generally, and the
below tutorial isn't doing it for you, check out our collection of
[presentations, blog posts, and podcasts][resources].
- A guide for those [coming from jQuery's `$.Deferred`][jquery].
We'd also love to have you join the Q-Continuum [mailing list][].
[wiki]: https://github.com/kriskowal/q/wiki
[reference]: https://github.com/kriskowal/q/wiki/API-Reference
[examples]: https://github.com/kriskowal/q/wiki/Examples-Gallery
[Libraries]: https://github.com/kriskowal/q/wiki/Libraries
[resources]: https://github.com/kriskowal/q/wiki/General-Promise-Resources
[jquery]: https://github.com/kriskowal/q/wiki/Coming-from-jQuery
[mailing list]: https://groups.google.com/forum/#!forum/q-continuum
## Tutorial
Promises have a ``then`` method, which you can use to get the eventual
return value (fulfillment) or thrown exception (rejection).
```javascript
promiseMeSomething()
.then(function (value) {
}, function (reason) {
});
```
If ``promiseMeSomething`` returns a promise that gets fulfilled later
with a return value, the first function (the fulfillment handler) will be
called with the value. However, if the ``promiseMeSomething`` function
gets rejected later by a thrown exception, the second function (the
rejection handler) will be called with the exception.
Note that resolution of a promise is always asynchronous: that is, the
fulfillment or rejection handler will always be called in the next turn of the
event loop (i.e. `process.nextTick` in Node). This gives you a nice
guarantee when mentally tracing the flow of your code, namely that
``then`` will always return before either handler is executed.
In this tutorial, we begin with how to consume and work with promises. We'll
talk about how to create them, and thus create functions like
`promiseMeSomething` that return promises, [below](#the-beginning).
### Propagation
The ``then`` method returns a promise, which in this example, Im
assigning to ``outputPromise``.
```javascript
var outputPromise = getInputPromise()
.then(function (input) {
}, function (reason) {
});
```
The ``outputPromise`` variable becomes a new promise for the return
value of either handler. Since a function can only either return a
value or throw an exception, only one handler will ever be called and it
will be responsible for resolving ``outputPromise``.
- If you return a value in a handler, ``outputPromise`` will get
fulfilled.
- If you throw an exception in a handler, ``outputPromise`` will get
rejected.
- If you return a **promise** in a handler, ``outputPromise`` will
“become” that promise. Being able to become a new promise is useful
for managing delays, combining results, or recovering from errors.
If the ``getInputPromise()`` promise gets rejected and you omit the
rejection handler, the **error** will go to ``outputPromise``:
```javascript
var outputPromise = getInputPromise()
.then(function (value) {
});
```
If the input promise gets fulfilled and you omit the fulfillment handler, the
**value** will go to ``outputPromise``:
```javascript
var outputPromise = getInputPromise()
.then(null, function (error) {
});
```
Q promises provide a ``fail`` shorthand for ``then`` when you are only
interested in handling the error:
```javascript
var outputPromise = getInputPromise()
.fail(function (error) {
});
```
If you are writing JavaScript for modern engines only or using
CoffeeScript, you may use `catch` instead of `fail`.
Promises also have a ``fin`` function that is like a ``finally`` clause.
The final handler gets called, with no arguments, when the promise
returned by ``getInputPromise()`` either returns a value or throws an
error. The value returned or error thrown by ``getInputPromise()``
passes directly to ``outputPromise`` unless the final handler fails, and
may be delayed if the final handler returns a promise.
```javascript
var outputPromise = getInputPromise()
.fin(function () {
// close files, database connections, stop servers, conclude tests
});
```
- If the handler returns a value, the value is ignored
- If the handler throws an error, the error passes to ``outputPromise``
- If the handler returns a promise, ``outputPromise`` gets postponed. The
eventual value or error has the same effect as an immediate return
value or thrown error: a value would be ignored, an error would be
forwarded.
If you are writing JavaScript for modern engines only or using
CoffeeScript, you may use `finally` instead of `fin`.
### Chaining
There are two ways to chain promises. You can chain promises either
inside or outside handlers. The next two examples are equivalent.
```javascript
return getUsername()
.then(function (username) {
return getUser(username)
.then(function (user) {
// if we get here without an error,
// the value returned here
// or the exception thrown here
// resolves the promise returned
// by the first line
})
});
```
```javascript
return getUsername()
.then(function (username) {
return getUser(username);
})
.then(function (user) {
// if we get here without an error,
// the value returned here
// or the exception thrown here
// resolves the promise returned
// by the first line
});
```
The only difference is nesting. Its useful to nest handlers if you
need to capture multiple input values in your closure.
```javascript
function authenticate() {
return getUsername()
.then(function (username) {
return getUser(username);
})
// chained because we will not need the user name in the next event
.then(function (user) {
return getPassword()
// nested because we need both user and password next
.then(function (password) {
if (user.passwordHash !== hash(password)) {
throw new Error("Can't authenticate");
}
});
});
}
```
### Combination
You can turn an array of promises into a promise for the whole,
fulfilled array using ``all``.
```javascript
return Q.all([
eventualAdd(2, 2),
eventualAdd(10, 20)
]);
```
If you have a promise for an array, you can use ``spread`` as a
replacement for ``then``. The ``spread`` function “spreads” the
values over the arguments of the fulfillment handler. The rejection handler
will get called at the first sign of failure. That is, whichever of
the recived promises fails first gets handled by the rejection handler.
```javascript
function eventualAdd(a, b) {
return Q.spread([a, b], function (a, b) {
return a + b;
})
}
```
But ``spread`` calls ``all`` initially, so you can skip it in chains.
```javascript
return getUsername()
.then(function (username) {
return [username, getUser(username)];
})
.spread(function (username, user) {
});
```
The ``all`` function returns a promise for an array of values. When this
promise is fulfilled, the array contains the fulfillment values of the original
promises, in the same order as those promises. If one of the given promises
is rejected, the returned promise is immediately rejected, not waiting for the
rest of the batch. If you want to wait for all of the promises to either be
fulfilled or rejected, you can use ``allSettled``.
```javascript
Q.allSettled(promises)
.then(function (results) {
results.forEach(function (result) {
if (result.state === "fulfilled") {
var value = result.value;
} else {
var reason = result.reason;
}
});
});
```
### Sequences
If you have a number of promise-producing functions that need
to be run sequentially, you can of course do so manually:
```javascript
return foo(initialVal).then(bar).then(baz).then(qux);
```
However, if you want to run a dynamically constructed sequence of
functions, you'll want something like this:
```javascript
var funcs = [foo, bar, baz, qux];
var result = Q(initialVal);
funcs.forEach(function (f) {
result = result.then(f);
});
return result;
```
You can make this slightly more compact using `reduce`:
```javascript
return funcs.reduce(function (soFar, f) {
return soFar.then(f);
}, Q(initialVal));
```
Or, you could use th ultra-compact version:
```javascript
return funcs.reduce(Q.when, Q());
```
### Handling Errors
One sometimes-unintuive aspect of promises is that if you throw an
exception in the fulfillment handler, it will not be be caught by the error
handler.
```javascript
return foo()
.then(function (value) {
throw new Error("Can't bar.");
}, function (error) {
// We only get here if "foo" fails
});
```
To see why this is, consider the parallel between promises and
``try``/``catch``. We are ``try``-ing to execute ``foo()``: the error
handler represents a ``catch`` for ``foo()``, while the fulfillment handler
represents code that happens *after* the ``try``/``catch`` block.
That code then needs its own ``try``/``catch`` block.
In terms of promises, this means chaining your rejection handler:
```javascript
return foo()
.then(function (value) {
throw new Error("Can't bar.");
})
.fail(function (error) {
// We get here with either foo's error or bar's error
});
```
### Progress Notification
It's possible for promises to report their progress, e.g. for tasks that take a
long time like a file upload. Not all promises will implement progress
notifications, but for those that do, you can consume the progress values using
a third parameter to ``then``:
```javascript
return uploadFile()
.then(function () {
// Success uploading the file
}, function (err) {
// There was an error, and we get the reason for error
}, function (progress) {
// We get notified of the upload's progress as it is executed
});
```
Like `fail`, Q also provides a shorthand for progress callbacks
called `progress`:
```javascript
return uploadFile().progress(function (progress) {
// We get notified of the upload's progress
});
```
### The End
When you get to the end of a chain of promises, you should either
return the last promise or end the chain. Since handlers catch
errors, its an unfortunate pattern that the exceptions can go
unobserved.
So, either return it,
```javascript
return foo()
.then(function () {
return "bar";
});
```
Or, end it.
```javascript
foo()
.then(function () {
return "bar";
})
.done();
```
Ending a promise chain makes sure that, if an error doesnt get
handled before the end, it will get rethrown and reported.
This is a stopgap. We are exploring ways to make unhandled errors
visible without any explicit handling.
### The Beginning
Everything above assumes you get a promise from somewhere else. This
is the common case. Every once in a while, you will need to create a
promise from scratch.
#### Using ``Q.fcall``
You can create a promise from a value using ``Q.fcall``. This returns a
promise for 10.
```javascript
return Q.fcall(function () {
return 10;
});
```
You can also use ``fcall`` to get a promise for an exception.
```javascript
return Q.fcall(function () {
throw new Error("Can't do it");
});
```
As the name implies, ``fcall`` can call functions, or even promised
functions. This uses the ``eventualAdd`` function above to add two
numbers.
```javascript
return Q.fcall(eventualAdd, 2, 2);
```
#### Using Deferreds
If you have to interface with asynchronous functions that are callback-based
instead of promise-based, Q provides a few shortcuts (like ``Q.nfcall`` and
friends). But much of the time, the solution will be to use *deferreds*.
```javascript
var deferred = Q.defer();
FS.readFile("foo.txt", "utf-8", function (error, text) {
if (error) {
deferred.reject(new Error(error));
} else {
deferred.resolve(text);
}
});
return deferred.promise;
```
Note that a deferred can be resolved with a value or a promise. The
``reject`` function is a shorthand for resolving with a rejected
promise.
```javascript
// this:
deferred.reject(new Error("Can't do it"));
// is shorthand for:
var rejection = Q.fcall(function () {
throw new Error("Can't do it");
});
deferred.resolve(rejection);
```
This is a simplified implementation of ``Q.delay``.
```javascript
function delay(ms) {
var deferred = Q.defer();
setTimeout(deferred.resolve, ms);
return deferred.promise;
}
```
This is a simplified implementation of ``Q.timeout``
```javascript
function timeout(promise, ms) {
var deferred = Q.defer();
Q.when(promise, deferred.resolve);
delay(ms).then(function () {
deferred.reject(new Error("Timed out"));
});
return deferred.promise;
}
```
Finally, you can send a progress notification to the promise with
``deferred.notify``.
For illustration, this is a wrapper for XML HTTP requests in the browser. Note
that a more [thorough][XHR] implementation would be in order in practice.
[XHR]: https://github.com/montagejs/mr/blob/71e8df99bb4f0584985accd6f2801ef3015b9763/browser.js#L29-L73
```javascript
function requestOkText(url) {
var request = new XMLHttpRequest();
var deferred = Q.defer();
request.open("GET", url, true);
request.onload = onload;
request.onerror = onerror;
request.onprogress = onprogress;
request.send();
function onload() {
if (request.status === 200) {
deferred.resolve(request.responseText);
} else {
deferred.reject(new Error("Status code was " + request.status));
}
}
function onerror() {
deferred.reject(new Error("Can't XHR " + JSON.stringify(url)));
}
function onprogress(event) {
deferred.notify(event.loaded / event.total);
}
return deferred.promise;
}
```
Below is an example of how to use this ``requestOkText`` function:
```javascript
requestOkText("http://localhost:3000")
.then(function (responseText) {
// If the HTTP response returns 200 OK, log the response text.
console.log(responseText);
}, function (error) {
// If there's an error or a non-200 status code, log the error.
console.error(error);
}, function (progress) {
// Log the progress as it comes in.
console.log("Request progress: " + Math.round(progress * 100) + "%");
});
```
### The Middle
If you are using a function that may return a promise, but just might
return a value if it doesnt need to defer, you can use the “static”
methods of the Q library.
The ``when`` function is the static equivalent for ``then``.
```javascript
return Q.when(valueOrPromise, function (value) {
}, function (error) {
});
```
All of the other methods on a promise have static analogs with the
same name.
The following are equivalent:
```javascript
return Q.all([a, b]);
```
```javascript
return Q.fcall(function () {
return [a, b];
})
.all();
```
When working with promises provided by other libraries, you should
convert it to a Q promise. Not all promise libraries make the same
guarantees as Q and certainly dont provide all of the same methods.
Most libraries only provide a partially functional ``then`` method.
This thankfully is all we need to turn them into vibrant Q promises.
```javascript
return Q($.ajax(...))
.then(function () {
});
```
If there is any chance that the promise you receive is not a Q promise
as provided by your library, you should wrap it using a Q function.
You can even use ``Q.invoke`` as a shorthand.
```javascript
return Q.invoke($, 'ajax', ...)
.then(function () {
});
```
### Over the Wire
A promise can serve as a proxy for another object, even a remote
object. There are methods that allow you to optimistically manipulate
properties or call functions. All of these interactions return
promises, so they can be chained.
```
direct manipulation using a promise as a proxy
-------------------------- -------------------------------
value.foo promise.get("foo")
value.foo = value promise.put("foo", value)
delete value.foo promise.del("foo")
value.foo(...args) promise.post("foo", [args])
value.foo(...args) promise.invoke("foo", ...args)
value(...args) promise.fapply([args])
value(...args) promise.fcall(...args)
```
If the promise is a proxy for a remote object, you can shave
round-trips by using these functions instead of ``then``. To take
advantage of promises for remote objects, check out [Q-Connection][].
[Q-Connection]: https://github.com/kriskowal/q-connection
Even in the case of non-remote objects, these methods can be used as
shorthand for particularly-simple fulfillment handlers. For example, you
can replace
```javascript
return Q.fcall(function () {
return [{ foo: "bar" }, { foo: "baz" }];
})
.then(function (value) {
return value[0].foo;
});
```
with
```javascript
return Q.fcall(function () {
return [{ foo: "bar" }, { foo: "baz" }];
})
.get(0)
.get("foo");
```
### Adapting Node
If you're working with functions that make use of the Node.js callback pattern,
where callbacks are in the form of `function(err, result)`, Q provides a few
useful utility functions for converting between them. The most straightforward
are probably `Q.nfcall` and `Q.nfapply` ("Node function call/apply") for calling
Node.js-style functions and getting back a promise:
```javascript
return Q.nfcall(FS.readFile, "foo.txt", "utf-8");
return Q.nfapply(FS.readFile, ["foo.txt", "utf-8"]);
```
If you are working with methods, instead of simple functions, you can easily
run in to the usual problems where passing a method to another function—like
`Q.nfcall`—"un-binds" the method from its owner. To avoid this, you can either
use `Function.prototype.bind` or some nice shortcut methods we provide:
```javascript
return Q.ninvoke(redisClient, "get", "user:1:id");
return Q.npost(redisClient, "get", ["user:1:id"]);
```
You can also create reusable wrappers with `Q.denodeify` or `Q.nbind`:
```javascript
var readFile = Q.denodeify(FS.readFile);
return readFile("foo.txt", "utf-8");
var redisClientGet = Q.nbind(redisClient.get, redisClient);
return redisClientGet("user:1:id");
```
Finally, if you're working with raw deferred objects, there is a
`makeNodeResolver` method on deferreds that can be handy:
```javascript
var deferred = Q.defer();
FS.readFile("foo.txt", "utf-8", deferred.makeNodeResolver());
return deferred.promise;
```
### Long Stack Traces
Q comes with optional support for “long stack traces,” wherein the `stack`
property of `Error` rejection reasons is rewritten to be traced along
asynchronous jumps instead of stopping at the most recent one. As an example:
```js
function theDepthsOfMyProgram() {
Q.delay(100).done(function explode() {
throw new Error("boo!");
});
}
theDepthsOfMyProgram();
```
usually would give a rather unhelpful stack trace looking something like
```
Error: boo!
at explode (/path/to/test.js:3:11)
at _fulfilled (/path/to/test.js:q:54)
at resolvedValue.promiseDispatch.done (/path/to/q.js:823:30)
at makePromise.promise.promiseDispatch (/path/to/q.js:496:13)
at pending (/path/to/q.js:397:39)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
```
But, if you turn this feature on by setting
```js
Q.longStackSupport = true;
```
then the above code gives a nice stack trace to the tune of
```
Error: boo!
at explode (/path/to/test.js:3:11)
From previous event:
at theDepthsOfMyProgram (/path/to/test.js:2:16)
at Object.<anonymous> (/path/to/test.js:7:1)
```
Note how you can see the the function that triggered the async operation in the
stack trace! This is very helpful for debugging, as otherwise you end up getting
only the first line, plus a bunch of Q internals, with no sign of where the
operation started.
This feature does come with somewhat-serious performance and memory overhead,
however. If you're working with lots of promises, or trying to scale a server
to many users, you should probably keep it off. But in development, go for it!
## Tests
You can view the results of the Q test suite [in your browser][tests]!
[tests]: https://rawgithub.com/kriskowal/q/master/spec/q-spec.html
## License
Copyright 20092013 Kristopher Michael Kowal
MIT License (enclosed)

View File

@ -1,71 +0,0 @@
"use strict";
var Q = require("../q");
var fs = require("fs");
suite("A single simple async operation", function () {
bench("with an immediately-fulfilled promise", function (done) {
Q().then(done);
});
bench("with direct setImmediate usage", function (done) {
setImmediate(done);
});
bench("with direct setTimeout(…, 0)", function (done) {
setTimeout(done, 0);
});
});
suite("A fs.readFile", function () {
var denodeified = Q.denodeify(fs.readFile);
set("iterations", 1000);
set("delay", 1000);
bench("directly, with callbacks", function (done) {
fs.readFile(__filename, done);
});
bench("with Q.nfcall", function (done) {
Q.nfcall(fs.readFile, __filename).then(done);
});
bench("with a Q.denodeify'ed version", function (done) {
denodeified(__filename).then(done);
});
bench("with manual usage of deferred.makeNodeResolver", function (done) {
var deferred = Q.defer();
fs.readFile(__filename, deferred.makeNodeResolver());
deferred.promise.then(done);
});
});
suite("1000 operations in parallel", function () {
function makeCounter(desiredCount, ultimateCallback) {
var soFar = 0;
return function () {
if (++soFar === desiredCount) {
ultimateCallback();
}
};
}
var numberOfOps = 1000;
bench("with immediately-fulfilled promises", function (done) {
var counter = makeCounter(numberOfOps, done);
for (var i = 0; i < numberOfOps; ++i) {
Q().then(counter);
}
});
bench("with direct setImmediate usage", function (done) {
var counter = makeCounter(numberOfOps, done);
for (var i = 0; i < numberOfOps; ++i) {
setImmediate(counter);
}
});
});

View File

@ -1,36 +0,0 @@
"use strict";
var Q = require("../q");
suite("Chaining", function () {
var numberToChain = 1000;
bench("Chaining many already-fulfilled promises together", function (done) {
var currentPromise = Q();
for (var i = 0; i < numberToChain; ++i) {
currentPromise = currentPromise.then(function () {
return Q();
});
}
currentPromise.then(done);
});
bench("Chaining and then fulfilling the end of the chain", function (done) {
var deferred = Q.defer();
var currentPromise = deferred.promise;
for (var i = 0; i < numberToChain; ++i) {
(function () {
var promiseToReturn = currentPromise;
currentPromise = Q().then(function () {
return promiseToReturn;
});
}());
}
currentPromise.then(done);
deferred.resolve();
});
});

93
bin/node_modules/q/package.json generated vendored

File diff suppressed because one or more lines are too long

1937
bin/node_modules/q/q.js generated vendored

File diff suppressed because it is too large Load Diff

35
bin/node_modules/q/queue.js generated vendored
View File

@ -1,35 +0,0 @@
var Q = require("./q");
module.exports = Queue;
function Queue() {
var ends = Q.defer();
var closed = Q.defer();
return {
put: function (value) {
var next = Q.defer();
ends.resolve({
head: value,
tail: next.promise
});
ends.resolve = next.resolve;
},
get: function () {
var result = ends.promise.get("head");
ends.promise = ends.promise.get("tail");
return result.fail(function (error) {
closed.resolve(error);
throw error;
});
},
closed: closed.promise,
close: function (error) {
error = error || new Error("Can't get value from closed queue");
var end = {head: Q.reject(error)};
end.tail = end;
ends.resolve(end);
return closed.promise;
}
};
}

View File

@ -1,6 +0,0 @@
{
"name": "ShellJS",
"twitter": [
"r2r"
]
}

7
bin/node_modules/shelljs/.jshintrc generated vendored
View File

@ -1,7 +0,0 @@
{
"loopfunc": true,
"sub": true,
"undef": true,
"unused": true,
"node": true
}

View File

@ -1,2 +0,0 @@
test/
tmp/

View File

@ -1,5 +0,0 @@
language: node_js
node_js:
- "0.8"
- "0.10"
- "0.11"

26
bin/node_modules/shelljs/LICENSE generated vendored
View File

@ -1,26 +0,0 @@
Copyright (c) 2012, Artur Adib <aadib@mozilla.com>
All rights reserved.
You may use this project under the terms of the New BSD license as follows:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Artur Adib nor the
names of the contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL ARTUR ADIB BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

552
bin/node_modules/shelljs/README.md generated vendored
View File

@ -1,552 +0,0 @@
# ShellJS - Unix shell commands for Node.js [![Build Status](https://secure.travis-ci.org/arturadib/shelljs.png)](http://travis-ci.org/arturadib/shelljs)
ShellJS is a portable **(Windows/Linux/OS X)** implementation of Unix shell commands on top of the Node.js API. You can use it to eliminate your shell script's dependency on Unix while still keeping its familiar and powerful commands. You can also install it globally so you can run it from outside Node projects - say goodbye to those gnarly Bash scripts!
The project is [unit-tested](http://travis-ci.org/arturadib/shelljs) and battled-tested in projects like:
+ [PDF.js](http://github.com/mozilla/pdf.js) - Firefox's next-gen PDF reader
+ [Firebug](http://getfirebug.com/) - Firefox's infamous debugger
+ [JSHint](http://jshint.com) - Most popular JavaScript linter
+ [Zepto](http://zeptojs.com) - jQuery-compatible JavaScript library for modern browsers
+ [Yeoman](http://yeoman.io/) - Web application stack and development tool
+ [Deployd.com](http://deployd.com) - Open source PaaS for quick API backend generation
and [many more](https://npmjs.org/browse/depended/shelljs).
## Installing
Via npm:
```bash
$ npm install [-g] shelljs
```
If the global option `-g` is specified, the binary `shjs` will be installed. This makes it possible to
run ShellJS scripts much like any shell script from the command line, i.e. without requiring a `node_modules` folder:
```bash
$ shjs my_script
```
You can also just copy `shell.js` into your project's directory, and `require()` accordingly.
## Examples
### JavaScript
```javascript
require('shelljs/global');
if (!which('git')) {
echo('Sorry, this script requires git');
exit(1);
}
// Copy files to release dir
mkdir('-p', 'out/Release');
cp('-R', 'stuff/*', 'out/Release');
// Replace macros in each .js file
cd('lib');
ls('*.js').forEach(function(file) {
sed('-i', 'BUILD_VERSION', 'v0.1.2', file);
sed('-i', /.*REMOVE_THIS_LINE.*\n/, '', file);
sed('-i', /.*REPLACE_LINE_WITH_MACRO.*\n/, cat('macro.js'), file);
});
cd('..');
// Run external tool synchronously
if (exec('git commit -am "Auto-commit"').code !== 0) {
echo('Error: Git commit failed');
exit(1);
}
```
### CoffeeScript
```coffeescript
require 'shelljs/global'
if not which 'git'
echo 'Sorry, this script requires git'
exit 1
# Copy files to release dir
mkdir '-p', 'out/Release'
cp '-R', 'stuff/*', 'out/Release'
# Replace macros in each .js file
cd 'lib'
for file in ls '*.js'
sed '-i', 'BUILD_VERSION', 'v0.1.2', file
sed '-i', /.*REMOVE_THIS_LINE.*\n/, '', file
sed '-i', /.*REPLACE_LINE_WITH_MACRO.*\n/, cat 'macro.js', file
cd '..'
# Run external tool synchronously
if (exec 'git commit -am "Auto-commit"').code != 0
echo 'Error: Git commit failed'
exit 1
```
## Global vs. Local
The example above uses the convenience script `shelljs/global` to reduce verbosity. If polluting your global namespace is not desirable, simply require `shelljs`.
Example:
```javascript
var shell = require('shelljs');
shell.echo('hello world');
```
## Make tool
A convenience script `shelljs/make` is also provided to mimic the behavior of a Unix Makefile. In this case all shell objects are global, and command line arguments will cause the script to execute only the corresponding function in the global `target` object. To avoid redundant calls, target functions are executed only once per script.
Example (CoffeeScript):
```coffeescript
require 'shelljs/make'
target.all = ->
target.bundle()
target.docs()
target.bundle = ->
cd __dirname
mkdir 'build'
cd 'lib'
(cat '*.js').to '../build/output.js'
target.docs = ->
cd __dirname
mkdir 'docs'
cd 'lib'
for file in ls '*.js'
text = grep '//@', file # extract special comments
text.replace '//@', '' # remove comment tags
text.to 'docs/my_docs.md'
```
To run the target `all`, call the above script without arguments: `$ node make`. To run the target `docs`: `$ node make docs`, and so on.
<!--
DO NOT MODIFY BEYOND THIS POINT - IT'S AUTOMATICALLY GENERATED
-->
## Command reference
All commands run synchronously, unless otherwise stated.
### cd('dir')
Changes to directory `dir` for the duration of the script
### pwd()
Returns the current directory.
### ls([options ,] path [,path ...])
### ls([options ,] path_array)
Available options:
+ `-R`: recursive
+ `-A`: all files (include files beginning with `.`, except for `.` and `..`)
Examples:
```javascript
ls('projs/*.js');
ls('-R', '/users/me', '/tmp');
ls('-R', ['/users/me', '/tmp']); // same as above
```
Returns array of files in the given path, or in current directory if no path provided.
### find(path [,path ...])
### find(path_array)
Examples:
```javascript
find('src', 'lib');
find(['src', 'lib']); // same as above
find('.').filter(function(file) { return file.match(/\.js$/); });
```
Returns array of all files (however deep) in the given paths.
The main difference from `ls('-R', path)` is that the resulting file names
include the base directories, e.g. `lib/resources/file1` instead of just `file1`.
### cp([options ,] source [,source ...], dest)
### cp([options ,] source_array, dest)
Available options:
+ `-f`: force
+ `-r, -R`: recursive
Examples:
```javascript
cp('file1', 'dir1');
cp('-Rf', '/tmp/*', '/usr/local/*', '/home/tmp');
cp('-Rf', ['/tmp/*', '/usr/local/*'], '/home/tmp'); // same as above
```
Copies files. The wildcard `*` is accepted.
### rm([options ,] file [, file ...])
### rm([options ,] file_array)
Available options:
+ `-f`: force
+ `-r, -R`: recursive
Examples:
```javascript
rm('-rf', '/tmp/*');
rm('some_file.txt', 'another_file.txt');
rm(['some_file.txt', 'another_file.txt']); // same as above
```
Removes files. The wildcard `*` is accepted.
### mv(source [, source ...], dest')
### mv(source_array, dest')
Available options:
+ `f`: force
Examples:
```javascript
mv('-f', 'file', 'dir/');
mv('file1', 'file2', 'dir/');
mv(['file1', 'file2'], 'dir/'); // same as above
```
Moves files. The wildcard `*` is accepted.
### mkdir([options ,] dir [, dir ...])
### mkdir([options ,] dir_array)
Available options:
+ `p`: full path (will create intermediate dirs if necessary)
Examples:
```javascript
mkdir('-p', '/tmp/a/b/c/d', '/tmp/e/f/g');
mkdir('-p', ['/tmp/a/b/c/d', '/tmp/e/f/g']); // same as above
```
Creates directories.
### test(expression)
Available expression primaries:
+ `'-b', 'path'`: true if path is a block device
+ `'-c', 'path'`: true if path is a character device
+ `'-d', 'path'`: true if path is a directory
+ `'-e', 'path'`: true if path exists
+ `'-f', 'path'`: true if path is a regular file
+ `'-L', 'path'`: true if path is a symboilc link
+ `'-p', 'path'`: true if path is a pipe (FIFO)
+ `'-S', 'path'`: true if path is a socket
Examples:
```javascript
if (test('-d', path)) { /* do something with dir */ };
if (!test('-f', path)) continue; // skip if it's a regular file
```
Evaluates expression using the available primaries and returns corresponding value.
### cat(file [, file ...])
### cat(file_array)
Examples:
```javascript
var str = cat('file*.txt');
var str = cat('file1', 'file2');
var str = cat(['file1', 'file2']); // same as above
```
Returns a string containing the given file, or a concatenated string
containing the files if more than one file is given (a new line character is
introduced between each file). Wildcard `*` accepted.
### 'string'.to(file)
Examples:
```javascript
cat('input.txt').to('output.txt');
```
Analogous to the redirection operator `>` in Unix, but works with JavaScript strings (such as
those returned by `cat`, `grep`, etc). _Like Unix redirections, `to()` will overwrite any existing file!_
### 'string'.toEnd(file)
Examples:
```javascript
cat('input.txt').toEnd('output.txt');
```
Analogous to the redirect-and-append operator `>>` in Unix, but works with JavaScript strings (such as
those returned by `cat`, `grep`, etc).
### sed([options ,] search_regex, replace_str, file)
Available options:
+ `-i`: Replace contents of 'file' in-place. _Note that no backups will be created!_
Examples:
```javascript
sed('-i', 'PROGRAM_VERSION', 'v0.1.3', 'source.js');
sed(/.*DELETE_THIS_LINE.*\n/, '', 'source.js');
```
Reads an input string from `file` and performs a JavaScript `replace()` on the input
using the given search regex and replacement string. Returns the new string after replacement.
### grep([options ,] regex_filter, file [, file ...])
### grep([options ,] regex_filter, file_array)
Available options:
+ `-v`: Inverse the sense of the regex and print the lines not matching the criteria.
Examples:
```javascript
grep('-v', 'GLOBAL_VARIABLE', '*.js');
grep('GLOBAL_VARIABLE', '*.js');
```
Reads input string from given files and returns a string containing all lines of the
file that match the given `regex_filter`. Wildcard `*` accepted.
### which(command)
Examples:
```javascript
var nodeExec = which('node');
```
Searches for `command` in the system's PATH. On Windows looks for `.exe`, `.cmd`, and `.bat` extensions.
Returns string containing the absolute path to the command.
### echo(string [,string ...])
Examples:
```javascript
echo('hello world');
var str = echo('hello world');
```
Prints string to stdout, and returns string with additional utility methods
like `.to()`.
### pushd([options,] [dir | '-N' | '+N'])
Available options:
+ `-n`: Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated.
Arguments:
+ `dir`: Makes the current working directory be the top of the stack, and then executes the equivalent of `cd dir`.
+ `+N`: Brings the Nth directory (counting from the left of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
+ `-N`: Brings the Nth directory (counting from the right of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
Examples:
```javascript
// process.cwd() === '/usr'
pushd('/etc'); // Returns /etc /usr
pushd('+1'); // Returns /usr /etc
```
Save the current directory on the top of the directory stack and then cd to `dir`. With no arguments, pushd exchanges the top two directories. Returns an array of paths in the stack.
### popd([options,] ['-N' | '+N'])
Available options:
+ `-n`: Suppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated.
Arguments:
+ `+N`: Removes the Nth directory (counting from the left of the list printed by dirs), starting with zero.
+ `-N`: Removes the Nth directory (counting from the right of the list printed by dirs), starting with zero.
Examples:
```javascript
echo(process.cwd()); // '/usr'
pushd('/etc'); // '/etc /usr'
echo(process.cwd()); // '/etc'
popd(); // '/usr'
echo(process.cwd()); // '/usr'
```
When no arguments are given, popd removes the top directory from the stack and performs a cd to the new top directory. The elements are numbered from 0 starting at the first directory listed with dirs; i.e., popd is equivalent to popd +0. Returns an array of paths in the stack.
### dirs([options | '+N' | '-N'])
Available options:
+ `-c`: Clears the directory stack by deleting all of the elements.
Arguments:
+ `+N`: Displays the Nth directory (counting from the left of the list printed by dirs when invoked without options), starting with zero.
+ `-N`: Displays the Nth directory (counting from the right of the list printed by dirs when invoked without options), starting with zero.
Display the list of currently remembered directories. Returns an array of paths in the stack, or a single path if +N or -N was specified.
See also: pushd, popd
### exit(code)
Exits the current process with the given exit code.
### env['VAR_NAME']
Object containing environment variables (both getter and setter). Shortcut to process.env.
### exec(command [, options] [, callback])
Available options (all `false` by default):
+ `async`: Asynchronous execution. Defaults to true if a callback is provided.
+ `silent`: Do not echo program output to console.
Examples:
```javascript
var version = exec('node --version', {silent:true}).output;
var child = exec('some_long_running_process', {async:true});
child.stdout.on('data', function(data) {
/* ... do something with data ... */
});
exec('some_long_running_process', function(code, output) {
console.log('Exit code:', code);
console.log('Program output:', output);
});
```
Executes the given `command` _synchronously_, unless otherwise specified.
When in synchronous mode returns the object `{ code:..., output:... }`, containing the program's
`output` (stdout + stderr) and its exit `code`. Otherwise returns the child process object, and
the `callback` gets the arguments `(code, output)`.
**Note:** For long-lived processes, it's best to run `exec()` asynchronously as
the current synchronous implementation uses a lot of CPU. This should be getting
fixed soon.
### chmod(octal_mode || octal_string, file)
### chmod(symbolic_mode, file)
Available options:
+ `-v`: output a diagnostic for every file processed
+ `-c`: like verbose but report only when a change is made
+ `-R`: change files and directories recursively
Examples:
```javascript
chmod(755, '/Users/brandon');
chmod('755', '/Users/brandon'); // same as above
chmod('u+x', '/Users/brandon');
```
Alters the permissions of a file or directory by either specifying the
absolute permissions in octal form or expressing the changes in symbols.
This command tries to mimic the POSIX behavior as much as possible.
Notable exceptions:
+ In symbolic modes, 'a-r' and '-r' are identical. No consideration is
given to the umask.
+ There is no "quiet" option since default behavior is to run silent.
## Non-Unix commands
### tempdir()
Examples:
```javascript
var tmp = tempdir(); // "/tmp" for most *nix platforms
```
Searches and returns string containing a writeable, platform-dependent temporary directory.
Follows Python's [tempfile algorithm](http://docs.python.org/library/tempfile.html#tempfile.tempdir).
### error()
Tests if error occurred in the last command. Returns `null` if no error occurred,
otherwise returns string explaining the error
## Configuration
### config.silent
Example:
```javascript
var silentState = config.silent; // save old silent state
config.silent = true;
/* ... */
config.silent = silentState; // restore old silent state
```
Suppresses all command output if `true`, except for `echo()` calls.
Default is `false`.
### config.fatal
Example:
```javascript
config.fatal = true;
cp('this_file_does_not_exist', '/dev/null'); // dies here
/* more commands... */
```
If `true` the script will die on errors. Default is `false`.

51
bin/node_modules/shelljs/bin/shjs generated vendored
View File

@ -1,51 +0,0 @@
#!/usr/bin/env node
require('../global');
if (process.argv.length < 3) {
console.log('ShellJS: missing argument (script name)');
console.log();
process.exit(1);
}
var args,
scriptName = process.argv[2];
env['NODE_PATH'] = __dirname + '/../..';
if (!scriptName.match(/\.js/) && !scriptName.match(/\.coffee/)) {
if (test('-f', scriptName + '.js'))
scriptName += '.js';
if (test('-f', scriptName + '.coffee'))
scriptName += '.coffee';
}
if (!test('-f', scriptName)) {
console.log('ShellJS: script not found ('+scriptName+')');
console.log();
process.exit(1);
}
args = process.argv.slice(3);
for (var i = 0, l = args.length; i < l; i++) {
if (args[i][0] !== "-"){
args[i] = '"' + args[i] + '"'; // fixes arguments with multiple words
}
}
if (scriptName.match(/\.coffee$/)) {
//
// CoffeeScript
//
if (which('coffee')) {
exec('coffee ' + scriptName + ' ' + args.join(' '), { async: true });
} else {
console.log('ShellJS: CoffeeScript interpreter not found');
console.log();
process.exit(1);
}
} else {
//
// JavaScript
//
exec('node ' + scriptName + ' ' + args.join(' '), { async: true });
}

3
bin/node_modules/shelljs/global.js generated vendored
View File

@ -1,3 +0,0 @@
var shell = require('./shell.js');
for (var cmd in shell)
global[cmd] = shell[cmd];

47
bin/node_modules/shelljs/make.js generated vendored
View File

@ -1,47 +0,0 @@
require('./global');
global.config.fatal = true;
global.target = {};
// This ensures we only execute the script targets after the entire script has
// been evaluated
var args = process.argv.slice(2);
setTimeout(function() {
var t;
if (args.length === 1 && args[0] === '--help') {
console.log('Available targets:');
for (t in global.target)
console.log(' ' + t);
return;
}
// Wrap targets to prevent duplicate execution
for (t in global.target) {
(function(t, oldTarget){
// Wrap it
global.target[t] = function(force) {
if (oldTarget.done && !force)
return;
oldTarget.done = true;
return oldTarget.apply(oldTarget, arguments);
};
})(t, global.target[t]);
}
// Execute desired targets
if (args.length > 0) {
args.forEach(function(arg) {
if (arg in global.target)
global.target[arg]();
else {
console.log('no such target: ' + arg);
}
});
} else if ('all' in global.target) {
global.target.all();
}
}, 0);

File diff suppressed because one or more lines are too long

View File

@ -1,21 +0,0 @@
#!/usr/bin/env node
require('../global');
echo('Appending docs to README.md');
cd(__dirname + '/..');
// Extract docs from shell.js
var docs = grep('//@', 'shell.js');
docs = docs.replace(/\/\/\@include (.+)/g, function(match, path) {
var file = path.match('.js$') ? path : path+'.js';
return grep('//@', file);
});
// Remove '//@'
docs = docs.replace(/\/\/\@ ?/g, '');
// Append docs to README
sed('-i', /## Command reference(.|\n)*/, '## Command reference\n\n' + docs, 'README.md');
echo('All done.');

View File

@ -1,50 +0,0 @@
#!/usr/bin/env node
require('../global');
var path = require('path');
var failed = false;
//
// Lint
//
JSHINT_BIN = './node_modules/jshint/bin/jshint';
cd(__dirname + '/..');
if (!test('-f', JSHINT_BIN)) {
echo('JSHint not found. Run `npm install` in the root dir first.');
exit(1);
}
if (exec(JSHINT_BIN + ' *.js test/*.js').code !== 0) {
failed = true;
echo('*** JSHINT FAILED! (return code != 0)');
echo();
} else {
echo('All JSHint tests passed');
echo();
}
//
// Unit tests
//
cd(__dirname + '/../test');
ls('*.js').forEach(function(file) {
echo('Running test:', file);
if (exec('node ' + file).code !== 123) { // 123 avoids false positives (e.g. premature exit)
failed = true;
echo('*** TEST FAILED! (missing exit code "123")');
echo();
}
});
if (failed) {
echo();
echo('*******************************************************');
echo('WARNING: Some tests did not pass!');
echo('*******************************************************');
exit(1);
} else {
echo();
echo('All tests passed.');
}

153
bin/node_modules/shelljs/shell.js generated vendored
View File

@ -1,153 +0,0 @@
//
// ShellJS
// Unix shell commands on top of Node's API
//
// Copyright (c) 2012 Artur Adib
// http://github.com/arturadib/shelljs
//
var common = require('./src/common');
//@
//@ All commands run synchronously, unless otherwise stated.
//@
//@include ./src/cd
var _cd = require('./src/cd');
exports.cd = common.wrap('cd', _cd);
//@include ./src/pwd
var _pwd = require('./src/pwd');
exports.pwd = common.wrap('pwd', _pwd);
//@include ./src/ls
var _ls = require('./src/ls');
exports.ls = common.wrap('ls', _ls);
//@include ./src/find
var _find = require('./src/find');
exports.find = common.wrap('find', _find);
//@include ./src/cp
var _cp = require('./src/cp');
exports.cp = common.wrap('cp', _cp);
//@include ./src/rm
var _rm = require('./src/rm');
exports.rm = common.wrap('rm', _rm);
//@include ./src/mv
var _mv = require('./src/mv');
exports.mv = common.wrap('mv', _mv);
//@include ./src/mkdir
var _mkdir = require('./src/mkdir');
exports.mkdir = common.wrap('mkdir', _mkdir);
//@include ./src/test
var _test = require('./src/test');
exports.test = common.wrap('test', _test);
//@include ./src/cat
var _cat = require('./src/cat');
exports.cat = common.wrap('cat', _cat);
//@include ./src/to
var _to = require('./src/to');
String.prototype.to = common.wrap('to', _to);
//@include ./src/toEnd
var _toEnd = require('./src/toEnd');
String.prototype.toEnd = common.wrap('toEnd', _toEnd);
//@include ./src/sed
var _sed = require('./src/sed');
exports.sed = common.wrap('sed', _sed);
//@include ./src/grep
var _grep = require('./src/grep');
exports.grep = common.wrap('grep', _grep);
//@include ./src/which
var _which = require('./src/which');
exports.which = common.wrap('which', _which);
//@include ./src/echo
var _echo = require('./src/echo');
exports.echo = _echo; // don't common.wrap() as it could parse '-options'
//@include ./src/dirs
var _dirs = require('./src/dirs').dirs;
exports.dirs = common.wrap("dirs", _dirs);
var _pushd = require('./src/dirs').pushd;
exports.pushd = common.wrap('pushd', _pushd);
var _popd = require('./src/dirs').popd;
exports.popd = common.wrap("popd", _popd);
//@
//@ ### exit(code)
//@ Exits the current process with the given exit code.
exports.exit = process.exit;
//@
//@ ### env['VAR_NAME']
//@ Object containing environment variables (both getter and setter). Shortcut to process.env.
exports.env = process.env;
//@include ./src/exec
var _exec = require('./src/exec');
exports.exec = common.wrap('exec', _exec, {notUnix:true});
//@include ./src/chmod
var _chmod = require('./src/chmod');
exports.chmod = common.wrap('chmod', _chmod);
//@
//@ ## Non-Unix commands
//@
//@include ./src/tempdir
var _tempDir = require('./src/tempdir');
exports.tempdir = common.wrap('tempdir', _tempDir);
//@include ./src/error
var _error = require('./src/error');
exports.error = _error;
//@
//@ ## Configuration
//@
exports.config = common.config;
//@
//@ ### config.silent
//@ Example:
//@
//@ ```javascript
//@ var silentState = config.silent; // save old silent state
//@ config.silent = true;
//@ /* ... */
//@ config.silent = silentState; // restore old silent state
//@ ```
//@
//@ Suppresses all command output if `true`, except for `echo()` calls.
//@ Default is `false`.
//@
//@ ### config.fatal
//@ Example:
//@
//@ ```javascript
//@ config.fatal = true;
//@ cp('this_file_does_not_exist', '/dev/null'); // dies here
//@ /* more commands... */
//@ ```
//@
//@ If `true` the script will die on errors. Default is `false`.

43
bin/node_modules/shelljs/src/cat.js generated vendored
View File

@ -1,43 +0,0 @@
var common = require('./common');
var fs = require('fs');
//@
//@ ### cat(file [, file ...])
//@ ### cat(file_array)
//@
//@ Examples:
//@
//@ ```javascript
//@ var str = cat('file*.txt');
//@ var str = cat('file1', 'file2');
//@ var str = cat(['file1', 'file2']); // same as above
//@ ```
//@
//@ Returns a string containing the given file, or a concatenated string
//@ containing the files if more than one file is given (a new line character is
//@ introduced between each file). Wildcard `*` accepted.
function _cat(options, files) {
var cat = '';
if (!files)
common.error('no paths given');
if (typeof files === 'string')
files = [].slice.call(arguments, 1);
// if it's array leave it as it is
files = common.expand(files);
files.forEach(function(file) {
if (!fs.existsSync(file))
common.error('no such file or directory: ' + file);
cat += fs.readFileSync(file, 'utf8') + '\n';
});
if (cat[cat.length-1] === '\n')
cat = cat.substring(0, cat.length-1);
return common.ShellString(cat);
}
module.exports = _cat;

19
bin/node_modules/shelljs/src/cd.js generated vendored
View File

@ -1,19 +0,0 @@
var fs = require('fs');
var common = require('./common');
//@
//@ ### cd('dir')
//@ Changes to directory `dir` for the duration of the script
function _cd(options, dir) {
if (!dir)
common.error('directory not specified');
if (!fs.existsSync(dir))
common.error('no such file or directory: ' + dir);
if (!fs.statSync(dir).isDirectory())
common.error('not a directory: ' + dir);
process.chdir(dir);
}
module.exports = _cd;

208
bin/node_modules/shelljs/src/chmod.js generated vendored
View File

@ -1,208 +0,0 @@
var common = require('./common');
var fs = require('fs');
var path = require('path');
var PERMS = (function (base) {
return {
OTHER_EXEC : base.EXEC,
OTHER_WRITE : base.WRITE,
OTHER_READ : base.READ,
GROUP_EXEC : base.EXEC << 3,
GROUP_WRITE : base.WRITE << 3,
GROUP_READ : base.READ << 3,
OWNER_EXEC : base.EXEC << 6,
OWNER_WRITE : base.WRITE << 6,
OWNER_READ : base.READ << 6,
// Literal octal numbers are apparently not allowed in "strict" javascript. Using parseInt is
// the preferred way, else a jshint warning is thrown.
STICKY : parseInt('01000', 8),
SETGID : parseInt('02000', 8),
SETUID : parseInt('04000', 8),
TYPE_MASK : parseInt('0770000', 8)
};
})({
EXEC : 1,
WRITE : 2,
READ : 4
});
//@
//@ ### chmod(octal_mode || octal_string, file)
//@ ### chmod(symbolic_mode, file)
//@
//@ Available options:
//@
//@ + `-v`: output a diagnostic for every file processed//@
//@ + `-c`: like verbose but report only when a change is made//@
//@ + `-R`: change files and directories recursively//@
//@
//@ Examples:
//@
//@ ```javascript
//@ chmod(755, '/Users/brandon');
//@ chmod('755', '/Users/brandon'); // same as above
//@ chmod('u+x', '/Users/brandon');
//@ ```
//@
//@ Alters the permissions of a file or directory by either specifying the
//@ absolute permissions in octal form or expressing the changes in symbols.
//@ This command tries to mimic the POSIX behavior as much as possible.
//@ Notable exceptions:
//@
//@ + In symbolic modes, 'a-r' and '-r' are identical. No consideration is
//@ given to the umask.
//@ + There is no "quiet" option since default behavior is to run silent.
function _chmod(options, mode, filePattern) {
if (!filePattern) {
if (options.length > 0 && options.charAt(0) === '-') {
// Special case where the specified file permissions started with - to subtract perms, which
// get picked up by the option parser as command flags.
// If we are down by one argument and options starts with -, shift everything over.
filePattern = mode;
mode = options;
options = '';
}
else {
common.error('You must specify a file.');
}
}
options = common.parseOptions(options, {
'R': 'recursive',
'c': 'changes',
'v': 'verbose'
});
if (typeof filePattern === 'string') {
filePattern = [ filePattern ];
}
var files;
if (options.recursive) {
files = [];
common.expand(filePattern).forEach(function addFile(expandedFile) {
var stat = fs.lstatSync(expandedFile);
if (!stat.isSymbolicLink()) {
files.push(expandedFile);
if (stat.isDirectory()) { // intentionally does not follow symlinks.
fs.readdirSync(expandedFile).forEach(function (child) {
addFile(expandedFile + '/' + child);
});
}
}
});
}
else {
files = common.expand(filePattern);
}
files.forEach(function innerChmod(file) {
file = path.resolve(file);
if (!fs.existsSync(file)) {
common.error('File not found: ' + file);
}
// When recursing, don't follow symlinks.
if (options.recursive && fs.lstatSync(file).isSymbolicLink()) {
return;
}
var perms = fs.statSync(file).mode;
var type = perms & PERMS.TYPE_MASK;
var newPerms = perms;
if (isNaN(parseInt(mode, 8))) {
// parse options
mode.split(',').forEach(function (symbolicMode) {
/*jshint regexdash:true */
var pattern = /([ugoa]*)([=\+-])([rwxXst]*)/i;
var matches = pattern.exec(symbolicMode);
if (matches) {
var applyTo = matches[1];
var operator = matches[2];
var change = matches[3];
var changeOwner = applyTo.indexOf('u') != -1 || applyTo === 'a' || applyTo === '';
var changeGroup = applyTo.indexOf('g') != -1 || applyTo === 'a' || applyTo === '';
var changeOther = applyTo.indexOf('o') != -1 || applyTo === 'a' || applyTo === '';
var changeRead = change.indexOf('r') != -1;
var changeWrite = change.indexOf('w') != -1;
var changeExec = change.indexOf('x') != -1;
var changeSticky = change.indexOf('t') != -1;
var changeSetuid = change.indexOf('s') != -1;
var mask = 0;
if (changeOwner) {
mask |= (changeRead ? PERMS.OWNER_READ : 0) + (changeWrite ? PERMS.OWNER_WRITE : 0) + (changeExec ? PERMS.OWNER_EXEC : 0) + (changeSetuid ? PERMS.SETUID : 0);
}
if (changeGroup) {
mask |= (changeRead ? PERMS.GROUP_READ : 0) + (changeWrite ? PERMS.GROUP_WRITE : 0) + (changeExec ? PERMS.GROUP_EXEC : 0) + (changeSetuid ? PERMS.SETGID : 0);
}
if (changeOther) {
mask |= (changeRead ? PERMS.OTHER_READ : 0) + (changeWrite ? PERMS.OTHER_WRITE : 0) + (changeExec ? PERMS.OTHER_EXEC : 0);
}
// Sticky bit is special - it's not tied to user, group or other.
if (changeSticky) {
mask |= PERMS.STICKY;
}
switch (operator) {
case '+':
newPerms |= mask;
break;
case '-':
newPerms &= ~mask;
break;
case '=':
newPerms = type + mask;
// According to POSIX, when using = to explicitly set the permissions, setuid and setgid can never be cleared.
if (fs.statSync(file).isDirectory()) {
newPerms |= (PERMS.SETUID + PERMS.SETGID) & perms;
}
break;
}
if (options.verbose) {
log(file + ' -> ' + newPerms.toString(8));
}
if (perms != newPerms) {
if (!options.verbose && options.changes) {
log(file + ' -> ' + newPerms.toString(8));
}
fs.chmodSync(file, newPerms);
}
}
else {
common.error('Invalid symbolic mode change: ' + symbolicMode);
}
});
}
else {
// they gave us a full number
newPerms = type + parseInt(mode, 8);
// POSIX rules are that setuid and setgid can only be added using numeric form, but not cleared.
if (fs.statSync(file).isDirectory()) {
newPerms |= (PERMS.SETUID + PERMS.SETGID) & perms;
}
fs.chmodSync(file, newPerms);
}
});
}
module.exports = _chmod;

View File

@ -1,189 +0,0 @@
var os = require('os');
var fs = require('fs');
var _ls = require('./ls');
// Module globals
var config = {
silent: false,
fatal: false
};
exports.config = config;
var state = {
error: null,
currentCmd: 'shell.js',
tempDir: null
};
exports.state = state;
var platform = os.type().match(/^Win/) ? 'win' : 'unix';
exports.platform = platform;
function log() {
if (!config.silent)
console.log.apply(this, arguments);
}
exports.log = log;
// Shows error message. Throws unless _continue or config.fatal are true
function error(msg, _continue) {
if (state.error === null)
state.error = '';
state.error += state.currentCmd + ': ' + msg + '\n';
if (msg.length > 0)
log(state.error);
if (config.fatal)
process.exit(1);
if (!_continue)
throw '';
}
exports.error = error;
// In the future, when Proxies are default, we can add methods like `.to()` to primitive strings.
// For now, this is a dummy function to bookmark places we need such strings
function ShellString(str) {
return str;
}
exports.ShellString = ShellString;
// Returns {'alice': true, 'bob': false} when passed a dictionary, e.g.:
// parseOptions('-a', {'a':'alice', 'b':'bob'});
function parseOptions(str, map) {
if (!map)
error('parseOptions() internal error: no map given');
// All options are false by default
var options = {};
for (var letter in map)
options[map[letter]] = false;
if (!str)
return options; // defaults
if (typeof str !== 'string')
error('parseOptions() internal error: wrong str');
// e.g. match[1] = 'Rf' for str = '-Rf'
var match = str.match(/^\-(.+)/);
if (!match)
return options;
// e.g. chars = ['R', 'f']
var chars = match[1].split('');
chars.forEach(function(c) {
if (c in map)
options[map[c]] = true;
else
error('option not recognized: '+c);
});
return options;
}
exports.parseOptions = parseOptions;
// Expands wildcards with matching (ie. existing) file names.
// For example:
// expand(['file*.js']) = ['file1.js', 'file2.js', ...]
// (if the files 'file1.js', 'file2.js', etc, exist in the current dir)
function expand(list) {
var expanded = [];
list.forEach(function(listEl) {
// Wildcard present?
if (listEl.search(/\*/) > -1) {
_ls('', listEl).forEach(function(file) {
expanded.push(file);
});
} else {
expanded.push(listEl);
}
});
return expanded;
}
exports.expand = expand;
// Normalizes _unlinkSync() across platforms to match Unix behavior, i.e.
// file can be unlinked even if it's read-only, see https://github.com/joyent/node/issues/3006
function unlinkSync(file) {
try {
fs.unlinkSync(file);
} catch(e) {
// Try to override file permission
if (e.code === 'EPERM') {
fs.chmodSync(file, '0666');
fs.unlinkSync(file);
} else {
throw e;
}
}
}
exports.unlinkSync = unlinkSync;
// e.g. 'shelljs_a5f185d0443ca...'
function randomFileName() {
function randomHash(count) {
if (count === 1)
return parseInt(16*Math.random(), 10).toString(16);
else {
var hash = '';
for (var i=0; i<count; i++)
hash += randomHash(1);
return hash;
}
}
return 'shelljs_'+randomHash(20);
}
exports.randomFileName = randomFileName;
// extend(target_obj, source_obj1 [, source_obj2 ...])
// Shallow extend, e.g.:
// extend({A:1}, {b:2}, {c:3}) returns {A:1, b:2, c:3}
function extend(target) {
var sources = [].slice.call(arguments, 1);
sources.forEach(function(source) {
for (var key in source)
target[key] = source[key];
});
return target;
}
exports.extend = extend;
// Common wrapper for all Unix-like commands
function wrap(cmd, fn, options) {
return function() {
var retValue = null;
state.currentCmd = cmd;
state.error = null;
try {
var args = [].slice.call(arguments, 0);
if (options && options.notUnix) {
retValue = fn.apply(this, args);
} else {
if (args.length === 0 || typeof args[0] !== 'string' || args[0][0] !== '-')
args.unshift(''); // only add dummy option if '-option' not already present
retValue = fn.apply(this, args);
}
} catch (e) {
if (!state.error) {
// If state.error hasn't been set it's an error thrown by Node, not us - probably a bug...
console.log('shell.js: internal error');
console.log(e.stack || e);
process.exit(1);
}
if (config.fatal)
throw e;
}
state.currentCmd = 'shell.js';
return retValue;
};
} // wrap
exports.wrap = wrap;

200
bin/node_modules/shelljs/src/cp.js generated vendored
View File

@ -1,200 +0,0 @@
var fs = require('fs');
var path = require('path');
var common = require('./common');
// Buffered file copy, synchronous
// (Using readFileSync() + writeFileSync() could easily cause a memory overflow
// with large files)
function copyFileSync(srcFile, destFile) {
if (!fs.existsSync(srcFile))
common.error('copyFileSync: no such file or directory: ' + srcFile);
var BUF_LENGTH = 64*1024,
buf = new Buffer(BUF_LENGTH),
bytesRead = BUF_LENGTH,
pos = 0,
fdr = null,
fdw = null;
try {
fdr = fs.openSync(srcFile, 'r');
} catch(e) {
common.error('copyFileSync: could not read src file ('+srcFile+')');
}
try {
fdw = fs.openSync(destFile, 'w');
} catch(e) {
common.error('copyFileSync: could not write to dest file (code='+e.code+'):'+destFile);
}
while (bytesRead === BUF_LENGTH) {
bytesRead = fs.readSync(fdr, buf, 0, BUF_LENGTH, pos);
fs.writeSync(fdw, buf, 0, bytesRead);
pos += bytesRead;
}
fs.closeSync(fdr);
fs.closeSync(fdw);
fs.chmodSync(destFile, fs.statSync(srcFile).mode);
}
// Recursively copies 'sourceDir' into 'destDir'
// Adapted from https://github.com/ryanmcgrath/wrench-js
//
// Copyright (c) 2010 Ryan McGrath
// Copyright (c) 2012 Artur Adib
//
// Licensed under the MIT License
// http://www.opensource.org/licenses/mit-license.php
function cpdirSyncRecursive(sourceDir, destDir, opts) {
if (!opts) opts = {};
/* Create the directory where all our junk is moving to; read the mode of the source directory and mirror it */
var checkDir = fs.statSync(sourceDir);
try {
fs.mkdirSync(destDir, checkDir.mode);
} catch (e) {
//if the directory already exists, that's okay
if (e.code !== 'EEXIST') throw e;
}
var files = fs.readdirSync(sourceDir);
for (var i = 0; i < files.length; i++) {
var srcFile = sourceDir + "/" + files[i];
var destFile = destDir + "/" + files[i];
var srcFileStat = fs.lstatSync(srcFile);
if (srcFileStat.isDirectory()) {
/* recursion this thing right on back. */
cpdirSyncRecursive(srcFile, destFile, opts);
} else if (srcFileStat.isSymbolicLink()) {
var symlinkFull = fs.readlinkSync(srcFile);
fs.symlinkSync(symlinkFull, destFile);
} else {
/* At this point, we've hit a file actually worth copying... so copy it on over. */
if (fs.existsSync(destFile) && !opts.force) {
common.log('skipping existing file: ' + files[i]);
} else {
copyFileSync(srcFile, destFile);
}
}
} // for files
} // cpdirSyncRecursive
//@
//@ ### cp([options ,] source [,source ...], dest)
//@ ### cp([options ,] source_array, dest)
//@ Available options:
//@
//@ + `-f`: force
//@ + `-r, -R`: recursive
//@
//@ Examples:
//@
//@ ```javascript
//@ cp('file1', 'dir1');
//@ cp('-Rf', '/tmp/*', '/usr/local/*', '/home/tmp');
//@ cp('-Rf', ['/tmp/*', '/usr/local/*'], '/home/tmp'); // same as above
//@ ```
//@
//@ Copies files. The wildcard `*` is accepted.
function _cp(options, sources, dest) {
options = common.parseOptions(options, {
'f': 'force',
'R': 'recursive',
'r': 'recursive'
});
// Get sources, dest
if (arguments.length < 3) {
common.error('missing <source> and/or <dest>');
} else if (arguments.length > 3) {
sources = [].slice.call(arguments, 1, arguments.length - 1);
dest = arguments[arguments.length - 1];
} else if (typeof sources === 'string') {
sources = [sources];
} else if ('length' in sources) {
sources = sources; // no-op for array
} else {
common.error('invalid arguments');
}
var exists = fs.existsSync(dest),
stats = exists && fs.statSync(dest);
// Dest is not existing dir, but multiple sources given
if ((!exists || !stats.isDirectory()) && sources.length > 1)
common.error('dest is not a directory (too many sources)');
// Dest is an existing file, but no -f given
if (exists && stats.isFile() && !options.force)
common.error('dest file already exists: ' + dest);
if (options.recursive) {
// Recursive allows the shortcut syntax "sourcedir/" for "sourcedir/*"
// (see Github issue #15)
sources.forEach(function(src, i) {
if (src[src.length - 1] === '/')
sources[i] += '*';
});
// Create dest
try {
fs.mkdirSync(dest, parseInt('0777', 8));
} catch (e) {
// like Unix's cp, keep going even if we can't create dest dir
}
}
sources = common.expand(sources);
sources.forEach(function(src) {
if (!fs.existsSync(src)) {
common.error('no such file or directory: '+src, true);
return; // skip file
}
// If here, src exists
if (fs.statSync(src).isDirectory()) {
if (!options.recursive) {
// Non-Recursive
common.log(src + ' is a directory (not copied)');
} else {
// Recursive
// 'cp /a/source dest' should create 'source' in 'dest'
var newDest = path.join(dest, path.basename(src)),
checkDir = fs.statSync(src);
try {
fs.mkdirSync(newDest, checkDir.mode);
} catch (e) {
//if the directory already exists, that's okay
if (e.code !== 'EEXIST') throw e;
}
cpdirSyncRecursive(src, newDest, {force: options.force});
}
return; // done with dir
}
// If here, src is a file
// When copying to '/path/dir':
// thisDest = '/path/dir/file1'
var thisDest = dest;
if (fs.existsSync(dest) && fs.statSync(dest).isDirectory())
thisDest = path.normalize(dest + '/' + path.basename(src));
if (fs.existsSync(thisDest) && !options.force) {
common.error('dest file already exists: ' + thisDest, true);
return; // skip file
}
copyFileSync(src, thisDest);
}); // forEach(src)
}
module.exports = _cp;

191
bin/node_modules/shelljs/src/dirs.js generated vendored
View File

@ -1,191 +0,0 @@
var common = require('./common');
var _cd = require('./cd');
var path = require('path');
// Pushd/popd/dirs internals
var _dirStack = [];
function _isStackIndex(index) {
return (/^[\-+]\d+$/).test(index);
}
function _parseStackIndex(index) {
if (_isStackIndex(index)) {
if (Math.abs(index) < _dirStack.length + 1) { // +1 for pwd
return (/^-/).test(index) ? Number(index) - 1 : Number(index);
} else {
common.error(index + ': directory stack index out of range');
}
} else {
common.error(index + ': invalid number');
}
}
function _actualDirStack() {
return [process.cwd()].concat(_dirStack);
}
//@
//@ ### pushd([options,] [dir | '-N' | '+N'])
//@
//@ Available options:
//@
//@ + `-n`: Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated.
//@
//@ Arguments:
//@
//@ + `dir`: Makes the current working directory be the top of the stack, and then executes the equivalent of `cd dir`.
//@ + `+N`: Brings the Nth directory (counting from the left of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
//@ + `-N`: Brings the Nth directory (counting from the right of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
//@
//@ Examples:
//@
//@ ```javascript
//@ // process.cwd() === '/usr'
//@ pushd('/etc'); // Returns /etc /usr
//@ pushd('+1'); // Returns /usr /etc
//@ ```
//@
//@ Save the current directory on the top of the directory stack and then cd to `dir`. With no arguments, pushd exchanges the top two directories. Returns an array of paths in the stack.
function _pushd(options, dir) {
if (_isStackIndex(options)) {
dir = options;
options = '';
}
options = common.parseOptions(options, {
'n' : 'no-cd'
});
var dirs = _actualDirStack();
if (dir === '+0') {
return dirs; // +0 is a noop
} else if (!dir) {
if (dirs.length > 1) {
dirs = dirs.splice(1, 1).concat(dirs);
} else {
return common.error('no other directory');
}
} else if (_isStackIndex(dir)) {
var n = _parseStackIndex(dir);
dirs = dirs.slice(n).concat(dirs.slice(0, n));
} else {
if (options['no-cd']) {
dirs.splice(1, 0, dir);
} else {
dirs.unshift(dir);
}
}
if (options['no-cd']) {
dirs = dirs.slice(1);
} else {
dir = path.resolve(dirs.shift());
_cd('', dir);
}
_dirStack = dirs;
return _dirs('');
}
exports.pushd = _pushd;
//@
//@ ### popd([options,] ['-N' | '+N'])
//@
//@ Available options:
//@
//@ + `-n`: Suppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated.
//@
//@ Arguments:
//@
//@ + `+N`: Removes the Nth directory (counting from the left of the list printed by dirs), starting with zero.
//@ + `-N`: Removes the Nth directory (counting from the right of the list printed by dirs), starting with zero.
//@
//@ Examples:
//@
//@ ```javascript
//@ echo(process.cwd()); // '/usr'
//@ pushd('/etc'); // '/etc /usr'
//@ echo(process.cwd()); // '/etc'
//@ popd(); // '/usr'
//@ echo(process.cwd()); // '/usr'
//@ ```
//@
//@ When no arguments are given, popd removes the top directory from the stack and performs a cd to the new top directory. The elements are numbered from 0 starting at the first directory listed with dirs; i.e., popd is equivalent to popd +0. Returns an array of paths in the stack.
function _popd(options, index) {
if (_isStackIndex(options)) {
index = options;
options = '';
}
options = common.parseOptions(options, {
'n' : 'no-cd'
});
if (!_dirStack.length) {
return common.error('directory stack empty');
}
index = _parseStackIndex(index || '+0');
if (options['no-cd'] || index > 0 || _dirStack.length + index === 0) {
index = index > 0 ? index - 1 : index;
_dirStack.splice(index, 1);
} else {
var dir = path.resolve(_dirStack.shift());
_cd('', dir);
}
return _dirs('');
}
exports.popd = _popd;
//@
//@ ### dirs([options | '+N' | '-N'])
//@
//@ Available options:
//@
//@ + `-c`: Clears the directory stack by deleting all of the elements.
//@
//@ Arguments:
//@
//@ + `+N`: Displays the Nth directory (counting from the left of the list printed by dirs when invoked without options), starting with zero.
//@ + `-N`: Displays the Nth directory (counting from the right of the list printed by dirs when invoked without options), starting with zero.
//@
//@ Display the list of currently remembered directories. Returns an array of paths in the stack, or a single path if +N or -N was specified.
//@
//@ See also: pushd, popd
function _dirs(options, index) {
if (_isStackIndex(options)) {
index = options;
options = '';
}
options = common.parseOptions(options, {
'c' : 'clear'
});
if (options['clear']) {
_dirStack = [];
return _dirStack;
}
var stack = _actualDirStack();
if (index) {
index = _parseStackIndex(index);
if (index < 0) {
index = stack.length + index;
}
common.log(stack[index]);
return stack[index];
}
common.log(stack.join(' '));
return stack;
}
exports.dirs = _dirs;

20
bin/node_modules/shelljs/src/echo.js generated vendored
View File

@ -1,20 +0,0 @@
var common = require('./common');
//@
//@ ### echo(string [,string ...])
//@
//@ Examples:
//@
//@ ```javascript
//@ echo('hello world');
//@ var str = echo('hello world');
//@ ```
//@
//@ Prints string to stdout, and returns string with additional utility methods
//@ like `.to()`.
function _echo() {
var messages = [].slice.call(arguments, 0);
console.log.apply(this, messages);
return common.ShellString(messages.join(' '));
}
module.exports = _echo;

View File

@ -1,10 +0,0 @@
var common = require('./common');
//@
//@ ### error()
//@ Tests if error occurred in the last command. Returns `null` if no error occurred,
//@ otherwise returns string explaining the error
function error() {
return common.state.error;
};
module.exports = error;

181
bin/node_modules/shelljs/src/exec.js generated vendored
View File

@ -1,181 +0,0 @@
var common = require('./common');
var _tempDir = require('./tempdir');
var _pwd = require('./pwd');
var path = require('path');
var fs = require('fs');
var child = require('child_process');
// Hack to run child_process.exec() synchronously (sync avoids callback hell)
// Uses a custom wait loop that checks for a flag file, created when the child process is done.
// (Can't do a wait loop that checks for internal Node variables/messages as
// Node is single-threaded; callbacks and other internal state changes are done in the
// event loop).
function execSync(cmd, opts) {
var tempDir = _tempDir();
var stdoutFile = path.resolve(tempDir+'/'+common.randomFileName()),
codeFile = path.resolve(tempDir+'/'+common.randomFileName()),
scriptFile = path.resolve(tempDir+'/'+common.randomFileName()),
sleepFile = path.resolve(tempDir+'/'+common.randomFileName());
var options = common.extend({
silent: common.config.silent
}, opts);
var previousStdoutContent = '';
// Echoes stdout changes from running process, if not silent
function updateStdout() {
if (options.silent || !fs.existsSync(stdoutFile))
return;
var stdoutContent = fs.readFileSync(stdoutFile, 'utf8');
// No changes since last time?
if (stdoutContent.length <= previousStdoutContent.length)
return;
process.stdout.write(stdoutContent.substr(previousStdoutContent.length));
previousStdoutContent = stdoutContent;
}
function escape(str) {
return (str+'').replace(/([\\"'])/g, "\\$1").replace(/\0/g, "\\0");
}
cmd += ' > '+stdoutFile+' 2>&1'; // works on both win/unix
var script =
"var child = require('child_process')," +
" fs = require('fs');" +
"child.exec('"+escape(cmd)+"', {env: process.env, maxBuffer: 20*1024*1024}, function(err) {" +
" fs.writeFileSync('"+escape(codeFile)+"', err ? err.code.toString() : '0');" +
"});";
if (fs.existsSync(scriptFile)) common.unlinkSync(scriptFile);
if (fs.existsSync(stdoutFile)) common.unlinkSync(stdoutFile);
if (fs.existsSync(codeFile)) common.unlinkSync(codeFile);
fs.writeFileSync(scriptFile, script);
child.exec('"'+process.execPath+'" '+scriptFile, {
env: process.env,
cwd: _pwd(),
maxBuffer: 20*1024*1024
});
// The wait loop
// sleepFile is used as a dummy I/O op to mitigate unnecessary CPU usage
// (tried many I/O sync ops, writeFileSync() seems to be only one that is effective in reducing
// CPU usage, though apparently not so much on Windows)
while (!fs.existsSync(codeFile)) { updateStdout(); fs.writeFileSync(sleepFile, 'a'); }
while (!fs.existsSync(stdoutFile)) { updateStdout(); fs.writeFileSync(sleepFile, 'a'); }
// At this point codeFile exists, but it's not necessarily flushed yet.
// Keep reading it until it is.
var code = parseInt('', 10);
while (isNaN(code)) {
code = parseInt(fs.readFileSync(codeFile, 'utf8'), 10);
}
var stdout = fs.readFileSync(stdoutFile, 'utf8');
// No biggie if we can't erase the files now -- they're in a temp dir anyway
try { common.unlinkSync(scriptFile); } catch(e) {}
try { common.unlinkSync(stdoutFile); } catch(e) {}
try { common.unlinkSync(codeFile); } catch(e) {}
try { common.unlinkSync(sleepFile); } catch(e) {}
// some shell return codes are defined as errors, per http://tldp.org/LDP/abs/html/exitcodes.html
if (code === 1 || code === 2 || code >= 126) {
common.error('', true); // unix/shell doesn't really give an error message after non-zero exit codes
}
// True if successful, false if not
var obj = {
code: code,
output: stdout
};
return obj;
} // execSync()
// Wrapper around exec() to enable echoing output to console in real time
function execAsync(cmd, opts, callback) {
var output = '';
var options = common.extend({
silent: common.config.silent
}, opts);
var c = child.exec(cmd, {env: process.env, maxBuffer: 20*1024*1024}, function(err) {
if (callback)
callback(err ? err.code : 0, output);
});
c.stdout.on('data', function(data) {
output += data;
if (!options.silent)
process.stdout.write(data);
});
c.stderr.on('data', function(data) {
output += data;
if (!options.silent)
process.stdout.write(data);
});
return c;
}
//@
//@ ### exec(command [, options] [, callback])
//@ Available options (all `false` by default):
//@
//@ + `async`: Asynchronous execution. Defaults to true if a callback is provided.
//@ + `silent`: Do not echo program output to console.
//@
//@ Examples:
//@
//@ ```javascript
//@ var version = exec('node --version', {silent:true}).output;
//@
//@ var child = exec('some_long_running_process', {async:true});
//@ child.stdout.on('data', function(data) {
//@ /* ... do something with data ... */
//@ });
//@
//@ exec('some_long_running_process', function(code, output) {
//@ console.log('Exit code:', code);
//@ console.log('Program output:', output);
//@ });
//@ ```
//@
//@ Executes the given `command` _synchronously_, unless otherwise specified.
//@ When in synchronous mode returns the object `{ code:..., output:... }`, containing the program's
//@ `output` (stdout + stderr) and its exit `code`. Otherwise returns the child process object, and
//@ the `callback` gets the arguments `(code, output)`.
//@
//@ **Note:** For long-lived processes, it's best to run `exec()` asynchronously as
//@ the current synchronous implementation uses a lot of CPU. This should be getting
//@ fixed soon.
function _exec(command, options, callback) {
if (!command)
common.error('must specify command');
// Callback is defined instead of options.
if (typeof options === 'function') {
callback = options;
options = { async: true };
}
// Callback is defined with options.
if (typeof options === 'object' && typeof callback === 'function') {
options.async = true;
}
options = common.extend({
silent: common.config.silent,
async: false
}, options);
if (options.async)
return execAsync(command, options, callback);
else
return execSync(command, options);
}
module.exports = _exec;

51
bin/node_modules/shelljs/src/find.js generated vendored
View File

@ -1,51 +0,0 @@
var fs = require('fs');
var common = require('./common');
var _ls = require('./ls');
//@
//@ ### find(path [,path ...])
//@ ### find(path_array)
//@ Examples:
//@
//@ ```javascript
//@ find('src', 'lib');
//@ find(['src', 'lib']); // same as above
//@ find('.').filter(function(file) { return file.match(/\.js$/); });
//@ ```
//@
//@ Returns array of all files (however deep) in the given paths.
//@
//@ The main difference from `ls('-R', path)` is that the resulting file names
//@ include the base directories, e.g. `lib/resources/file1` instead of just `file1`.
function _find(options, paths) {
if (!paths)
common.error('no path specified');
else if (typeof paths === 'object')
paths = paths; // assume array
else if (typeof paths === 'string')
paths = [].slice.call(arguments, 1);
var list = [];
function pushFile(file) {
if (common.platform === 'win')
file = file.replace(/\\/g, '/');
list.push(file);
}
// why not simply do ls('-R', paths)? because the output wouldn't give the base dirs
// to get the base dir in the output, we need instead ls('-R', 'dir/*') for every directory
paths.forEach(function(file) {
pushFile(file);
if (fs.statSync(file).isDirectory()) {
_ls('-RA', file+'/*').forEach(function(subfile) {
pushFile(subfile);
});
}
});
return list;
}
module.exports = _find;

52
bin/node_modules/shelljs/src/grep.js generated vendored
View File

@ -1,52 +0,0 @@
var common = require('./common');
var fs = require('fs');
//@
//@ ### grep([options ,] regex_filter, file [, file ...])
//@ ### grep([options ,] regex_filter, file_array)
//@ Available options:
//@
//@ + `-v`: Inverse the sense of the regex and print the lines not matching the criteria.
//@
//@ Examples:
//@
//@ ```javascript
//@ grep('-v', 'GLOBAL_VARIABLE', '*.js');
//@ grep('GLOBAL_VARIABLE', '*.js');
//@ ```
//@
//@ Reads input string from given files and returns a string containing all lines of the
//@ file that match the given `regex_filter`. Wildcard `*` accepted.
function _grep(options, regex, files) {
options = common.parseOptions(options, {
'v': 'inverse'
});
if (!files)
common.error('no paths given');
if (typeof files === 'string')
files = [].slice.call(arguments, 2);
// if it's array leave it as it is
files = common.expand(files);
var grep = '';
files.forEach(function(file) {
if (!fs.existsSync(file)) {
common.error('no such file or directory: ' + file, true);
return;
}
var contents = fs.readFileSync(file, 'utf8'),
lines = contents.split(/\r*\n/);
lines.forEach(function(line) {
var matched = line.match(regex);
if ((options.inverse && !matched) || (!options.inverse && matched))
grep += line + '\n';
});
});
return common.ShellString(grep);
}
module.exports = _grep;

126
bin/node_modules/shelljs/src/ls.js generated vendored
View File

@ -1,126 +0,0 @@
var path = require('path');
var fs = require('fs');
var common = require('./common');
var _cd = require('./cd');
var _pwd = require('./pwd');
//@
//@ ### ls([options ,] path [,path ...])
//@ ### ls([options ,] path_array)
//@ Available options:
//@
//@ + `-R`: recursive
//@ + `-A`: all files (include files beginning with `.`, except for `.` and `..`)
//@
//@ Examples:
//@
//@ ```javascript
//@ ls('projs/*.js');
//@ ls('-R', '/users/me', '/tmp');
//@ ls('-R', ['/users/me', '/tmp']); // same as above
//@ ```
//@
//@ Returns array of files in the given path, or in current directory if no path provided.
function _ls(options, paths) {
options = common.parseOptions(options, {
'R': 'recursive',
'A': 'all',
'a': 'all_deprecated'
});
if (options.all_deprecated) {
// We won't support the -a option as it's hard to image why it's useful
// (it includes '.' and '..' in addition to '.*' files)
// For backwards compatibility we'll dump a deprecated message and proceed as before
common.log('ls: Option -a is deprecated. Use -A instead');
options.all = true;
}
if (!paths)
paths = ['.'];
else if (typeof paths === 'object')
paths = paths; // assume array
else if (typeof paths === 'string')
paths = [].slice.call(arguments, 1);
var list = [];
// Conditionally pushes file to list - returns true if pushed, false otherwise
// (e.g. prevents hidden files to be included unless explicitly told so)
function pushFile(file, query) {
// hidden file?
if (path.basename(file)[0] === '.') {
// not explicitly asking for hidden files?
if (!options.all && !(path.basename(query)[0] === '.' && path.basename(query).length > 1))
return false;
}
if (common.platform === 'win')
file = file.replace(/\\/g, '/');
list.push(file);
return true;
}
paths.forEach(function(p) {
if (fs.existsSync(p)) {
var stats = fs.statSync(p);
// Simple file?
if (stats.isFile()) {
pushFile(p, p);
return; // continue
}
// Simple dir?
if (stats.isDirectory()) {
// Iterate over p contents
fs.readdirSync(p).forEach(function(file) {
if (!pushFile(file, p))
return;
// Recursive?
if (options.recursive) {
var oldDir = _pwd();
_cd('', p);
if (fs.statSync(file).isDirectory())
list = list.concat(_ls('-R'+(options.all?'A':''), file+'/*'));
_cd('', oldDir);
}
});
return; // continue
}
}
// p does not exist - possible wildcard present
var basename = path.basename(p);
var dirname = path.dirname(p);
// Wildcard present on an existing dir? (e.g. '/tmp/*.js')
if (basename.search(/\*/) > -1 && fs.existsSync(dirname) && fs.statSync(dirname).isDirectory) {
// Escape special regular expression chars
var regexp = basename.replace(/(\^|\$|\(|\)|<|>|\[|\]|\{|\}|\.|\+|\?)/g, '\\$1');
// Translates wildcard into regex
regexp = '^' + regexp.replace(/\*/g, '.*') + '$';
// Iterate over directory contents
fs.readdirSync(dirname).forEach(function(file) {
if (file.match(new RegExp(regexp))) {
if (!pushFile(path.normalize(dirname+'/'+file), basename))
return;
// Recursive?
if (options.recursive) {
var pp = dirname + '/' + file;
if (fs.lstatSync(pp).isDirectory())
list = list.concat(_ls('-R'+(options.all?'A':''), pp+'/*'));
} // recursive
} // if file matches
}); // forEach
return;
}
common.error('no such file or directory: ' + p, true);
});
return list;
}
module.exports = _ls;

View File

@ -1,68 +0,0 @@
var common = require('./common');
var fs = require('fs');
var path = require('path');
// Recursively creates 'dir'
function mkdirSyncRecursive(dir) {
var baseDir = path.dirname(dir);
// Base dir exists, no recursion necessary
if (fs.existsSync(baseDir)) {
fs.mkdirSync(dir, parseInt('0777', 8));
return;
}
// Base dir does not exist, go recursive
mkdirSyncRecursive(baseDir);
// Base dir created, can create dir
fs.mkdirSync(dir, parseInt('0777', 8));
}
//@
//@ ### mkdir([options ,] dir [, dir ...])
//@ ### mkdir([options ,] dir_array)
//@ Available options:
//@
//@ + `p`: full path (will create intermediate dirs if necessary)
//@
//@ Examples:
//@
//@ ```javascript
//@ mkdir('-p', '/tmp/a/b/c/d', '/tmp/e/f/g');
//@ mkdir('-p', ['/tmp/a/b/c/d', '/tmp/e/f/g']); // same as above
//@ ```
//@
//@ Creates directories.
function _mkdir(options, dirs) {
options = common.parseOptions(options, {
'p': 'fullpath'
});
if (!dirs)
common.error('no paths given');
if (typeof dirs === 'string')
dirs = [].slice.call(arguments, 1);
// if it's array leave it as it is
dirs.forEach(function(dir) {
if (fs.existsSync(dir)) {
if (!options.fullpath)
common.error('path already exists: ' + dir, true);
return; // skip dir
}
// Base dir does not exist, and no -p option given
var baseDir = path.dirname(dir);
if (!fs.existsSync(baseDir) && !options.fullpath) {
common.error('no such file or directory: ' + baseDir, true);
return; // skip dir
}
if (options.fullpath)
mkdirSyncRecursive(dir);
else
fs.mkdirSync(dir, parseInt('0777', 8));
});
} // mkdir
module.exports = _mkdir;

80
bin/node_modules/shelljs/src/mv.js generated vendored
View File

@ -1,80 +0,0 @@
var fs = require('fs');
var path = require('path');
var common = require('./common');
//@
//@ ### mv(source [, source ...], dest')
//@ ### mv(source_array, dest')
//@ Available options:
//@
//@ + `f`: force
//@
//@ Examples:
//@
//@ ```javascript
//@ mv('-f', 'file', 'dir/');
//@ mv('file1', 'file2', 'dir/');
//@ mv(['file1', 'file2'], 'dir/'); // same as above
//@ ```
//@
//@ Moves files. The wildcard `*` is accepted.
function _mv(options, sources, dest) {
options = common.parseOptions(options, {
'f': 'force'
});
// Get sources, dest
if (arguments.length < 3) {
common.error('missing <source> and/or <dest>');
} else if (arguments.length > 3) {
sources = [].slice.call(arguments, 1, arguments.length - 1);
dest = arguments[arguments.length - 1];
} else if (typeof sources === 'string') {
sources = [sources];
} else if ('length' in sources) {
sources = sources; // no-op for array
} else {
common.error('invalid arguments');
}
sources = common.expand(sources);
var exists = fs.existsSync(dest),
stats = exists && fs.statSync(dest);
// Dest is not existing dir, but multiple sources given
if ((!exists || !stats.isDirectory()) && sources.length > 1)
common.error('dest is not a directory (too many sources)');
// Dest is an existing file, but no -f given
if (exists && stats.isFile() && !options.force)
common.error('dest file already exists: ' + dest);
sources.forEach(function(src) {
if (!fs.existsSync(src)) {
common.error('no such file or directory: '+src, true);
return; // skip file
}
// If here, src exists
// When copying to '/path/dir':
// thisDest = '/path/dir/file1'
var thisDest = dest;
if (fs.existsSync(dest) && fs.statSync(dest).isDirectory())
thisDest = path.normalize(dest + '/' + path.basename(src));
if (fs.existsSync(thisDest) && !options.force) {
common.error('dest file already exists: ' + thisDest, true);
return; // skip file
}
if (path.resolve(src) === path.dirname(path.resolve(thisDest))) {
common.error('cannot move to self: '+src, true);
return; // skip file
}
fs.renameSync(src, thisDest);
}); // forEach(src)
} // mv
module.exports = _mv;

View File

@ -1 +0,0 @@
// see dirs.js

View File

@ -1 +0,0 @@
// see dirs.js

11
bin/node_modules/shelljs/src/pwd.js generated vendored
View File

@ -1,11 +0,0 @@
var path = require('path');
var common = require('./common');
//@
//@ ### pwd()
//@ Returns the current directory.
function _pwd(options) {
var pwd = path.resolve(process.cwd());
return common.ShellString(pwd);
}
module.exports = _pwd;

145
bin/node_modules/shelljs/src/rm.js generated vendored
View File

@ -1,145 +0,0 @@
var common = require('./common');
var fs = require('fs');
// Recursively removes 'dir'
// Adapted from https://github.com/ryanmcgrath/wrench-js
//
// Copyright (c) 2010 Ryan McGrath
// Copyright (c) 2012 Artur Adib
//
// Licensed under the MIT License
// http://www.opensource.org/licenses/mit-license.php
function rmdirSyncRecursive(dir, force) {
var files;
files = fs.readdirSync(dir);
// Loop through and delete everything in the sub-tree after checking it
for(var i = 0; i < files.length; i++) {
var file = dir + "/" + files[i],
currFile = fs.lstatSync(file);
if(currFile.isDirectory()) { // Recursive function back to the beginning
rmdirSyncRecursive(file, force);
}
else if(currFile.isSymbolicLink()) { // Unlink symlinks
if (force || isWriteable(file)) {
try {
common.unlinkSync(file);
} catch (e) {
common.error('could not remove file (code '+e.code+'): ' + file, true);
}
}
}
else // Assume it's a file - perhaps a try/catch belongs here?
if (force || isWriteable(file)) {
try {
common.unlinkSync(file);
} catch (e) {
common.error('could not remove file (code '+e.code+'): ' + file, true);
}
}
}
// Now that we know everything in the sub-tree has been deleted, we can delete the main directory.
// Huzzah for the shopkeep.
var result;
try {
result = fs.rmdirSync(dir);
} catch(e) {
common.error('could not remove directory (code '+e.code+'): ' + dir, true);
}
return result;
} // rmdirSyncRecursive
// Hack to determine if file has write permissions for current user
// Avoids having to check user, group, etc, but it's probably slow
function isWriteable(file) {
var writePermission = true;
try {
var __fd = fs.openSync(file, 'a');
fs.closeSync(__fd);
} catch(e) {
writePermission = false;
}
return writePermission;
}
//@
//@ ### rm([options ,] file [, file ...])
//@ ### rm([options ,] file_array)
//@ Available options:
//@
//@ + `-f`: force
//@ + `-r, -R`: recursive
//@
//@ Examples:
//@
//@ ```javascript
//@ rm('-rf', '/tmp/*');
//@ rm('some_file.txt', 'another_file.txt');
//@ rm(['some_file.txt', 'another_file.txt']); // same as above
//@ ```
//@
//@ Removes files. The wildcard `*` is accepted.
function _rm(options, files) {
options = common.parseOptions(options, {
'f': 'force',
'r': 'recursive',
'R': 'recursive'
});
if (!files)
common.error('no paths given');
if (typeof files === 'string')
files = [].slice.call(arguments, 1);
// if it's array leave it as it is
files = common.expand(files);
files.forEach(function(file) {
if (!fs.existsSync(file)) {
// Path does not exist, no force flag given
if (!options.force)
common.error('no such file or directory: '+file, true);
return; // skip file
}
// If here, path exists
var stats = fs.lstatSync(file);
if (stats.isFile() || stats.isSymbolicLink()) {
// Do not check for file writing permissions
if (options.force) {
common.unlinkSync(file);
return;
}
if (isWriteable(file))
common.unlinkSync(file);
else
common.error('permission denied: '+file, true);
return;
} // simple file
// Path is an existing directory, but no -r flag given
if (stats.isDirectory() && !options.recursive) {
common.error('path is a directory', true);
return; // skip path
}
// Recursively remove existing directory
if (stats.isDirectory() && options.recursive) {
rmdirSyncRecursive(file, options.force);
}
}); // forEach(file)
} // rm
module.exports = _rm;

43
bin/node_modules/shelljs/src/sed.js generated vendored
View File

@ -1,43 +0,0 @@
var common = require('./common');
var fs = require('fs');
//@
//@ ### sed([options ,] search_regex, replace_str, file)
//@ Available options:
//@
//@ + `-i`: Replace contents of 'file' in-place. _Note that no backups will be created!_
//@
//@ Examples:
//@
//@ ```javascript
//@ sed('-i', 'PROGRAM_VERSION', 'v0.1.3', 'source.js');
//@ sed(/.*DELETE_THIS_LINE.*\n/, '', 'source.js');
//@ ```
//@
//@ Reads an input string from `file` and performs a JavaScript `replace()` on the input
//@ using the given search regex and replacement string. Returns the new string after replacement.
function _sed(options, regex, replacement, file) {
options = common.parseOptions(options, {
'i': 'inplace'
});
if (typeof replacement === 'string')
replacement = replacement; // no-op
else if (typeof replacement === 'number')
replacement = replacement.toString(); // fallback
else
common.error('invalid replacement string');
if (!file)
common.error('no file given');
if (!fs.existsSync(file))
common.error('no such file or directory: ' + file);
var result = fs.readFileSync(file, 'utf8').replace(regex, replacement);
if (options.inplace)
fs.writeFileSync(file, result, 'utf8');
return common.ShellString(result);
}
module.exports = _sed;

View File

@ -1,56 +0,0 @@
var common = require('./common');
var os = require('os');
var fs = require('fs');
// Returns false if 'dir' is not a writeable directory, 'dir' otherwise
function writeableDir(dir) {
if (!dir || !fs.existsSync(dir))
return false;
if (!fs.statSync(dir).isDirectory())
return false;
var testFile = dir+'/'+common.randomFileName();
try {
fs.writeFileSync(testFile, ' ');
common.unlinkSync(testFile);
return dir;
} catch (e) {
return false;
}
}
//@
//@ ### tempdir()
//@
//@ Examples:
//@
//@ ```javascript
//@ var tmp = tempdir(); // "/tmp" for most *nix platforms
//@ ```
//@
//@ Searches and returns string containing a writeable, platform-dependent temporary directory.
//@ Follows Python's [tempfile algorithm](http://docs.python.org/library/tempfile.html#tempfile.tempdir).
function _tempDir() {
var state = common.state;
if (state.tempDir)
return state.tempDir; // from cache
state.tempDir = writeableDir(os.tempDir && os.tempDir()) || // node 0.8+
writeableDir(process.env['TMPDIR']) ||
writeableDir(process.env['TEMP']) ||
writeableDir(process.env['TMP']) ||
writeableDir(process.env['Wimp$ScrapDir']) || // RiscOS
writeableDir('C:\\TEMP') || // Windows
writeableDir('C:\\TMP') || // Windows
writeableDir('\\TEMP') || // Windows
writeableDir('\\TMP') || // Windows
writeableDir('/tmp') ||
writeableDir('/var/tmp') ||
writeableDir('/usr/tmp') ||
writeableDir('.'); // last resort
return state.tempDir;
}
module.exports = _tempDir;

85
bin/node_modules/shelljs/src/test.js generated vendored
View File

@ -1,85 +0,0 @@
var common = require('./common');
var fs = require('fs');
//@
//@ ### test(expression)
//@ Available expression primaries:
//@
//@ + `'-b', 'path'`: true if path is a block device
//@ + `'-c', 'path'`: true if path is a character device
//@ + `'-d', 'path'`: true if path is a directory
//@ + `'-e', 'path'`: true if path exists
//@ + `'-f', 'path'`: true if path is a regular file
//@ + `'-L', 'path'`: true if path is a symboilc link
//@ + `'-p', 'path'`: true if path is a pipe (FIFO)
//@ + `'-S', 'path'`: true if path is a socket
//@
//@ Examples:
//@
//@ ```javascript
//@ if (test('-d', path)) { /* do something with dir */ };
//@ if (!test('-f', path)) continue; // skip if it's a regular file
//@ ```
//@
//@ Evaluates expression using the available primaries and returns corresponding value.
function _test(options, path) {
if (!path)
common.error('no path given');
// hack - only works with unary primaries
options = common.parseOptions(options, {
'b': 'block',
'c': 'character',
'd': 'directory',
'e': 'exists',
'f': 'file',
'L': 'link',
'p': 'pipe',
'S': 'socket'
});
var canInterpret = false;
for (var key in options)
if (options[key] === true) {
canInterpret = true;
break;
}
if (!canInterpret)
common.error('could not interpret expression');
if (options.link) {
try {
return fs.lstatSync(path).isSymbolicLink();
} catch(e) {
return false;
}
}
if (!fs.existsSync(path))
return false;
if (options.exists)
return true;
var stats = fs.statSync(path);
if (options.block)
return stats.isBlockDevice();
if (options.character)
return stats.isCharacterDevice();
if (options.directory)
return stats.isDirectory();
if (options.file)
return stats.isFile();
if (options.pipe)
return stats.isFIFO();
if (options.socket)
return stats.isSocket();
} // test
module.exports = _test;

29
bin/node_modules/shelljs/src/to.js generated vendored
View File

@ -1,29 +0,0 @@
var common = require('./common');
var fs = require('fs');
var path = require('path');
//@
//@ ### 'string'.to(file)
//@
//@ Examples:
//@
//@ ```javascript
//@ cat('input.txt').to('output.txt');
//@ ```
//@
//@ Analogous to the redirection operator `>` in Unix, but works with JavaScript strings (such as
//@ those returned by `cat`, `grep`, etc). _Like Unix redirections, `to()` will overwrite any existing file!_
function _to(options, file) {
if (!file)
common.error('wrong arguments');
if (!fs.existsSync( path.dirname(file) ))
common.error('no such file or directory: ' + path.dirname(file));
try {
fs.writeFileSync(file, this.toString(), 'utf8');
} catch(e) {
common.error('could not write to file (code '+e.code+'): '+file, true);
}
}
module.exports = _to;

View File

@ -1,29 +0,0 @@
var common = require('./common');
var fs = require('fs');
var path = require('path');
//@
//@ ### 'string'.toEnd(file)
//@
//@ Examples:
//@
//@ ```javascript
//@ cat('input.txt').toEnd('output.txt');
//@ ```
//@
//@ Analogous to the redirect-and-append operator `>>` in Unix, but works with JavaScript strings (such as
//@ those returned by `cat`, `grep`, etc).
function _toEnd(options, file) {
if (!file)
common.error('wrong arguments');
if (!fs.existsSync( path.dirname(file) ))
common.error('no such file or directory: ' + path.dirname(file));
try {
fs.appendFileSync(file, this.toString(), 'utf8');
} catch(e) {
common.error('could not append to file (code '+e.code+'): '+file, true);
}
}
module.exports = _toEnd;

View File

@ -1,79 +0,0 @@
var common = require('./common');
var fs = require('fs');
var path = require('path');
// Cross-platform method for splitting environment PATH variables
function splitPath(p) {
for (i=1;i<2;i++) {}
if (!p)
return [];
if (common.platform === 'win')
return p.split(';');
else
return p.split(':');
}
//@
//@ ### which(command)
//@
//@ Examples:
//@
//@ ```javascript
//@ var nodeExec = which('node');
//@ ```
//@
//@ Searches for `command` in the system's PATH. On Windows looks for `.exe`, `.cmd`, and `.bat` extensions.
//@ Returns string containing the absolute path to the command.
function _which(options, cmd) {
if (!cmd)
common.error('must specify command');
var pathEnv = process.env.path || process.env.Path || process.env.PATH,
pathArray = splitPath(pathEnv),
where = null;
// No relative/absolute paths provided?
if (cmd.search(/\//) === -1) {
// Search for command in PATH
pathArray.forEach(function(dir) {
if (where)
return; // already found it
var attempt = path.resolve(dir + '/' + cmd);
if (fs.existsSync(attempt)) {
where = attempt;
return;
}
if (common.platform === 'win') {
var baseAttempt = attempt;
attempt = baseAttempt + '.exe';
if (fs.existsSync(attempt)) {
where = attempt;
return;
}
attempt = baseAttempt + '.cmd';
if (fs.existsSync(attempt)) {
where = attempt;
return;
}
attempt = baseAttempt + '.bat';
if (fs.existsSync(attempt)) {
where = attempt;
return;
}
} // if 'win'
});
}
// Command not found anywhere?
if (!fs.existsSync(cmd) && !where)
return null;
where = where || path.resolve(cmd);
return common.ShellString(where);
}
module.exports = _which;

23
bin/node_modules/which/LICENSE generated vendored
View File

@ -1,23 +0,0 @@
Copyright 2009, 2010, 2011 Isaac Z. Schlueter.
All rights reserved.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

5
bin/node_modules/which/README.md generated vendored
View File

@ -1,5 +0,0 @@
The "which" util from npm's guts.
Finds the first instance of a specified executable in the PATH
environment variable. Does not cache the results, so `hash -r` is not
needed when the PATH changes.

14
bin/node_modules/which/bin/which generated vendored
View File

@ -1,14 +0,0 @@
#!/usr/bin/env node
var which = require("../")
if (process.argv.length < 3) {
console.error("Usage: which <thing>")
process.exit(1)
}
which(process.argv[2], function (er, thing) {
if (er) {
console.error(er.message)
process.exit(er.errno || 127)
}
console.log(thing)
})

31
bin/node_modules/which/package.json generated vendored
View File

@ -1,31 +0,0 @@
{
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
"url": "http://blog.izs.me"
},
"name": "which",
"description": "Like which(1) unix command. Find the first instance of an executable in the PATH.",
"version": "1.0.5",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/node-which.git"
},
"main": "which.js",
"bin": {
"which": "./bin/which"
},
"engines": {
"node": "*"
},
"dependencies": {},
"devDependencies": {},
"readme": "The \"which\" util from npm's guts.\n\nFinds the first instance of a specified executable in the PATH\nenvironment variable. Does not cache the results, so `hash -r` is not\nneeded when the PATH changes.\n",
"readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/isaacs/node-which/issues"
},
"homepage": "https://github.com/isaacs/node-which",
"_id": "which@1.0.5",
"_from": "which@"
}

104
bin/node_modules/which/which.js generated vendored
View File

@ -1,104 +0,0 @@
module.exports = which
which.sync = whichSync
var path = require("path")
, fs
, COLON = process.platform === "win32" ? ";" : ":"
, isExe
try {
fs = require("graceful-fs")
} catch (ex) {
fs = require("fs")
}
if (process.platform == "win32") {
// On windows, there is no good way to check that a file is executable
isExe = function isExe () { return true }
} else {
isExe = function isExe (mod, uid, gid) {
//console.error(mod, uid, gid);
//console.error("isExe?", (mod & 0111).toString(8))
var ret = (mod & 0001)
|| (mod & 0010) && process.getgid && gid === process.getgid()
|| (mod & 0100) && process.getuid && uid === process.getuid()
//console.error("isExe?", ret)
return ret
}
}
function which (cmd, cb) {
if (isAbsolute(cmd)) return cb(null, cmd)
var pathEnv = (process.env.PATH || "").split(COLON)
, pathExt = [""]
if (process.platform === "win32") {
pathEnv.push(process.cwd())
pathExt = (process.env.PATHEXT || ".EXE").split(COLON)
if (cmd.indexOf(".") !== -1) pathExt.unshift("")
}
//console.error("pathEnv", pathEnv)
;(function F (i, l) {
if (i === l) return cb(new Error("not found: "+cmd))
var p = path.resolve(pathEnv[i], cmd)
;(function E (ii, ll) {
if (ii === ll) return F(i + 1, l)
var ext = pathExt[ii]
//console.error(p + ext)
fs.stat(p + ext, function (er, stat) {
if (!er &&
stat &&
stat.isFile() &&
isExe(stat.mode, stat.uid, stat.gid)) {
//console.error("yes, exe!", p + ext)
return cb(null, p + ext)
}
return E(ii + 1, ll)
})
})(0, pathExt.length)
})(0, pathEnv.length)
}
function whichSync (cmd) {
if (isAbsolute(cmd)) return cmd
var pathEnv = (process.env.PATH || "").split(COLON)
, pathExt = [""]
if (process.platform === "win32") {
pathEnv.push(process.cwd())
pathExt = (process.env.PATHEXT || ".EXE").split(COLON)
if (cmd.indexOf(".") !== -1) pathExt.unshift("")
}
for (var i = 0, l = pathEnv.length; i < l; i ++) {
var p = path.join(pathEnv[i], cmd)
for (var j = 0, ll = pathExt.length; j < ll; j ++) {
var cur = p + pathExt[j]
var stat
try { stat = fs.statSync(cur) } catch (ex) {}
if (stat &&
stat.isFile() &&
isExe(stat.mode, stat.uid, stat.gid)) return cur
}
}
throw new Error("not found: "+cmd)
}
var isAbsolute = process.platform === "win32" ? absWin : absUnix
function absWin (p) {
if (absUnix(p)) return true
// pull off the device/UNC bit from a windows path.
// from node's lib/path.js
var splitDeviceRe =
/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?([\\\/])?/
, result = splitDeviceRe.exec(p)
, device = result[1] || ''
, isUnc = device && device.charAt(1) !== ':'
, isAbsolute = !!result[2] || isUnc // UNC paths are always absolute
return isAbsolute
}
function absUnix (p) {
return p.charAt(0) === "/" || p === ""
}

View File

@ -1,41 +0,0 @@
#!/usr/bin/env node
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
var build = require('./lib/build'),
reqs = require('./lib/check_reqs'),
args = process.argv;
// Support basic help commands
if(args[2] == '--help' ||
args[2] == '/?' ||
args[2] == '-h' ||
args[2] == 'help' ||
args[2] == '-help' ||
args[2] == '/help') {
build.help();
} else {
reqs.run().done(function() {
return build.run(args.slice(2));
}, function(err) {
console.error(err);
process.exit(2);
});
}

View File

@ -1,26 +0,0 @@
:: Licensed to the Apache Software Foundation (ASF) under one
:: or more contributor license agreements. See the NOTICE file
:: distributed with this work for additional information
:: regarding copyright ownership. The ASF licenses this file
:: to you under the Apache License, Version 2.0 (the
:: "License"); you may not use this file except in compliance
:: with the License. You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing,
:: software distributed under the License is distributed on an
:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
:: KIND, either express or implied. See the License for the
:: specific language governing permissions and limitations
:: under the License.
@ECHO OFF
SET script_path="%~dp0build"
IF EXIST %script_path% (
node %script_path% %*
) ELSE (
ECHO.
ECHO ERROR: Could not find 'build' script in 'cordova' folder, aborting...>&2
EXIT /B 1
)

View File

@ -1,44 +0,0 @@
#!/usr/bin/env node
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
var build = require('./lib/build'),
reqs = require('./lib/check_reqs'),
args = process.argv;
var path = require('path');
// Support basic help commands
if(args[2] == '--help' ||
args[2] == '/?' ||
args[2] == '-h' ||
args[2] == 'help' ||
args[2] == '-help' ||
args[2] == '/help') {
console.log('Usage: ' + path.relative(process.cwd(), process.argv[1]));
console.log('Cleans the project directory.');
process.exit(0);
} else {
reqs.run().done(function() {
return build.runClean(args.slice(2));
}, function(err) {
console.error(err);
process.exit(2);
});
}

View File

@ -1,26 +0,0 @@
:: Licensed to the Apache Software Foundation (ASF) under one
:: or more contributor license agreements. See the NOTICE file
:: distributed with this work for additional information
:: regarding copyright ownership. The ASF licenses this file
:: to you under the Apache License, Version 2.0 (the
:: "License"); you may not use this file except in compliance
:: with the License. You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing,
:: software distributed under the License is distributed on an
:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
:: KIND, either express or implied. See the License for the
:: specific language governing permissions and limitations
:: under the License.
@ECHO OFF
SET script_path="%~dp0clean"
IF EXIST %script_path% (
node %script_path% %*
) ELSE (
ECHO.
ECHO ERROR: Could not find 'clean' script in 'cordova' folder, aborting...>&2
EXIT /B 1
)

View File

@ -1,41 +0,0 @@
#!/usr/bin/env node
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
var path = require('path');
var fs = require('fs');
var cachedAppInfo = null;
function readAppInfoFromManifest() {
var manifestPath = path.join(__dirname, '..', '..', 'AndroidManifest.xml');
var manifestData = fs.readFileSync(manifestPath, {encoding:'utf8'});
var packageName = /\bpackage\s*=\s*"(.+?)"/.exec(manifestData);
if (!packageName) throw new Error('Could not find package name within ' + manifestPath);
var activityTag = /<activity\b[\s\S]*<\/activity>/.exec(manifestData);
if (!activityTag) throw new Error('Could not find <activity> within ' + manifestPath);
var activityName = /\bandroid:name\s*=\s*"(.+?)"/.exec(activityTag);
if (!activityName) throw new Error('Could not find android:name within ' + manifestPath);
return packageName[1] + '/.' + activityName[1];
}
exports.getActivityName = function() {
return cachedAppInfo = cachedAppInfo || readAppInfoFromManifest();
};

View File

@ -1,440 +0,0 @@
#!/usr/bin/env node
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
var shell = require('shelljs'),
spawn = require('./spawn'),
Q = require('q'),
path = require('path'),
fs = require('fs'),
ROOT = path.join(__dirname, '..', '..');
var check_reqs = require('./check_reqs');
var exec = require('./exec');
var LOCAL_PROPERTIES_TEMPLATE =
'# This file is automatically generated.\n' +
'# Do not modify this file -- YOUR CHANGES WILL BE ERASED!\n';
function findApks(directory) {
var ret = [];
if (fs.existsSync(directory)) {
fs.readdirSync(directory).forEach(function(p) {
if (path.extname(p) == '.apk') {
ret.push(path.join(directory, p));
}
});
}
return ret;
}
function sortFilesByDate(files) {
return files.map(function(p) {
return { p: p, t: fs.statSync(p).mtime };
}).sort(function(a, b) {
var timeDiff = b.t - a.t;
return timeDiff === 0 ? a.p.length - b.p.length : timeDiff;
}).map(function(p) { return p.p; });
}
function findOutputApksHelper(dir, build_type, arch) {
var ret = findApks(dir).filter(function(candidate) {
// Need to choose between release and debug .apk.
if (build_type === 'debug') {
return /-debug/.exec(candidate) && !/-unaligned|-unsigned/.exec(candidate);
}
if (build_type === 'release') {
return /-release/.exec(candidate) && !/-unaligned/.exec(candidate);
}
return true;
});
ret = sortFilesByDate(ret);
if (ret.length === 0) {
return ret;
}
var archSpecific = !!/-x86|-arm/.exec(ret[0]);
ret = ret.filter(function(p) {
return !!/-x86|-arm/.exec(p) == archSpecific;
});
if (arch) {
ret = ret.filter(function(p) {
return p.indexOf('-' + arch) != -1;
});
}
return ret;
}
function hasCustomRules() {
return fs.existsSync(path.join(ROOT, 'custom_rules.xml'));
}
function extractProjectNameFromManifest(projectPath) {
var manifestPath = path.join(projectPath, 'AndroidManifest.xml');
var manifestData = fs.readFileSync(manifestPath, 'utf8');
var m = /<activity[\s\S]*?android:name\s*=\s*"(.*?)"/i.exec(manifestData);
if (!m) {
throw new Error('Could not find activity name in ' + manifestPath);
}
return m[1];
}
function extractSubProjectPaths() {
var data = fs.readFileSync(path.join(ROOT, 'project.properties'), 'utf8');
var ret = {};
var r = /^\s*android\.library\.reference\.\d+=(.*)(?:\s|$)/mg
var m;
while (m = r.exec(data)) {
ret[m[1]] = 1;
}
return Object.keys(ret);
}
var builders = {
ant: {
getArgs: function(cmd) {
var args = [cmd, '-f', path.join(ROOT, 'build.xml')];
// custom_rules.xml is required for incremental builds.
if (hasCustomRules()) {
args.push('-Dout.dir=ant-build', '-Dgen.absolute.dir=ant-gen');
}
return args;
},
prepEnv: function() {
return check_reqs.check_ant()
.then(function() {
// Copy in build.xml on each build so that:
// A) we don't require the Android SDK at project creation time, and
// B) we always use the SDK's latest version of it.
var sdkDir = process.env['ANDROID_HOME'];
var buildTemplate = fs.readFileSync(path.join(sdkDir, 'tools', 'lib', 'build.template'), 'utf8');
function writeBuildXml(projectPath) {
var newData = buildTemplate.replace('PROJECT_NAME', extractProjectNameFromManifest(ROOT));
fs.writeFileSync(path.join(projectPath, 'build.xml'), newData);
if (!fs.existsSync(path.join(projectPath, 'local.properties'))) {
fs.writeFileSync(path.join(projectPath, 'local.properties'), LOCAL_PROPERTIES_TEMPLATE);
}
}
var subProjects = extractSubProjectPaths();
writeBuildXml(ROOT);
for (var i = 0; i < subProjects.length; ++i) {
writeBuildXml(path.join(ROOT, subProjects[i]));
}
});
},
/*
* Builds the project with ant.
* Returns a promise.
*/
build: function(build_type) {
// Without our custom_rules.xml, we need to clean before building.
var ret = Q();
if (!hasCustomRules()) {
// clean will call check_ant() for us.
ret = this.clean();
}
var builder = this;
var args = this.getArgs(build_type == 'debug' ? 'debug' : 'release');
return check_reqs.check_ant()
.then(function() {
return spawn('ant', args);
});
},
clean: function() {
var args = this.getArgs('clean');
return check_reqs.check_ant()
.then(function() {
return spawn('ant', args);
});
},
findOutputApks: function(build_type) {
var binDir = path.join(ROOT, hasCustomRules() ? 'ant-build' : 'bin');
return findOutputApksHelper(binDir, build_type, null);
}
},
gradle: {
getArgs: function(cmd, arch) {
var lintSteps;
if (process.env['BUILD_MULTIPLE_APKS']) {
lintSteps = [
'lint',
'lintVitalX86Release',
'lintVitalArmv7Release',
'compileLint',
'copyReleaseLint',
'copyDebugLint'
];
} else {
lintSteps = [
'lint',
'lintVitalRelease',
'compileLint',
'copyReleaseLint',
'copyDebugLint'
];
}
if (arch == 'arm' && cmd == 'debug') {
cmd = 'assembleArmv7Debug';
} else if (arch == 'arm' && cmd == 'release') {
cmd = 'assembleArmv7Release';
} else if (arch == 'x86' && cmd == 'debug') {
cmd = 'assembleX86Debug';
} else if (arch == 'x86' && cmd == 'release') {
cmd = 'assembleX86Release';
} else if (cmd == 'debug') {
cmd = 'assembleDebug';
} else if (cmd == 'release') {
cmd = 'assembleRelease';
}
var args = [cmd, '-b', path.join(ROOT, 'build.gradle')];
// 10 seconds -> 6 seconds
args.push('-Dorg.gradle.daemon=true');
// Excluding lint: 6s-> 1.6s
for (var i = 0; i < lintSteps.length; ++i) {
args.push('-x', lintSteps[i]);
}
// Shaves another 100ms, but produces a "try at own risk" warning. Not worth it (yet):
// args.push('-Dorg.gradle.parallel=true');
return args;
},
prepEnv: function() {
return check_reqs.check_gradle()
.then(function() {
// Copy the gradle wrapper on each build so that:
// A) we don't require the Android SDK at project creation time, and
// B) we always use the SDK's latest version of it.
var projectPath = ROOT;
// check_reqs ensures that this is set.
var sdkDir = process.env['ANDROID_HOME'];
var wrapperDir = path.join(sdkDir, 'tools', 'templates', 'gradle', 'wrapper');
if (process.platform == 'win32') {
shell.cp('-f', path.join(wrapperDir, 'gradlew.bat'), projectPath);
} else {
shell.cp('-f', path.join(wrapperDir, 'gradlew'), projectPath);
}
shell.rm('-rf', path.join(projectPath, 'gradle', 'wrapper'));
shell.mkdir('-p', path.join(projectPath, 'gradle'));
shell.cp('-r', path.join(wrapperDir, 'gradle', 'wrapper'), path.join(projectPath, 'gradle'));
// If the gradle distribution URL is set, make sure it points to version 1.12.
// 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.
var distributionUrlRegex = '/^distributionUrl=.*$/';
var distributionUrl = 'distributionUrl=http\\://services.gradle.org/distributions/gradle-1.12-all.zip';
var gradleWrapperPropertiesPath = path.join(projectPath, 'gradle', 'wrapper', 'gradle-wrapper.properties');
shell.sed('-i', distributionUrlRegex, distributionUrl, gradleWrapperPropertiesPath);
// Update the version of build.gradle in each dependent library.
var pluginBuildGradle = path.join(projectPath, 'cordova', 'lib', 'plugin-build.gradle');
var subProjects = extractSubProjectPaths();
for (var i = 0; i < subProjects.length; ++i) {
shell.cp('-f', pluginBuildGradle, path.join(ROOT, subProjects[i], 'build.gradle'));
}
var subProjectsAsGradlePaths = subProjects.map(function(p) { return ':' + p.replace(/[/\\]/g, ':') });
// Write the settings.gradle file.
fs.writeFileSync(path.join(projectPath, 'settings.gradle'),
'// GENERATED FILE - DO NOT EDIT\n' +
'include ":"\n' +
'include "' + subProjectsAsGradlePaths.join('"\ninclude "') + '"\n');
// Update dependencies within build.gradle.
var buildGradle = fs.readFileSync(path.join(projectPath, 'build.gradle'), 'utf8');
var depsList = '';
subProjectsAsGradlePaths.forEach(function(p) {
depsList += ' debugCompile project(path: "' + p + '", configuration: "debug")\n';
depsList += ' releaseCompile project(path: "' + p + '", configuration: "release")\n';
});
buildGradle = buildGradle.replace(/(SUB-PROJECT DEPENDENCIES START)[\s\S]*(\/\/ SUB-PROJECT DEPENDENCIES END)/, '$1\n' + depsList + ' $2');
fs.writeFileSync(path.join(projectPath, 'build.gradle'), buildGradle);
});
},
/*
* Builds the project with gradle.
* Returns a promise.
*/
build: function(build_type, arch) {
var builder = this;
var wrapper = path.join(ROOT, 'gradlew');
var args = this.getArgs(build_type == 'debug' ? 'debug' : 'release', arch);
return Q().then(function() {
return spawn(wrapper, args);
});
},
clean: function() {
var builder = this;
var wrapper = path.join(ROOT, 'gradlew');
var args = builder.getArgs('clean');
return Q().then(function() {
return spawn(wrapper, args);
});
},
findOutputApks: function(build_type, arch) {
var binDir = path.join(ROOT, 'build', 'outputs', 'apk');
return findOutputApksHelper(binDir, build_type, arch);
}
},
none: {
prepEnv: function() {
return Q();
},
build: function() {
console.log('Skipping build...');
return Q(null);
},
clean: function() {
return Q();
},
findOutputApks: function(build_type, arch) {
return sortFilesByDate(builders.ant.findOutputApks(build_type, arch).concat(builders.gradle.findOutputApks(build_type, arch)));
}
}
};
function parseOpts(options, resolvedTarget) {
// Backwards-compatibility: Allow a single string argument
if (typeof options == "string") options = [options];
var ret = {
buildType: 'debug',
buildMethod: process.env['ANDROID_BUILD'] || 'ant',
arch: null
};
// Iterate through command line options
for (var i=0; options && (i < options.length); ++i) {
if (/^--/.exec(options[i])) {
var option = options[i].substring(2);
switch(option) {
case 'debug':
case 'release':
ret.buildType = option;
break;
case 'ant':
case 'gradle':
ret.buildMethod = option;
break;
case 'nobuild' :
ret.buildMethod = 'none';
break;
default :
return Q.reject('Build option \'' + options[i] + '\' not recognized.');
}
} else {
return Q.reject('Build option \'' + options[i] + '\' not recognized.');
}
}
var multiApk = ret.buildMethod == 'gradle' && process.env['BUILD_MULTIPLE_APKS'];
if (multiApk && !/0|false|no/i.exec(multiApk)) {
ret.arch = resolvedTarget && resolvedTarget.arch;
}
return ret;
}
/*
* Builds the project with the specifed options
* Returns a promise.
*/
module.exports.runClean = function(options) {
var opts = parseOpts(options);
var builder = builders[opts.buildMethod];
return builder.prepEnv()
.then(function() {
return builder.clean();
}).then(function() {
shell.rm('-rf', path.join(ROOT, 'out'));
});
};
/*
* Builds the project with the specifed options
* Returns a promise.
*/
module.exports.run = function(options, optResolvedTarget) {
var opts = parseOpts(options, optResolvedTarget);
var builder = builders[opts.buildMethod];
return builder.prepEnv()
.then(function() {
return builder.build(opts.buildType, opts.arch);
}).then(function() {
var apkPaths = builder.findOutputApks(opts.buildType, opts.arch);
console.log('Built the following apk(s):');
console.log(' ' + apkPaths.join('\n '));
return {
apkPaths: apkPaths,
buildType: opts.buildType,
buildMethod: opts.buildMethod
};
});
};
/*
* Detects the architecture of a device/emulator
* Returns "arm" or "x86".
*/
module.exports.detectArchitecture = function(target) {
return exec('adb -s ' + target + ' shell cat /proc/cpuinfo')
.then(function(output) {
if (/intel/i.exec(output)) {
return 'x86';
}
return 'arm';
});
};
module.exports.findBestApkForArchitecture = function(buildResults, arch) {
var paths = buildResults.apkPaths.filter(function(p) {
if (buildResults.buildType == 'debug') {
return /-debug/.exec(p);
}
return !/-debug/.exec(p);
});
var archPattern = new RegExp('-' + arch);
var hasArchPattern = /-x86|-arm/;
for (var i = 0; i < paths.length; ++i) {
if (hasArchPattern.exec(paths[i])) {
if (archPattern.exec(paths[i])) {
return paths[i];
}
} else {
return paths[i];
}
}
throw new Error('Could not find apk architecture: ' + arch + ' build-type: ' + buildResults.buildType);
};
module.exports.help = function() {
console.log('Usage: ' + path.relative(process.cwd(), path.join(ROOT, 'cordova', 'build')) + ' [build_type]');
console.log('Build Types : ');
console.log(' \'--debug\': Default build, will build project in debug mode');
console.log(' \'--release\': will build project for release');
console.log(' \'--ant\': Default build, will build project with ant');
console.log(' \'--gradle\': will build project with gradle');
console.log(' \'--nobuild\': will skip build process (can be used with run command)');
process.exit(0);
};

View File

@ -1,102 +0,0 @@
#!/usr/bin/env node
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
var exec = require('./exec'),
Q = require('q'),
path = require('path'),
build = require('./build'),
appinfo = require('./appinfo'),
ROOT = path.join(__dirname, '..', '..');
/**
* Returns a promise for the list of the device ID's found
*/
module.exports.list = function() {
return exec('adb devices')
.then(function(output) {
var response = output.split('\n');
var device_list = [];
for (var i = 1; i < response.length; i++) {
if (response[i].match(/\w+\tdevice/) && !response[i].match(/emulator/)) {
device_list.push(response[i].replace(/\tdevice/, '').replace('\r', ''));
}
}
return device_list;
});
}
module.exports.resolveTarget = function(target) {
return this.list()
.then(function(device_list) {
if (!device_list || !device_list.length) {
return Q.reject('ERROR: Failed to deploy to device, no devices found.');
}
// default device
target = target || device_list[0];
if (device_list.indexOf(target) < 0) {
return Q.reject('ERROR: Unable to find target \'' + target + '\'.');
}
return build.detectArchitecture(target)
.then(function(arch) {
return { target: target, arch: arch, isEmulator: false };
});
});
};
/*
* Installs a previously built application on the device
* and launches it.
* Returns a promise.
*/
module.exports.install = function(target, buildResults) {
return Q().then(function() {
if (target && typeof target == 'object') {
return target;
}
return module.exports.resolveTarget(target);
}).then(function(resolvedTarget) {
var apk_path = build.findBestApkForArchitecture(buildResults, resolvedTarget.arch);
var launchName = appinfo.getActivityName();
console.log('Using apk: ' + apk_path);
console.log('Installing app on device...');
var cmd = 'adb -s ' + resolvedTarget.target + ' install -r "' + apk_path + '"';
return exec(cmd)
.then(function(output) {
if (output.match(/Failure/)) return Q.reject('ERROR: Failed to install apk to device: ' + output);
//unlock screen
var cmd = 'adb -s ' + resolvedTarget.target + ' shell input keyevent 82';
return exec(cmd);
}, function(err) { return Q.reject('ERROR: Failed to install apk to device: ' + err); })
.then(function() {
// launch the application
console.log('Launching application...');
var cmd = 'adb -s ' + resolvedTarget.target + ' shell am start -W -a android.intent.action.MAIN -n ' + launchName;
return exec(cmd);
}).then(function() {
console.log('LAUNCH SUCCESS');
}, function(err) {
return Q.reject('ERROR: Failed to launch application on device: ' + err);
});
});
}

View File

@ -1,335 +0,0 @@
#!/usr/bin/env node
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
var shell = require('shelljs'),
exec = require('./exec'),
Q = require('q'),
path = require('path'),
appinfo = require('./appinfo'),
build = require('./build'),
ROOT = path.join(__dirname, '..', '..'),
child_process = require('child_process'),
new_emulator = 'cordova_emulator';
var check_reqs = require('./check_reqs');
/**
* Returns a Promise for a list of emulator images in the form of objects
* {
name : <emulator_name>,
path : <path_to_emulator_image>,
target : <api_target>,
abi : <cpu>,
skin : <skin>
}
*/
module.exports.list_images = function() {
return exec('android list avds')
.then(function(output) {
var response = output.split('\n');
var emulator_list = [];
for (var i = 1; i < response.length; i++) {
// To return more detailed information use img_obj
var img_obj = {};
if (response[i].match(/Name:\s/)) {
img_obj['name'] = response[i].split('Name: ')[1].replace('\r', '');
if (response[i + 1].match(/Path:\s/)) {
i++;
img_obj['path'] = response[i].split('Path: ')[1].replace('\r', '');
}
if (response[i + 1].match(/\(API\slevel\s/)) {
i++;
img_obj['target'] = response[i].replace('\r', '');
}
if (response[i + 1].match(/ABI:\s/)) {
i++;
img_obj['abi'] = response[i].split('ABI: ')[1].replace('\r', '');
}
if (response[i + 1].match(/Skin:\s/)) {
i++;
img_obj['skin'] = response[i].split('Skin: ')[1].replace('\r', '');
}
emulator_list.push(img_obj);
}
/* To just return a list of names use this
if (response[i].match(/Name:\s/)) {
emulator_list.push(response[i].split('Name: ')[1].replace('\r', '');
}*/
}
return emulator_list;
});
}
/**
* Will return the closest avd to the projects target
* or undefined if no avds exist.
* Returns a promise.
*/
module.exports.best_image = function() {
var project_target = check_reqs.get_target().replace('android-', '');
return this.list_images()
.then(function(images) {
var closest = 9999;
var best = images[0];
for (i in images) {
var target = images[i].target;
if(target) {
var num = target.split('(API level ')[1].replace(')', '');
if (num == project_target) {
return images[i];
} else if (project_target - num < closest && project_target > num) {
var closest = project_target - num;
best = images[i];
}
}
}
return best;
});
}
// Returns a promise.
module.exports.list_started = function() {
return exec('adb devices')
.then(function(output) {
var response = output.split('\n');
var started_emulator_list = [];
for (var i = 1; i < response.length; i++) {
if (response[i].match(/device/) && response[i].match(/emulator/)) {
started_emulator_list.push(response[i].replace(/\tdevice/, '').replace('\r', ''));
}
}
return started_emulator_list;
});
}
// Returns a promise.
module.exports.list_targets = function() {
return exec('android list targets')
.then(function(output) {
var target_out = output.split('\n');
var targets = [];
for (var i = target_out.length; i >= 0; i--) {
if(target_out[i].match(/id:/)) {
targets.push(targets[i].split(' ')[1]);
}
}
return targets;
});
}
/*
* Starts an emulator with the given ID,
* and returns the started ID of that emulator.
* If no ID is given it will used the first image available,
* if no image is available it will error out (maybe create one?).
*
* Returns a promise.
*/
module.exports.start = function(emulator_ID) {
var self = this;
var emulator_id, num_started, started_emulators;
return self.list_started()
.then(function(list) {
started_emulators = list;
num_started = started_emulators.length;
if (!emulator_ID) {
return self.list_images()
.then(function(emulator_list) {
if (emulator_list.length > 0) {
return self.best_image()
.then(function(best) {
emulator_ID = best.name;
console.log('WARNING : no emulator specified, defaulting to ' + emulator_ID);
return emulator_ID;
});
} else {
var androidCmd = check_reqs.getAbsoluteAndroidCmd();
return Q.reject('ERROR : No emulator images (avds) found.\n' +
'1. Download desired System Image by running: ' + androidCmd + ' sdk\n' +
'2. Create an AVD by running: ' + androidCmd + ' avd\n' +
'HINT: For a faster emulator, use an Intel System Image and install the HAXM device driver\n');
}
});
} else {
return Q(emulator_ID);
}
}).then(function() {
var cmd = 'emulator';
var args = ['-avd', emulator_ID];
var proc = child_process.spawn(cmd, args, { stdio: 'inherit', detached: true });
proc.unref(); // Don't wait for it to finish, since the emulator will probably keep running for a long time.
}).then(function() {
// wait for emulator to start
console.log('Waiting for emulator...');
return self.wait_for_emulator(num_started);
}).then(function(new_started) {
if (new_started.length > 1) {
for (i in new_started) {
if (started_emulators.indexOf(new_started[i]) < 0) {
emulator_id = new_started[i];
}
}
} else {
emulator_id = new_started[0];
}
if (!emulator_id) return Q.reject('ERROR : Failed to start emulator, could not find new emulator');
//wait for emulator to boot up
process.stdout.write('Booting up emulator (this may take a while)...');
return self.wait_for_boot(emulator_id);
}).then(function() {
console.log('BOOT COMPLETE');
//unlock screen
return exec('adb -s ' + emulator_id + ' shell input keyevent 82');
}).then(function() {
//return the new emulator id for the started emulators
return emulator_id;
});
}
/*
* Waits for the new emulator to apear on the started-emulator list.
* Returns a promise with a list of newly started emulators' IDs.
*/
module.exports.wait_for_emulator = function(num_running) {
var self = this;
return self.list_started()
.then(function(new_started) {
if (new_started.length > num_running) {
return new_started;
} else {
return Q.delay(1000).then(function() {
return self.wait_for_emulator(num_running);
});
}
});
}
/*
* Waits for the boot animation property of the emulator to switch to 'stopped'
*/
module.exports.wait_for_boot = function(emulator_id) {
var self = this;
return exec('adb -s ' + emulator_id + ' shell getprop init.svc.bootanim')
.then(function(output) {
if (output.match(/stopped/)) {
return;
} else {
process.stdout.write('.');
return Q.delay(3000).then(function() {
return self.wait_for_boot(emulator_id);
});
}
});
}
/*
* Create avd
* TODO : Enter the stdin input required to complete the creation of an avd.
* Returns a promise.
*/
module.exports.create_image = function(name, target) {
console.log('Creating avd named ' + name);
if (target) {
return exec('android create avd --name ' + name + ' --target ' + target)
.then(null, function(error) {
console.error('ERROR : Failed to create emulator image : ');
console.error(' Do you have the latest android targets including ' + target + '?');
console.error(create.output);
});
} else {
console.log('WARNING : Project target not found, creating avd with a different target but the project may fail to install.');
return exec('android create avd --name ' + name + ' --target ' + this.list_targets()[0])
.then(function() {
// TODO: This seems like another error case, even though it always happens.
console.error('ERROR : Unable to create an avd emulator, no targets found.');
console.error('Please insure you have targets available by running the "android" command');
return Q.reject();
}, function(error) {
console.error('ERROR : Failed to create emulator image : ');
console.error(error);
});
}
}
module.exports.resolveTarget = function(target) {
return this.list_started()
.then(function(emulator_list) {
if (emulator_list.length < 1) {
return Q.reject('No started emulators found, please start an emultor before deploying your project.');
}
// default emulator
target = target || emulator_list[0];
if (emulator_list.indexOf(target) < 0) {
return Q.reject('Unable to find target \'' + target + '\'. Failed to deploy to emulator.');
}
return build.detectArchitecture(target)
.then(function(arch) {
return {target:target, arch:arch, isEmulator:true};
});
});
};
/*
* Installs a previously built application on the emulator and launches it.
* If no target is specified, then it picks one.
* If no started emulators are found, error out.
* Returns a promise.
*/
module.exports.install = function(target, buildResults) {
return Q().then(function() {
if (target && typeof target == 'object') {
return target;
}
return module.exports.resolveTarget(target);
}).then(function(resolvedTarget) {
var apk_path = build.findBestApkForArchitecture(buildResults, resolvedTarget.arch);
console.log('Installing app on emulator...');
console.log('Using apk: ' + apk_path);
return exec('adb -s ' + resolvedTarget.target + ' install -r "' + apk_path + '"')
.then(function(output) {
if (output.match(/Failure/)) {
return Q.reject('Failed to install apk to emulator: ' + output);
}
return Q();
}, function(err) {
return Q.reject('Failed to install apk to emulator: ' + err);
}).then(function() {
//unlock screen
return exec('adb -s ' + resolvedTarget.target + ' shell input keyevent 82');
}).then(function() {
// launch the application
console.log('Launching application...');
var launchName = appinfo.getActivityName();
cmd = 'adb -s ' + resolvedTarget.target + ' shell am start -W -a android.intent.action.MAIN -n ' + launchName;
return exec(cmd);
}).then(function(output) {
console.log('LAUNCH SUCCESS');
}, function(err) {
return Q.reject('Failed to launch app on emulator: ' + err);
});
});
}

View File

@ -1,41 +0,0 @@
#!/usr/bin/env node
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
var child_process = require('child_process'),
Q = require('q');
// Takes a command and optional current working directory.
// Returns a promise that either resolves with the stdout, or
// rejects with an error message and the stderr.
module.exports = function(cmd, opt_cwd) {
var d = Q.defer();
try {
child_process.exec(cmd, {cwd: opt_cwd, maxBuffer: 1024000}, function(err, stdout, stderr) {
if (err) d.reject('Error executing "' + cmd + '": ' + stderr);
else d.resolve(stdout);
});
} catch(e) {
console.error('error caught: ' + e);
d.reject(e);
}
return d.promise;
}

View File

@ -1,42 +0,0 @@
#!/usr/bin/env node
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
var device = require('./device'),
args = process.argv;
if(args.length > 2) {
var install_target;
if (args[2].substring(0, 9) == '--target=') {
install_target = args[2].substring(9, args[2].length);
device.install(install_target).done(null, function(err) {
console.error('ERROR: ' + err);
process.exit(2);
});
} else {
console.error('ERROR : argument \'' + args[2] + '\' not recognized.');
process.exit(2);
}
} else {
device.install().done(null, function(err) {
console.error('ERROR: ' + err);
process.exit(2);
});
}

View File

@ -1,26 +0,0 @@
:: Licensed to the Apache Software Foundation (ASF) under one
:: or more contributor license agreements. See the NOTICE file
:: distributed with this work for additional information
:: regarding copyright ownership. The ASF licenses this file
:: to you under the Apache License, Version 2.0 (the
:: "License"); you may not use this file except in compliance
:: with the License. You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing,
:: software distributed under the License is distributed on an
:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
:: KIND, either express or implied. See the License for the
:: specific language governing permissions and limitations
:: under the License.
@ECHO OFF
SET script_path="%~dp0install-device"
IF EXIST %script_path% (
node "%script_path%" %*
) ELSE (
ECHO.
ECHO ERROR: Could not find 'install-device' script in 'cordova\lib' folder, aborting...>&2
EXIT /B 1
)

View File

@ -1,38 +0,0 @@
#!/usr/bin/env node
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
var emulator = require('./emulator'),
args = process.argv;
var install_target;
if(args.length > 2) {
if (args[2].substring(0, 9) == '--target=') {
install_target = args[2].substring(9, args[2].length);
} else {
console.error('ERROR : argument \'' + args[2] + '\' not recognized.');
process.exit(2);
}
}
emulator.install(install_target).done(null, function(err) {
console.error('ERROR: ' + err);
process.exit(2);
});

View File

@ -1,26 +0,0 @@
:: Licensed to the Apache Software Foundation (ASF) under one
:: or more contributor license agreements. See the NOTICE file
:: distributed with this work for additional information
:: regarding copyright ownership. The ASF licenses this file
:: to you under the Apache License, Version 2.0 (the
:: "License"); you may not use this file except in compliance
:: with the License. You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing,
:: software distributed under the License is distributed on an
:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
:: KIND, either express or implied. See the License for the
:: specific language governing permissions and limitations
:: under the License.
@ECHO OFF
SET script_path="%~dp0install-emulator"
IF EXIST %script_path% (
node "%script_path%" %*
) ELSE (
ECHO.
ECHO ERROR: Could not find 'install-emulator' script in 'cordova\lib' folder, aborting...>&2
EXIT /B 1
)

View File

@ -1,33 +0,0 @@
#!/usr/bin/env node
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
var devices = require('./device');
// Usage support for when args are given
devices.list().done(function(device_list) {
device_list && device_list.forEach(function(dev) {
console.log(dev);
});
}, function(err) {
console.error('ERROR: ' + err);
process.exit(2);
});

View File

@ -1,26 +0,0 @@
:: Licensed to the Apache Software Foundation (ASF) under one
:: or more contributor license agreements. See the NOTICE file
:: distributed with this work for additional information
:: regarding copyright ownership. The ASF licenses this file
:: to you under the Apache License, Version 2.0 (the
:: "License"); you may not use this file except in compliance
:: with the License. You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing,
:: software distributed under the License is distributed on an
:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
:: KIND, either express or implied. See the License for the
:: specific language governing permissions and limitations
:: under the License.
@ECHO OFF
SET script_path="%~dp0list-devices"
IF EXIST %script_path% (
node "%script_path%" %*
) ELSE (
ECHO.
ECHO ERROR: Could not find 'list-devices' script in 'cordova\lib' folder, aborting...>&2
EXIT /B 1
)

View File

@ -1,26 +0,0 @@
:: Licensed to the Apache Software Foundation (ASF) under one
:: or more contributor license agreements. See the NOTICE file
:: distributed with this work for additional information
:: regarding copyright ownership. The ASF licenses this file
:: to you under the Apache License, Version 2.0 (the
:: "License"); you may not use this file except in compliance
:: with the License. You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing,
:: software distributed under the License is distributed on an
:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
:: KIND, either express or implied. See the License for the
:: specific language governing permissions and limitations
:: under the License.
@ECHO OFF
SET script_path="%~dp0list-emulator-images"
IF EXIST %script_path% (
node "%script_path%" %*
) ELSE (
ECHO.
ECHO ERROR: Could not find 'list-emulator-images' script in 'cordova\lib' folder, aborting...>&2
EXIT /B 1
)

View File

@ -1,32 +0,0 @@
#!/usr/bin/env node
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
var emulators = require('./emulator');
// Usage support for when args are given
emulators.list_started().done(function(emulator_list) {
emulator_list && emulator_list.forEach(function(emu) {
console.log(emu);
});
}, function(err) {
console.error('ERROR: ' + err);
process.exit(2);
});

View File

@ -1,26 +0,0 @@
:: Licensed to the Apache Software Foundation (ASF) under one
:: or more contributor license agreements. See the NOTICE file
:: distributed with this work for additional information
:: regarding copyright ownership. The ASF licenses this file
:: to you under the Apache License, Version 2.0 (the
:: "License"); you may not use this file except in compliance
:: with the License. You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing,
:: software distributed under the License is distributed on an
:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
:: KIND, either express or implied. See the License for the
:: specific language governing permissions and limitations
:: under the License.
@ECHO OFF
SET script_path="%~dp0list-started-emulators"
IF EXIST %script_path% (
node "%script_path%" %*
) ELSE (
ECHO.
ECHO ERROR: Could not find 'list-started-emulators' script in 'cordova\lib' folder, aborting...>&2
EXIT /B 1
)

View File

@ -1,57 +0,0 @@
#!/usr/bin/env node
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
var shell = require('shelljs'),
path = require('path'),
Q = require('q'),
child_process = require('child_process'),
ROOT = path.join(__dirname, '..', '..');
/*
* Starts running logcat in the shell.
* Returns a promise.
*/
module.exports.run = function() {
var cmd = 'adb logcat | grep -v nativeGetEnabledTags';
var d = Q.defer();
var adb = child_process.spawn('adb', ['logcat']);
adb.stdout.on('data', function(data) {
var lines = data ? data.toString().split('\n') : [];
var out = lines.filter(function(x) { return x.indexOf('nativeGetEnabledTags') < 0; });
console.log(out.join('\n'));
});
adb.stderr.on('data', console.error);
adb.on('close', function(code) {
if (code > 0) {
d.reject('Failed to run logcat command.');
} else d.resolve();
});
return d.promise;
}
module.exports.help = function() {
console.log('Usage: ' + path.relative(process.cwd(), path.join(ROOT, 'cordova', 'log')));
console.log('Gives the logcat output on the command line.');
process.exit(0);
}

Some files were not shown because too many files have changed in this diff Show More