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
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
* 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
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`.