mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 22:46:27 +00:00
fix(manager/sbt): handle new line after equalities in the file (#15613)
This commit is contained in:
parent
5afed40ba3
commit
e183d4c064
2 changed files with 45 additions and 2 deletions
|
@ -217,5 +217,46 @@ describe('modules/manager/sbt/extract', () => {
|
||||||
packageFileVersion: undefined,
|
packageFileVersion: undefined,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('extract deps when they are defined in a new line', () => {
|
||||||
|
const content = `
|
||||||
|
name := "service"
|
||||||
|
scalaVersion := "2.13.8"
|
||||||
|
|
||||||
|
lazy val compileDependencies =
|
||||||
|
Seq(
|
||||||
|
"com.typesafe.scala-logging" %% "scala-logging" % "3.9.4",
|
||||||
|
"ch.qos.logback" % "logback-classic" % "1.2.10"
|
||||||
|
)
|
||||||
|
|
||||||
|
libraryDependencies ++= compileDependencies`;
|
||||||
|
expect(extractPackageFile(content)).toMatchObject({
|
||||||
|
deps: [
|
||||||
|
{
|
||||||
|
registryUrls: ['https://repo.maven.apache.org/maven2'],
|
||||||
|
datasource: 'maven',
|
||||||
|
depName: 'scala',
|
||||||
|
packageName: 'org.scala-lang:scala-library',
|
||||||
|
currentValue: '2.13.8',
|
||||||
|
separateMinorPatch: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
registryUrls: ['https://repo.maven.apache.org/maven2'],
|
||||||
|
depName: 'com.typesafe.scala-logging:scala-logging',
|
||||||
|
packageName: 'com.typesafe.scala-logging:scala-logging_2.13',
|
||||||
|
currentValue: '3.9.4',
|
||||||
|
datasource: 'sbt-package',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
registryUrls: ['https://repo.maven.apache.org/maven2'],
|
||||||
|
depName: 'ch.qos.logback:logback-classic',
|
||||||
|
packageName: 'ch.qos.logback:logback-classic',
|
||||||
|
currentValue: '1.2.10',
|
||||||
|
datasource: 'sbt-package',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
packageFileVersion: undefined,
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { regEx } from '../../../util/regex';
|
import { newlineRegex, regEx } from '../../../util/regex';
|
||||||
import { MavenDatasource } from '../../datasource/maven';
|
import { MavenDatasource } from '../../datasource/maven';
|
||||||
import { MAVEN_REPO } from '../../datasource/maven/common';
|
import { MAVEN_REPO } from '../../datasource/maven/common';
|
||||||
import { SbtPackageDatasource } from '../../datasource/sbt-package';
|
import { SbtPackageDatasource } from '../../datasource/sbt-package';
|
||||||
|
@ -347,7 +347,9 @@ export function extractPackageFile(content: string): PackageFile | null {
|
||||||
if (!content) {
|
if (!content) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const lines = content.split(regEx(/\n/)).map(stripComment);
|
const equalsToNewLineRe = regEx(/=\s*\n/, 'gm');
|
||||||
|
const goodContentForParsing = content.replace(equalsToNewLineRe, '=');
|
||||||
|
const lines = goodContentForParsing.split(newlineRegex).map(stripComment);
|
||||||
|
|
||||||
const acc: PackageFile & ParseOptions = {
|
const acc: PackageFile & ParseOptions = {
|
||||||
registryUrls: [MAVEN_REPO],
|
registryUrls: [MAVEN_REPO],
|
||||||
|
|
Loading…
Reference in a new issue