From 78f7ed0303ea42fca8f4e1535ea800d12d2a80eb Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sun, 2 Nov 2014 16:46:59 -0800 Subject: tweaked cross-build example --- book/src/main/scalatex/book/Index.scalatex | 2 +- .../scalatex/book/handson/CrossModules.scalatex | 114 +++++++++++++++++++-- .../scalatex/book/indepth/DesignSpace.scalatex | 13 ++- examples/crossBuilds/simple/build.sbt | 4 +- .../js/shared/main/scala/simple/Simple.scala | 7 ++ .../simple/js/src/main/scala/simple/Platform.scala | 11 +- .../jvm/src/main/scala/simple/Platform.scala | 14 ++- examples/crossBuilds/simple/project/build.sbt | 1 + .../simple/shared/main/scala/simple/Simple.scala | 9 -- 9 files changed, 139 insertions(+), 36 deletions(-) create mode 100644 examples/crossBuilds/simple/js/shared/main/scala/simple/Simple.scala delete mode 100644 examples/crossBuilds/simple/shared/main/scala/simple/Simple.scala diff --git a/book/src/main/scalatex/book/Index.scalatex b/book/src/main/scalatex/book/Index.scalatex index 0ff807d..2ac629b 100644 --- a/book/src/main/scalatex/book/Index.scalatex +++ b/book/src/main/scalatex/book/Index.scalatex @@ -29,7 +29,7 @@ @sect("Cross-platform Modules") @handson.CrossModules.template - @sect("Client-Server Integration") + @sect("Integrating Client and Server") @handson.ClientServer.template @sect("Scala.js in Depth", "Exploring Scala.js") diff --git a/book/src/main/scalatex/book/handson/CrossModules.scalatex b/book/src/main/scalatex/book/handson/CrossModules.scalatex index 9b1f62c..8cf5292 100644 --- a/book/src/main/scalatex/book/handson/CrossModules.scalatex +++ b/book/src/main/scalatex/book/handson/CrossModules.scalatex @@ -1,16 +1,112 @@ @p We've spent several chapters exploring the experience of making web apps using Scala.js, but any large app (web or not!) likely relies on a host of libraries in order to implement large chunks of its functionality. Ideally these libraries would be re-usable, and can be shared among different projects, teams or even companies. -@p - In JVM-land, the standard method for distributing these libraries is as @a("Maven Artifacts", href:="http://stackoverflow.com/questions/2487485/what-is-maven-artifact"). These are typically published in a public location such as @a("Maven Central", href:="http://search.maven.org/"), where others can find and download them for use. Typically downloads are done automatically by the build-tool: in Scala-JVM typically this is SBT. -@p - In Javascript-land, there are multiple ways of acquiring dependencies: @a("CommonJS", href:="http://en.wikipedia.org/wiki/CommonJS") and @a("RequireJS/AMD", href:="http://requirejs.org/") are two competing standards with a host of implementations. Historically, a third approach has been most common: the developer would simply download the modules himself, check it into source-control and manually add a @hl.html{