Giter VIP home page Giter VIP logo

scalatex's People

Contributors

alexarchambault avatar cvogt avatar jhnsmth avatar jopasserat avatar jrudolph avatar lihaoyi avatar mathieuleclaire avatar mechkg avatar mgedigian avatar olafurpg avatar philwalk avatar romainreuillon avatar thesamet avatar williamho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scalatex's Issues

Syntax Highlighters for Editors?

I think the scalatex code is well highlighted in the document web,but how could I get a highlighter for my favorite editors like IDEA or Atom,or how could I migrate the highlighter to them?

Site.renderTo writes junk bytes at the end of HTML files.

When I use Site.renderTo, HTML pages are rendered, but they contain junk bytes at the end of the file, after the closing </html>. This is because this line:

val bytes = scala.io.Codec.UTF8.encoder.encode(cb)

returns a ByteBuffer whose internal capacity is greater than the actually written content. Therefore, writing bytes.array() at
write.over(outputRoot/path, bytes.array(), createFolders = true)

also writes junk bytes of the internal array that were never written.

A solution is to slice the array before giving it to write.over:

write.over(outputRoot/path,
  bytes.array().slice(bytes.position(), bytes.limit()), createFolders = true)

scalatex scalac warnings

I love that Scalatex compiles as normal Scala files (it seems to work a lot better than Tux which seems to behave subtly differently to scalac) but there are gotchas - mainly scalac warnings right now.

The following is pretty much required scalatex but generates a scalac warning. It would be nice if it was suppressed out of the box somehow.

[warn] Error in /Users/caoiocon/scala/test/readme/Readme.scalatex: <input>:1: error: identifier expected but import found
@import Main._
 ^

Upgrade scalaparse dependency. java.lang.ClassNotFoundException: fastparse.Utils$FuncName

I have a scalatex 0.3.5 readme project that transitively depends on scalaparse 0.3.7 via a core project. This means the scalaparse dependency in readme is overriden to 0.3.7 (instead of 0.3.1, which scalatex requires). This causes the following error during readme/run:

[error] /Users/ollie/dev/scala/scalafmt/readme/target/scala-2.11/src_managed/main/scalatex/Readme.scala:7: exception during macro expansion:
[error] java.lang.ClassNotFoundException: fastparse.Utils$FuncName
[error]     at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
[error]     at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
[error]     at java.security.AccessController.doPrivileged(Native Method)
[error]     at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
[error]     at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[error]     at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[error]     at scalatex.stages.Parser.TextNot(Parser.scala:44)
[error]     at scalatex.stages.Parser.<init>(Parser.scala:50)
[error]     at scalatex.stages.Parser$.apply(Parser.scala:17)
[error]     at scalatex.stages.Parser$.apply(Parser.scala:15)
[error]     at scala.Function2$$anonfun$tupled$1.apply(Function2.scala:54)
[error]     at scala.Function2$$anonfun$tupled$1.apply(Function2.scala:53)
[error]     at scalatex.package$Internals$.compile$1(package.scala:84)
[error]     at scalatex.package$Internals$.compileThing(package.scala:101)
[error]     at scalatex.package$Internals$.applyMacroFileBase(package.scala:43)
[error]     at scalatex.package$Internals$.applyMacroFile(package.scala:27)
[error]   def apply(): Frag = _root_.scalatex.twf("/Users/ollie/dev/scala/scalafmt/readme/Readme.scalatex")

FuncName was removed in this commit.

FWIW, adding

dependencyOverrides += "com.lihaoyi" %% "scalaparse" % "0.3.1"

to the readme settings solves the problem in my case, at least for now.

watchSources should be files not dirs

~run does not work for me (on ubuntu). I suspect the cause is,

 > show watchSources
[info] List(/home/naftoli/dev/github.com/nafg/slides-docker/src/main/scala/Main.scala, /home/naftoli/dev/github.com/nafg/slides-docker/src/main/resources, /home/naftoli/dev/github.com/nafg/slides-docker/src/test/resources, /home/naftoli/dev/github.com/nafg/slides-docker/src/main/scalatex)

So for scala, it includes actual files, but for scalatex on the directories.

ls /home/naftoli/dev/github.com/nafg/slides-docker/src/main/scalatex
Slides.scalatex

