summaryrefslogtreecommitdiff
path: root/book/src/main/scalatex/book/handson/PublishingModules.scalatex
diff options
context:
space:
mode:
Diffstat (limited to 'book/src/main/scalatex/book/handson/PublishingModules.scalatex')
-rw-r--r--book/src/main/scalatex/book/handson/PublishingModules.scalatex13
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