Skip to content

Commit

Permalink
fix: version detection when using arguments (#258)
Browse files Browse the repository at this point in the history
Signed-off-by: Ilona Shishov <[email protected]>
  • Loading branch information
IlonaShishov authored May 19, 2024
1 parent f5d3d82 commit 928110e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/providers/build.gradle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export class DependencyProvider extends EcosystemDependencyResolver implements I
// determine dependency version
const depVersion: string = myClassObj.version;
if (depVersion) {
dep.version = { value: depVersion, position: { line: index + 1, column: line.indexOf(depVersion) + 1 } };
dep.version = { value: depVersion.includes('$') ? this.replaceArgsInString(depVersion) : depVersion, position: { line: index + 1, column: line.indexOf(depVersion) + 1 } };
} else {
// if version is not specified, generate placeholder template
if (keyValuePairs) {
Expand Down
4 changes: 2 additions & 2 deletions test/providers/build.gradle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,11 @@ dependencies {
expect(deps).is.eql([
{
name: {value: 'log4j/log4j', position: {line: 0, column: 0}},
version: {value: '${versionArg}', position: {line: 30, column: 44}}
version: {value: '1.2.3', position: {line: 30, column: 44}}
},
{
name: {value: 'log4j/log4j', position: {line: 0, column: 0}},
version: {value: '${versionArg}', position: {line: 31, column: 66}}
version: {value: '1.2.3', position: {line: 31, column: 66}}
}
]);
});
Expand Down

0 comments on commit 928110e

Please sign in to comment.