mirror of
https://github.com/gradle/gradle-build-action.git
synced 2025-09-11 02:02:22 +08: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:
@@ -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> {
|
||||
const stat = fs.lstatSync(file)
|
||||
for (let count = 0; count < 3; count++) {
|
||||
try {
|
||||
fs.unlinkSync(file)
|
||||
if (stat.isDirectory()) {
|
||||
fs.rmdirSync(file, {recursive: true})
|
||||
} else {
|
||||
fs.unlinkSync(file)
|
||||
}
|
||||
return
|
||||
} catch (error) {
|
||||
if (count === 2) {
|
||||
|
Reference in New Issue
Block a user