|
|
@@ -1,39 +0,0 @@
|
|
|
-package com.tflucke.webroutes
|
|
|
-
|
|
|
-import sbt._
|
|
|
-import Keys.{sourceGenerators,resourceManaged,libraryDependencies}
|
|
|
-import com.tflucke.webroutes.parsers.Parser
|
|
|
-import com.tflucke.webroutes.endpoints.EndpointFile
|
|
|
-import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._
|
|
|
-
|
|
|
-/** The main entry point for the plugin.
|
|
|
- *
|
|
|
- * Defines project tasks and default settings.
|
|
|
- *
|
|
|
- * @author Thomas Flucke
|
|
|
- */
|
|
|
-object RestRPC extends AutoPlugin {
|
|
|
-
|
|
|
- object autoImport {
|
|
|
- val generateRpc = taskKey[Seq[File]]("Generate scala client RPC APIs")
|
|
|
- val apiDefinitions = taskKey[Seq[EndpointFile]]("List of files containing API definitions and their parsers")
|
|
|
-
|
|
|
- lazy val baseRestRPCSettings: Seq[Def.Setting[_]] = Seq(
|
|
|
- libraryDependencies += "org.tflucke" %%% "rest-rpc" % "0.1.0"
|
|
|
- )
|
|
|
-
|
|
|
- lazy val compileRestRPCSettings: Seq[Def.Setting[_]] = Seq(
|
|
|
- apiDefinitions := Seq.empty,
|
|
|
- sourceGenerators += generateRpc,
|
|
|
- generateRpc := {
|
|
|
- println("Generating Scala RPC objects...")
|
|
|
- RPCGenerator(apiDefinitions.value, (Compile / resourceManaged).value)
|
|
|
- }
|
|
|
- )
|
|
|
- }
|
|
|
-
|
|
|
- import autoImport._
|
|
|
-
|
|
|
- override lazy val projectSettings = baseRestRPCSettings ++
|
|
|
- inConfig(Compile)(compileRestRPCSettings)
|
|
|
-}
|