Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update build script #8

Merged
merged 5 commits into from
Jan 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
language: scala
scala:
- 2.12.1
- 2.11.8

script: sbt ++$TRAVIS_SCALA_VERSION test -Dloglevel=debug
script: sbt ++$TRAVIS_SCALA_VERSION test

before_install:
- gem update --system 2.2.0
Expand Down
20 changes: 5 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fluentd-standalone
fluentd-standalone [![Build Status](https://travis-ci.org/xerial/fluentd-standalone.svg?branch=develop)](https://travis-ci.org/xerial/fluentd-standalone) ![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.xerial/fluentd-standalone_2.12/badge.svg) [![Scaladoc](http://javadoc-badge.appspot.com/org.xerial/fluentd-standalone_2.12.svg?label=scaladoc)](http://javadoc-badge.appspot.com/org.xerial/fluentd-standalone_2.12)
=========

Standalone fluentd (http://fluentd.org) server for Java and Scala.
Expand Down Expand Up @@ -26,16 +26,16 @@ See also http://docs.fluentd.org/articles/quickstart.
...
<dependency>
<groupId>org.xerial</groupId>
<artifactId>fluentd-standalone</artifactId>
<version>0.1.2</version>
<artifactId>fluentd-standalone_2.12</artifactId>
<version>0.14.14</version>
</dependency>
...
</dependencies>
```

### sbt
```
libraryDependencies += "org.xerial" % "fluentd-standalone" % "0.1.2"
libraryDependencies += "org.xerial" %% "fluentd-standalone" % "0.14.14"
```

## Sample code
Expand Down Expand Up @@ -64,15 +64,5 @@ $ git submodule init # Only for the first time
$ git submodule update # Fetch fluentd

# Run tests
$ ./sbt test -Dloglevel=debug
$ ./sbt test
```


For using Travis CI (http://travis-ci.org), add the following settings to install ruby dependencies fluentd.

.travis.yml
```
before_install: gem install fluentd
```

* [Scala API](https://oss.sonatype.org/service/local/repositories/releases/archive/org/xerial/fluentd-standalone/0.1.2/fluentd-standalone-0.1.2-javadoc.jar/!/index.html#xerial.fluentd.FluentdStandalone$)
13 changes: 13 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Release Notes

## 0.14.14

- Upgrade to fluentd 0.14.14
- Scala 2.12, 2.11 support.
- Dropped Scala 2.10 support

## 0.1.2
- Fixed temporary folder to extract fluentd

## 0.1
- The first release
90 changes: 40 additions & 50 deletions project/Build.scala → build.sbt
Original file line number Diff line number Diff line change
@@ -1,75 +1,50 @@
import sbt._
import sbt.Keys._
import ReleaseTransformations._

object Build extends sbt.Build {
val copyFluentd = taskKey[Unit]("Embed fluentd into jar")
val SCALA_VERSION = "2.12.1"

private def profile = System.getProperty("xerial.profile", "default")

def releaseResolver(v: String): Option[Resolver] = {
profile match {
case "default" => {
val nexus = "https://oss.sonatype.org/"
if (v.trim.endsWith("SNAPSHOT"))
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
case p => {
scala.Console.err.println("unknown xerial.profile '%s'".format(p))
None
}
}
}

val copyFluentd = TaskKey[Unit]("copy-fluentd", "Embed fluend into jar")

val SCALA_VERSION = "2.12.1"

lazy val root = Project(
lazy val root = Project(
id = "fluentd-standalone",
base = file("."),
settings = Defaults.defaultSettings ++ sbtrelease.ReleasePlugin.releaseSettings ++
Seq(
settings = Seq(
organization := "org.xerial",
organizationName := "xerial.org",
organizationHomepage := Some(new URL("http://github.com/xerial/fluentd-standalone")),
description := "Standalone fluend server for Java and Scala",
scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature"),
// custom settings here
scalaVersion := SCALA_VERSION,
crossScalaVersions := Seq("2.10.5", "2.11.8", SCALA_VERSION),
crossScalaVersions := Seq("2.11.8", SCALA_VERSION),
crossPaths := true,
publishMavenStyle := true,
publishArtifact in Test := false,
publishTo <<= version { v => releaseResolver(v) },
compile in Compile <<= (compile in Compile).dependsOn(copyFluentd),
compile in Compile := { (compile in Compile).dependsOn(copyFluentd).value },
copyFluentd := {
val baseDir : File = baseDirectory.value
val fluentd = baseDir / "fluentd"

Seq("2.10", "2.11", "2.12").foreach { ScalaV =>
val targetDir : File = target.value / s"scala-$ScalaV" / "classes/xerial/fluentd/core"
val s = streams.value
def rpath(path:File) = path.relativeTo(baseDir).getOrElse(path)
val targetDir : File = (classDirectory in Compile).value / "xerial/fluentd/core"
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cory-p-oncota FYI. I've found classDirectory is a more straightforward way to specify the class file directory for each Scala version.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slick! Thanks, will throw that in my toolbox.

val s = streams.value
def rpath(path:File) = path.relativeTo(baseDir).getOrElse(path)

s.log.info("copy " + rpath(fluentd) + " to " + rpath(targetDir))
val p = (fluentd ** "*")
for(file <- p.get; relPath <- file.relativeTo(fluentd) if !relPath.getPath.startsWith(".git")) {
val out = targetDir / relPath.getPath
if(file.isDirectory) {
s.log.debug("create directory: " + rpath(out))
IO.createDirectory(out)
}
else {
s.log.debug("copy " + rpath(file) + " to " + rpath(out))
IO.copyFile(file, out, preserveLastModified=true)
}
s.log.info("copy " + rpath(fluentd) + " to " + rpath(targetDir))
val p = (fluentd ** "*")
for(file <- p.get; relPath <- file.relativeTo(fluentd) if !relPath.getPath.startsWith(".git")) {
val out = targetDir / relPath.getPath
if(file.isDirectory) {
s.log.debug("create directory: " + rpath(out))
IO.createDirectory(out)
}
else {
s.log.debug("copy " + rpath(file) + " to " + rpath(out))
IO.copyFile(file, out, preserveLastModified=true)
}
}
},
logBuffered in Test := false,
libraryDependencies ++= Seq(
// Add dependent jars here
"org.wvlet" %% "wvlet-log" % "1.1",
"org.xerial" %% "xerial-core" % "3.6.0",
"org.slf4j" % "slf4j-simple" % "1.7.22" % "test",
"org.scalatest" %% "scalatest" % "3.0.1" % "test"
Expand Down Expand Up @@ -98,8 +73,23 @@ object Build extends sbt.Build {
<url>http://xerial.org/leo</url>
</developer>
</developers>
}

},
// Release settings
releaseTagName := { (version in ThisBuild).value },
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
ReleaseStep(action = Command.process("publishSigned", _), enableCrossBuild = true),
setNextVersion,
commitNextVersion,
ReleaseStep(action = Command.process("sonatypeReleaseAll", _), enableCrossBuild = true),
pushChanges
),
releaseCrossBuild := true
)
)
}
16 changes: 4 additions & 12 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.5.1")

addSbtPlugin("com.github.gseitz" % "sbt-release" % "0.8")









addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.3")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "1.1")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-M14-7")
Loading