From 856eb33b25e005d4978212f82ccda3e5ef95f56b Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Wed, 15 Jan 2020 06:26:49 +0100 Subject: [PATCH] fix: Revert "fix(sbt): normalize scala version" This reverts commit ff0ffd2e9093ec3ccb74bc6bf12cdf826f00e31a. --- lib/manager/sbt/extract.ts | 12 ++---------- .../sbt/__snapshots__/extract.spec.ts.snap | 18 +++++++++--------- .../sbt/_fixtures/scala-version-variable.sbt | 2 +- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/lib/manager/sbt/extract.ts b/lib/manager/sbt/extract.ts index 21fb09a7f3..347f1d801b 100644 --- a/lib/manager/sbt/extract.ts +++ b/lib/manager/sbt/extract.ts @@ -20,14 +20,6 @@ const isScalaVersion = (str: string): boolean => const getScalaVersion = (str: string): string => str.replace(/^\s*scalaVersion\s*:=\s*"/, '').replace(/"\s*$/, ''); -/* - https://www.scala-sbt.org/release/docs/Cross-Build.html#Publishing+conventions - */ -const normalizeScalaVersion = (str: string): string => - /^\d+\.\d+\.\d+$/.test(str) - ? str.replace(/^(\d+)\.(\d+)\.\d+$/, '$1.$2') - : str; - const isScalaVersionVariable = (str: string): boolean => /^\s*scalaVersion\s*:=\s*[_a-zA-Z][_a-zA-Z0-9]*\s*$/.test(str); @@ -184,7 +176,7 @@ function parseSbtLine( if (!isComment(line)) { if (isScalaVersion(line)) { isMultiDeps = false; - scalaVersion = normalizeScalaVersion(getScalaVersion(line)); + scalaVersion = getScalaVersion(line); } else if (isScalaVersionVariable(line)) { isMultiDeps = false; scalaVersionVariable = getScalaVersionVariable(line); @@ -252,7 +244,7 @@ function parseSbtLine( scalaVersion || (scalaVersionVariable && variables[scalaVersionVariable] && - normalizeScalaVersion(variables[scalaVersionVariable].val)), + variables[scalaVersionVariable].val), }; if (deps.length) return { deps }; return null; diff --git a/test/manager/sbt/__snapshots__/extract.spec.ts.snap b/test/manager/sbt/__snapshots__/extract.spec.ts.snap index 2bcba9738f..1877fc2ae5 100644 --- a/test/manager/sbt/__snapshots__/extract.spec.ts.snap +++ b/test/manager/sbt/__snapshots__/extract.spec.ts.snap @@ -144,7 +144,7 @@ Object { "currentValue": "0.0.1", "datasource": "sbt", "depName": "org.example:foo", - "fileReplacePosition": 195, + "fileReplacePosition": 192, "registryUrls": Array [ "https://repo.maven.apache.org/maven2", "https://example.com/repos/1/", @@ -158,7 +158,7 @@ Object { "currentValue": "0.0.2", "datasource": "sbt", "depName": "org.example:bar_2.12", - "fileReplacePosition": 251, + "fileReplacePosition": 248, "registryUrls": Array [ "https://repo.maven.apache.org/maven2", "https://example.com/repos/1/", @@ -172,7 +172,7 @@ Object { "currentValue": "0.0.3", "datasource": "sbt", "depName": "org.example:baz_2.12", - "fileReplacePosition": 315, + "fileReplacePosition": 312, "registryUrls": Array [ "https://repo.maven.apache.org/maven2", "https://example.com/repos/1/", @@ -186,7 +186,7 @@ Object { "currentValue": "0.0.4", "datasource": "sbt", "depName": "org.example:qux", - "fileReplacePosition": 350, + "fileReplacePosition": 347, "registryUrls": Array [ "https://repo.maven.apache.org/maven2", "https://example.com/repos/1/", @@ -200,7 +200,7 @@ Object { "currentValue": "0.0.5", "datasource": "sbt", "depName": "org.example:quux", - "fileReplacePosition": 409, + "fileReplacePosition": 406, "registryUrls": Array [ "https://repo.maven.apache.org/maven2", "https://example.com/repos/1/", @@ -215,7 +215,7 @@ Object { "datasource": "sbt", "depName": "org.example:quuz_2.12", "depType": "test", - "fileReplacePosition": 553, + "fileReplacePosition": 550, "registryUrls": Array [ "https://repo.maven.apache.org/maven2", "https://example.com/repos/1/", @@ -230,7 +230,7 @@ Object { "datasource": "sbt", "depName": "org.example:corge", "depType": "Provided", - "fileReplacePosition": 611, + "fileReplacePosition": 608, "registryUrls": Array [ "https://repo.maven.apache.org/maven2", "https://example.com/repos/1/", @@ -245,7 +245,7 @@ Object { "datasource": "sbt", "depName": "org.example:grault", "depType": "Test", - "fileReplacePosition": 51, + "fileReplacePosition": 48, "registryUrls": Array [ "https://repo.maven.apache.org/maven2", "https://example.com/repos/1/", @@ -260,7 +260,7 @@ Object { "datasource": "sbt", "depName": "org.example:waldo", "depType": "plugin", - "fileReplacePosition": 1013, + "fileReplacePosition": 1010, "registryUrls": Array [ "https://repo.maven.apache.org/maven2", "https://example.com/repos/1/", diff --git a/test/manager/sbt/_fixtures/scala-version-variable.sbt b/test/manager/sbt/_fixtures/scala-version-variable.sbt index fd0abe2efd..9cdeb6bb71 100644 --- a/test/manager/sbt/_fixtures/scala-version-variable.sbt +++ b/test/manager/sbt/_fixtures/scala-version-variable.sbt @@ -1,4 +1,4 @@ -val ScalaVersion = "2.12.10" +val ScalaVersion = "2.12" val versionExample = "0.0.8" scalaVersion := ScalaVersion -- GitLab