mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-13 07:26:26 +00:00
a9332a8db0
This deprecates the (internal) use of package URLs and instead replaces with `datasource`/`lookupName`. Closes #3005
44 lines
1.1 KiB
JavaScript
44 lines
1.1 KiB
JavaScript
const { coerce } = require('semver');
|
|
|
|
module.exports = {
|
|
extractPackageFile,
|
|
};
|
|
|
|
function extractPackageFile(fileContent) {
|
|
logger.debug('gradle-wrapper.extractPackageFile()');
|
|
const lines = fileContent.split('\n');
|
|
|
|
let lineNumber = 0;
|
|
for (const line of lines) {
|
|
const match = line.match(
|
|
/^distributionUrl=.*-((\d|\.)+)-(bin|all)\.zip\s*$/
|
|
);
|
|
if (match) {
|
|
const dependency = {
|
|
datasource: 'gradleVersion',
|
|
depType: 'gradle-wrapper',
|
|
depName: 'gradle',
|
|
currentValue: coerce(match[1]).toString(),
|
|
lineNumber,
|
|
versionScheme: 'semver',
|
|
/* gradle specifics ... */
|
|
gradleWrapperType: match[3],
|
|
};
|
|
|
|
let shaLineNumber = 0;
|
|
for (const shaLine of lines) {
|
|
const shaMatch = shaLine.match(/^distributionSha256Sum=((\w){64}).*$/);
|
|
if (shaMatch) {
|
|
dependency.checksumLineNumber = shaLineNumber;
|
|
break;
|
|
}
|
|
shaLineNumber += 1;
|
|
}
|
|
|
|
logger.info(dependency, 'Gradle Wrapper');
|
|
return { deps: [dependency] };
|
|
}
|
|
lineNumber += 1;
|
|
}
|
|
return null;
|
|
}
|