Added gradle.properties file to the cache key

Part of project configuration may be in the `gradle.properties` file and changing it should invalidate cache

See: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
This commit is contained in:
Alexandr Evstigneev 2023-03-04 08:35:25 +04:00
parent ea15b3b99c
commit a76faebd93
5 changed files with 16 additions and 5 deletions

View file

@ -98,7 +98,7 @@ describe('dependency cache', () => {
await expect(restore('gradle')).rejects.toThrowError(
`No file in ${projectRoot(
workspace
)} matched to [**/*.gradle*,**/gradle-wrapper.properties,buildSrc/**/Versions.kt,buildSrc/**/Dependencies.kt,gradle/*.versions.toml], make sure you have checked out the target repository`
)} matched to [**/*.gradle*,**/gradle-wrapper.properties,buildSrc/**/Versions.kt,buildSrc/**/Dependencies.kt,gradle/*.versions.toml,gradle.properties], make sure you have checked out the target repository`
);
});
it('downloads cache based on build.gradle', async () => {
@ -121,6 +121,14 @@ describe('dependency cache', () => {
createDirectory(join(workspace, 'gradle'));
createFile(join(workspace, 'gradle', 'libs.versions.toml'));
await restore('gradle');
expect(spyCacheRestore).toBeCalled();
expect(spyWarning).not.toBeCalled();
expect(spyInfo).toBeCalledWith('gradle cache is not found');
});
it('downloads cache based on gradle.properties', async () => {
createFile(join(workspace, 'gradle.properties'));
await restore('gradle');
expect(spyCacheRestore).toBeCalled();
expect(spyWarning).not.toBeCalled();