mirror of
https://github.com/actions/setup-java.git
synced 2024-11-14 14:08:05 +00:00
Compare commits
3 Commits
de69dd7792
...
fc9d354884
Author | SHA1 | Date | |
---|---|---|---|
|
fc9d354884 | ||
|
cd89f46ac9 | ||
|
91f49aa1b0 |
@ -113,8 +113,8 @@ Currently, the following distributions are supported:
|
||||
**NOTE:** For Azul Zulu OpenJDK architectures x64 and arm64 are mapped to x86 / arm with proper hw_bitness.
|
||||
|
||||
### 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:
|
||||
- gradle: `**/*.gradle*`, `**/gradle-wrapper.properties`, `buildSrc/**/Versions.kt`, `buildSrc/**/Dependencies.kt`, and `gradle/*.versions.toml`
|
||||
The action has a built-in functionality for caching and restoring dependencies. It uses [toolkit/cache](https://github.com/actions/toolkit/tree/main/packages/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/*.versions.toml`, and `**/versions.properties`
|
||||
- maven: `**/pom.xml`
|
||||
- sbt: all sbt build definition files `**/*.sbt`, `**/project/build.properties`, `**/project/**.scala`, `**/project/**.sbt`
|
||||
|
||||
|
@ -102,7 +102,7 @@ describe('dependency cache', () => {
|
||||
await expect(restore('gradle')).rejects.toThrow(
|
||||
`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,**/versions.properties], make sure you have checked out the target repository`
|
||||
);
|
||||
});
|
||||
it('downloads cache based on build.gradle', async () => {
|
||||
@ -179,6 +179,14 @@ describe('dependency cache', () => {
|
||||
expect(firstCall).not.toBe(thirdCall);
|
||||
});
|
||||
});
|
||||
it('downloads cache based on versions.properties', async () => {
|
||||
createFile(join(workspace, 'versions.properties'));
|
||||
|
||||
await restore('gradle');
|
||||
expect(spyCacheRestore).toHaveBeenCalled();
|
||||
expect(spyWarning).not.toHaveBeenCalled();
|
||||
expect(spyInfo).toHaveBeenCalledWith('gradle cache is not found');
|
||||
});
|
||||
});
|
||||
describe('save', () => {
|
||||
let spyCacheSave: jest.SpyInstance<
|
||||
@ -333,6 +341,17 @@ describe('dependency cache', () => {
|
||||
expect.stringMatching(/^Cache saved with the key:.*/)
|
||||
);
|
||||
});
|
||||
it('uploads cache based on versions.properties', async () => {
|
||||
createFile(join(workspace, 'versions.properties'));
|
||||
createStateForSuccessfulRestore();
|
||||
|
||||
await save('gradle');
|
||||
expect(spyCacheSave).toHaveBeenCalled();
|
||||
expect(spyWarning).not.toHaveBeenCalled();
|
||||
expect(spyInfo).toHaveBeenCalledWith(
|
||||
expect.stringMatching(/^Cache saved with the key:.*/)
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -77,9 +77,9 @@ describe('toolchains tests', () => {
|
||||
};
|
||||
|
||||
const result = `<?xml version="1.0"?>
|
||||
<toolchains xmlns="https://maven.apache.org/TOOLCHAINS/1.1.0"
|
||||
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="https://maven.apache.org/TOOLCHAINS/1.1.0 https://maven.apache.org/xsd/toolchains-1.1.0.xsd">
|
||||
<toolchains xmlns="http://maven.apache.org/TOOLCHAINS/1.1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/TOOLCHAINS/1.1.0 https://maven.apache.org/xsd/toolchains-1.1.0.xsd">
|
||||
<toolchain>
|
||||
<type>jdk</type>
|
||||
<provides>
|
||||
@ -248,9 +248,9 @@ describe('toolchains tests', () => {
|
||||
};
|
||||
|
||||
const expectedToolchains = `<?xml version="1.0"?>
|
||||
<toolchains xmlns="https://maven.apache.org/TOOLCHAINS/1.1.0"
|
||||
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="https://maven.apache.org/TOOLCHAINS/1.1.0 https://maven.apache.org/xsd/toolchains-1.1.0.xsd">
|
||||
<toolchains xmlns="http://maven.apache.org/TOOLCHAINS/1.1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/TOOLCHAINS/1.1.0 https://maven.apache.org/xsd/toolchains-1.1.0.xsd">
|
||||
<toolchain>
|
||||
<type>jdk</type>
|
||||
<provides>
|
||||
|
3
dist/cleanup/index.js
vendored
3
dist/cleanup/index.js
vendored
@ -66632,7 +66632,8 @@ const supportedPackageManager = [
|
||||
'**/gradle-wrapper.properties',
|
||||
'buildSrc/**/Versions.kt',
|
||||
'buildSrc/**/Dependencies.kt',
|
||||
'gradle/*.versions.toml'
|
||||
'gradle/*.versions.toml',
|
||||
'**/versions.properties'
|
||||
]
|
||||
},
|
||||
{
|
||||
|
9
dist/setup/index.js
vendored
9
dist/setup/index.js
vendored
@ -101837,7 +101837,8 @@ const supportedPackageManager = [
|
||||
'**/gradle-wrapper.properties',
|
||||
'buildSrc/**/Versions.kt',
|
||||
'buildSrc/**/Dependencies.kt',
|
||||
'gradle/*.versions.toml'
|
||||
'gradle/*.versions.toml',
|
||||
'**/versions.properties'
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -103973,9 +103974,9 @@ function generateToolchainDefinition(original, version, vendor, id, jdkHome) {
|
||||
else
|
||||
xmlObj = xmlbuilder2_1.create({
|
||||
toolchains: {
|
||||
'@xmlns': 'https://maven.apache.org/TOOLCHAINS/1.1.0',
|
||||
'@xmlns:xsi': 'https://www.w3.org/2001/XMLSchema-instance',
|
||||
'@xsi:schemaLocation': 'https://maven.apache.org/TOOLCHAINS/1.1.0 https://maven.apache.org/xsd/toolchains-1.1.0.xsd',
|
||||
'@xmlns': 'http://maven.apache.org/TOOLCHAINS/1.1.0',
|
||||
'@xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance',
|
||||
'@xsi:schemaLocation': 'http://maven.apache.org/TOOLCHAINS/1.1.0 https://maven.apache.org/xsd/toolchains-1.1.0.xsd',
|
||||
toolchain: [
|
||||
{
|
||||
type: 'jdk',
|
||||
|
@ -39,7 +39,8 @@ const supportedPackageManager: PackageManager[] = [
|
||||
'**/gradle-wrapper.properties',
|
||||
'buildSrc/**/Versions.kt',
|
||||
'buildSrc/**/Dependencies.kt',
|
||||
'gradle/*.versions.toml'
|
||||
'gradle/*.versions.toml',
|
||||
'**/versions.properties'
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -104,10 +104,10 @@ export function generateToolchainDefinition(
|
||||
} else
|
||||
xmlObj = xmlCreate({
|
||||
toolchains: {
|
||||
'@xmlns': 'https://maven.apache.org/TOOLCHAINS/1.1.0',
|
||||
'@xmlns:xsi': 'https://www.w3.org/2001/XMLSchema-instance',
|
||||
'@xmlns': 'http://maven.apache.org/TOOLCHAINS/1.1.0',
|
||||
'@xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance',
|
||||
'@xsi:schemaLocation':
|
||||
'https://maven.apache.org/TOOLCHAINS/1.1.0 https://maven.apache.org/xsd/toolchains-1.1.0.xsd',
|
||||
'http://maven.apache.org/TOOLCHAINS/1.1.0 https://maven.apache.org/xsd/toolchains-1.1.0.xsd',
|
||||
toolchain: [
|
||||
{
|
||||
type: 'jdk',
|
||||
|
Loading…
Reference in New Issue
Block a user