Skip to content

Instantly share code, notes, and snippets.

View quintona's full-sized avatar

Quinton Anderson quintona

  • Sydney Australia
View GitHub Profile
@quintona
quintona / build.scala
Created March 21, 2014 05:54
SBT Build plugin for Hadoop legacy jar format
object build extends Build {
val maestroJar = TaskKey[File]("maestro-jar", "Creates a packaged jar that works for maestro")
def allFiles(base: File): Seq[File] = {
val finder: PathFinder = PathFinder(base).***
finder.get
}
val maestroJarSettings: Seq[Project.Setting[_]] = inTask(maestroJar)(Seq(
artifactPath <<= artifactPathSetting(artifact),
@quintona
quintona / Macros.scala
Created March 25, 2014 22:28
Trait expansion macro
object helloMacro {
def impl(c: Context)(annottees: c.Expr[Any]*): c.Expr[Any] = {
import c.universe._
import Flag._
val result = {
annottees.map(_.tree).toList match {
case q"trait $name extends ..$parents { ..$body }" :: Nil =>
q"""
trait $name extends ..$parents {
def hello = "hello"
@quintona
quintona / build.sbt
Created May 8, 2014 11:29
Native RPM SBT example
import com.typesafe.sbt.packager.Keys._
import sbt.Keys._
import com.typesafe.sbt.SbtNativePackager._
name := "hw"
version := "1.0"
scalaVersion := "2.10.3"