Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. int computeVersionCode() {
  2. def (major, minor, patch) = project.versionStr.replaceAll('-', '').tokenize(".")
  3. def candidate = "99"
  4. if (patch.endsWith("snapshot")) {
  5. candidate = "0"
  6. patch = patch.replaceAll("[^0-9]", "")
  7. } else {
  8. if (project.versionStr.contains("rc")) {
  9. def rc
  10. (patch, rc) = patch.tokenize("rc")
  11. if (rc) {
  12. candidate = rc
  13. }
  14. }
  15. }
  16.  
  17. (major, minor, patch, candidate) = [major, minor, patch, candidate].collect { it.toInteger() }
  18.  
  19. (major * 1000000) + (minor * 10000) + (patch * 100) + candidate
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement