mirror of
https://github.com/actions/setup-java.git
synced 2024-11-12 04:48:03 +00:00
feat: support Gradle version catalog (#394)
This commit is contained in:
parent
2c53c1a588
commit
de1bb2b0c5
@ -108,7 +108,7 @@ Currently, the following distributions are supported:
|
|||||||
|
|
||||||
### Caching packages dependencies
|
### Caching packages dependencies
|
||||||
The action has a built-in functionality for caching and restoring dependencies. It uses [actions/cache](https://github.com/actions/cache) under hood for caching dependencies but requires less configuration settings. Supported package managers are gradle, maven and sbt. The format of the used cache key is `setup-java-${{ platform }}-${{ packageManager }}-${{ fileHash }}`, where the hash is based on the following files:
|
The action has a built-in functionality for caching and restoring dependencies. It uses [actions/cache](https://github.com/actions/cache) under hood for caching dependencies but requires less configuration settings. Supported package managers are gradle, maven and sbt. The format of the used cache key is `setup-java-${{ platform }}-${{ packageManager }}-${{ fileHash }}`, where the hash is based on the following files:
|
||||||
- gradle: `**/*.gradle*`, `**/gradle-wrapper.properties`, `buildSrc/**/Versions.kt`, `buildSrc/**/Dependencies.kt`
|
- gradle: `**/*.gradle*`, `**/gradle-wrapper.properties`, `buildSrc/**/Versions.kt`, `buildSrc/**/Dependencies.kt`, and `gradle/*.versions.toml`
|
||||||
- maven: `**/pom.xml`
|
- maven: `**/pom.xml`
|
||||||
- sbt: all sbt build definition files `**/*.sbt`, `**/project/build.properties`, `**/project/**.{scala,sbt}`
|
- sbt: all sbt build definition files `**/*.sbt`, `**/project/build.properties`, `**/project/**.{scala,sbt}`
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ describe('dependency cache', () => {
|
|||||||
await expect(restore('gradle')).rejects.toThrowError(
|
await expect(restore('gradle')).rejects.toThrowError(
|
||||||
`No file in ${projectRoot(
|
`No file in ${projectRoot(
|
||||||
workspace
|
workspace
|
||||||
)} matched to [**/*.gradle*,**/gradle-wrapper.properties,buildSrc/**/Versions.kt,buildSrc/**/Dependencies.kt], make sure you have checked out the target repository`
|
)} matched to [**/*.gradle*,**/gradle-wrapper.properties,buildSrc/**/Versions.kt,buildSrc/**/Dependencies.kt,gradle/*.versions.toml], make sure you have checked out the target repository`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('downloads cache based on build.gradle', async () => {
|
it('downloads cache based on build.gradle', async () => {
|
||||||
@ -112,6 +112,15 @@ describe('dependency cache', () => {
|
|||||||
it('downloads cache based on build.gradle.kts', async () => {
|
it('downloads cache based on build.gradle.kts', async () => {
|
||||||
createFile(join(workspace, 'build.gradle.kts'));
|
createFile(join(workspace, 'build.gradle.kts'));
|
||||||
|
|
||||||
|
await restore('gradle');
|
||||||
|
expect(spyCacheRestore).toBeCalled();
|
||||||
|
expect(spyWarning).not.toBeCalled();
|
||||||
|
expect(spyInfo).toBeCalledWith('gradle cache is not found');
|
||||||
|
});
|
||||||
|
it('downloads cache based on libs.versions.toml', async () => {
|
||||||
|
createDirectory(join(workspace, 'gradle'));
|
||||||
|
createFile(join(workspace, 'gradle', 'libs.versions.toml'));
|
||||||
|
|
||||||
await restore('gradle');
|
await restore('gradle');
|
||||||
expect(spyCacheRestore).toBeCalled();
|
expect(spyCacheRestore).toBeCalled();
|
||||||
expect(spyWarning).not.toBeCalled();
|
expect(spyWarning).not.toBeCalled();
|
||||||
|
3
dist/cleanup/index.js
vendored
3
dist/cleanup/index.js
vendored
@ -68224,7 +68224,8 @@ const supportedPackageManager = [
|
|||||||
'**/*.gradle*',
|
'**/*.gradle*',
|
||||||
'**/gradle-wrapper.properties',
|
'**/gradle-wrapper.properties',
|
||||||
'buildSrc/**/Versions.kt',
|
'buildSrc/**/Versions.kt',
|
||||||
'buildSrc/**/Dependencies.kt'
|
'buildSrc/**/Dependencies.kt',
|
||||||
|
'gradle/*.versions.toml'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
3
dist/setup/index.js
vendored
3
dist/setup/index.js
vendored
@ -103427,7 +103427,8 @@ const supportedPackageManager = [
|
|||||||
'**/*.gradle*',
|
'**/*.gradle*',
|
||||||
'**/gradle-wrapper.properties',
|
'**/gradle-wrapper.properties',
|
||||||
'buildSrc/**/Versions.kt',
|
'buildSrc/**/Versions.kt',
|
||||||
'buildSrc/**/Dependencies.kt'
|
'buildSrc/**/Dependencies.kt',
|
||||||
|
'gradle/*.versions.toml'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,8 @@ const supportedPackageManager: PackageManager[] = [
|
|||||||
'**/*.gradle*',
|
'**/*.gradle*',
|
||||||
'**/gradle-wrapper.properties',
|
'**/gradle-wrapper.properties',
|
||||||
'buildSrc/**/Versions.kt',
|
'buildSrc/**/Versions.kt',
|
||||||
'buildSrc/**/Dependencies.kt'
|
'buildSrc/**/Dependencies.kt',
|
||||||
|
'gradle/*.versions.toml'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user