@@ -31,6 +31,15 @@ import { getOpamLocalPackages } from "./packages.js";
31
31
import { resolveCompiler } from "./version.js" ;
32
32
import { setupCygwin } from "./windows.js" ;
33
33
34
+ async function restoreOpamCaches ( ) {
35
+ const [ opamCacheHit , cygwinCacheHit ] = await Promise . all (
36
+ PLATFORM === "windows"
37
+ ? [ restoreOpamCache ( ) , restoreCygwinCache ( ) ]
38
+ : [ restoreOpamCache ( ) ] ,
39
+ ) ;
40
+ return { opamCacheHit, cygwinCacheHit } ;
41
+ }
42
+
34
43
export async function installer ( ) {
35
44
if ( core . isDebug ( ) ) {
36
45
core . exportVariable ( "OPAMVERBOSE" , 1 ) ;
@@ -58,13 +67,12 @@ export async function installer() {
58
67
] ) ;
59
68
await exec ( "fsutil" , [ "behavior" , "query" , "SymlinkEvaluation" ] ) ;
60
69
} ) ;
61
- const cygwinCacheHit = await restoreCygwinCache ( ) ;
62
- if ( ! cygwinCacheHit ) {
63
- await setupCygwin ( ) ;
64
- await saveCygwinCache ( ) ;
65
- }
66
70
}
67
- const opamCacheHit = await restoreOpamCache ( ) ;
71
+ const { opamCacheHit, cygwinCacheHit } = await restoreOpamCaches ( ) ;
72
+ if ( ! cygwinCacheHit && PLATFORM === "windows" ) {
73
+ await setupCygwin ( ) ;
74
+ await saveCygwinCache ( ) ;
75
+ }
68
76
await setupOpam ( ) ;
69
77
await repositoryRemoveAll ( ) ;
70
78
await repositoryAddAll ( OPAM_REPOSITORIES ) ;
0 commit comments