Skip to content
Snippets Groups Projects
Unverified Commit 9c11e43b authored by george-wilson-rea's avatar george-wilson-rea Committed by GitHub
Browse files

feat(sbt): Support Scala 3 dependency resolution (#29291)


Co-authored-by: default avatarRhys Arkins <rhys@arkins.net>
parent be9e3484
No related branches found
No related tags found
No related merge requests found
......@@ -243,6 +243,26 @@ describe('modules/manager/sbt/extract', () => {
});
});
it('extracts deps correctly when dealing with scala 3', () => {
const content = `
scalaVersion := "3.3.4"
libraryDependencies += "org.example" %% "bar" % "0.0.5"
`;
expect(extractPackageFile(content)).toMatchObject({
deps: [
{
packageName: 'org.scala-lang:scala3-library_3',
currentValue: '3.3.4',
},
{
packageName: 'org.example:bar_3',
currentValue: '0.0.5',
},
],
});
});
it('extracts deps when scala version is defined in a variable with ThisBuild scope', () => {
const content = `
val ScalaVersion = "2.12.10"
......
......@@ -201,12 +201,16 @@ function depHandler(ctx: Ctx): Ctx {
delete ctx.variableName;
const depName = `${groupId!}:${artifactId!}`;
const isScala3 = scalaVersion?.[0] === '3';
const scalaVersionForPackageName = isScala3 ? '3' : scalaVersion;
const dep: PackageDependency = {
datasource: SbtPackageDatasource.id,
depName,
packageName:
scalaVersion && useScalaVersion ? `${depName}_${scalaVersion}` : depName,
scalaVersionForPackageName && useScalaVersion
? `${depName}_${scalaVersionForPackageName}`
: depName,
currentValue,
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment