mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-09 13:36:26 +00:00
Merge 6eb54b574d
into adede1d309
This commit is contained in:
commit
731ed6951b
7 changed files with 150 additions and 160 deletions
|
@ -1,103 +0,0 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`modules/manager/gradle/parser calculations parses fixture from "gradle" manager 1`] = `
|
||||
[
|
||||
{
|
||||
"currentValue": "1.5.2.RELEASE",
|
||||
"depName": "org.springframework.boot:spring-boot-gradle-plugin",
|
||||
"groupName": "springBootVersion",
|
||||
"managerData": {
|
||||
"fileReplacePosition": 53,
|
||||
"packageFile": "build.gradle",
|
||||
},
|
||||
},
|
||||
{
|
||||
"currentValue": "1.2.3",
|
||||
"depName": "com.github.jengelman.gradle.plugins:shadow",
|
||||
"managerData": {
|
||||
"fileReplacePosition": 417,
|
||||
"packageFile": "build.gradle",
|
||||
},
|
||||
},
|
||||
{
|
||||
"currentValue": "0.1",
|
||||
"depName": "com.fkorotkov:gradle-libraries-plugin",
|
||||
"managerData": {
|
||||
"fileReplacePosition": 481,
|
||||
"packageFile": "build.gradle",
|
||||
},
|
||||
},
|
||||
{
|
||||
"currentValue": "0.2.3",
|
||||
"depName": "gradle.plugin.se.patrikerdes:gradle-use-latest-versions-plugin",
|
||||
"managerData": {
|
||||
"fileReplacePosition": 568,
|
||||
"packageFile": "build.gradle",
|
||||
},
|
||||
},
|
||||
{
|
||||
"currentValue": "3.1.1",
|
||||
"depName": "org.apache.openjpa:openjpa",
|
||||
"managerData": {
|
||||
"fileReplacePosition": 621,
|
||||
"packageFile": "build.gradle",
|
||||
},
|
||||
},
|
||||
{
|
||||
"currentValue": "0.13.0",
|
||||
"depName": "com.gradle.publish:plugin-publish-plugin",
|
||||
"managerData": {
|
||||
"fileReplacePosition": 688,
|
||||
"packageFile": "build.gradle",
|
||||
},
|
||||
},
|
||||
{
|
||||
"currentValue": "6.0.9.RELEASE",
|
||||
"depName": "org.grails:gorm-hibernate5-spring-boot",
|
||||
"managerData": {
|
||||
"fileReplacePosition": 1882,
|
||||
"packageFile": "build.gradle",
|
||||
},
|
||||
},
|
||||
{
|
||||
"currentValue": "6.0.5",
|
||||
"depName": "mysql:mysql-connector-java",
|
||||
"managerData": {
|
||||
"fileReplacePosition": 1938,
|
||||
"packageFile": "build.gradle",
|
||||
},
|
||||
},
|
||||
{
|
||||
"currentValue": "1.0-groovy-2.4",
|
||||
"depName": "org.spockframework:spock-spring",
|
||||
"managerData": {
|
||||
"fileReplacePosition": 1996,
|
||||
"packageFile": "build.gradle",
|
||||
},
|
||||
},
|
||||
{
|
||||
"currentValue": "1.3",
|
||||
"depName": "org.hamcrest:hamcrest-core",
|
||||
"managerData": {
|
||||
"fileReplacePosition": 2101,
|
||||
"packageFile": "build.gradle",
|
||||
},
|
||||
},
|
||||
{
|
||||
"currentValue": "3.1",
|
||||
"depName": "cglib:cglib-nodep",
|
||||
"managerData": {
|
||||
"fileReplacePosition": 2189,
|
||||
"packageFile": "build.gradle",
|
||||
},
|
||||
},
|
||||
{
|
||||
"currentValue": "3.1.1",
|
||||
"depName": "org.apache.openjpa:openjpa",
|
||||
"managerData": {
|
||||
"fileReplacePosition": 2295,
|
||||
"packageFile": "build.gradle",
|
||||
},
|
||||
},
|
||||
]
|
||||
`;
|
|
@ -792,7 +792,106 @@ describe('modules/manager/gradle/parser', () => {
|
|||
content.slice(managerData!.fileReplacePosition).indexOf(currentValue!),
|
||||
);
|
||||
expect(replacementIndices.every((idx) => idx === 0)).toBeTrue();
|
||||
expect(deps).toMatchSnapshot();
|
||||
expect(deps).toMatchObject([
|
||||
{
|
||||
currentValue: '1.5.2.RELEASE',
|
||||
depName: 'org.springframework.boot:spring-boot-gradle-plugin',
|
||||
groupName: 'springBootVersion',
|
||||
managerData: {
|
||||
fileReplacePosition: 53,
|
||||
packageFile: 'build.gradle',
|
||||
},
|
||||
},
|
||||
{
|
||||
currentValue: '1.2.3',
|
||||
depName: 'com.github.jengelman.gradle.plugins:shadow',
|
||||
managerData: {
|
||||
fileReplacePosition: 417,
|
||||
packageFile: 'build.gradle',
|
||||
},
|
||||
},
|
||||
{
|
||||
currentValue: '0.1',
|
||||
depName: 'com.fkorotkov:gradle-libraries-plugin',
|
||||
managerData: {
|
||||
fileReplacePosition: 481,
|
||||
packageFile: 'build.gradle',
|
||||
},
|
||||
},
|
||||
{
|
||||
currentValue: '0.2.3',
|
||||
depName:
|
||||
'gradle.plugin.se.patrikerdes:gradle-use-latest-versions-plugin',
|
||||
managerData: {
|
||||
fileReplacePosition: 568,
|
||||
packageFile: 'build.gradle',
|
||||
},
|
||||
},
|
||||
{
|
||||
currentValue: '3.1.1',
|
||||
depName: 'org.apache.openjpa:openjpa',
|
||||
managerData: {
|
||||
fileReplacePosition: 621,
|
||||
packageFile: 'build.gradle',
|
||||
},
|
||||
},
|
||||
{
|
||||
currentValue: '0.13.0',
|
||||
depName: 'com.gradle.publish:plugin-publish-plugin',
|
||||
managerData: {
|
||||
fileReplacePosition: 688,
|
||||
packageFile: 'build.gradle',
|
||||
},
|
||||
},
|
||||
{
|
||||
currentValue: '6.0.9.RELEASE',
|
||||
depName: 'org.grails:gorm-hibernate5-spring-boot',
|
||||
managerData: {
|
||||
fileReplacePosition: 1882,
|
||||
packageFile: 'build.gradle',
|
||||
},
|
||||
},
|
||||
{
|
||||
currentValue: '6.0.5',
|
||||
depName: 'mysql:mysql-connector-java',
|
||||
managerData: {
|
||||
fileReplacePosition: 1938,
|
||||
packageFile: 'build.gradle',
|
||||
},
|
||||
},
|
||||
{
|
||||
currentValue: '1.0-groovy-2.4',
|
||||
depName: 'org.spockframework:spock-spring',
|
||||
managerData: {
|
||||
fileReplacePosition: 1996,
|
||||
packageFile: 'build.gradle',
|
||||
},
|
||||
},
|
||||
{
|
||||
currentValue: '1.3',
|
||||
depName: 'org.hamcrest:hamcrest-core',
|
||||
managerData: {
|
||||
fileReplacePosition: 2101,
|
||||
packageFile: 'build.gradle',
|
||||
},
|
||||
},
|
||||
{
|
||||
currentValue: '3.1',
|
||||
depName: 'cglib:cglib-nodep',
|
||||
managerData: {
|
||||
fileReplacePosition: 2189,
|
||||
packageFile: 'build.gradle',
|
||||
},
|
||||
},
|
||||
{
|
||||
currentValue: '3.1.1',
|
||||
depName: 'org.apache.openjpa:openjpa',
|
||||
managerData: {
|
||||
fileReplacePosition: 2295,
|
||||
packageFile: 'build.gradle',
|
||||
},
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -321,14 +321,24 @@ export const qDotOrBraceExpr = (
|
|||
matcher: q.QueryBuilder<Ctx, parser.Node>,
|
||||
): q.QueryBuilder<Ctx, parser.Node> =>
|
||||
q.sym<Ctx>(symValue).alt(
|
||||
q.alt<Ctx>(
|
||||
q.op<Ctx>('.').join(matcher),
|
||||
q.tree({
|
||||
type: 'wrapped-tree',
|
||||
maxDepth: 1,
|
||||
startsWith: '{',
|
||||
endsWith: '}',
|
||||
search: matcher,
|
||||
}),
|
||||
),
|
||||
q.op<Ctx>('.').join(matcher),
|
||||
q.tree({
|
||||
type: 'wrapped-tree',
|
||||
maxDepth: 1,
|
||||
startsWith: '{',
|
||||
endsWith: '}',
|
||||
search: matcher,
|
||||
}),
|
||||
);
|
||||
|
||||
export const qGroupId = qValueMatcher.handler((ctx) =>
|
||||
storeInTokenMap(ctx, 'groupId'),
|
||||
);
|
||||
|
||||
export const qArtifactId = qValueMatcher.handler((ctx) =>
|
||||
storeInTokenMap(ctx, 'artifactId'),
|
||||
);
|
||||
|
||||
export const qVersion = qValueMatcher.handler((ctx) =>
|
||||
storeInTokenMap(ctx, 'version'),
|
||||
);
|
||||
|
|
|
@ -4,9 +4,12 @@ import type { Ctx } from '../types';
|
|||
import {
|
||||
GRADLE_PLUGINS,
|
||||
cleanupTempVars,
|
||||
qArtifactId,
|
||||
qDotOrBraceExpr,
|
||||
qGroupId,
|
||||
qTemplateString,
|
||||
qValueMatcher,
|
||||
qVersion,
|
||||
storeInTokenMap,
|
||||
storeVarToken,
|
||||
} from './common';
|
||||
|
@ -17,18 +20,6 @@ import {
|
|||
handleLongFormDep,
|
||||
} from './handlers';
|
||||
|
||||
const qGroupId = qValueMatcher.handler((ctx) =>
|
||||
storeInTokenMap(ctx, 'groupId'),
|
||||
);
|
||||
|
||||
const qArtifactId = qValueMatcher.handler((ctx) =>
|
||||
storeInTokenMap(ctx, 'artifactId'),
|
||||
);
|
||||
|
||||
const qVersion = qValueMatcher.handler((ctx) =>
|
||||
storeInTokenMap(ctx, 'version'),
|
||||
);
|
||||
|
||||
// "foo:bar:1.2.3"
|
||||
// "foo:bar:$baz"
|
||||
// "foo" + "${bar}" + baz
|
||||
|
|
|
@ -4,16 +4,12 @@ import type { Ctx } from '../types';
|
|||
import {
|
||||
cleanupTempVars,
|
||||
qStringValue,
|
||||
qValueMatcher,
|
||||
qVersion,
|
||||
storeInTokenMap,
|
||||
storeVarToken,
|
||||
} from './common';
|
||||
import { handlePlugin } from './handlers';
|
||||
|
||||
const qVersion = qValueMatcher.handler((ctx) =>
|
||||
storeInTokenMap(ctx, 'version'),
|
||||
);
|
||||
|
||||
export const qPlugins = q
|
||||
.sym(regEx(/^(?:id|kotlin)$/), storeVarToken)
|
||||
.handler((ctx) => storeInTokenMap(ctx, 'methodName'))
|
||||
|
|
|
@ -32,6 +32,7 @@ const qUri = q
|
|||
// mavenCentral { ... }
|
||||
const qPredefinedRegistries = q
|
||||
.sym(regEx(`^(?:${Object.keys(REGISTRY_URLS).join('|')})$`), storeVarToken)
|
||||
.handler((ctx) => storeInTokenMap(ctx, 'registryUrl'))
|
||||
.alt(
|
||||
q.tree({
|
||||
type: 'wrapped-tree',
|
||||
|
@ -45,10 +46,31 @@ const qPredefinedRegistries = q
|
|||
endsWith: '}',
|
||||
}),
|
||||
)
|
||||
.handler((ctx) => storeInTokenMap(ctx, 'registryUrl'))
|
||||
.handler(handlePredefinedRegistryUrl)
|
||||
.handler(cleanupTempVars);
|
||||
|
||||
// { url = "https://some.repo" }
|
||||
const qMavenArtifactRegistry = q.tree({
|
||||
type: 'wrapped-tree',
|
||||
maxDepth: 1,
|
||||
startsWith: '{',
|
||||
endsWith: '}',
|
||||
search: q.alt(
|
||||
q
|
||||
.sym<Ctx>('name')
|
||||
.opt(q.op('='))
|
||||
.join(qValueMatcher)
|
||||
.handler((ctx) => storeInTokenMap(ctx, 'name')),
|
||||
q.sym<Ctx>('url').opt(q.op('=')).join(qUri),
|
||||
q.sym<Ctx>('setUrl').tree({
|
||||
maxDepth: 1,
|
||||
startsWith: '(',
|
||||
endsWith: ')',
|
||||
search: q.begin<Ctx>().join(qUri).end(),
|
||||
}),
|
||||
),
|
||||
});
|
||||
|
||||
// maven(url = uri("https://foo.bar/baz"))
|
||||
// maven { name = some; url = "https://foo.bar/${name}" }
|
||||
const qCustomRegistryUrl = q
|
||||
|
@ -61,26 +83,7 @@ const qCustomRegistryUrl = q
|
|||
endsWith: ')',
|
||||
search: q.begin<Ctx>().opt(q.sym<Ctx>('url').op('=')).join(qUri).end(),
|
||||
}),
|
||||
q.tree({
|
||||
type: 'wrapped-tree',
|
||||
maxDepth: 1,
|
||||
startsWith: '{',
|
||||
endsWith: '}',
|
||||
search: q.alt(
|
||||
q
|
||||
.sym<Ctx>('name')
|
||||
.opt(q.op('='))
|
||||
.join(qValueMatcher)
|
||||
.handler((ctx) => storeInTokenMap(ctx, 'name')),
|
||||
q.sym<Ctx>('url').opt(q.op('=')).join(qUri),
|
||||
q.sym<Ctx>('setUrl').tree({
|
||||
maxDepth: 1,
|
||||
startsWith: '(',
|
||||
endsWith: ')',
|
||||
search: q.begin<Ctx>().join(qUri).end(),
|
||||
}),
|
||||
),
|
||||
}),
|
||||
qMavenArtifactRegistry,
|
||||
)
|
||||
.handler(handleCustomRegistryUrl)
|
||||
.handler(cleanupTempVars);
|
||||
|
|
|
@ -2,6 +2,8 @@ import { query as q } from 'good-enough-parser';
|
|||
import type { Ctx } from '../types';
|
||||
import {
|
||||
cleanupTempVars,
|
||||
qArtifactId,
|
||||
qGroupId,
|
||||
qStringValue,
|
||||
qStringValueAsSymbol,
|
||||
qValueMatcher,
|
||||
|
@ -10,14 +12,6 @@ import {
|
|||
} from './common';
|
||||
import { handleLibraryDep, handlePlugin } from './handlers';
|
||||
|
||||
const qGroupId = qValueMatcher.handler((ctx) =>
|
||||
storeInTokenMap(ctx, 'groupId'),
|
||||
);
|
||||
|
||||
const qArtifactId = qValueMatcher.handler((ctx) =>
|
||||
storeInTokenMap(ctx, 'artifactId'),
|
||||
);
|
||||
|
||||
const qVersionCatalogVersion = q
|
||||
.op<Ctx>('.')
|
||||
.alt(
|
||||
|
|
Loading…
Reference in a new issue