summaryrefslogtreecommitdiff
path: root/book/src/main/scala/book/BookData.scala
diff options
context:
space:
mode:
authorLi Haoyi <haoyi@dropbox.com>2014-11-10 21:10:07 -0800
committerLi Haoyi <haoyi@dropbox.com>2014-11-10 21:10:07 -0800
commit8ced367e0d736b429f0b39ae7fde2b76b1d64ed5 (patch)
treee1154648219f8367c2537580f207e8f100e75590 /book/src/main/scala/book/BookData.scala
parent2846d28c95d183792d6d809d1c3884b619b6f937 (diff)
downloadhands-on-scala-js-8ced367e0d736b429f0b39ae7fde2b76b1d64ed5.tar.gz
hands-on-scala-js-8ced367e0d736b429f0b39ae7fde2b76b1d64ed5.tar.bz2
hands-on-scala-js-8ced367e0d736b429f0b39ae7fde2b76b1d64ed5.zip
More refactoring
Diffstat (limited to 'book/src/main/scala/book/BookData.scala')
-rw-r--r--book/src/main/scala/book/BookData.scala44
1 files changed, 44 insertions, 0 deletions
diff --git a/book/src/main/scala/book/BookData.scala b/book/src/main/scala/book/BookData.scala
new file mode 100644
index 0000000..0a47aaf
--- /dev/null
+++ b/book/src/main/scala/book/BookData.scala
@@ -0,0 +1,44 @@
+package book
+
+import acyclic.file
+
+object BookData {
+ val myTable = Seq(
+ ("Most of java.lang.*", "j.l.Thread, j.l.Runtime, ..."),
+ ("Almost all of scala.*", "s.c.parallel, s.tools.nsc"),
+ ("Some of java.util.*", "org.omg.CORBA, sun.misc.*"),
+ ("Scala Macros: upickle, scala-async, scalaxy, etc", "Reflection: scala-pickling, scala-reflect"),
+ ("Pure-Scala ecosystem: shapeless, scalaz, scalatags, utest", "Java-dependent: Scalatest, Scalate"),
+ ("JS stuff: XmlHttpRequest, Websockets. Localstorage", " JVM stuff: Netty, akka, spray, file IO, JNI"),
+ ("HTML DOM, Canvas, WebGL", "AWT, Swing, SWT, OpenGL"),
+ ("JavaScript libraries: chipmunk.js, hand.js, react.js, jquery", "Java ecosystem: guice, junit, apache-commons, log4j"),
+ ("IntelliJ, Eclipse, SBT, Chrome console, firebug", "Scala REPL, Yourkit, VisualVM, JProfiler")
+ )
+
+ lazy val javaAPIs = {
+ import java.io.File
+ def recursiveListFiles(f: File): Array[File] = {
+ val these = f.listFiles
+ these ++ these.filter(_.isDirectory).flatMap(recursiveListFiles)
+ }
+
+ val roots = Seq(
+ "output/scala-js/javalanglib/src/main/scala",
+ "output/scala-js/javalib/src/main/scala"
+ )
+ for{
+ root <- roots
+ file <- recursiveListFiles(new File(root))
+ if file != null
+ if file.isFile
+ } yield{
+ val path = file.getPath
+ .drop(root.length + 1)
+ .dropRight(".scala".length)
+ val filename = path.replace('/', '.')
+ val docpath = s"https://docs.oracle.com/javase/7/docs/api/$path.html"
+ filename -> docpath
+ }
+ }
+}
+