alexarchambault on 1.6.3
alexarchambault on master
1.6.3 (compare)
lihaoyi on gh-pages
5ad9ae5538f23cab92ccd8c6b1617d8… (compare)
alexarchambault on master
Partly revert 84d48542 (#923) … (compare)
Hi all, I'm working to embed Ammonite in my application, and I'd like to be able to pass an object from the application to the Ammonite environment, e.g.
def my_entrypoint(foo: Foo) = {
// Make `foo` accessible from the script.
ammonite.Main(...).runScript(...)
}
I see the run
method on Main
would allow me to do this, but I want to be able to do this when running a script non-interactively - are there any methods that would allow me to achieve this?
I managed to get it working without a threadlocal with this:
ammoniteMain
.instantiateRepl(IndexedSeq("foo" -> foo)).map { repl =>
repl.interp.initializePredef()
ammonite.main.Scripts.runScript(...)
}
The only issue is that it doesn't seem to pick up the @main
annotations.
@ import scala.collection.JavaConverters.asScalaBufferConverter
import scala.collection.JavaConverters.asScalaBufferConverter
@ val tmp: Buffer[String] = flavors.getNativesForFlavor(DataFlavor.imageFlavor)
cmd44.sc:1: type mismatch;
found : java.util.List[String]
required: scala.collection.mutable.Buffer[String]
val tmp: Buffer[String] = flavors.getNativesForFlavor(DataFlavor.imageFlavor)
^
Compilation Failed
@
os.proc().spawn
. You cannot fork JVMs https://jukkaz.wordpress.com/2010/05/27/forking-a-jvm/
I’m trying to follow the steps to add Ammonite to an SBT project. Now when I run Test / compile
it fails with:
[error] error while loading Object, Missing dependency 'object scala.native in compiler mirror', required by /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/lib/rt.jar(java/lang/Object.class)
[error] ## Exception when compiling 1 sources to /Users/jason/source/console-api/target/scala-2.13/test-classes
[error] scala.reflect.internal.MissingRequirementError: object scala in compiler mirror not found.
…
This is with sbt 1.3.5 and Scala 2.13.1
I'm trying to load scala-js-d3v4
lib using ammonite script of @lihaoyi without success,
interp.repositories() ++= Seq(coursierapi.IvyRepository.of("https://jitpack.io"))
import $ivy.`com.github.fdietze:scala-js-d3v4:master-SNAPSHOT`
I have a failed resolving error ... someone use d3 with scala js here ?
org.xml.sax.SAXParseException; lineNumber: 42; columnNumber: 3; Le type d'élément "meta" doit se terminer par la balise de fin correspondante "</meta>". (Le type d'élément "meta" doit se terminer par la balise
de fin correspondante "</meta>".)
I switched from MINGW64 to WSL / Debian buster on my Win10 laptop today.
Welcome to the Ammonite Repl 1.9.8
(Scala 2.13.1 Java 11.0.5)
If you like Ammonite, please support our development at www.patreon.com/lihaoyi
Great!
One drawback:
I am used to use TABs to format code,
but Ammonite Repl uses TABs for autocompletion in interactive mode.
How can I turn this off ore replace with another key (Shift+Tab?) and use Tabs as Tabs,
besides replacing all TABs with blanks :-) ?
amm
Loading...
Welcome to the Ammonite Repl 2.0.1
(Scala 2.12.10 Java 1.8.0_232)
If you like Ammonite, please support our development at www.patreon.com/lihaoyi
colin-banana-rdf@ import coursier.core.Authentication, coursier.MavenRepository
cmd0.sc:1: not found: value coursier
import coursier.core.Authentication, coursier.MavenRepository
^
cmd0.sc:1: not found: value coursier
import coursier.core.Authentication, coursier.MavenRepository
^
Compilation Failed
colin-banana-rdf@
colin-banana-rdf@ interp.repositories() ++= Seq(MavenRepository(
"http://bblfish.net/work/repo/snapshots/"
))
cmd0.sc:1: value ++= is not a member of List[coursierapi.Repository]
Expression does not convert to assignment because:
not found: value MavenRepository
expansion: {
<synthetic> val ev$1: ammonite.util.Ref[List[coursierapi.Repository]] = ammonite.interp.api.InterpBridge.value.repositories;
ev$1.update(ev$1.apply().++(Seq(<MavenRepository: error>("http://bblfish.net/work/repo/snapshots/"))))
}
val res0 = interp.repositories() ++= Seq(MavenRepository(
^
Compilation Failed
set -x
when running scala scripts
? I found lihaoyi/Ammonite#421 but assume it's related to the REPL, and not scala scripts
.