Skip to content

Commit

Permalink
feat(bazel): Use Gradle versioning for maven_install by default (#2…
Browse files Browse the repository at this point in the history
  • Loading branch information
zharinov committed Mar 4, 2023
1 parent 14019fe commit 9ec4804
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
19 changes: 18 additions & 1 deletion docs/usage/bazel.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Renovate supports upgrading dependencies in Bazel `WORKSPACE` files.

1. Bazel support is enabled automatically
2. Renovate will search repositories for any `WORKSPACE` files in the repository
3. Existing dependencies will be extracted from `git_repository` and `http_archive` declarations
3. Existing dependencies will be extracted from `container_pull`, `git_repository`, `go_repository`, `maven_install`, and `http_archive`/`http_file` declarations
4. Renovate will replace any old versions with the latest version available

## git_repository
Expand Down Expand Up @@ -54,6 +54,23 @@ http_archive(

Renovate uses the list of **releases** that it finds at the `url` to detect a new version.

## maven_install

By default, Maven dependencies are extracted in the context of Gradle versioning scheme.
To change it, configure `packageRules` like this:

```json
{
"packageRules": [
{
"matchManagers": ["bazel"],
"matchDatasources": ["maven"],
"versioning": "maven"
}
]
}
```

## Future work

Contributions and/or feature requests are welcome to support more patterns or additional use cases.
3 changes: 3 additions & 0 deletions lib/modules/manager/bazel/rules/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ describe('modules/manager/bazel/rules/index', () => {
{
currentValue: '1.1.1',
datasource: 'maven',
versioning: 'gradle',
depType: 'maven_install',
depName: 'com.example1:foo',
registryUrls: [
Expand All @@ -388,6 +389,7 @@ describe('modules/manager/bazel/rules/index', () => {
{
currentValue: '2.2.2',
datasource: 'maven',
versioning: 'gradle',
depType: 'maven_install',
depName: 'com.example2:bar',
registryUrls: [
Expand All @@ -398,6 +400,7 @@ describe('modules/manager/bazel/rules/index', () => {
{
currentValue: '3.3.3',
datasource: 'maven',
versioning: 'gradle',
depType: 'maven_install',
depName: 'com.example3:baz',
registryUrls: [
Expand Down
2 changes: 2 additions & 0 deletions lib/modules/manager/bazel/rules/maven.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import is from '@sindresorhus/is';
import { z } from 'zod';
import { MavenDatasource } from '../../../datasource/maven';
import { id as versioning } from '../../../versioning/gradle';
import type { PackageDependency } from '../../types';

export const mavenRules = ['maven_install'] as const;
Expand Down Expand Up @@ -52,6 +53,7 @@ export const MavenTarget = z
}): PackageDependency[] =>
artifacts.map(({ group, artifact, version: currentValue }) => ({
datasource: MavenDatasource.id,
versioning,
depName: `${group}:${artifact}`,
currentValue,
depType,
Expand Down

0 comments on commit 9ec4804

Please sign in to comment.