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

--classpath fails when it contains a directory in command package but works with compile #3095

Closed
joan38 opened this issue Aug 14, 2024 · 0 comments · Fixed by #3096
Closed
Assignees
Labels
bug Something isn't working package command

Comments

@joan38
Copy link
Contributor

joan38 commented Aug 14, 2024

Version(s)
1.4.3

Describe the bug
--classpath is not handled the same between the commands package and compile.
package fails if it contains directories which is what compile --print-classpath outputs.

To Reproduce

# Install scala cli
curl -o scala https://raw.githubusercontent.com/VirtusLab/scala-cli/main/scala-cli.sh && chmod +x scala

# Setup projects
mkdir lib  && cd $_
echo "def displayMessage = println(\"Lib\")" > displayMessage.scala

mkdir app && cd $_
echo "@main def run = displayMessage" > run.scala

# Compile, package...
cd ..
./scala compile --print-classpath lib
# Copy the output classpath

# The following works:
./scala compile --classpath <past the previously copied classpath here> app
# Whereas the following does not:
./scala --power package --classpath <past the previously copied classpath here> app
Error: java.io.IOException: Is a directory
For more details, please see '...'
java.io.IOException: Is a directory
  [email protected]/sun.nio.ch.FileDispatcherImpl.read0(FileDispatcherImpl.java)
  [email protected]/sun.nio.ch.FileDispatcherImpl.read(FileDispatcherImpl.java:48)
  [email protected]/sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:330)
  [email protected]/sun.nio.ch.IOUtil.read(IOUtil.java:296)
  [email protected]/sun.nio.ch.IOUtil.read(IOUtil.java:273)
  [email protected]/sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:232)
  [email protected]/sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:65)
  [email protected]/sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:107)
  [email protected]/sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:101)
  [email protected]/java.io.InputStream.read(InputStream.java:218)
  os.Internals$.transfer0(Internals.scala:14)
  os.Internals$.transfer(Internals.scala:22)
  os.read$bytes$.apply(ReadWriteOps.scala:273)
  scala.cli.commands.package0.Package$.$anonfun$27(Package.scala:749)
  scala.collection.immutable.List.map(List.scala:247)
  scala.collection.immutable.List.map(List.scala:79)
  scala.cli.commands.package0.Package$.bootstrap$$anonfun$1(Package.scala:749)
  scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
  scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
  scala.build.EitherCps$Helper.apply(EitherCps.scala:19)
  scala.cli.commands.package0.Package$.bootstrap(Package.scala:796)
  scala.cli.commands.package0.Package$.doPackage$$anonfun$1(Package.scala:316)
  scala.build.EitherCps$Helper.apply(EitherCps.scala:19)
  scala.cli.commands.package0.Package$.doPackage(Package.scala:526)
  scala.cli.commands.package0.Package$.runCommand(Package.scala:155)
  scala.cli.commands.package0.Package$.runCommand(Package.scala:71)
  scala.cli.commands.ScalaCommand.run(ScalaCommand.scala:379)
  scala.cli.commands.ScalaCommand.run(ScalaCommand.scala:361)
  caseapp.core.app.CaseApp.main(CaseApp.scala:157)
  scala.cli.commands.ScalaCommand.main(ScalaCommand.scala:346)
  caseapp.core.app.CommandsEntryPoint.main(CommandsEntryPoint.scala:169)
  scala.cli.ScalaCliCommands.main(ScalaCliCommands.scala:125)
  scala.cli.ScalaCli$.main0(ScalaCli.scala:291)
  scala.cli.ScalaCli$.main(ScalaCli.scala:117)
  scala.cli.ScalaCli.main(ScalaCli.scala)

Expected behaviour
--classpath should handle directories

Thanks

@joan38 joan38 added the bug Something isn't working label Aug 14, 2024
@Gedochao Gedochao moved this from To do to In progress in Issue Board Aug 14, 2024
@github-project-automation github-project-automation bot moved this from In progress to Done in Issue Board Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working package command
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants