diff options
author | Li Haoyi <haoyi@dropbox.com> | 2015-02-04 09:11:44 -0800 |
---|---|---|
committer | Li Haoyi <haoyi@dropbox.com> | 2015-02-04 09:11:44 -0800 |
commit | b5cdc9d91c5582a26a6d2e2c8e81b67c593d14ac (patch) | |
tree | 2a3989ba98b32a2540d9b094f1d6023ee5b1c5fb /book/src/main/scalatex/book/handson/PublishingModules.scalatex | |
parent | fd2f23fbfb8ce6501fff20ea1c305d00249fb465 (diff) | |
download | hands-on-scala-js-b5cdc9d91c5582a26a6d2e2c8e81b67c593d14ac.tar.gz hands-on-scala-js-b5cdc9d91c5582a26a6d2e2c8e81b67c593d14ac.tar.bz2 hands-on-scala-js-b5cdc9d91c5582a26a6d2e2c8e81b67c593d14ac.zip |
second pass at updating cross-built chapters for 0.6.0
Diffstat (limited to 'book/src/main/scalatex/book/handson/PublishingModules.scalatex')
-rw-r--r-- | book/src/main/scalatex/book/handson/PublishingModules.scalatex | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/book/src/main/scalatex/book/handson/PublishingModules.scalatex b/book/src/main/scalatex/book/handson/PublishingModules.scalatex index 44cefb7..44bad45 100644 --- a/book/src/main/scalatex/book/handson/PublishingModules.scalatex +++ b/book/src/main/scalatex/book/handson/PublishingModules.scalatex @@ -15,11 +15,12 @@ $ tree . ├── build.sbt - ├── app - │ ├── js/src/main/scala/simple/Platform.scala - │ ├── jvm/src/main/scala/simple/Platform.scala - │ └── shared/src/main/scala/simple/Simple.scala - └── project/ build.sbt + ├── project/build.sbt + └── library + ├── js/src/main/scala/simple/Platform.scala + ├── jvm/src/main/scala/simple/Platform.scala + └── shared/src/main/scala/simple/Simple.scala + @p As you can see, we have three main places where code lives: @code{js/} is where Scala-JS specific code lives, @code{jvm/} for Scala-JVM specific code, and @code{shared/} for code that is common between both platforms. Depending on your project, you may have more or less code in the @code{shared/} folder: a mostly-the-same cross-compiled module may have most or all its code in @code{shared/} while a @sect.ref("Integrating Client-Server", "client-server web application") would have lots of client/server js/jvm-specific code. @@ -35,7 +36,7 @@ @hl.ref(wd/'examples/'crossBuilds/'simple/"build.sbt") @p - Unlike the equivalent @code{build.sbt} files you saw in earlier chapters, this does not simply enable the @hl.scala{ScalaJSPlugin} to the root project. Rather, it uses the @hl.scala{crossProject} function provided by the Scala.js plugin to set up two projects: one in the @code{app/js/} folder and one in the @code{jvm/} folder. We also have places to put settings related to either the JS side, the JVM side, or both. In this case, we add a dependency on @lnk("uTest", "https://github.com/lihaoyi/utest"), which we will use as the test framework for our library. + Unlike the equivalent @code{build.sbt} files you saw in earlier chapters, this does not simply enable the @hl.scala{ScalaJSPlugin} to the root project. Rather, it uses the @hl.scala{crossProject} function provided by the Scala.js plugin to set up two projects: one in the @code{app/js/} folder and one in the @code{jvm/} folder. We also have places to put settings related to either the JS side, the JVM side, or both. In this case, we add a dependency on @lnk("uTest", "https://github.com/lihaoyi/utest"), which we will use as the test framework for our library. Note how we use triple @hl.scala{%%%} to indicate that we're using the platform-specific version of uTest, such that the Scala.js or Scala-JVM version will be properly pulled in when compiling for each platform. @sect{Source Files} @val simple = wd/'examples/'crossBuilds/'simple |