Skip to content

Commit

Permalink
Merge branch 'main' into feat/11398-blobless-git
Browse files Browse the repository at this point in the history
# Conflicts:
#	lib/util/git/index.spec.ts
#	lib/util/git/index.ts
  • Loading branch information
rarkins committed Sep 6, 2021
2 parents 925f85d + a163306 commit 044af61
Show file tree
Hide file tree
Showing 55 changed files with 1,198 additions and 663 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
@@ -1,4 +1,4 @@
FROM containerbase/node:14.17.6@sha256:ebe928dcb70c9ec5ad36adc576218d81a3f2a598f0b8cfa14c23467957596389
FROM containerbase/node:14.17.6@sha256:449af722795fbfec2c8ee00724fea3b1b5a4bbd7bdfecfaf783fa746be48ba19


# renovate: datasource=npm
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Expand Up @@ -22,15 +22,15 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@b0e70410b40f1a9af3bba1cecd95b4b57896af26 # renovate: tag=v1.0.12
uses: github/codeql-action/init@89d78ba4572c7854683ec144d212bf0b52cd2a2a # renovate: tag=v1.0.13

# Override language selection by uncommenting this and choosing your languages
# with:
# languages: go, javascript, csharp, python, cpp, java
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@b0e70410b40f1a9af3bba1cecd95b4b57896af26 # renovate: tag=v1.0.12
uses: github/codeql-action/autobuild@89d78ba4572c7854683ec144d212bf0b52cd2a2a # renovate: tag=v1.0.13

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -44,4 +44,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@b0e70410b40f1a9af3bba1cecd95b4b57896af26 # renovate: tag=v1.0.12
uses: github/codeql-action/analyze@89d78ba4572c7854683ec144d212bf0b52cd2a2a # renovate: tag=v1.0.13
9 changes: 9 additions & 0 deletions docs/usage/configuration-options.md
Expand Up @@ -719,6 +719,14 @@ If configured, Renovate bypasses its normal major/minor/patch upgrade logic and
Beware that Renovate follows tags strictly.
For example, if you are following a tag like `next` and then that stream is released as `stable` and `next` is no longer being updated then that means your dependencies also won't be getting updated.

## gitAuthor

You can customize the Git author that's used whenever Renovate creates a commit.
The `gitAuthor` option accepts a RFC5322-compliant string.

**Note** We strongly recommend that the Git author email you use is unique to Renovate.
Otherwise, if another bot or human shares the same email and pushes to one of Renovate's branches then Renovate will mistake the branch as unmodified and potentially force push over the changes.

## gitIgnoredAuthors

Specify commit authors ignored by Renovate.
Expand Down Expand Up @@ -1016,6 +1024,7 @@ Example:
This can be a base URL (e.g. `https://api.github.com`) or a hostname like `github.com` or `api.github.com`.
If the value starts with `http(s)` then it will only match against URLs which start with the full base URL.
Otherwise, it will be matched by checking if the URL's hostname matches the `matchHost` directly or ends with it.
When checking the end of the hostname, a single dot is prefixed to the value of `matchHost`, if one is not already present, to ensure it can only match against whole domain segments.

### timeout

Expand Down
2 changes: 1 addition & 1 deletion docs/usage/docker.md
Expand Up @@ -227,7 +227,7 @@ To get access to the token a custom Renovate Docker image is needed that include
The Dockerfile to create such an image can look like this:

```Dockerfile
FROM renovate/renovate:26.12.0
FROM renovate/renovate:26.19.1
# Include the "Docker tip" which you can find here https://cloud.google.com/sdk/docs/install
# under "Installation" for "Debian/Ubuntu"
RUN ...
Expand Down
8 changes: 7 additions & 1 deletion docs/usage/java.md
Expand Up @@ -16,12 +16,18 @@ Renovate detects versions that are specified in a string `'group:artifact:versio

Renovate can update `build.gradle`/`build.gradle.kts` files in the root of the repository.
It also updates any `*.gradle`/`*.gradle.kts` files in a subdirectory as multi-project configurations.
Renovate also tries to find updates for dependencies whose version is defined in a `*.properties` file, and scans for `*.versions.toml` files and for `*.toml` files inside the `gradle` folder to keep [catalogs](https://docs.gradle.org/current/userguide/platforms.html) up to date.

Renovate does not support:

- Projects which do not have either a `build.gradle` or `build.gradle.kts` in the repository root
- Android projects that require extra configuration to run (e.g. setting the Android SDK)
- Gradle versions prior to version 5.0.
- Gradle versions older than version 5.0
- Catalogs defined inside a `build.gradle` or `build.gradle.kts` file rather than in TOML
- Catalogs with version ranges
- Catalogs using the `required`, `strictly`, `preferred`, `reject`, and `rejectAll` version declarations
- Catalogs with custom names that do not end in `.toml`
- Catalogs outside the `gradle` folder whose names do not end in `.versions.toml`

## Gradle Wrapper

Expand Down
8 changes: 0 additions & 8 deletions docs/usage/self-hosted-configuration.md
Expand Up @@ -205,14 +205,6 @@ This should be set to a Personal Access Token (GitHub only) when `forkMode` is s
Renovate will use this token to fork the repository into the personal space of the person owning the Personal Access Token.
Renovate will then create branches on the fork and opens Pull Requests on the parent repository.

## gitAuthor

You can customize the Git author that's used whenever Renovate creates a commit.
The `gitAuthor` option accepts a RFC5322-compliant string.

**Note** We strongly recommend that the Git author email you use is unique to Renovate.
Otherwise, if another bot or human shares the same email and pushes to one of Renovate's branches then Renovate will mistake the branch as unmodified and potentially force push over the changes.

## gitNoVerify

Controls when Renovate passes the `--no-verify` flag to `git`.
Expand Down
1 change: 0 additions & 1 deletion lib/config/options/index.ts
Expand Up @@ -634,7 +634,6 @@ const options: RenovateOptions[] = [
name: 'gitAuthor',
description: 'Author to use for Git commits. Must conform to RFC5322.',
type: 'string',
globalOnly: true,
},
{
name: 'gitPrivateKey',
Expand Down
1 change: 1 addition & 0 deletions lib/config/presets/internal/monorepo.ts
Expand Up @@ -126,6 +126,7 @@ const repoGroups = {
'https://github.com/neutrinojs/neutrino',
'https://github.com/mozilla-neutrino/neutrino-dev',
],
nexpect: 'https://github.com/fluffynuts/NExpect',
nextjs: [
'https://github.com/zeit/next.js', // old repo
'https://github.com/vercel/next.js',
Expand Down
6 changes: 0 additions & 6 deletions lib/globals.d.ts
Expand Up @@ -9,12 +9,6 @@ declare interface Error {
validationMessage?: string;
}

declare namespace NodeJS {
interface Global {
gitAuthor?: { name: string; email: string };
}
}

// can't use `resolveJsonModule` because it will copy json files and change dist path

declare module '*/package.json' {
Expand Down
7 changes: 6 additions & 1 deletion lib/manager/gradle/index.ts
Expand Up @@ -29,7 +29,12 @@ export function updateDependency(
export const language = LANGUAGE_JAVA;

export const defaultConfig = {
fileMatch: ['\\.gradle(\\.kts)?$', '(^|/)gradle.properties$'],
fileMatch: [
'\\.gradle(\\.kts)?$',
'(^|/)gradle.properties$',
'(^|\\/)gradle\\/.+\\.toml$',
'\\.versions\\.toml$',
],
timeout: 600,
versioning: gradleVersioning.id,
};
17 changes: 17 additions & 0 deletions lib/manager/gradle/shallow/__fixtures__/1/libs.versions.toml
@@ -0,0 +1,17 @@
[versions]
detekt = "1.17.0"
kotest = "4.6.0"
publish-on-central = "0.5.0"

[libraries]
detekt-formatting = { module = "io.gitlab.arturbosch.detekt:detekt-formatting", version.ref = "detekt" }
kotest-assertions-core-jvm = { module = "io.kotest:kotest-assertions-core-jvm", version.ref = "kotest" }
kotest-runner-junit5 = { module = "io.kotest:kotest-runner-junit5", version.ref = "kotest" }
mockito = { group = "org.mockito", name = "mockito-core", version = "3.10.0" }

[bundles]
kotest = [ "kotest-runner-junit5", "kotest-assertions-core-jvm" ]

[plugins]
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
publish-on-central = { id = "org.danilopianini.publish-on-central", version.ref = "publish-on-central" }
13 changes: 13 additions & 0 deletions lib/manager/gradle/shallow/__fixtures__/2/libs.versions.toml
@@ -0,0 +1,13 @@
[versions]
kotlin = "1.5.21"
retrofit = "2.8.2"

[libraries]
okHttp = "com.squareup.okhttp3:okhttp:4.9.0"
okio = { module = "com.squareup.okio:okio", version = "2.8.0" }
picasso = { group = "com.squareup.picasso", name = "picasso", version = "2.5.1" }
retrofit2-retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }

[plugins]
kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version = "1.5.21" }
kotlinSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
180 changes: 179 additions & 1 deletion lib/manager/gradle/shallow/extract.spec.ts
@@ -1,5 +1,5 @@
import { extractAllPackageFiles } from '..';
import { fs } from '../../../../test/util';
import { fs, loadFixture } from '../../../../test/util';

jest.mock('../../../util/fs');

Expand Down Expand Up @@ -136,4 +136,182 @@ describe('manager/gradle/shallow/extract', () => {
},
]);
});

it('works with dependency catalogs', async () => {
const tomlFile = loadFixture('1/libs.versions.toml');
const fsMock = {
'gradle/libs.versions.toml': tomlFile,
};
mockFs(fsMock);
const res = await extractAllPackageFiles({} as never, Object.keys(fsMock));
expect(res).toMatchObject([
{
packageFile: 'gradle/libs.versions.toml',
deps: [
{
depName: 'io.gitlab.arturbosch.detekt:detekt-formatting',
groupName: 'io.gitlab.arturbosch.detekt',
currentValue: '1.17.0',
managerData: {
fileReplacePosition: 21,
packageFile: 'gradle/libs.versions.toml',
},
},
{
depName: 'io.kotest:kotest-assertions-core-jvm',
groupName: 'io.kotest',
currentValue: '4.6.0',
managerData: {
fileReplacePosition: 39,
packageFile: 'gradle/libs.versions.toml',
},
},
{
depName: 'io.kotest:kotest-runner-junit5',
groupName: 'io.kotest',
currentValue: '4.6.0',
managerData: {
fileReplacePosition: 39,
packageFile: 'gradle/libs.versions.toml',
},
},
{
depName: 'org.mockito:mockito-core',
groupName: 'org.mockito',
currentValue: '3.10.0',
managerData: {
fileReplacePosition: 460,
packageFile: 'gradle/libs.versions.toml',
},
},
{
depName: 'io.gitlab.arturbosch.detekt',
depType: 'plugin',
currentValue: '1.17.0',
commitMessageTopic: 'plugin detekt',
lookupName:
'io.gitlab.arturbosch.detekt:io.gitlab.arturbosch.detekt.gradle.plugin',
managerData: {
fileReplacePosition: 21,
packageFile: 'gradle/libs.versions.toml',
},
registryUrls: [
'https://repo.maven.apache.org/maven2',
'https://plugins.gradle.org/m2/',
],
},
{
depName: 'org.danilopianini.publish-on-central',
depType: 'plugin',
currentValue: '0.5.0',
commitMessageTopic: 'plugin publish-on-central',
lookupName:
'org.danilopianini.publish-on-central:org.danilopianini.publish-on-central.gradle.plugin',
managerData: {
fileReplacePosition: 68,
packageFile: 'gradle/libs.versions.toml',
},
registryUrls: [
'https://repo.maven.apache.org/maven2',
'https://plugins.gradle.org/m2/',
],
},
],
},
]);
});

