Skip to content

Commit

Permalink
fix(gradle): Support classifier and extension (#3995)
Browse files Browse the repository at this point in the history
  • Loading branch information
ikesyo authored and rarkins committed Jul 10, 2019
1 parent cbf695b commit bb5baaa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/manager/gradle/build-gradle.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,10 @@ function updatePropertyFileGlobalVariables(
return null;
}

// https://github.com/patrikerdes/gradle-use-latest-versions-plugin/blob/8cf9c3917b8b04ba41038923cab270d2adda3aa6/src/main/groovy/se/patrikerdes/DependencyUpdate.groovy#L27-L29
function moduleStringVersionFormatMatch(dependency) {
return new RegExp(
`(["']${dependency.group}:${dependency.name}:)[^$].*?(["'])`
`(["']${dependency.group}:${dependency.name}:)[^$].*?((:.*?)?["'])`
);
}

Expand Down
12 changes: 12 additions & 0 deletions test/manager/gradle/build-gradle.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ describe('lib/manager/gradle/updateGradleVersion', () => {
);
});

it('should returns a file updated with keeping a classifier and an extension if the version is found', () => {
const gradleFile = "runtime ( 'junit:junit:4.0:javadoc@jar' )";
const updatedGradleFile = gradle.updateGradleVersion(
gradleFile,
{ group: 'junit', name: 'junit', version: '4.0' },
'5.0'
);
expect(updatedGradleFile).toEqual(
"runtime ( 'junit:junit:5.0:javadoc@jar' )"
);
});

it('returns a file updated if the version defined as map is found', () => {
const gradleFile = `compile group : 'mysql' ,
name : 'mysql-connector-java',
Expand Down

0 comments on commit bb5baaa

Please sign in to comment.