Note the default value for watchSources comes from

    def collectFiles(dirs: ScopedTaskable[Seq[File]], filter: ScopedTaskable[FileFilter], excludes: ScopedTaskable[FileFilter]): Initialize[Task[Seq[File]]] =
        (dirs, filter, excludes) map { (d,f,excl) => d.descendantsExcept(f,excl).get }

...

        unmanagedSources <<= collectFiles(unmanagedSourceDirectories, includeFilter in unmanagedSources, excludeFilter in unmanagedSources),
    watchSources in ConfigGlobal <++= unmanagedSources

...

        unmanagedResources <<= collectFiles(unmanagedResourceDirectories, includeFilter in unmanagedResources, excludeFilter in unmanagedResources),
        watchSources in ConfigGlobal ++= unmanagedResources.value

(from http://www.scala-sbt.org/0.13/sxr/sbt/Defaults.scala.html)

While scalatex has

watchSources ++= {
      for{
        f <- (scalatexDirectory in Compile).value.get
        if f.relativeTo((target in Compile).value).isEmpty
      } yield f
    }

use hierarchy in anchor links

I tried to use the same subtitle in two different sections, eg,

  • one
    -- A
  • two
    -- A

Both received the same anchor link (#A) and so navigating didn't work as expected. I wonder if it would be possible/desirable to make anchor links hierarchy sensitive, ie (#oneA and #twoA).

Publish permission

Hello @lihaoyi,

may you allow me to publish new version of scalatex on sonatype? My login is reuillon.

Cheers,
Romain

PS: thx for your interesting critical blog post on SBT, BTW ;)

Using @package lead to a blank page

I wanted to use @Package at the begining of a scalatex file.

P.scalatext:

@package p

content

Then I generated a site:

  val site = new scalatex.site.Site {
    def content =
      Map(
        "p.html" -> p.P()
      )
  }

  site.renderTo(args(0) + "/")

In this configuration it generates an empty html file.

Cheers,
Romain

Add simple ways to add scalajs examples to scalatex

As I have done a bunch of libs/facades I would be happy to be able to easily inlude examples in scalatex.readme project without creating a separate project for scalajs examples. So, some support for scalajs inclusion + docs will be very helpful in scalatext sbt plugin

Compilation error on Windows

Scalatex sources can't be compiled on Windows since path names use backslashes, which happen to be the escape character for string.

This problem can be fixed by using triple quotes around paths in generated source files or replacing backslashes with forward slashes.

edit: is it a coincidence that this is issue #9?

How can i use scalatex-site in build.sbt?

I can't access Site type trait inside build.sbt.

image

image

i tried direct import. but it's not working.

image

what do i need to use scala-site?

below is code.

plugins.sbt

addSbtPlugin("com.lihaoyi" % "scalatex-sbt-plugin" % "0.3.9")

build.sbt

......
libraryDependencies += "com.lihaoyi" % "scalatex-site_2.12" % "0.3.9"

scalatex.SbtPlugin.projectSettings

// quick settings
// http://www.lihaoyi.com/Scalatex/#QuickStartq
lazy val readme = scalatex
  .ScalatexReadme(
    projectId = "readme",
    wd = file(""),
    url = "https://github.com/baram204/learningPixi/tree/master",
    source = "Readme")

lazy val site = new scalatex.site.Site {
  def content = Map("index.html" -> (defaultHeader, Hello()))
}
site.renderTo(wd/'site/'target/'output)
......

Using Scalatex through Ammonite scripts

Hi @lihaoyi

I was wondering if it's possible to use scalatex via the ammonite repl.

I'm a n00b to the scala ecosystem and I do have a strong preference of using scala/java libraries with ammonite . However, I was unable to find the maven coordinates I'd need for importing/downloading the scalatex lib.

Could you please help me out with the the instructions regarding how to set it up with ammonite ?

Not found type Site

Hi,

I have added the scalatex settings my sbt project. Basic generation works:

> run
Generating Scalatex Sources...
[info] Compiling 1 Scala source to /home/reuillon/Documents/Recherche/Projects/openmole/openmole/bin/documentation/target/scala-2.11/classes...
[info] Running Documentation 
<div>
  Hello World

  <h1>
    I am a cow!</h1></div>
[success] Total time: 1 s, completed 29 déc. 2014 23:26:28

But when I try to generate a Site with this code:

object Documentation extends App {
  println(Hello().render)

  val site = new Site {
    def content = Map("index.html" -> Hello())
  }
  site.renderTo("/tmp/doc/")
}

I got an error:

> run
Generating Scalatex Sources...
[info] Compiling 1 Scala source to /home/reuillon/Documents/Recherche/Projects/openmole/openmole/bin/documentation/target/scala-2.11/classes...
[error] /home/reuillon/Documents/Recherche/Projects/openmole/openmole/bin/documentation/src/main/scala/Documentation.scala:24: not found: type Site
[error]   val site = new Site {
[error]                  ^
[error] /home/reuillon/Documents/Recherche/Projects/openmole/openmole/bin/documentation/src/main/scala/Documentation.scala:27: value renderTo is not a member of AnyRef{def content: scala.collection.immutable.Map[String,scalatags.Text.all.Frag]}
[error]   site.renderTo("/tmp/doc/")
[error]        ^
[error] two errors found
[error] (documentation/compile:compile) Compilation failed
[error] Total time: 0 s, completed 29 déc. 2014 23:26:35

Any idea what I did wrong?

Cheers,
Romain

(amazing project by the way)

License info

What is the license under which this software is available? Do you mind adding a license file?

thanks.

Example creates Hello in a scalatex package

I'm not sure if this is intentional or not, but the example instructions at http://lihaoyi.github.io/Scalatex/ put the Hello classes in a scalatex package. Is that intentional?

scala> Hello().render
:8: error: not found: value Hello
Hello().render
^
scala> scalatex.Hello().render
res1: String =

<div>
  Hello World

  <h1>
    I am a cow!</h1></div>

Scalatex-site 0.3.5 doesn't work with scalatags 0.5.5

Some change between scalatag 0.5.4 and 0.5.5 broke the css part of scalatex-site

java.lang.NoSuchMethodError: scalatags.stylesheet.StyleSheet$cls$.apply(Lscala/collection/Seq;)Lscalatags/stylesheet/Cls;
    at scalatex.site.Styles$class.headerLink(Styles.scala:12)
    at scalatex.site.Styles$$anon$1.headerLink$lzycompute(Styles.scala:6)
    at scalatex.site.Styles$$anon$1.headerLink(Styles.scala:6)
    at scalatex.site.Section$class.headingAnchor(Section.scala:108)
    at scalatex.Frontpage$sect$2$.headingAnchor(Frontpage.scala:3)
    at scalatex.site.Section$$anonfun$apply$2.apply(Section.scala:127)
    at scalatex.site.Section$$anonfun$apply$2.apply(Section.scala:122)
    at scalatex.site.Section$Proxy.apply(Section.scala:11)
    at scalatex.Frontpage$.apply(Frontpage.scala:5)
    at blog.Site$.index(Site.scala:39)
    at blog.Site$.generate(Site.scala:53)
    at blog.Main$.main(Main.scala:60)
    at blog.Main.main(Main.scala)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)

Compare is not showing the whole expected output

The line https://github.com/lihaoyi/Ammonite/blob/c25dc3aa46bd409fad147aababa2186cfd51b7d8/readme/Shell.scalatex#L134 reads @compare("""ls -a | grep "^\." """, "ls! pwd |? (_.last(0) == '.')") but if I go to http://ammonite.io/#Piping, I see the following where I would expect to see the output for that line:

<div><pre><span style="color: #8e44ad;">
bash$ </span>ls -a | grep "^\."
.
..
.git
.github
.gitignore
.travis.yml</pre><pre><span>  /home/travis/build/lihaoyi/Ammonite/.git,
  /home/travis/build/lihaoyi/Ammonite/.github,
  /home/travis/build/lihaoyi/Ammonite/.gitignore,
  /home/travis/build/lihaoyi/Ammonite/.travis.yml
)
</span></pre></div>

Note that the second <pre> seems to be missing some lines at the beginning, so the example on the ammonite shell page is broken. Apparently the same is true for all other blocks.

P.S.: Many thanks to the whole team for the great projects. Really awesome contributions!

auto refresh page feature?

how can browse auto-refresh after readme/run?

I try this with Itellij chrome live edit feature.

but it's not working well.

I want to use workbench. but don't know how.

If without an Else doesn't render

val a = scalatex.tw("@if(true){omg}").render.trim
val b = scalatex.tw("@if(true)\n    omg").render.trim
assert(a == b && a == "omg")

There are some tests cases which cover the parsing of these expressions into Ast.Block.IfElse which seem to work but they don't render and no test cases seem to cover the render step.

Default charset might break scalatex

When building on machin with high level of concurency I often get this kind of error, despite the build works perfecty on more sequential computers:

[error]   def apply(): Frag = scalatex.twf("/tmp/openmole/openmole/bin/org.openmole.site/src/main/scalatex/org.openmole.site/documentation/console/tutorial/HeadlessNetLogo.scalatex")
[error]                                   ^
[error] /tmp/openmole/openmole/bin/org.openmole.site/target/scala-2.11/src_managed/main/scalatex/org.openmole.site/documentation/console/tutorial/HelloWorld.scala:9: exception during macro expansion: 
[error] java.nio.charset.MalformedInputException: Input length = 1
[error]     at java.nio.charset.CoderResult.throwException(CoderResult.java:281)
[error]     at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:339)
[error]     at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
[error]     at java.io.InputStreamReader.read(InputStreamReader.java:184)
[error]     at java.io.BufferedReader.read1(BufferedReader.java:210)
[error]     at java.io.BufferedReader.read(BufferedReader.java:286)
[error]     at java.io.Reader.read(Reader.java:140)
[error]     at scala.io.BufferedSource.mkString(BufferedSource.scala:96)
[error]     at scalatex.package$Internals$.applyMacroFileBase(package.scala:36)
[error]     at scalatex.package$Internals$.applyMacroFile(package.scala:25)
[error]     at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
[error]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error]     at java.lang.reflect.Method.invoke(Method.java:497)
[error]     at scala.reflect.macros.runtime.JavaReflectionRuntimes$JavaReflectionResolvers$$anonfun$resolveJavaReflectionRuntime$2.apply(JavaReflectionRuntimes.scala:34)
[error]     at scala.reflect.macros.runtime.JavaReflectionRuntimes$JavaReflectionResolvers$$anonfun$resolveJavaReflectionRuntime$2.apply(JavaReflectionRuntimes.scala:22)
[error]     at scala.tools.nsc.typechecker.Macros$class.macroExpandWithRuntime(Macros.scala:755)

