fix: make 'android-lang' optional, with java as default#149
fix: make 'android-lang' optional, with java as default#149OS-pedrogustavobilro merged 10 commits intomainfrom
Conversation
jcesarmobile
left a comment
There was a problem hiding this comment.
if kt is also a valid value, should be documented, or if not, it should not accept kt
|
Hmm, currently in 0.21.0 So now I feel more inclined to drop it, but it is a breaking change technically, but since we're on 0.x versions, it's more acceptable. Are you ok with removing |
|
Whatever you prefer. Breaking changes are not a big concern for this package since it's a tool and also it's on 0.x as you said. |
Following PR discussion
…team/create-capacitor-plugin into fix/android-lang-optional
|
Ended up removing the 'kt' option. |
| debug(`invalid option: --%s %O: %s`, option, value, validatorResult); | ||
|
|
||
| // 'android-lang' is not prompted, so it should fail if invalid | ||
| if (option === 'android-lang' && value !== undefined && value !== '') { |
There was a problem hiding this comment.
| if (option === 'android-lang' && value !== undefined && value !== '') { | |
| if (option === 'android-lang') { |
at this point it can't be undefined or empty, so no need to check
| license: string; | ||
| description: string; | ||
| 'android-lang': string; | ||
| 'android-lang'?: string; |
There was a problem hiding this comment.
it's not really optional since if not defined it will be set to java.
If you not make it optional here, you can avoid setting java as default in several places in src/template.ts
There was a problem hiding this comment.
Yeah true, I was tinkering with it in an earlier version of the PR, but yeah this shouldn't be optional.
Well spotted!
Description
This PR updates the recently added 'android-lang' to be optional, and never be prompted. The default (if no 'android-lang' is provided) was made to be Java. If users want kotlin, they'll have to explicitly set the argument when running the command.
This could be considered a breaking change, but since we're in 0.x version numbers, we're more lenient with breaking changes.
Also fixed a minor bug where when using 'kt' for 'android-lang', the java source directory was not getting removed.
Change Type
Rationale / Problems Fixed
We had released a version where Android Language was always prompted, and the option selected by default was kotlin. Some time after the team had some internal discussions, and decided that we should stick to Java, since it is the Android Language that Capacitor framework is built on, and we may switch the default to Kotlin in the future whenever we migrate Capacitor to use Kotlin.
Having a default made it less relevant for the Android Language option to be prompted, so we removed it in order to have one less prompt option for the command. The plan will be as well to update the capacitor-docs to better let users know of this option, improving discoverability.
Tests or Reproductions
If you want, you may pull the branch, build it, and run it with different 'android-lang' values (and also with no value), and see that you are never prompted for the Android Language
Platforms Affected