-
Notifications
You must be signed in to change notification settings - Fork 395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More flexibility in versionCode generator #605
Comments
Example: Consider this version name
PS: I can prepare a pull request for my suggestion above; before I begin I'd like to hear any comments or alternative approaches (if considered more suitable). |
You're talking about the I'm all for making the code more versatile. What did you have in mind to replace the existing implementation? |
As my own use case is directly taking the output of
In this case ( <manifestVersionCodeUpdateFromVersion>true</manifestVersionCodeUpdateFromVersion>
<manifestVersionDigits>4,3,3</manifestVersionDigits>
<!-- added configuration -->
<manifestVersionSeparators>.-</manifestVersionSeparators>
<manifestVersionName>0.0-38-g493f883</manifestVersionName> and expect a If a regex-based approach is taken, one would instead write something like: <!-- only match the interesting parts -->
<!-- I just made this tag name up; it definitely can be made shorter... -->
<manifestVersionNamingPattern>^(\d+)\.(\d+)-(\d+)</manifestVersionNamingPattern>
<!-- or even like this (just imagining the possibilities here), note the reordering enabled by using named groups: -->
<manifestVersionNamingPattern>^(?P<1>\d+)\.(?P<3>\d+)-(?P<2>\d+)</manifestVersionNamingPattern> This has the downside of requiring one to specify a regex and actually sticking with that, but in reality regexes are ubiquitous; also, if one actually finds him/herself having to do manifest magic like this, probably a simpler functionality would not be sufficient. Anyway here are some example version names taken from my phone, in addition to the
None of these can be correctly processed by the plugin at present; the simpler first approach can somehow deal with them, albeit by ignoring irrelevant characters; the regex approach can handle them elegantly. Now which approach would people prefer? (Personally I would go regex.) // EDIT: Ouch, the angular brackets in named group syntax should be escaped. Maybe that's a good sign indicating that this degree of versatility is unnecessary...) |
I favour regex. But we need the default to match the existing default implementation so On Tue, Mar 10, 2015 at 1:25 AM, Wang Xuerui [email protected]
|
As the source code shows, currently the
versionCode
generator discards any character not a digit or period in version name. This would, for example, fail when faced with agit describe
-formatted version name as generated by thegit-commit-id-plugin
. AFAIK this could not be solved without forking either plugin or changing the versioning scheme.We can possibly allow configuration of version part separator characters, so that these use cases are covered.
The text was updated successfully, but these errors were encountered: