@@ -34,23 +34,31 @@ trait ScalaCliCompile extends ScalaModule {
34
34
new FallbackRefreshDisplay
35
35
)
36
36
val cache = FileCache ().withLogger(logger)
37
+ val artifact = Artifact (url).withChanging(compileScalaCliIsChanging)
37
38
val archiveCache = ArchiveCache ()
38
39
.withCache(cache)
39
- val artifact = Artifact (url).withChanging(compileScalaCliIsChanging)
40
- val file = archiveCache.get(artifact).unsafeRun()(cache.ec) match {
41
- case Left (e) => throw new Exception (e)
42
- case Right (f) =>
43
- if (Properties .isWin)
44
- os.list(os.Path (f, os.pwd)).filter(_.last.endsWith(" .exe" )).headOption match {
45
- case None => sys.error(s " No .exe found under $f" )
46
- case Some (exe) => exe
40
+ if (compileScalaCliIsCompressed)
41
+ archiveCache.get(artifact).unsafeRun()(cache.ec) match {
42
+ case Left (e) => throw new Exception (e)
43
+ case Right (f) =>
44
+ if (Properties .isWin)
45
+ os.list(os.Path (f, os.pwd)).filter(_.last.endsWith(" .exe" )).headOption match {
46
+ case None => sys.error(s " No .exe found under $f" )
47
+ case Some (exe) => exe
48
+ }
49
+ else {
50
+ f.setExecutable(true )
51
+ os.Path (f, os.pwd)
47
52
}
48
- else {
49
- f.setExecutable(true )
53
+ }
54
+ else
55
+ cache.file(artifact).run.unsafeRun()(cache.ec) match {
56
+ case Left (e) => throw new Exception (e)
57
+ case Right (f) =>
58
+ if (! Properties .isWin)
59
+ f.setExecutable(true )
50
60
os.Path (f, os.pwd)
51
- }
52
- }
53
- PathRef (file)
61
+ }
54
62
}
55
63
}
56
64
import ScalaCliInternal ._
@@ -74,8 +82,10 @@ trait ScalaCliCompile extends ScalaModule {
74
82
else None
75
83
}
76
84
def compileScalaCliIsChanging : Boolean = false
85
+ def compileScalaCliIsCompressed : Boolean =
86
+ compileScalaCliUrl.exists(url => url.endsWith(" .gz" ) || url.endsWith(" .zip" ))
77
87
78
- def compileScalaCli : Option [PathRef ] = compileScalaCliImpl
88
+ def compileScalaCli : Option [os. Path ] = compileScalaCliImpl
79
89
80
90
def extraScalaCliOptions : T [List [String ]] =
81
91
T {
@@ -84,7 +94,7 @@ trait ScalaCliCompile extends ScalaModule {
84
94
85
95
override def compile : T [CompilationResult ] =
86
96
if (enableScalaCli)
87
- compileScalaCli.map(_.path) match {
97
+ compileScalaCli match {
88
98
case None => super .compile
89
99
case Some (cli) =>
90
100
T .persistent {
0 commit comments