it("can run Javier's example", async () => {
const tomlFile = loadFixture('2/libs.versions.toml');
const fsMock = {
'gradle/libs.versions.toml': tomlFile,
};
mockFs(fsMock);
const res = await extractAllPackageFiles({} as never, Object.keys(fsMock));
expect(res).toMatchObject([
{
packageFile: 'gradle/libs.versions.toml',
deps: [
{
depName: 'com.squareup.okhttp3:okhttp',
groupName: 'com.squareup.okhttp3',
currentValue: '4.9.0',
managerData: {
fileReplacePosition: 99,
packageFile: 'gradle/libs.versions.toml',
},
},
{
depName: 'com.squareup.okio:okio',
groupName: 'com.squareup.okio',
currentValue: '2.8.0',
managerData: {
fileReplacePosition: 161,
packageFile: 'gradle/libs.versions.toml',
},
},
{
depName: 'com.squareup.picasso:picasso',
groupName: 'com.squareup.picasso',
currentValue: '2.5.1',
managerData: {
fileReplacePosition: 243,
packageFile: 'gradle/libs.versions.toml',
},
},
{
depName: 'com.squareup.retrofit2:retrofit',
groupName: 'com.squareup.retrofit2',
currentValue: '2.8.2',
managerData: {
fileReplacePosition: 41,
packageFile: 'gradle/libs.versions.toml',
},
},
{
depName: 'org.jetbrains.kotlin.jvm',
depType: 'plugin',
currentValue: '1.5.21',
commitMessageTopic: 'plugin kotlinJvm',
lookupName:
'org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin',
managerData: {
fileReplacePosition: 415,
packageFile: 'gradle/libs.versions.toml',
},
registryUrls: [
'https://repo.maven.apache.org/maven2',
'https://plugins.gradle.org/m2/',
],
},
{
depName: 'org.jetbrains.kotlin.plugin.serialization',
depType: 'plugin',
currentValue: '1.5.21',
commitMessageTopic: 'plugin kotlinSerialization',
lookupName:
'org.jetbrains.kotlin.plugin.serialization:org.jetbrains.kotlin.plugin.serialization.gradle.plugin',
managerData: {
fileReplacePosition: 21,
packageFile: 'gradle/libs.versions.toml',
},
registryUrls: [
'https://repo.maven.apache.org/maven2',
'https://plugins.gradle.org/m2/',
],
},
],
},
]);
});

it('ignores an empty TOML', async () => {
const tomlFile = '';
const fsMock = {
'gradle/libs.versions.toml': tomlFile,
};
mockFs(fsMock);
const res = await extractAllPackageFiles({} as never, Object.keys(fsMock));
expect(res).toBeNull();
});
});
9 changes: 9 additions & 0 deletions lib/manager/gradle/shallow/extract.ts
Expand Up @@ -11,12 +11,14 @@ import type {
PackageFile,
} from '../../types';
import type { GradleManagerData } from '../types';
import { parseCatalog } from './extract/catalog';
import { parseGradle, parseProps } from './parser';
import type { PackageVariables, VariableRegistry } from './types';
import {
getVars,
isGradleFile,
isPropsFile,
isTOMLFile,
reorderFiles,
toAbsolutePath,
} from './utils';
Expand Down Expand Up @@ -64,6 +66,13 @@ export async function extractAllPackageFiles(
const { vars, deps } = parseProps(content, packageFile);
updateVars(vars);
extractedDeps.push(...deps);
} else if (isTOMLFile(packageFile)) {
try {
const updatesFromCatalog = parseCatalog(packageFile, content);
extractedDeps.push(...updatesFromCatalog);
} catch (error) {
logger.warn({ error }, 'TOML parsing error');
}
} else if (isGradleFile(packageFile)) {
const vars = getVars(registry, dir);
const {
Expand Down

0 comments on commit 044af61

Please sign in to comment.