Lnk: Follow redirects when validating

If a link's status code is a redirect, it is not considered broken by Scalatex. However, that redirect's destination may result in a 404, and thus a broken link. Scalatex should follow redirects before deciding if a link is broken or not. Additionally, it might consider emitting a warning when it does encounter a redirect.

This was observed by the presents of broken links in lihaoyi/hands-on-scala-js#44

Module not found

I'm getting a module not found: com.lihaoyi#scalatex;0.1.0
When using:
addSbtPlugin("com.lihaoyi" %% "scalatex" % "0.1.0")
per the Getting Started instructions.
Do I need to add a repo?

[info] Resolving com.lihaoyi#scalatex;0.1.0 ...
[warn]  module not found: com.lihaoyi#scalatex;0.1.0
[warn] ==== typesafe-ivy-releases: tried
[warn]   https://repo.typesafe.com/typesafe/ivy-releases/com.lihaoyi/scalatex/scala_2.10/sbt_0.13/0.1.0/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn]   https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.lihaoyi/scalatex/scala_2.10/sbt_0.13/0.1.0/ivys/ivy.xml
[warn] ==== local: tried
[warn]   /home/bjackman/.ivy2/local/com.lihaoyi/scalatex/scala_2.10/sbt_0.13/0.1.0/ivys/ivy.xml
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/com/lihaoyi/scalatex_2.10_0.13/0.1.0/scalatex-0.1.0.pom
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.lihaoyi#scalatex;0.1.0: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn] 
[warn]  Note: Some unresolved dependencies have extra attributes.  Check that these dependencies exist with the requested attributes.
[warn]      com.lihaoyi:scalatex:0.1.0 (sbtVersion=0.13, scalaVersion=2.10)
[warn] 
[warn]  Note: Unresolved dependencies path:
[warn]      com.lihaoyi:scalatex:0.1.0 (sbtVersion=0.13, scalaVersion=2.10) (/home/bjackman/cgta/ultimate/project/plugins.sbt#L22-23)
[warn]        +- default:ultimate-build:0.1-SNAPSHOT (sbtVersion=0.13, scalaVersion=2.10)
sbt.ResolveException: unresolved dependency: com.lihaoyi#scalatex;0.1.0: not found

Provide better messages on parse error

[error] /Users/haoyi/Dropbox (Personal)/Workspace/fastparse-root/readme/target/scala-2.11/src_managed/main/scalatex/Readme.scala:7: exception during macro expansion:
[error] java.lang.Exception: File:0 / Body:0 / BodyEx:0 / BodyItem:0 / SpecialIndented:1 / HeaderBlock:1 / Body:14 / BodyEx:14 / BodyItem:385 / SpecialIndented:387 / HeaderBlock:387 / Body:512 / BodyEx:512 / BodyItem:512 / SpecialIndented:514 / IndentScalaChain:514 / Body:610 / BodyEx:610 / BodyItem:22875 / SpecialIndented:22881 / IndentScalaChain:22881 / Body:22898 / BodyEx:22898 / BodyItem:24865 / SpecialIndented:24875 / IndentScalaChain:24875 / Body:24876 / BodyEx:24876 / BodyItem:24936 / Special:24937 / ScalaChain:24937 / Extension:24938 / ParenArgList:24938 / Exprs:24939 / Expr:25083 / (If | While | Try | DoWhile | For | Throw | Return | ImplicitLambda | SmallerExprOrLambda):25083 ...") using Fa"
[error]     at scalatex.stages.Parser$.apply(Parser.scala:19)
[error]     at scalatex.stages.Parser$.apply(Parser.scala:15)
[error]     at scala.Function2$$anonfun$tupled$1.apply(Function2.scala:54)
[error]     at scala.Function2$$anonfun$tupled$1.apply(Function2.scala:53)
[error]     at scalatex.package$Internals$.compile$1(package.scala:83)
[error]     at scalatex.package$Internals$.compileThing(package.scala:88)
[error]     at scalatex.package$Internals$.applyMacroFileBase(package.scala:42)
[error]     at scalatex.package$Internals$.applyMacroFile(package.scala:25)
[error]   def apply(): Frag = _root_.scalatex.twf("/Users/haoyi/Dropbox (Personal)/Workspace/fastparse-root/readme/Readme.scalatex")
[error]                                          ^
[error] one error found
[error] (readme/compile:compileIncremental) Compilation failed
[error] Total time: 3 s, completed May 10, 2015 8:39:03 PM

Since we already know exactly where the parse failed (we even show the index!) we should update the error location accordingly to show the source code rather than the synthesized macro call

Confusing @sect compilation error

@import Main._

@sect{Test}

Generates the following error message,

[error] /Users/caoiocon/cps/chuckwagon/readme/Readme.scalatex:3: type mismatch;
[error]  found   : scalatex.site.Section.Proxy
[error]  required: scalatags.Text.all.Frag
[error]     (which expands to)  scalatags.generic.Frag[scalatags.text.Builder,String]
[error] @sect{test}
[error]      ^
[error] one error found

It goes away if you change it to

@import Main._

@sect{Test}
    test

but this is confusing for a new user

not found: value lnk

Tried:

test @lnk("Scalatex", "http://www.lihaoyi.com/Scalatex/")
not found: value lnk

test @a("Scalatex-", href := "http://www.lihaoyi.com/Scalatex/")
is ok

Update scalatags to 0.6.0

Hi,

we have a project which mixes some libs depending on the latest version of scalatags and on the latest version of scalatex. We get an error because of the API of scalatags 0.6.0 is binary incompatible with 0.5.x. Could you update the scalatags version of scalatex please?

Cheers,
Romain

How to make other dom elements

So I am trying out scalatex to make a blog and I hit a stumbling point right away:

@html
  @head
    @title Ben's Blog
  @body

@title isn't defined this lead me to a couple questions:

  1. What is the suggested way to include it?
  2. More importantly: how can I just make any element I want? I tried this:
    @("title".tag){Ben's Blog}

but I got

[error] /home/bjackman/dev/github/blog/src/main/scalatex/biz/jackman/blog/Hello.scalatex:3: type mismatch;
[error]  found   : String("Ben\'s Blog")
[error]  required: scalatags.generic.Namespace
[error]     @("title".tag){Ben's Blog}

I didn't see anything in the documentation about how to use custom html tags

scalatex generated source breaks acyclic rules

I get the following error when compiling scalatex with acyclic turned on.

[error] Unwanted cyclic dependency
[info]
[info] /Users/caoiocon/cps/test-scalatex/readme/target/scala-2.12/sbt-0.13/src_managed/main/scalatex/Main.scala:9:
[info]             scalatex.Readme()
[info]                      ^
[info] symbol: method apply
[info]

Here is the content,

package scalatex
          object Main extends scalatex.site.Main(
            url = "zzz",
            wd = ammonite.ops.Path("zzz"),
            output = ammonite.ops.Path("zzz"),
            extraAutoResources = Seq[String]().map(ammonite.ops.resource/ammonite.ops.RelPath(_)),
            extraManualResources = Seq[String]().map(ammonite.ops.resource/ammonite.ops.RelPath(_)),
            scalatex.Readme()
          )

I'm mainly reporting this issue because the irony is delicious ;-)

Cannot generate html in a subdirectory

Hi,

an execption is throw if the destination of an html file is specified in a subdir:

  val site = new scalatex.site.Site {
    def content =
      Map(
        "index.html" -> Index(),
        "console/console.html" -> Console()
      )
  }

Raises this exception:

[info] Running Documentation /tmp/doc/
[error] (run-main-0) java.nio.file.NoSuchFileException: /tmp/doc/console/console.html
java.nio.file.NoSuchFileException: /tmp/doc/console/console.html
    at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
    at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
    at java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:434)
    at java.nio.file.Files.newOutputStream(Files.java:216)
    at java.nio.file.Files.write(Files.java:3292)
    at scalatex.site.Site$$anonfun$generateHtml$2.apply(Site.scala:130)
    at scalatex.site.Site$$anonfun$generateHtml$2.apply(Site.scala:125)
    at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:778)
    at scala.collection.immutable.Map$Map3.foreach(Map.scala:161)
    at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:777)
    at scalatex.site.Site$class.generateHtml(Site.scala:125)
    at Documentation$$anon$1.generateHtml(Documentation.scala:22)
    at scalatex.site.Site$class.renderTo(Site.scala:140)
    at Documentation$$anon$1.renderTo(Documentation.scala:22)
    at Documentation$.delayedEndpoint$Documentation$1(Documentation.scala:30)
    at Documentation$delayedInit$body.apply(Documentation.scala:20)
    at scala.Function0$class.apply$mcV$sp(Function0.scala:40)
    at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
    at scala.App$$anonfun$main$1.apply(App.scala:76)
    at scala.App$$anonfun$main$1.apply(App.scala:76)
    at scala.collection.immutable.List.foreach(List.scala:381)
    at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
    at scala.App$class.main(App.scala:76)
    at Documentation$.main(Documentation.scala:20)
    at Documentation.main(Documentation.scala)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)

