From a58cfa6fd971bc8b672ff592068af2ec0fd3f5d4 Mon Sep 17 00:00:00 2001 From: lost-name <19654615+lost-name@users.noreply.github.com> Date: Tue, 9 Apr 2019 13:20:51 -0500 Subject: [PATCH] fix: fixes java version matching for gradle when only major version provided (#104) (#110) --- aws_lambda_builders/workflows/java_gradle/gradle_validator.py | 2 +- tests/unit/workflows/java_gradle/test_gradle_validator.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/aws_lambda_builders/workflows/java_gradle/gradle_validator.py b/aws_lambda_builders/workflows/java_gradle/gradle_validator.py index 3350baa84..38165ef86 100644 --- a/aws_lambda_builders/workflows/java_gradle/gradle_validator.py +++ b/aws_lambda_builders/workflows/java_gradle/gradle_validator.py @@ -43,7 +43,7 @@ def validated_binary_path(self): def _get_major_version(self, gradle_path): vs = self._get_jvm_string(gradle_path) if vs: - m = re.search(r'JVM:\s+(\d.*)', vs) + m = re.search(r'JVM:\s+([\d\.]+)', vs) version = m.group(1).split('.') # For Java 8 or earlier, version strings begin with 1.{Major Version} if version[0] == '1': diff --git a/tests/unit/workflows/java_gradle/test_gradle_validator.py b/tests/unit/workflows/java_gradle/test_gradle_validator.py index cdadf52fa..03755de79 100644 --- a/tests/unit/workflows/java_gradle/test_gradle_validator.py +++ b/tests/unit/workflows/java_gradle/test_gradle_validator.py @@ -30,7 +30,9 @@ def setUp(self, MockOSUtils): @parameterized.expand([ '1.7.0', '1.8.9', - '11.0.0' + '11.0.0', + '12 (Fluff)', + '12' ]) def test_accepts_any_jvm_mv(self, version): version_string = ('JVM: %s' % version).encode()