build.sc
changeset 33 fa0f19a74283
parent 32 2d14f02ba3bd
equal deleted inserted replaced
32:2d14f02ba3bd 33:fa0f19a74283
    10 
    10 
    11 val scalaJsVer = "0.6.33"
    11 val scalaJsVer = "0.6.33"
    12 val scalaVer = "2.12.12"
    12 val scalaVer = "2.12.12"
    13 val akkaVer = "2.6.10"
    13 val akkaVer = "2.6.10"
    14 val akkaHttp = "10.2.1"
    14 val akkaHttp = "10.2.1"
       
    15 
       
    16 val topLevelDir: Path = build.millSourcePath
    15 
    17 
    16 trait Common extends ScalaModule with PublishModule {
    18 trait Common extends ScalaModule with PublishModule {
    17   val scalaVersion = scalaVer
    19   val scalaVersion = scalaVer
    18 
    20 
    19   def publishVersion: Target[String] = appVersion
    21   def publishVersion: Target[String] = appVersion
   133           | import scalatags.Text.all._
   135           | import scalatags.Text.all._
   134           | import scalatex._
   136           | import scalatex._
   135           | import sqwl.cms.Category._
   137           | import sqwl.cms.Category._
   136           | import sqwl.cms.Tag._
   138           | import sqwl.cms.Tag._
   137           | import sqwl.cms.Articles.article
   139           | import sqwl.cms.Articles.article
   138           | object `$aid` {
   140           | object `$aid` extends ContentHolder {
   139           |   implicit val id = Articles.Id("$id")
   141           |   implicit val id = Articles.Id("$id")
   140           |   twf("${p.toString}")
   142           |   val content = twf("${p.toString}")
   141           | }
   143           | }
   142           |
   144           |
   143           |/*
   145           |/*
   144           |${os.read(p)}
   146           |${os.read(p)}
   145           |*/
   147           |*/
   158       """.stripMargin)
   160       """.stripMargin)
   159 
   161 
   160     write(dir / "main.scala",
   162     write(dir / "main.scala",
   161       """
   163       """
   162         | package sqwl.cms
   164         | package sqwl.cms
   163         | object Main extends Server {
   165         | import java.nio.file.Paths
   164         |   override def content: iContent = Content
   166         | object Main extends Server with config {
       
   167         |   override def content: iContent =
       
   168         |     new Content(Paths.get(cms.root).toAbsolutePath)
   165         | }
   169         | }
   166       """.stripMargin)
   170       """.stripMargin)
   167 
   171 
   168     Seq(PathRef(dir))
   172     Seq(PathRef(dir))
   169   }
   173   }
   191 object example extends Content {
   195 object example extends Content {
   192   def contentSources: Sources =
   196   def contentSources: Sources =
   193     T.sources{ millSourcePath / up / 'example / 'content }
   197     T.sources{ millSourcePath / up / 'example / 'content }
   194 }
   198 }
   195 
   199 
   196 object production extends Content {
       
   197   def contentSources: Sources =
       
   198     T.sources{ millSourcePath / up / 'production / 'content }
       
   199 
       
   200   def hgProdId: Input[String] = T.input {
       
   201     os.proc("hg", "id", "-i", "--cwd", "production").call().out.trim
       
   202   }
       
   203 
       
   204   override def assemblyName: Target[String] = T{
       
   205     s"${super.assemblyName()}-${hgProdId()}"
       
   206   }
       
   207 }
       
   208 
       
   209 
       
   210 object js extends Common with ScalaJSModule {
   200 object js extends Common with ScalaJSModule {
   211   def scalaJSVersion: Target[String] = scalaJsVer
   201   def scalaJSVersion: Target[String] = scalaJsVer
   212 }
   202 }
   213 
   203 
   214 // vim: et ts=2 sw=2 syn=scala 
   204 // vim: et ts=2 sw=2 syn=scala