Romain

Missing libraryDependencies

Had to add to "build.sbt":

lazy val root = (project in file("."))
.settings(
    libraryDependencies ++= Seq(
    	"com.lihaoyi"			%% "scalatex-site"	% "0.4.1",
	"com.lihaoyi"			%% "scalatex-api"	% "0.4.1"
    )
)

Getting NoClassDefFound exception in run when using upickle as a dependency

I am trying to use a library (upickle) in a Scalatex project to generate some of the JSON examples that I need to include in the documentation.

My build.sbt looks like this:

lazy val apiDocs = scalatex.ScalatexReadme(
  projectId = "ApiDocs",
  wd = file(""),
  url = "",
  source = "ApiDocs"
).settings(
  scalaVersion := "2.11.7",
  libraryDependencies += "com.lihaoyi" %% "upickle" % "0.3.4"
).dependsOn(sharedTypesJvm)

The ApiDocs.scalatex file does the following:
@import upickle.default._

Which compiles fine but when I try to generate a site using ApiDocs/run it crashes with the following:

[error] (run-main-10) java.lang.NoClassDefFoundError: upickle/package$
java.lang.NoClassDefFoundError: upickle/package$
    at scalatex.site.Sidebar$.snippet(Sidebar.scala:10)
    at scalatex.site.Main.bodyFrag(Main.scala:43)
    at scalatex.site.Main.bodyFrag(Main.scala:16)

