Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After first SBT compile, subsequent compiles fail with "[etlas] copyFile: permission denied (Access is denied.)" #4

Open
harveywi opened this issue Aug 21, 2017 · 16 comments

Comments

@harveywi
Copy link

On Windows 7 Enterprise, the initial SBT compilation of the example project works great. However, changing the Transform.hs file and recompiling will result in an etlas error copyFile: permission denied (Access is denied.). Here is some sample console output:

c:\Temp\example>sbt
"C:\Users\harveyw.sbt\preloaded\org.scala-sbt\sbt"1.0.0"\jars\sbt.jar"
[info] Loading global plugins from C:\Users\harveyw.sbt\0.13\plugins
[info] Loading project definition from C:\Temp\example\project
[info] [etlas] Checking Maven dependencies...
[info] Set current project to Hello (in build file:/C:/Temp/example/)
> compile
[info] [etlas] Preprocessing library for example-0.1.0.0..
[info] [etlas] Building library for example-0.1.0.0..
[info] [etlas] Linking C:\Temp\example\target\eta\dist\build\HSexample-0.1.0.0-HE1kIw7Yuzp8IzZKCddlt2.jar ...
[info] [etlas] Retrieving Eta dependency jar paths...
[info] Compiling 1 Scala source to C:\Temp\example\target\scala-2.12\classes...
[success] Total time: 3 s, completed Aug 21, 2017 5:37:50 PM
> compile
[info] [etlas] Preprocessing library for example-0.1.0.0..
[info] [etlas] Building library for example-0.1.0.0..
[info] [etlas] [1 of 1] Compiling Example.Transform ( Example\Transform.hs, C:\Temp\example\target\eta\dist\build\Example\Transform.jar )
[info] [etlas] Linking C:\Temp\example\target\eta\dist\build\HSexample-0.1.0.0-HE1kIw7Yuzp8IzZKCddlt2.jar ...
[error] [etlas] copyFile: permission denied (Access is denied.)
[trace] Stack trace suppressed: run last compile:etaCompile for the full output.
[error] (compile:etaCompile)
[error]
[error] [etlas] Exit Failure 1
[error] Total time: 1 s, completed Aug 21, 2017 5:38:05 PM

Running last compile:etaCompile gives the following stack trace:

> last compile:etaCompile
java.lang.RuntimeException:

[etlas] Exit Failure 1
at scala.sys.package$.error(package.scala:27)
at com.typelead.SbtEta$.etlas(SbtEta.scala:114)
at com.typelead.SbtEta$$anonfun$2.apply(SbtEta.scala:29)
at com.typelead.SbtEta$$anonfun$2.apply(SbtEta.scala:25)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
at sbt.std.Transform$$anon$4.work(System.scala:63)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:28)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:28)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
at sbt.Execute.work(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestritions.scala:159)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:51)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
[error] (compile:etaCompile)
[error]
[error] [etlas] Exit Failure 1

@harveywi
Copy link
Author

I should add that quitting and reloading SBT allows the project to compile again, but only a single time before the issue above occurs again.

@rahulmutt
Copy link
Member

rahulmutt commented Aug 30, 2017

@harveywi Apologise for the late response.

Can you go to src/main/eta and try etlas deps --classpath --builddir=[path-to-your-sbt-project]\target\eta\dist -v3 and see what happens when you run it multiple times? Please share the output as well.

@harveywi
Copy link
Author

harveywi commented Sep 1, 2017

