Skip to content

Commit

Permalink
Support sbt.
Browse files Browse the repository at this point in the history
  • Loading branch information
takeshita committed Dec 9, 2011
1 parent 023eae5 commit e0606e4
Show file tree
Hide file tree
Showing 5 changed files with 242 additions and 42 deletions.
22 changes: 22 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,26 @@ C:/Documents and Settings/(user name)/.m2/repository
$ mvn release:prepare
$ mvn release:perform

Default scala version is set to 2.9.0.
If you want to compile in scala version 2.9.1 or 2.9.0-1, replace pom.xml property or use sbt.

This project also support sbt 0.11.2.

In sbt console.
To build
$ package

Generate poms
$+ make-pom

make-pom generate maven pom files into target/{scala.version}.










70 changes: 29 additions & 41 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,45 @@
<maven.compiler.source>1.5</maven.compiler.source>
<maven.compiler.target>1.5</maven.compiler.target>
<encoding>UTF-8</encoding>
<!--<scala.version>2.8.1</scala.version> -->
<scala.version>2.9.0</scala.version>
</properties>


<profiles>

<!-- deploy setting -->
<profile>
<id>scala-2.8.1</id>
<properties>
<scala.version>2.8.1</scala.version>
</properties>
</profile>
<profile>
<id>scala-2.9.0</id>
<id>default_deploy</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<scala.version>2.9.0</scala.version>
</properties>
<distributionManagement>
<repository>
<uniqueVersion>false</uniqueVersion>
<id>msgpack.org</id>
<name>Repository at msgpack.org</name>
<url>file://${project.build.directory}/website/maven2/</url>
</repository>
<snapshotRepository>
<uniqueVersion>true</uniqueVersion>
<id>msgpack.org</id>
<name>Repository at msgpack.org</name>
<url>file://${project.build.directory}/website/maven2/</url>
</snapshotRepository>
</distributionManagement>
</profile>
<profile>
<id>scala-2.9.1</id>
<properties>
<scala.version>2.9.1</scala.version>
</properties>
<id>to_my_repo</id>
<distributionManagement>
<repository>
<id>geishatokyo-releases</id>
<url>${deploy-release}</url>
</repository>
<snapshotRepository>
<id>geishatokyo-snapshots</id>
<url>${deploy-snapshot}</url>
</snapshotRepository>
</distributionManagement>
</profile>
</profiles>

Expand Down Expand Up @@ -92,32 +106,6 @@
</dependency>
</dependencies>

<distributionManagement>
<!--<repository>
<uniqueVersion>false</uniqueVersion>
<id>msgpack.org</id>
<name>Repository at msgpack.org</name>
<url>file://${project.build.directory}/website/maven2/</url>
</repository>
<snapshotRepository>
<uniqueVersion>true</uniqueVersion>
<id>msgpack.org</id>
<name>Repository at msgpack.org</name>
<url>file://${project.build.directory}/website/maven2/</url>
</snapshotRepository>-->
<repository>
<uniqueVersion>false</uniqueVersion>
<id>deploy.release</id>
<name>Repository for release</name>
<url>${deploy-release-url}</url>
</repository>
<snapshotRepository>
<uniqueVersion>true</uniqueVersion>
<id>deploy.snapshot</id>
<name>Repository for snapshot</name>
<url>${deploy-snapshot-url}</url>
</snapshotRepository>
</distributionManagement>

<build>
<sourceDirectory>src/main/scala</sourceDirectory>
Expand Down
50 changes: 50 additions & 0 deletions project/Build.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import sbt._
import Keys._
import Process._
import xml.XML

