Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
renovate
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SmartDataLab
public
applications
renovate
Commits
d3cea95f
Unverified
Commit
d3cea95f
authored
5 years ago
by
IKEDA Sho
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
feat(sbt): support scalaVersion defined with a trailing comma (#6520)
parent
3c7a180c
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/manager/sbt/__snapshots__/extract.spec.ts.snap
+30
-0
30 additions, 0 deletions
lib/manager/sbt/__snapshots__/extract.spec.ts.snap
lib/manager/sbt/extract.spec.ts
+19
-0
19 additions, 0 deletions
lib/manager/sbt/extract.spec.ts
lib/manager/sbt/extract.ts
+4
-4
4 additions, 4 deletions
lib/manager/sbt/extract.ts
with
53 additions
and
4 deletions
lib/manager/sbt/__snapshots__/extract.spec.ts.snap
+
30
−
0
View file @
d3cea95f
...
@@ -279,6 +279,36 @@ Object {
...
@@ -279,6 +279,36 @@ Object {
}
}
`;
`;
exports[`lib/manager/sbt/extract extractPackageFile() extracts deps when scala version is defined in a variable with a trailing comma 1`] = `
Object {
"deps": Array [
Object {
"currentValue": "0.0.2",
"datasource": "sbt-package",
"depName": "org.example:bar_2.12",
"registryUrls": Array [
"https://repo.maven.apache.org/maven2",
],
},
],
}
`;
exports[`lib/manager/sbt/extract extractPackageFile() extracts deps when scala version is defined with a trailing comma 1`] = `
Object {
"deps": Array [
Object {
"currentValue": "0.0.2",
"datasource": "sbt-package",
"depName": "org.example:bar_2.12",
"registryUrls": Array [
"https://repo.maven.apache.org/maven2",
],
},
],
}
`;
exports[`lib/manager/sbt/extract extractPackageFile() skips deps when scala version is missing 1`] = `
exports[`lib/manager/sbt/extract extractPackageFile() skips deps when scala version is missing 1`] = `
Object {
Object {
"deps": Array [
"deps": Array [
...
...
This diff is collapsed.
Click to expand it.
lib/manager/sbt/extract.spec.ts
+
19
−
0
View file @
d3cea95f
...
@@ -59,5 +59,24 @@ describe('lib/manager/sbt/extract', () => {
...
@@ -59,5 +59,24 @@ describe('lib/manager/sbt/extract', () => {
it
(
'
extract deps from native scala file with variables
'
,
()
=>
{
it
(
'
extract deps from native scala file with variables
'
,
()
=>
{
expect
(
extractPackageFile
(
sbtDependencyFile
)).
toMatchSnapshot
();
expect
(
extractPackageFile
(
sbtDependencyFile
)).
toMatchSnapshot
();
});
});
it
(
'
extracts deps when scala version is defined with a trailing comma
'
,
()
=>
{
const
content
=
`
lazy val commonSettings = Seq(
scalaVersion := "2.12.10",
)
libraryDependencies += "org.example" %% "bar" % "0.0.2"
`
;
expect
(
extractPackageFile
(
content
)).
toMatchSnapshot
();
});
it
(
'
extracts deps when scala version is defined in a variable with a trailing comma
'
,
()
=>
{
const
content
=
`
val ScalaVersion = "2.12.10"
lazy val commonSettings = Seq(
scalaVersion := ScalaVersion,
)
libraryDependencies += "org.example" %% "bar" % "0.0.2"
`
;
expect
(
extractPackageFile
(
content
)).
toMatchSnapshot
();
});
});
});
});
});
This diff is collapsed.
Click to expand it.
lib/manager/sbt/extract.ts
+
4
−
4
View file @
d3cea95f
...
@@ -19,10 +19,10 @@ const isPluginDep = (str: string): boolean =>
...
@@ -19,10 +19,10 @@ const isPluginDep = (str: string): boolean =>
const
isStringLiteral
=
(
str
:
string
):
boolean
=>
/^"
[^
"
]
*"$/
.
test
(
str
);
const
isStringLiteral
=
(
str
:
string
):
boolean
=>
/^"
[^
"
]
*"$/
.
test
(
str
);
const
isScalaVersion
=
(
str
:
string
):
boolean
=>
const
isScalaVersion
=
(
str
:
string
):
boolean
=>
/^
\s
*scalaVersion
\s
*:=
\s
*"
[^
"
]
*"
\s
*$/
.
test
(
str
);
/^
\s
*scalaVersion
\s
*:=
\s
*"
[^
"
]
*"
[
\s
,
]
*$/
.
test
(
str
);
const
getScalaVersion
=
(
str
:
string
):
string
=>
const
getScalaVersion
=
(
str
:
string
):
string
=>
str
.
replace
(
/^
\s
*scalaVersion
\s
*:=
\s
*"/
,
''
).
replace
(
/"
\s
*$/
,
''
);
str
.
replace
(
/^
\s
*scalaVersion
\s
*:=
\s
*"/
,
''
).
replace
(
/"
[
\s
,
]
*$/
,
''
);
/*
/*
https://www.scala-sbt.org/release/docs/Cross-Build.html#Publishing+conventions
https://www.scala-sbt.org/release/docs/Cross-Build.html#Publishing+conventions
...
@@ -51,10 +51,10 @@ const normalizeScalaVersion = (str: string): string => {
...
@@ -51,10 +51,10 @@ const normalizeScalaVersion = (str: string): string => {
};
};
const
isScalaVersionVariable
=
(
str
:
string
):
boolean
=>
const
isScalaVersionVariable
=
(
str
:
string
):
boolean
=>
/^
\s
*scalaVersion
\s
*:=
\s
*
[
_a-zA-Z
][
_a-zA-Z0-9
]
*
\s
*$/
.
test
(
str
);
/^
\s
*scalaVersion
\s
*:=
\s
*
[
_a-zA-Z
][
_a-zA-Z0-9
]
*
[
\s
,
]
*$/
.
test
(
str
);
const
getScalaVersionVariable
=
(
str
:
string
):
string
=>
const
getScalaVersionVariable
=
(
str
:
string
):
string
=>
str
.
replace
(
/^
\s
*scalaVersion
\s
*:=
\s
*/
,
''
).
replace
(
/
\s
*$/
,
''
);
str
.
replace
(
/^
\s
*scalaVersion
\s
*:=
\s
*/
,
''
).
replace
(
/
[
\s
,
]
*$/
,
''
);
const
isResolver
=
(
str
:
string
):
boolean
=>
const
isResolver
=
(
str
:
string
):
boolean
=>
/^
\s
*
(
resolvers
\s
*
\+\+?
=
\s
*
(
Seq
\()?)?
"
[^
"
]
*"
\s
*at
\s
*"
[^
"
]
*"
[\s
,)
]
*$/
.
test
(
/^
\s
*
(
resolvers
\s
*
\+\+?
=
\s
*
(
Seq
\()?)?
"
[^
"
]
*"
\s
*at
\s
*"
[^
"
]
*"
[\s
,)
]
*$/
.
test
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment