Skip to content

Instantly share code, notes, and snippets.

@freekh
freekh / gist:8059708
Created December 20, 2013 19:02
Adept plan
SBT projects and packages:
adept-hash (merge with core?)
- adept.hash (Hashing object with (static) methods used to generate hashes. Hashes are generated from strings)
adept-core
- adept.variant.models (Variant, Id, Attribute, ArtifactRef, Requirement (dependency))
- adept.variant.models.constraints (Constraint base class + EqualConstraint and IdConstraint (TODO) )
- adept.variant.ordering (Ordering implicits. Used to generate the same ordered Seq(uences) from unordered Set(s))
@freekh
freekh / AdeptExample.scala
Created December 19, 2013 22:06
Example of Adept API usage: initialises and resolves some dependencies (requirements), downloads the jars needed then publishes
val standardProgressIndicator = new adept.progress.default.AllEncompassingProgress(System.out)
val repo1: RepositoryRef = GitRepository.init(Adept.HOME_DIR, "one") //init new adept repository in HOME_DIR/one
val repo2: RepositoryRef = GitRepository.open(Adept.HOME_DIR, "two") //open adept repository in HOME_DIR/two
val repo3: RepositoryRef = GitRepository.clone(Adept.HOME_DIR, "three", "git://server/project.git", standardProgressIndicator) //clone remote to HOME_DIR/three from git using the standard progress indicator
// Can also do: repo3.isFailure() //returns true if repo3 failed to init/open/clone
// And: repo1.addRemote("git://server2/project.git") //adds a new remote just for fun
val adept: Adept = new Adept(repo1, repo2, repo3) //a single instance that manages all repositories
@freekh
freekh / EmscriptenCompiler.scala
Created December 3, 2013 13:13
Emscripten (Naive) Compiler
import java.io.File
case class EmscriptenCompilerException(filename: String, lineNo: Option[Int], colNo: Option[Int], msg: String) extends Exception
class EmscriptenCompiler(eccCompiler: String) {
private val compilerString = eccCompiler + " "
val ErrorLine = """(.*?):(\d+):(\d+): error: (.*?)""".r
@freekh
freekh / Emscripten.scala
Created December 3, 2013 13:12
Emscripten 004
import sbt._
import sbt.Keys._
import java.io.File
import play.Keys._
import play.PlayExceptions._
import play.PlaySourceGenerators
object EmscriptenKeys {
val eccFiles = taskKey[PathFinder]("C/C++ files to be compiled")
val eccCompiler = settingKey[String]("Path to Emscripten compiler")
@freekh
freekh / Emscripten.scala
Created December 3, 2013 13:12
Emscripten 003
import sbt._
import sbt.Keys._
import java.io.File
import play.Keys._
import play.PlayExceptions._
import play.PlaySourceGenerators
object EmscriptenKeys {
val eccFiles = taskKey[PathFinder]("C/C++ files to be compiled")
val eccCompiler = settingKey[String]("Path to Emscripten compiler")
@freekh
freekh / Emscripten.scala
Created December 3, 2013 13:11
Emscripten 002
import sbt._
import sbt.Keys._
import java.io.File
import play.Keys._
import play.PlayExceptions._
import play.PlaySourceGenerators
object EmscriptenKeys {
val eccFiles = taskKey[PathFinder]("C/C++ files to be compiled")
val eccCompiler = settingKey[String]("Path to Emscripten compiler")
@freekh
freekh / Emscripten.scala
Last active December 30, 2015 03:19
Emscripten 001
import sbt._
import sbt.Keys._
import play.Keys._
import play.PlayExceptions._
import play.PlaySourceGenerators
object EmscriptenKeys {
val eccFiles = taskKey[PathFinder]("C/C++ files to be compiled")
val eccCompiler = settingKey[String]("Path to Emscripten compiler")
}
@freekh
freekh / gist:6549741
Created September 13, 2013 11:57 — forked from phaller/gist:6549614
Akka Team Blog:
http://letitcrash.com/
Shutdown Patterns in Akka 2:
http://letitcrash.com/post/30165507578/shutdown-patterns-in-akka-2
An Akka 2 Terminator:
http://letitcrash.com/post/29773618510/an-akka-2-terminator
@freekh
freekh / constraint-galore
Created September 11, 2013 18:04
adept test cases
val A10s210 = {
Variant("A",
attributes = Set(
Attribute("version", Set("1.0")),
Attribute("scala-binary-version", Set("2.10"))),
artifacts = Set(
Artifact("a10s210", Set(Configuration("compile")))),
configurations = Map(
Configuration("compile") -> Set(
@freekh
freekh / Build.scala
Created August 2, 2013 21:02
Replace the TODO with the path to the adept project and put this in the project/project/Build.scala file and it will load adept as a plugin
import sbt._
import sbt.Keys._
/** needed only till adept is released */
object PlayPlugins extends Build {
val adeptProjectPath = "TODO"
lazy val adeptSbt = ProjectRef(file(), "adept-sbt") //TODO: remove this file
lazy val root = Project(id = "play-adept-project",
base = file("."),