Permalink
Browse files

SBT project initialization: Util

  • Loading branch information...
1 parent 7cad135 commit 502c2aa8c4ad040de35e539745386dccdff24075 @melezov committed Mar 1, 2013
View
@@ -0,0 +1,6 @@
+.cache
+.classpath
+.project
+.settings
+target
+.target
View
26 LICENSE
@@ -0,0 +1,26 @@
+Copyright (c) 2013, Element d.o.o.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+3. Neither the name of the Element d.o.o. nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
View
@@ -0,0 +1,5 @@
+@echo off
+
+echo Performing dependency update for all projects ...
+echo Will also create Eclipse .project and .classpath files ...
+call "%~dp0sbt.bat" --no-jrebel %* update eclipse
View
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+echo Performing dependency update for all projects ...
+echo Will also create Eclipse .project and .classpath files ...
+`dirname $0`/sbt.sh --no-jrebel "$@" update eclipse
View
@@ -0,0 +1,157 @@
+import sbt._
+import Keys._
+
+object BuildSettings {
+ import Default._
+
+// ###########################################################################
+
+ val bsUtil = javaSettings ++ Seq(
+ name := "jvm-util"
+ , version := "0.0.1-SNAPSHOT"
+ , initialCommands := "import io.jvm._"
+ )
+}
+
+// ---------------------------------------------------------------------------
+
+object Dependencies {
+ val scala = "org.scala-lang" % "scala-library" % (_: String)
+ val scalaTest = "org.scalatest" %% "scalatest" % "2.0.M5b"
+
+ val ldUtil = libraryDependencies <++= (version, scalaVersion) ( (v, sV) => Seq(
+ scala(sV) % (if (v endsWith "SNAPSHOT") "compile" else "test")
+ , scalaTest % "test"
+ ))
+}
+
+// ###########################################################################
+
+object JvmIoBuild extends Build {
+ import BuildSettings._
+ import Default._
+ import Dependencies._
+
+ lazy val util = Project(
+ "util"
+ , file("util")
+ , settings = bsUtil :+ ldUtil
+ )
+}
+
+// ---------------------------------------------------------------------------
+
+object Repositories {
+ val ElementNexus = "Element Nexus" at "http://repo.element.hr/nexus/content/groups/public/"
+ val ElementReleases = "Element Releases" at "http://repo.element.hr/nexus/content/repositories/releases/"
+ val ElementSnapshots = "Element Snapshots" at "http://repo.element.hr/nexus/content/repositories/snapshots/"
+}
+
+// ---------------------------------------------------------------------------
+
+object Resolvers {
+ import Repositories._
+
+ lazy val settings = Seq(
+ resolvers := Seq(ElementNexus)
+ , externalResolvers <<= resolvers map { r =>
+ Resolver.withDefaultResolvers(r, mavenCentral = false)
+ }
+ )
+}
+
+// ---------------------------------------------------------------------------
+
+object Publishing {
+ import Repositories._
+
+ lazy val settings = Seq(
+ publishTo <<= version { version => Some(
+ if (version endsWith "SNAPSHOT") ElementSnapshots else ElementReleases
+ )}
+ , credentials += Credentials(Path.userHome / ".config" / "jvm.io" / "nexus.config")
+ , publishArtifact in (Compile, packageDoc) := false
+ )
+}
+
+// ---------------------------------------------------------------------------
+
+object Default {
+ //Eclipse plugin
+ import com.typesafe.sbteclipse.plugin.EclipsePlugin._
+
+ //Dependency graph plugin
+ import net.virtualvoid.sbt.graph.Plugin._
+
+ val scala2_8 = Seq(
+ "-unchecked"
+ , "-deprecation"
+ , "-optimise"
+ , "-encoding", "UTF-8"
+ , "-Xcheckinit"
+ , "-Xfatal-warnings"
+ , "-Yclosure-elim"
+ , "-Ydead-code"
+ , "-Yinline"
+ )
+
+ val scala2_9 = Seq(
+ "-Xmax-classfile-name", "72"
+ )
+
+ val scala2_9_1 = Seq(
+ "-Yrepl-sync"
+ , "-Xlint"
+ , "-Xverify"
+ , "-Ywarn-all"
+ )
+
+ val scala2_10 = Seq(
+ "-feature"
+ , "-language:postfixOps"
+ , "-language:implicitConversions"
+ , "-language:existentials"
+ )
+
+ lazy val scalaSettings =
+ Defaults.defaultSettings ++
+ eclipseSettings ++
+ graphSettings ++
+ Resolvers.settings ++
+ Publishing.settings ++ Seq(
+ organization := "io.jvm"
+
+ , scalaVersion <<= crossScalaVersions(_.last)
+ , crossScalaVersions := Seq(
+ "2.8.0", "2.8.1", "2.8.2", "2.8.3"
+ , "2.9.0", "2.9.0-1", "2.9.1", "2.9.1-1", "2.9.2", "2.9.3"
+ , "2.10.1-RC2"
+ )
+ , scalacOptions <<= scalaVersion map ( sV => scala2_8 ++ (sV match {
+ case x if (x startsWith "2.10.") => scala2_9 ++ scala2_9_1 ++ scala2_10
+ case x if (x startsWith "2.9.") && x >= "2.9.1" => scala2_9 ++ scala2_9_1
+ case x if (x startsWith "2.9.") => scala2_9
+ case _ => Nil
+ } )
+ )
+
+ , javaHome := sys.env.get("JDK16_HOME").map(file(_))
+ , javacOptions := Seq(
+ "-deprecation"
+ , "-encoding", "UTF-8"
+ , "-Xlint:unchecked"
+ , "-source", "1.6"
+ , "-target", "1.6"
+ )
+
+ , unmanagedSourceDirectories in Compile <<= (scalaSource in Compile)(_ :: Nil)
+ , unmanagedSourceDirectories in Test <<= (scalaSource in Test )(_ :: Nil)
+ )
+
+ lazy val javaSettings =
+ scalaSettings ++ Seq(
+ autoScalaLibrary := false
+ , crossPaths := false
+ , unmanagedSourceDirectories in Compile <<= (javaSource in Compile)(_ :: Nil)
+ )
+}
View
@@ -0,0 +1,30 @@
+resolvers := Seq(
+ "Element Nexus" at "http://repo.element.hr/nexus/content/groups/public/"
+, Resolver.url("Element Nexus (Ivy)",
+ url("http://repo.element.hr/nexus/content/groups/public/"))(Resolver.ivyStylePatterns)
+)
+
+externalResolvers <<= resolvers map { r =>
+ Resolver.withDefaultResolvers(r, mavenCentral = false)
+}
+
+libraryDependencies += "net.sf.jasmin" % "jasmin" % "2.4"
+
+// =======================================================================================
+
+// +-------------------------------------------------------------------------------------+
+// | SBT Eclipse (https://github.com/typesafehub/sbteclipse) |
+// | Creates .project and .classpath files for easy Eclipse project imports |
+// | |
+// | See also: Eclipse downloads (http://www.eclipse.org/downloads/) |
+// | See also: Scala IDE downloads (http://download.scala-ide.org/) |
+// +-------------------------------------------------------------------------------------+
+
+addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.1")
+
+// +-------------------------------------------------------------------------------------+
+// | Dependency graph SBT plugin (https://github.com/jrudolph/sbt-dependency-graph) |
+// | Lists all library dependencies in a nicely formatted way for easy inspection. |
+// +-------------------------------------------------------------------------------------+
+
+addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.0")
View
@@ -0,0 +1 @@
+sbt-launch-*.jar
Binary file not shown.
@@ -0,0 +1,27 @@
+[scala]
+ version: ${sbt.scala.version-auto}
+
+[app]
+ org: ${sbt.organization-org.scala-sbt}
+ name: sbt
+ version: ${sbt.version-read(sbt.version)[0.12.2]}
+ class: ${sbt.main.class-sbt.xMain}
+ components: xsbti,extra
+ cross-versioned: ${sbt.cross.versioned-false}
+
+[repositories]
+ local
+ element-repo-maven: http://repo.element.hr/nexus/content/groups/public/
+ element-repo-ivy: http://repo.element.hr/nexus/content/groups/public/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext]
+
+[boot]
+ directory: ../.sbt/jvm.io
+
+[ivy]
+ ivy-home: ../.ivy2/jvm.io
+ checksums: ${sbt.checksums-sha1,md5}
+ override-build-repos: ${sbt.override.build.repos-false}
+ repository-config: ${sbt.repository.config-${sbt.global.base-${user.home}/.sbt}/repositories}
+
+[log]
+ level: info
View
75 sbt.bat
@@ -0,0 +1,75 @@
+@echo off
+setlocal
+pushd
+cd "%~dp0"
+
+set JVM_PARAMS=-Xss2m -Xms2g -Xmx2g -XX:+TieredCompilation -XX:ReservedCodeCacheSize=256m -XX:MaxPermSize=256m -XX:+CMSClassUnloadingEnabled -XX:+UseNUMA -XX:+UseParallelGC -Dscalac.patmat.analysisBudget=off
+
+set LIFT_RUN_MODE=-Drun.mode=development
+set TRY_JREBEL=true
+set LOG_LEVEL=
+set NO_PAUSE=false
+set DO_LOOP=false
+
+:PARSER_LOOP
+if "%~1"=="" goto :PARSER_END
+
+if "%~1"=="--prod" (
+ set LIFT_RUN_MODE=-Drun.mode=production
+ goto :PARSER_CONTINUE
+)
+
+if "%~1"=="--debug" (
+ set LOG_LEVEL="set logLevel:=Level.Debug"
+ goto :PARSER_CONTINUE
+)
+
+if "%~1"=="~lift" (
+ set SBT_PARAMS=%SBT_PARAMS% container:start ~compile container:stop
+ set JREBEL_PLUGINS=%JREBEL_PLUGINS% -Drebel.lift_plugin=true
+ goto :PARSER_CONTINUE
+)
+
+if "%~1"=="--no-jrebel" (
+ set TRY_JREBEL=false
+ goto :PARSER_CONTINUE
+)
+
+if "%~1"=="--loop" (
+ set DO_LOOP=true
+ goto :PARSER_CONTINUE
+)
+
+if "%~1"=="--no-pause" (
+ set NO_PAUSE=true
+ goto :PARSER_CONTINUE
+)
+
+set SBT_PARAMS=%SBT_PARAMS% %1
+
+:PARSER_CONTINUE
+shift
+goto :PARSER_LOOP
+:PARSER_END
+
+set JVM_PARAMS=%JVM_PARAMS% %LIFT_RUN_MODE%
+if %TRY_JREBEL%.==true. (
+ if exist "%JREBEL_HOME%\jrebel.jar" set JVM_PARAMS=%JVM_PARAMS% -noverify -javaagent:"%JREBEL_HOME%\jrebel.jar" %JREBEL_PLUGINS%
+)
+
+set GRUJ_PATH=project\strap\gruj_vs_sbt-launch-0.12.2.jar
+set RUN_CMD=java %JVM_PARAMS% -jar %GRUJ_PATH% %LOG_LEVEL% %SBT_PARAMS%
+
+:RUN_LOOP
+%RUN_CMD%
+
+if %DO_LOOP%.==true. (
+ if %NO_PAUSE%.==false. (
+ echo Press Enter to continue or Press CTRL+C to exit!
+ pause
+ )
+ goto :RUN_LOOP
+)
+
+popd
+endlocal
Oops, something went wrong.

0 comments on commit 502c2aa

Please sign in to comment.