object MessagePackScalaBuild extends Build {

val messagePackVersion = "0.6.4-SNAPSHOT"


override lazy val settings = super.settings ++
Seq(
organization := "org.msgpack",
name := "msgpack-scala",
version := messagePackVersion,
scalaVersion := "2.9.0",
crossScalaVersions := Seq("2.9.0","2.9.0-1","2.9.1"),
resolvers ++= Seq(Resolver.mavenLocal),
parallelExecution in Test := false
)

lazy val dependencies = Seq(
"org.msgpack" % "msgpack" % messagePackVersion
)

lazy val dependenciesForTest = Seq(
"junit" % "junit" % "4.8.1" % "test",
"log4j" % "log4j" % "1.2.16" % "test"
)

lazy val scalaSpecs = (scalaVersion) { v => { v match{
case "2.9.1" => "org.scala-tools.testing" %% "specs" % "1.6.9" % "test"
case _ => "org.scala-tools.testing" %% "specs" % "1.6.8" % "test"
}}}


lazy val root = Project(id = "msgpack-scala",
base = file("."),
settings = Project.defaultSettings ++ Seq(
libraryDependencies ++= dependencies,
libraryDependencies ++= dependenciesForTest,
libraryDependencies <+= scalaSpecs,
pomExtra := loadPomExtra()
)
)

def loadPomExtra() = {
XML.loadFile( file( "./project/pomExtra.xml")).child
}
}
139 changes: 139 additions & 0 deletions project/pomExtra.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
<pomExtra>

<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>

<properties>
<maven.compiler.source>1.5</maven.compiler.source>
<maven.compiler.target>1.5</maven.compiler.target>
<encoding>UTF-8</encoding>
</properties>


<profiles>

<!-- deploy setting -->
<profile>
<id>default_deploy</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<distributionManagement>
<repository>
<uniqueVersion>false</uniqueVersion>
<id>msgpack.org</id>
<name>Repository at msgpack.org</name>
<url>file://${project.build.directory}/website/maven2/</url>
</repository>
<snapshotRepository>
<uniqueVersion>true</uniqueVersion>
<id>msgpack.org</id>
<name>Repository at msgpack.org</name>
<url>file://${project.build.directory}/website/maven2/</url>
</snapshotRepository>
</distributionManagement>
</profile>
<profile>
<id>to_my_repo</id>
<distributionManagement>
<repository>
<id>geishatokyo-releases</id>
<url>${deploy-release}</url>
</repository>
<snapshotRepository>
<id>geishatokyo-snapshots</id>
<url>${deploy-snapshot}</url>
</snapshotRepository>
</distributionManagement>
</profile>
</profiles>
<developers>
<developer>
<id>takeshita</id>
<name>Yositeru Takeshita</name>
<email>[email protected]</email>
</developer>
</developers>


<build>
<sourceDirectory>src/main/scala</sourceDirectory>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.15.0</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
<configuration>
<args>
<arg>-make:transitive</arg>
<arg>-dependencyfile</arg>
<arg>${project.build.directory}/.scala_dependencies</arg>
</args>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.6</version>
<configuration>
<useFile>false</useFile>
<disableXmlReport>true</disableXmlReport>
<includes>
<include>**/*Test.*</include>
<include>**/*Suite.*</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>

</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>

</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</pomExtra>
3 changes: 2 additions & 1 deletion src/test/scala/org/msgpack/PatternTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import org.junit.runner.RunWith
import org.specs.Specification
import org.specs.runner.{JUnit, JUnitSuiteRunner}
import org.specs.matcher.Matcher
import org.junit.Ignore

/**
*
Expand All @@ -37,7 +38,7 @@ class JavassistPatternTest extends PatternTestBase(ScalaMessagePack)
@RunWith(classOf[JUnitSuiteRunner])
class ReflectionPatternTest extends PatternTestBase(ScalaMessagePackForReflection)

class PatternTestBase(messagePack : ScalaMessagePackWrapper) extends Specification with JUnit{
abstract class PatternTestBase(messagePack : ScalaMessagePackWrapper) extends Specification with JUnit{

import messagePack._

Expand Down

0 comments on commit e0606e4

Please sign in to comment.