mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-11-25 17:51:02 -05:00
Treat directory for instrumented jar as single artifact
Leaving the `.lock` and `.receipt` files lying around was causing issues when the actual jar files were not restored. Now the entire directory will either be missing, or completely restored.
This commit is contained in:
parent
8b1f1a3817
commit
709ded51a5
2 changed files with 8 additions and 3 deletions
|
@ -38,7 +38,7 @@ inputs:
|
||||||
["generated-gradle-jars", "caches/*/generated-gradle-jars/*.jar"],
|
["generated-gradle-jars", "caches/*/generated-gradle-jars/*.jar"],
|
||||||
["wrapper-zips", "wrapper/dists/*/*/*.zip"],
|
["wrapper-zips", "wrapper/dists/*/*/*.zip"],
|
||||||
["dependency-jars", "caches/modules-*/files-*/**/*.jar"],
|
["dependency-jars", "caches/modules-*/files-*/**/*.jar"],
|
||||||
["instrumented-jars", "caches/jars-*/*/*.jar"]
|
["instrumented-jars", "caches/jars-*/*"]
|
||||||
]
|
]
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
|
|
|
@ -62,12 +62,17 @@ export function hashFileNames(fileNames: string[]): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempt to delete a file, waiting to allow locks to be released
|
* Attempt to delete a file or directory, waiting to allow locks to be released
|
||||||
*/
|
*/
|
||||||
export async function tryDelete(file: string): Promise<void> {
|
export async function tryDelete(file: string): Promise<void> {
|
||||||
|
const stat = fs.lstatSync(file)
|
||||||
for (let count = 0; count < 3; count++) {
|
for (let count = 0; count < 3; count++) {
|
||||||
try {
|
try {
|
||||||
fs.unlinkSync(file)
|
if (stat.isDirectory()) {
|
||||||
|
fs.rmdirSync(file, {recursive: true})
|
||||||
|
} else {
|
||||||
|
fs.unlinkSync(file)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (count === 2) {
|
if (count === 2) {
|
||||||
|
|
Loading…
Reference in a new issue