Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: bazelbuild/rules_scala
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4dd3950b094cc21317e5b3161f15d1181a2ac803
Choose a base ref
..
head repository: bazelbuild/rules_scala
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 7cfb44f2addd0e99e821132779e10251af454fcb
Choose a head ref
Showing with 9 additions and 12 deletions.
  1. +9 −12 scala/scala_cross_version_select.bzl
21 changes: 9 additions & 12 deletions scala/scala_cross_version_select.bzl
Original file line number Diff line number Diff line change
@@ -60,20 +60,17 @@ def _match_one_arg(scala_version, matcher_scala_version, compare):
# Compare only a part of version – to allow wildcarding.
return compare(scala_version[:len(matcher_scala_version)], matcher_scala_version)

def _match_any(scala_version, matcher_scala_version):
return _match_one_arg(scala_version, matcher_scala_version, lambda x, y: x == y)
def _build_matcher(compare):
def matcher(scala_version, matcher_scala_version):
return _match_one_arg(scala_version, matcher_scala_version, compare)

def _match_before(scala_version, matcher_scala_version):
return _match_one_arg(scala_version, matcher_scala_version, lambda x, y: x < y)
return matcher

def _match_after(scala_version, matcher_scala_version):
return _match_one_arg(scala_version, matcher_scala_version, lambda x, y: x > y)

def _match_until(scala_version, matcher_scala_version):
return _match_one_arg(scala_version, matcher_scala_version, lambda x, y: x <= y)

def _match_since(scala_version, matcher_scala_version):
return _match_one_arg(scala_version, matcher_scala_version, lambda x, y: x >= y)
_match_any = _build_matcher(lambda x, y: x == y)
_match_before = _build_matcher(lambda x, y: x < y)
_match_after = _build_matcher(lambda x, y: x > y)
_match_until = _build_matcher(lambda x, y: x <= y)
_match_since = _build_matcher(lambda x, y: x >= y)

def _match_between(scala_version, since_scala_version, until_scala_version):
return _match_since(scala_version, since_scala_version) and \