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
* 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
* 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
* 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
* (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
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>
* - 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>
* 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
* 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
* 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
`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`.
* 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
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
* Remove licenses for previously bundled packages
* Remove utils module with duplicate function
* Remove unused function check_reqs.check_ant
* Remove unused test helper
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
* (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
* 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>
* 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>
* 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>
* (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>