13 val akkaVer = "2.4.20" |
13 val akkaVer = "2.4.20" |
14 |
14 |
15 trait Common extends ScalaModule with PublishModule { |
15 trait Common extends ScalaModule with PublishModule { |
16 val scalaVersion = scalaVer |
16 val scalaVersion = scalaVer |
17 |
17 |
18 def publishVersion = appVersion |
18 def publishVersion: Target[String] = appVersion |
19 |
19 |
20 def pomSettings = PomSettings( |
20 def pomSettings = PomSettings( |
21 description = "Content management system for SQWL", |
21 description = "Content management system for SQWL", |
22 organization = "net.tz", |
22 organization = "net.tz", |
23 url = "http://kvalitapracovnihozivota.vubp.cz", |
23 url = "http://kvalitapracovnihozivota.vubp.cz", |
60 val fontAwesome = "5.5.0" |
60 val fontAwesome = "5.5.0" |
61 val jquery = "3.3.1-1" |
61 val jquery = "3.3.1-1" |
62 } |
62 } |
63 |
63 |
64 object base extends Common with Versions { |
64 object base extends Common with Versions { |
65 override def scalacPluginIvyDeps: Target[Loose.Agg[Dep]] = super.scalacPluginIvyDeps() ++ Agg( |
65 override def scalacPluginIvyDeps: Target[Loose.Agg[Dep]] = |
66 ivy"org.scalamacros:::paradise:2.1.0" |
66 super.scalacPluginIvyDeps() ++ Agg( |
67 ) |
67 ivy"org.scalamacros:::paradise:2.1.0" |
|
68 ) |
68 |
69 |
69 override def ivyDeps = Agg( |
70 override def ivyDeps = Agg( |
70 ivy"com.wacai::config-annotation:0.3.6", |
71 ivy"com.wacai::config-annotation:0.3.6", |
71 ivy"de.heikoseeberger::akka-http-json4s:1.22.0", |
72 ivy"de.heikoseeberger::akka-http-json4s:1.22.0", |
72 ivy"com.typesafe.akka::akka-slf4j:$akkaVer", |
73 ivy"com.typesafe.akka::akka-slf4j:$akkaVer", |
101 Seq(PathRef(dir)) |
102 Seq(PathRef(dir)) |
102 } |
103 } |
103 |
104 |
104 } |
105 } |
105 |
106 |
106 object content extends Common { |
107 trait Content extends Common { |
|
108 |
107 override def moduleDeps = Seq(base) |
109 override def moduleDeps = Seq(base) |
108 override def sources : Sources = T.sources{ millSourcePath / up / 'example / 'src } |
110 |
|
111 def contentSources: Target[PathRef] |
|
112 |
109 override def generatedSources: Target[Seq[PathRef]] = T{ |
113 override def generatedSources: Target[Seq[PathRef]] = T{ |
110 val dir = T.ctx().dest |
114 val dir = T.ctx().dest |
111 val src = millSourcePath / up / 'example / 'content |
115 val src = contentSources().path |
112 val ids = ls! src filter(_.name endsWith ".scalatex") map { p => |
116 val ids = ls! src filter(_.name endsWith ".scalatex") map { p => |
113 val id = p.name replaceAllLiterally (".scalatex", "") |
117 val id = p.name replaceAllLiterally (".scalatex", "") |
114 val aid = s"article-$id" |
118 val aid = s"article-$id" |
115 write(dir / s"$id.scala", |
119 write(dir / s"$id.scala", |
116 s""" |
120 s""" |
125 | twf("${p.toString}") |
129 | twf("${p.toString}") |
126 | } |
130 | } |
127 """.stripMargin) |
131 """.stripMargin) |
128 aid |
132 aid |
129 } |
133 } |
|
134 |
130 write(dir / "initializer.scala", |
135 write(dir / "initializer.scala", |
131 s""" |
136 s""" |
132 | package sqwl.cms |
137 | package sqwl.cms |
133 | object InitializeContent { |
138 | object InitializeContent { |
134 | def apply(): Unit = { |
139 | def apply(): Unit = { |
135 | Seq(${ids mkString("`", "`, `", "`")}) |
140 | Seq(${ids mkString("`", "`, `", "`")}) |
136 | } |
141 | } |
137 | } |
142 | } |
138 """.stripMargin) |
143 """.stripMargin) |
139 Seq(PathRef(dir)) |
|
140 } |
|
141 override def ivyDeps = Agg( |
|
142 ivy"com.beachape::enumeratum:1.5.13" |
|
143 ) |
|
144 } |
|
145 |
144 |
146 object app extends Common { |
|
147 override def moduleDeps = Seq(content) |
|
148 override def mainClass = Some("sqwl.cms.Main") |
|
149 |
|
150 override def generatedSources: Target[Seq[PathRef]] = T{ |
|
151 val dir = T.ctx().dest |
|
152 write(dir / "main.scala", |
145 write(dir / "main.scala", |
153 """ |
146 """ |
154 | package sqwl.cms |
147 | package sqwl.cms |
155 | object Main extends Server { |
148 | object Main extends Server { |
156 | override def content: iContent = Content |
149 | override def content: iContent = Content |
157 | } |
150 | } |
158 """.stripMargin) |
151 """.stripMargin) |
|
152 |
159 Seq(PathRef(dir)) |
153 Seq(PathRef(dir)) |
160 } |
154 } |
|
155 |
|
156 override def mainClass = Some("sqwl.cms.Main") |
|
157 |
|
158 override def ivyDeps = Agg( |
|
159 ivy"com.beachape::enumeratum:1.5.13" |
|
160 ) |
161 } |
161 } |
|
162 |
|
163 object example extends Content { |
|
164 def contentSources: Target[PathRef] = |
|
165 T{ PathRef(millSourcePath / up / 'example / 'content) } |
|
166 } |
|
167 |
|
168 object production extends Content { |
|
169 def contentSources: Target[PathRef] = |
|
170 T{ PathRef(millSourcePath / up / 'production / 'content) } |
|
171 } |
|
172 |
162 |
173 |
163 object js extends Common with ScalaJSModule { |
174 object js extends Common with ScalaJSModule { |
164 def scalaJSVersion: Target[String] = scalaJsVer |
175 def scalaJSVersion: Target[String] = scalaJsVer |
165 } |
176 } |
166 |
177 |