Apparently the upickle dependency does not end up on the classpath when scalatex.ApiDocs().render is run via the run task. How do I make sure that it does? No, it's on the classpath (at least according to show ApiDocs/runtime:fullClasspath).

It works as expected if I run that through ApiDocs/console rather than ApiDocs/run.

[0.3.7] sbt plugin tries to spuriously resolve artifacts from dependsOn

This is a regression that I noticed when upgrading from 0.3.5 to 0.3.7.

Here's a relevant excerpt of my readme project in scala.meta:

lazy val readme = scalatex.ScalatexReadme(
  projectId = "readme",
  wd = file(""),
  url = "https://github.com/scalameta/scalameta/tree/master",
  source = "Readme"
) settings (
  ...
  publish := {
    ...
    val _ = (run in Compile).toTask(" --validate").value
    ...
  },
  ...
) dependsOn (scalameta)

Here's what happens when I try to run sbt readme/publish with 0.3.7 (doing the same thing with 0.3.5 succeeds):

14:41 ~/Projects/Meta1x/sandbox (master)$ sbt
[info] Loading project definition from /Users/xeno_by/Projects/Meta1x/project
[info] Updating {file:/Users/xeno_by/Projects/Meta1x/project/}meta1x-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
running git rev-parse HEAD in /Users/xeno_by/Projects/Meta1x/.
running git diff --name-status in /Users/xeno_by/Projects/Meta1x/.
running git diff --staged --name-status in /Users/xeno_by/Projects/Meta1x/.
running git ls-files --others --exclude-standard in /Users/xeno_by/Projects/Meta1x/.
running git log -10 --pretty=%s in /Users/xeno_by/Projects/Meta1x/.
[info] Welcome to scala.meta 1.6.0-588.1485124911889 (publishing disabled)
[info] Set current project to scalametaRoot (in build file:/Users/xeno_by/Projects/Meta1x/)
> readme/publish
Generating Scalatex Sources...
[info] Updating readme
[info] Resolved readme dependencies
[trace] Stack trace suppressed: run last readme/*:coursierResolution for the full output.
[error] (readme/*:coursierResolution) coursier.ResolutionException: Encountered 1 error(s) in dependency resolution:
[error]   org.scalameta:scalameta_2.12:1.6.0-588.1485124911889:
[error]     not found:
[error]       /Users/xeno_by/.ivy2/local/org.scalameta/scalameta_2.12/1.6.0-588.1485124911889/ivys/ivy.xml
[error]       https://repo1.maven.org/maven2/org/scalameta/scalameta_2.12/1.6.0-588.1485124911889/scalameta_2.12-1.6.0-588.1485124911889.pom
[error]       https://dl.bintray.com/scalameta/maven/org/scalameta/scalameta_2.12/1.6.0-588.1485124911889/scalameta_2.12-1.6.0-588.1485124911889.pom
[error]       https://oss.sonatype.org/content/repositories/snapshots/org/scalameta/scalameta_2.12/1.6.0-588.1485124911889/scalameta_2.12-1.6.0-588.1485124911889.pom
[error]       https://oss.sonatype.org/content/repositories/releases/org/scalameta/scalameta_2.12/1.6.0-588.1485124911889/scalameta_2.12-1.6.0-588.1485124911889.pom
[error]       https://dl.bintray.com/olafurpg/maven/org/scalameta/scalameta_2.12/1.6.0-588.1485124911889/scalameta_2.12-1.6.0-588.1485124911889.pom
[error] Total time: 3 s, completed Jan 22, 2017 2:41:58 PM

In scala.meta, we've recently switched from specifying version numbers by hand to computing them on the fly. After that, I noticed that readme/publish started failing with a missing dependency error. It would seem that the 0.3.7 sbt plugin erroneously tries to resolve dependencies that come from dependsOn. 0.3.5 works just fine.

For a reproduction, check out xeno-by/scalameta@ad50481 and to git reset --hard HEAD~1.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.