Skip to content
This repository has been archived by the owner on Jan 16, 2019. It is now read-only.

Commit

Permalink
Merge pull request #19 from UdashFramework/udash-0.5
Browse files Browse the repository at this point in the history
Udash 0.5
  • Loading branch information
Starzu authored Jun 7, 2017
2 parents b16ba5d + 6f95a25 commit e0802f2
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 45 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
language: scala

scala:
- 2.11.7
- 2.12.2

jdk:
- oraclejdk8

script:
- ./test.sh
6 changes: 3 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
name := "udash-generator"

version in ThisBuild := "0.4.0-SNAPSHOT"
version in ThisBuild := "0.5.0-SNAPSHOT"
organization in ThisBuild := "io.udash"
scalaVersion in ThisBuild := "2.11.8"
scalaVersion in ThisBuild := "2.12.2"

lazy val generator = project.in(file("."))
.aggregate(core, cmd)
.settings(publishArtifact := false)

lazy val core = project.in(file("core"))
.settings(libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.0" % Test)
.settings(libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.3" % Test)

lazy val cmd = project.in(file("cmd"))
.dependsOn(core)
Expand Down
14 changes: 6 additions & 8 deletions core/src/main/scala/io/udash/generator/GeneratorSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ case class GeneratorSettings(rootDirectory: File,
/** Root package of styles in frontend. */
def stylesSubPackage: Seq[String] = Seq("styles")

def scalaVersion: String = "2.11.8"
def sbtVersion: String = "0.13.12"
def scalaJSVersion: String = "0.6.12"
def scalaCSSVersion: String = "0.5.0"
def udashVersion: String = "0.4.0"
def udashJQueryVersion: String = "1.0.0"
def scalaVersion: String = "2.12.2"
def sbtVersion: String = "0.13.15"
def scalaJSVersion: String = "0.6.17"
def scalaCSSVersion: String = "0.5.3"
def udashVersion: String = "0.5.0"
def udashJQueryVersion: String = "1.0.1"
def jettyVersion: String = "9.3.11.v20160721"
def logbackVersion: String = "1.1.3"

Expand All @@ -44,8 +44,6 @@ case class GeneratorSettings(rootDirectory: File,
def frontendDepsFastJs: String = "frontend-deps-fast.js"
/** Generated JS file with dependencies code name (prod). */
def frontendDepsJs: String = "frontend-deps.js"
/** Generated JS file with app launcher name (dev). */
def frontendInitJs: String = "frontend-init.js"

/** Udash DevGuide root URL. */
def udashDevGuide: String = "http://guide.udash.io/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ object JettyLauncherPlugin extends GeneratorPlugin with SBTProjectFiles with Fro
appendOnPlaceholder(sbtConfigFile)(BackendSettingsPlaceholder,
s""",
|
| compile <<= (compile in Compile),
| (compile in Compile) <<= (compile in Compile).dependsOn(copyStatics),
| compile := (compile in Compile).value,
| (compile in Compile) := (compile in Compile).dependsOn(copyStatics).value,
| copyStatics := IO.copyDirectory((crossTarget in $frontendModuleName).value / StaticFilesDir, (target in Compile).value / StaticFilesDir),
| copyStatics <<= copyStatics.dependsOn(compileStatics in $frontendModuleName),
| copyStatics := copyStatics.dependsOn(compileStatics in $frontendModuleName).value,
|
| mappings in (Compile, packageBin) ++= {
| copyStatics.value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ object SBTBootstrapPlugin extends GeneratorPlugin with SBTProjectFiles {
| "-language:dynamics",
| "-Xfuture",
| "-Xfatal-warnings",
| "-Xlint:_,-missing-interpolator,-adapted-args"
| "-Xlint:-unused,_"
|)
|
|""".stripMargin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ object SBTModulesPlugin extends GeneratorPlugin with SBTProjectFiles with Fronte
| files
| },
| //// use either refreshBrowsers OR updateBrowsers
| // refreshBrowsers <<= refreshBrowsers triggeredBy (compileStatics in Compile)
| updateBrowsers <<= updateBrowsers triggeredBy (compileStatics in Compile)
| // refreshBrowsers := (refreshBrowsers triggeredBy (compileStatics in Compile)).value
| updateBrowsers := (updateBrowsers triggeredBy (compileStatics in Compile)).value
| )
|""".stripMargin
else ""
Expand Down Expand Up @@ -82,9 +82,9 @@ object SBTModulesPlugin extends GeneratorPlugin with SBTProjectFiles with Fronte
| .settings(
| libraryDependencies ++= $depsName.value,
| jsDependencies ++= $depsJSName.value,
| persistLauncher in Compile := true,
| scalaJSUseMainModuleInitializer in Compile := true,
|
| compile <<= (compile in Compile).dependsOn(compileStatics),
| compile := (compile in Compile).dependsOn(compileStatics).value,
| compileStatics := {
| IO.copyDirectory(sourceDirectory.value / "main/assets/fonts", crossTarget.value / StaticFilesDir / WebContent / "assets/fonts")
| IO.copyDirectory(sourceDirectory.value / "main/assets/images", crossTarget.value / StaticFilesDir / WebContent / "assets/images")
Expand All @@ -99,9 +99,7 @@ object SBTModulesPlugin extends GeneratorPlugin with SBTProjectFiles with Fronte
| artifactPath in(Compile, packageJSDependencies) :=
| (crossTarget in(Compile, packageJSDependencies)).value / StaticFilesDir / WebContent / "scripts" / "${settings.frontendDepsFastJs}",
| artifactPath in(Compile, packageMinifiedJSDependencies) :=
| (crossTarget in(Compile, packageMinifiedJSDependencies)).value / StaticFilesDir / WebContent / "scripts" / "${settings.frontendDepsJs}",
| artifactPath in(Compile, packageScalaJSLauncher) :=
| (crossTarget in(Compile, packageScalaJSLauncher)).value / StaticFilesDir / WebContent / "scripts" / "${settings.frontendInitJs}"$FrontendSettingsPlaceholder
| (crossTarget in(Compile, packageMinifiedJSDependencies)).value / StaticFilesDir / WebContent / "scripts" / "${settings.frontendDepsJs}"
| )${scalajsWorkbenchSettings(settings)}
| $FrontendModulePlaceholder
|
Expand Down Expand Up @@ -183,9 +181,9 @@ object SBTModulesPlugin extends GeneratorPlugin with SBTProjectFiles with Fronte
| libraryDependencies ++= $frontendDepsName.value,
| crossLibs(Compile),
| jsDependencies ++= $frontendJSDepsName.value,
| persistLauncher in Compile := true,
| scalaJSUseMainModuleInitializer in Compile := true,
|
| compile <<= (compile in Compile).dependsOn(compileStatics),
| compile := (compile in Compile).dependsOn(compileStatics).value,
| compileStatics := {
| IO.copyDirectory(sourceDirectory.value / "main/assets/fonts", crossTarget.value / StaticFilesDir / WebContent / "assets/fonts")
| IO.copyDirectory(sourceDirectory.value / "main/assets/images", crossTarget.value / StaticFilesDir / WebContent / "assets/images")
Expand All @@ -200,9 +198,7 @@ object SBTModulesPlugin extends GeneratorPlugin with SBTProjectFiles with Fronte
| artifactPath in(Compile, packageJSDependencies) :=
| (crossTarget in(Compile, packageJSDependencies)).value / StaticFilesDir / WebContent / "scripts" / "${settings.frontendDepsFastJs}",
| artifactPath in(Compile, packageMinifiedJSDependencies) :=
| (crossTarget in(Compile, packageMinifiedJSDependencies)).value / StaticFilesDir / WebContent / "scripts" / "${settings.frontendDepsJs}",
| artifactPath in(Compile, packageScalaJSLauncher) :=
| (crossTarget in(Compile, packageScalaJSLauncher)).value / StaticFilesDir / WebContent / "scripts" / "${settings.frontendInitJs}"$FrontendSettingsPlaceholder
| (crossTarget in(Compile, packageMinifiedJSDependencies)).value / StaticFilesDir / WebContent / "scripts" / "${settings.frontendDepsJs}"
| )${scalajsWorkbenchSettings(settings)}
| $FrontendModulePlaceholder
|
Expand Down Expand Up @@ -251,14 +247,12 @@ object SBTModulesPlugin extends GeneratorPlugin with SBTProjectFiles with Fronte
s"""
| <script src="http://localhost:12345/${frontendDirectoryName}target/UdashStatic/WebContent/scripts/${settings.frontendDepsFastJs}"></script>
| <script src="http://localhost:12345/${frontendDirectoryName}target/UdashStatic/WebContent/scripts/${settings.frontendImplFastJs}"></script>
| <script src="http://localhost:12345/${frontendDirectoryName}target/UdashStatic/WebContent/scripts/${settings.frontendInitJs}"></script>
| <script src="http://localhost:12345/workbench.js"></script>
""".stripMargin
else
s"""
| <script src="scripts/${settings.frontendDepsFastJs}"></script>
| <script src="scripts/${settings.frontendImplFastJs}"></script>
| <script src="scripts/${settings.frontendInitJs}"></script>
""".stripMargin


Expand Down Expand Up @@ -290,7 +284,6 @@ object SBTModulesPlugin extends GeneratorPlugin with SBTProjectFiles with Fronte
|
| <script src="scripts/${settings.frontendDepsJs}"></script>
| <script src="scripts/${settings.frontendImplJs}"></script>
| <script src="scripts/${settings.frontendInitJs}"></script>
| $HTMLHeadPlaceholder
|</head>
|<body>
Expand Down Expand Up @@ -321,15 +314,13 @@ object SBTModulesPlugin extends GeneratorPlugin with SBTProjectFiles with Fronte
| copyIndex(indexFile, outDir)
| (fullOptJS in Compile).value
| (packageMinifiedJSDependencies in Compile).value
| (packageScalaJSLauncher in Compile).value
| }
| } else {
| Def.task {
| val indexFile = sourceDirectory.value / "main/assets/${indexDevHtml.getName}"
| copyIndex(indexFile, outDir)
| (fastOptJS in Compile).value
| (packageJSDependencies in Compile).value
| (packageScalaJSLauncher in Compile).value
| }
| }
| }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ object ScalaCSSDemosPlugin extends GeneratorPlugin with SBTProjectFiles with Fro
|case object DemoStylesViewPresenter extends DefaultViewPresenterFactory[$stateName.type](() => new DemoStylesView)
|
|class DemoStylesView extends View {
| import scalacss.Defaults._
| import scalacss.DevDefaults._
| import scalacss.ScalatagsCss._
| import scalatags.JsDom._
| import scalatags.JsDom.all._
Expand Down Expand Up @@ -259,7 +259,7 @@ object ScalaCSSDemosPlugin extends GeneratorPlugin with SBTProjectFiles with Fro
appendOnPlaceholder(initScala)(FrontendAppInitPlaceholder,
s"""
|
|import scalacss.Defaults._
|import scalacss.DevDefaults._
|import scalacss.ScalatagsCss._
|import scalatags.JsDom._
|import ${settings.rootPackage.mkPackage()}.${settings.stylesSubPackage.mkPackage()}.GlobalStyles
Expand All @@ -280,7 +280,7 @@ object ScalaCSSDemosPlugin extends GeneratorPlugin with SBTProjectFiles with Fro
|
|import scala.language.postfixOps
|import scalacss.internal.{Attr, Literal}
|import scalacss.Defaults._
|import scalacss.DevDefaults._
|
|object GlobalStyles extends StyleSheet.Inline {
| import dsl._
Expand Down Expand Up @@ -627,7 +627,7 @@ object ScalaCSSDemosPlugin extends GeneratorPlugin with SBTProjectFiles with Fro
|import scala.concurrent.duration.FiniteDuration
|import scala.language.postfixOps
|import scalacss.internal.Compose
|import scalacss.Defaults._
|import scalacss.DevDefaults._
|
|object DemoStyles extends StyleSheet.Inline {
| import dsl._
Expand Down Expand Up @@ -759,7 +759,7 @@ object ScalaCSSDemosPlugin extends GeneratorPlugin with SBTProjectFiles with Fro

writeFile(stylesConstantsScala)(
s"""package ${settings.rootPackage.mkPackage()}.${settings.stylesSubPackage.mkPackage()}.${stylesConstantsPackage.getName}
|import scalacss.Defaults._
|import scalacss.DevDefaults._
|
|object StyleConstants extends StyleSheet.Inline{
| import dsl._
Expand Down Expand Up @@ -821,7 +821,7 @@ object ScalaCSSDemosPlugin extends GeneratorPlugin with SBTProjectFiles with Fro
s"""package ${settings.rootPackage.mkPackage()}.${settings.stylesSubPackage.mkPackage()}.${stylesFontsPackage.getName}
|import scala.language.postfixOps
|import scalacss.internal.AV
|import scalacss.Defaults._
|import scalacss.DevDefaults._
|
|object UdashFonts extends StyleSheet.Inline {
| import dsl._
Expand Down Expand Up @@ -862,7 +862,7 @@ object ScalaCSSDemosPlugin extends GeneratorPlugin with SBTProjectFiles with Fro
|
|import scala.concurrent.duration.FiniteDuration
|import scala.language.postfixOps
|import scalacss.Defaults._
|import scalacss.DevDefaults._
|
|object HeaderStyles extends StyleSheet.Inline {
| import dsl._
Expand Down Expand Up @@ -1056,7 +1056,7 @@ object ScalaCSSDemosPlugin extends GeneratorPlugin with SBTProjectFiles with Fro
|import ${settings.rootPackage.mkPackage()}.${settings.stylesSubPackage.mkPackage()}.${stylesUtilsPackage.getName}.{MediaQueries, StyleUtils}
|
|import scala.language.postfixOps
|import scalacss.Defaults._
|import scalacss.DevDefaults._
|
|object FooterStyles extends StyleSheet.Inline {
| import dsl._
Expand Down Expand Up @@ -1144,7 +1144,7 @@ object ScalaCSSDemosPlugin extends GeneratorPlugin with SBTProjectFiles with Fro
|
|import ${settings.rootPackage.mkPackage()}.${settings.stylesSubPackage.mkPackage()}.${stylesConstantsPackage.getName}.StyleConstants
|
|import scalacss.Defaults._
|import scalacss.DevDefaults._
|import scala.language.postfixOps
|
|object MediaQueries extends StyleSheet.Inline {
Expand Down Expand Up @@ -1179,7 +1179,7 @@ object ScalaCSSDemosPlugin extends GeneratorPlugin with SBTProjectFiles with Fro
|import scala.concurrent.duration.FiniteDuration
|import scala.language.postfixOps
|import scalacss.internal.{AV, Attr, Length, ValueT}
|import scalacss.Defaults._
|import scalacss.DevDefaults._
|
|object StyleUtils extends StyleSheet.Inline {
| import dsl._
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version = 0.13.12
sbt.version = 0.13.15
3 changes: 2 additions & 1 deletion test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

echo "Assembling Udash generator..."
sbt assembly
cp cmd/target/scala-2.11/udash-generator.jar dist/udash-generator.jar
cp cmd/target/scala-2.12/udash-generator.jar dist/udash-generator.jar

cd dist

Expand All @@ -11,6 +11,7 @@ for f in ../test/*.cnf; do
echo "Starting test $f..."
./run.sh < $f > /dev/null
cd test-app
echo "Compiling $f..."
sbt compile > ../$f.log
if [ $? -eq 0 ]; then
echo -e "Test $f \e[32msucceed\e[39m!"
Expand Down

0 comments on commit e0802f2

Please sign in to comment.