Skip to content

Instantly share code, notes, and snippets.

@jmfayard
Created August 30, 2019 18:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmfayard/f4425bbb2d6415a7383135fef291f920 to your computer and use it in GitHub Desktop.
Save jmfayard/f4425bbb2d6415a7383135fef291f920 to your computer and use it in GitHub Desktop.

i was thinking how to integrate it with the newest feature

we could have

rejectVersionContaining ("alpha","beta",...)

which would be a shorter version of

rejectVersionIf { candidate ->
  listOf("alpha", "beta", "rc", "cr", "m", "preview", "b", "ea").any { qualifier ->
          candidate.version.matches(Regex("(?i).*[.-]\$qualifier[.\\d-+]*"))
        }
}

which would be a shorter version of

  resolutionStrategy {
    componentSelection {
      all {

        fun isNonStable(version: String) = listOf("alpha", "beta", "rc", "cr", "m", "preview", "b", "ea").any { qualifier ->
          version.matches(Regex("(?i).*[.-]\$qualifier[.\\d-+]*"))

        }

        if (isNonStable(candidate.version) && !isNonStable(currentVersion)) {
          reject("Release candidate")
        }
      }
    }
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment