Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gradle): Support classifier and extension #3995

Merged
merged 1 commit into from
Jul 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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