Thanks! I get etlas: unrecognized 'install' option `--classpath'.

I ran etlas install --help but couldn't find anything allowing specification of classpath.

@rahulmutt
Copy link
Member

Whoops - see my updated comment. Accidentally, added an extra install in the arguments list.

@harveywi
Copy link
Author

harveywi commented Sep 1, 2017

Thanks again! I ran it five times, each time obtaining identical output:

no user package environment file found at c:\Temp\example\src\main\eta
C:\Temp\example\target\eta\dist\build\HSexample-0.1.0.0-HE1kIw7Yuzp8IzZKCddlt2.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\StateVar-1.1.0.4-qI9GELIXTgF6Ha12HPEMe\HSStateVar-1.1.0.4-qI9GELIXTgF6Ha12HPEMe.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\adjunctions-4.3-FjRr1y2j2fs8J89MN5tmU6\HSadjunctions-4.3-FjRr1y2j2fs8J89MN5tmU6.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\aeson-1.2.1.0-Y413FHmlkro4MkW0lk6z\HSaeson-1.2.1.0-Y413FHmlkro4MkW0lk6z.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\array-0.5.2.0-2RWOOaF5GcW4U6D6pQUKE5\HSarray-0.5.2.0-2RWOOaF5GcW4U6D6pQUKE5.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\attoparsec-0.13.2.0-7QLASebVVe1IGcxmRczox4\HSattoparsec-0.13.2.0-7QLASebVVe1IGcxmRczox4.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\base-4.8.2.0-IPFDtZjmEfh5tPXF10v5hF\HSbase-4.8.2.0-IPFDtZjmEfh5tPXF10v5hF.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\base-compat-0.9.3-EqChIWszWYUJFoVHKmIX61\HSbase-compat-0.9.3-EqChIWszWYUJFoVHKmIX61.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\base-orphans-0.6-BrDHtfuUyx0EsEBTKmrZqp\HSbase-orphans-0.6-BrDHtfuUyx0EsEBTKmrZqp.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\bifunctors-5.4.2-EdZaPKv6pkzAG3x5aMFqQx\HSbifunctors-5.4.2-EdZaPKv6pkzAG3x5aMFqQx.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\binary-0.8.5.1-XCulyUW0jLDfM8QjWWONO\HSbinary-0.8.5.1-XCulyUW0jLDfM8QjWWONO.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\bytestring-0.10.8.2-BqFm4sXW1c7Fp5KyxfOs0Q\HSbytestring-0.10.8.2-BqFm4sXW1c7Fp5KyxfOs0Q.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\call-stack-0.1.0-BFdnMK1w0ZN30oGHO22lco\HScall-stack-0.1.0-BFdnMK1w0ZN30oGHO22lco.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\comonad-5.0.2-U1QnbnmCsVK0tZzqA0jgG\HScomonad-5.0.2-U1QnbnmCsVK0tZzqA0jgG.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\containers-0.5.10.2-DkblIMrarowGXLYJSwakh0\HScontainers-0.5.10.2-DkblIMrarowGXLYJSwakh0.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\contravariant-1.4-I6kAtxSunfftrJgn9bIWe\HScontravariant-1.4-I6kAtxSunfftrJgn9bIWe.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\deepseq-1.4.3.0-8L3V4T6ulnW9Px5CMEu13M\HSdeepseq-1.4.3.0-8L3V4T6ulnW9Px5CMEu13M.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\distributive-0.5.3-FiTqDhPF1ckIVazqKEfUdv\HSdistributive-0.5.3-FiTqDhPF1ckIVazqKEfUdv.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\dlist-0.8.0.3-KK3NuqmFo3bLbnH8eowpnf\HSdlist-0.8.0.3-KK3NuqmFo3bLbnH8eowpnf.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\exceptions-0.8.3-33cL9hQq0a3I6QZoelQKp0\HSexceptions-0.8.3-33cL9hQq0a3I6QZoelQKp0.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\fail-4.9.0.0-ArKNvWT0mta4fuLxoxfv1n\HSfail-4.9.0.0-ArKNvWT0mta4fuLxoxfv1n.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\filepath-1.4.1.2-Al6mhtc5hYQA8GQj9QvIKg\HSfilepath-1.4.1.2-Al6mhtc5hYQA8GQj9QvIKg.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\free-4.12.4-c0EH2lDDzk2aTBuyGl1f3\HSfree-4.12.4-c0EH2lDDzk2aTBuyGl1f3.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\generic-deriving-1.11.2-DxICvsNGdJEJtua8vMyA0i\HSgeneric-deriving-1.11.2-DxICvsNGdJEJtua8vMyA0i.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\ghc-boot-th-8.0.2-FyYKFMAI4i5IUUaSngIVY6\HSghc-boot-th-8.0.2-FyYKFMAI4i5IUUaSngIVY6.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\ghc-prim-0.4.0.0-Jhi6UgHuZdoBZWUpVo3WKE\HSghc-prim-0.4.0.0-Jhi6UgHuZdoBZWUpVo3WKE.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\hashable-1.2.6.1-G9HlfUAafqmJy7paxhlzLF\HShashable-1.2.6.1-G9HlfUAafqmJy7paxhlzLF.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\integer-0.5.1.0-ACyqTmAMUMGGvisLFeQbAm\HSinteger-0.5.1.0-ACyqTmAMUMGGvisLFeQbAm.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\integer-logarithms-1.0.2-FiR1A6F0uJ9GU6VBAcDBp9\HSinteger-logarithms-1.0.2-FiR1A6F0uJ9GU6VBAcDBp9.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\kan-extensions-5.0.2-L4qzgTR3OxwEmwDwNrzZht\HSkan-extensions-5.0.2-L4qzgTR3OxwEmwDwNrzZht.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\lens-4.15.4-5EfBYzpGb8LH7z3O0jTUB0\HSlens-4.15.4-5EfBYzpGb8LH7z3O0jTUB0.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\lens-aeson-1.0.2-ehoLbaoL8cGVgKxw5YTOE\HSlens-aeson-1.0.2-ehoLbaoL8cGVgKxw5YTOE.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\mtl-2.2.1-LWnjWe3RItnAXu7wJDYfFm\HSmtl-2.2.1-LWnjWe3RItnAXu7wJDYfFm.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\old-locale-1.0.0.7-DH3xKBpTqrM1KwfD8PoP41\HSold-locale-1.0.0.7-DH3xKBpTqrM1KwfD8PoP41.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\parallel-3.2.1.1-IDdK8oKVDV4DlLcLim5Rd7\HSparallel-3.2.1.1-IDdK8oKVDV4DlLcLim5Rd7.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\prelude-extras-0.4.0.3-7ZR7RxRrjYwBmcgiVfXDFt\HSprelude-extras-0.4.0.3-7ZR7RxRrjYwBmcgiVfXDFt.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\pretty-1.1.3.5-ItmjUBJrDLK1k3EMUMuOEN\HSpretty-1.1.3.5-ItmjUBJrDLK1k3EMUMuOEN.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\primitive-0.6.2.0-2xUPgV69cu3AD26RudYELH\HSprimitive-0.6.2.0-2xUPgV69cu3AD26RudYELH.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\profunctors-5.2.1-31W2JAItnf31VHrJE7ejN8\HSprofunctors-5.2.1-31W2JAItnf31VHrJE7ejN8.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\random-1.1-BjI8gsSgOeAjhqs8x0uyE\HSrandom-1.1-BjI8gsSgOeAjhqs8x0uyE.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\reflection-2.1.2-KQ7RrWgrzVoKbw1YuANtwk\HSreflection-2.1.2-KQ7RrWgrzVoKbw1YuANtwk.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\rts-0.1.0.0-5Dj4qf1Wx9cCeYbpni5T1w\HSrts-0.1.0.0-5Dj4qf1Wx9cCeYbpni5T1w.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\scientific-0.3.5.1-3FZuNNYcFQOX4fcBrKiPo\HSscientific-0.3.5.1-3FZuNNYcFQOX4fcBrKiPo.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\semigroupoids-5.2.1-6z33MIKKDnFJuynnnND43e\HSsemigroupoids-5.2.1-6z33MIKKDnFJuynnnND43e.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\semigroups-0.18.3-JsaHOvXsRJU9OLnp3Q9kk4\HSsemigroups-0.18.3-JsaHOvXsRJU9OLnp3Q9kk4.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\stm-2.4.4.1-3f0PTUA1JKeLEVTEhuOmnG\HSstm-2.4.4.1-3f0PTUA1JKeLEVTEhuOmnG.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\tagged-0.8.5-AcOhysL4gEjAaHpFfwjo1q\HStagged-0.8.5-AcOhysL4gEjAaHpFfwjo1q.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\template-haskell-2.11.1.0-HoWJKehHDuV1zvuHBQKGPm\HStemplate-haskell-2.11.1.0-HoWJKehHDuV1zvuHBQKGPm.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\text-1.2.2.2-F2cHT27bZB4JWqGrmupXOq\HStext-1.2.2.2-F2cHT27bZB4JWqGrmupXOq.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\th-abstraction-0.2.5.0-GGFJU2rBwfC2yCf8VxlVSL\HSth-abstraction-0.2.5.0-GGFJU2rBwfC2yCf8VxlVSL.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\time-1.8.0.3-WEwfNV542G61Hff69NMMS\HStime-1.8.0.3-WEwfNV542G61Hff69NMMS.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\time-locale-compat-0.1.1.3-CVhw4nBiZAUAvgKouOThHD\HStime-locale-compat-0.1.1.3-CVhw4nBiZAUAvgKouOThHD.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\transformers-0.5.4.0-8hyhV5wJmEf5Qwk3Q3GvVi\HStransformers-0.5.4.0-8hyhV5wJmEf5Qwk3Q3GvVi.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\transformers-compat-0.5.1.4-2ajqf97CornEYODVYSt1GJ\HStransformers-compat-0.5.1.4-2ajqf97CornEYODVYSt1GJ.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\unordered-containers-0.2.8.0-Jdq2PeLJ0wVFNDrV5RDS8R\HSunordered-containers-0.2.8.0-Jdq2PeLJ0wVFNDrV5RDS8R.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\uuid-types-1.0.3-Ca7YPFkpwcC8lwiAeNQo0q\HSuuid-types-1.0.3-Ca7YPFkpwcC8lwiAeNQo0q.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\vector-0.12.0.1-70RFB0NOySJDmiVLarG8vK\HSvector-0.12.0.1-70RFB0NOySJDmiVLarG8vK.jar
C:\Users\harveyw\AppData\Roaming\etlas\x86_64-windows-eta-0.0.9.1-ghc7_10_3\void-0.7.2-LQ3SY7Uf7GsEa1wVaQcVbx\HSvoid-0.7.2-LQ3SY7Uf7GsEa1wVaQcVbx.jar

@rahulmutt
Copy link
Member

@jneira, do you have any thoughts on what may be causing this? Can an open file handle prevent copyFile from working on Windows?

@harveywi
Copy link
Author

harveywi commented Sep 1, 2017

I think I may have an idea. Interestingly, I can't do a clean either after editing an eta file:

> clean
[info] [etlas] cleaning...
[info] [etlas] Error while removing dist/: removeDirectoryRecursive: permission denied (The process cannot access the file because it is being used by another process.)

If I look at Resource Monitor to find the files that are open by SBT (java.exe), I find that the compiled jar file remains open even after compilation:

C:\Temp\example\target\eta\dist\build\HSexample-0.1.0.0-HE1kIw7Yuzp8IzZKCddlt2.jar

If I try to delete that file manually while SBT is still running, Windows won't let me do it. So, maybe that file needs to be closed after compilation.

Thank you for all your help with this!

@rahulmutt
Copy link
Member

Cool, thanks for looking into it. Do you have an idea of how to go about a fix? This was my first SBT plugin so I may have done something wrong in terms of file handling.

@harveywi
Copy link
Author

harveywi commented Sep 1, 2017

I think it may have to do with resource management of the created Process that runs etlas here:

val exitCode = Process("etlas" +: args, cwd) ! logger

Looking at the Process API, it looks like there is a destroy() method that, presumably, cleans up resources and closes open files (the API doesn't say that it will happen...). It is not clear to me whether or not explicitly calling destroy() would resolve the issue. One explanation for my uncertainty is that there are questions on StackOverflow such as this one where people are confused about why an exited Process does not clean up after itself.

I will see if I can compile and run the SBT plugin to see if I can resolve the issue. Wish me luck!

@rahulmutt
Copy link
Member

Good luck! :)

The example project in this repo is setup to automatically recompile the plugin changes as well since it includes the plugin with a local path so it should be pretty easy to test out new changes.

@harveywi
Copy link
Author

harveywi commented Sep 1, 2017

Ok, I think (with the usual caveats) I understand what is going on. It doesn't appear to be a resource leak. Etlas produces a linked jar file that is then added to the SBT project as an unmanaged jar after the initial compile. When the second compile is attempted, SBT has the file open (since it's an unmanaged jar), and etlas is unable to write over the top of the jar.

So, to fix it, there probably needs to be a way to temporarily remove the linked jar file from unmanagedJars before compile, or some other more elegant solution.

I'll see if I can get a fix, even if it is not pretty.

@rahulmutt
Copy link
Member

@harveywi Were you able to get a fix?

@harveywi
Copy link
Author

@rahulmutt Unfortunately, not yet. I have limited experience writing SBT plugins, but based on my assessment I think the changes required to fix the problem may be substantial. I have not tried to use this plugin on a linux machine yet, so I am not sure if the problem persists there. If I have time this afternoon I will give it a whirl.

@rahulmutt
Copy link
Member

Ok great. If you can share the details of the assessment (beyond what you provided earlier) I can try to implement a fix and you can test it out.

@harveywi
Copy link
Author

@rahulmutt Wow, that would be cool! So, I could be wrong, but I think that running etlas, then adding the etlas-compiled jar to unmanagedJars prior to SBT's scala/java compilation phase is not the workflow that SBT expects, because it is not pure (i.e., it modifies unmanagedJars after the first invocation, and gets stuck). It appears that anything in unmanagedJars is assumed to be immutable by SBT, so SBT reserves the right to keep file handles to those during subsequent compilations. When etlas attempts to overwrite something that is in unmanagedJars, SBT already has the jar file open, and failure results (on Windows, at least).

Having never written an SBT plugin, I can only guess about a solution that SBT might expect. However, after thinking about this for a while, if I were to give it another try I might take a look at the sbt-frege plugin to see how they got it to work. They are not invoking a non-JVM binary, but other than that it seems like there should be some basic overlap between their plugin architecture and what SBT expects of the sbt-eta plugin.

I will let you know when I get a chance to jump in and help.

@rahulmutt
Copy link
Member

@Romastyi Do you think your changes may have fixed this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants