Skip to content

devkat/roy-sbt-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

roy-sbt-plugin: Compile Roy sources to JavaScript

© “Andreas Hartmann”http://www.devkat.net

Credits

Thanks to Brian McKenna for providing the Roy language. Parts of his Roy plugin for Play (Ray) have been used for this plugin.

Some code has been used from the Untyped SBT Plugins.

Installation

Add the following line to your project/build.sbt file:

addSbtPlugin("net.devkat" %% "roy-sbt-plugin" % "0.1")

After you start your web project, changes in Roy sources will be automatically detected and the sources recompiled:

sbt
> ~;container:start; container:reload /

Issues

At the moment the whole project is compiled when a Roy source file changes. Any hints how to compile only the affected Roy files are greatly appreciated.

Configuration

The plugin offers the following keys:

object RoyKeys {
  val roy = TaskKey[Seq[File]]("roy", "Compile Roy sources")
  val royIncludeFilter = SettingKey[FileFilter]("roy-include-filter", "Include filter")
  val royExcludeFilter = SettingKey[Seq[FileFilter]]("roy-exclude-filter", "Exclude filter")
  val royCompilerOptions = SettingKey[Seq[String]]("roy-compiler-options", "Options for the Roy compiler")
}

The following example shows how to configure an exclude filter in project/Build.scala. The plugin provides a PathFilter class for wildcard path patterns.

import net.devkat.sbtroy.RoyPlugin._
import net.devkat.sbtroy.RoyPlugin.RoyKeys._
import net.devkat.sbtroy.RoyPlugin.PathFilter
lazy val web: Project = Project("my-web-project", file("web"),
  settings = BuildSettings.buildSettings ++ (
    roySettings ++ Seq(
      royExcludeFilter in Compile += new PathFilter("**/my/excluded/path/**")
    )
  )
)

Include generated JavaScript files in web application resource path

The following configuration for the xsbt-web-plugin works e.g. for the Lift web application framework:

import com.github.siasia.PluginKeys._
settings = BuildSettings.buildSettings ++ (
    …
    ++ webSettings ++ Seq(
     (webappResources in Compile) <+= (resourceManaged in Compile) apply {
       r => file(r.getAbsolutePath() + "/webapp")
     }
    )
    …
  )

License

The Roy SBT plugin is licensed unter the Apache License, Version 2.0.

About

SBT plugin for compiling Roy files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published