From c7a7fce0ab8aca01253166992644156663e70e17 Mon Sep 17 00:00:00 2001 From: Alexandru Nedelcu Date: Thu, 22 Sep 2016 10:43:42 +0300 Subject: [PATCH] Initial commit --- .java-version | 1 + build.sbt | 166 +++++++++++++++++++++++++++++++++++++++ project/build.properties | 18 +++++ project/plugins.sbt | 2 + version.sbt | 1 + 5 files changed, 188 insertions(+) create mode 100644 .java-version create mode 100644 build.sbt create mode 100644 project/build.properties create mode 100644 project/plugins.sbt create mode 100644 version.sbt diff --git a/.java-version b/.java-version new file mode 100644 index 00000000..62593409 --- /dev/null +++ b/.java-version @@ -0,0 +1 @@ +1.8 diff --git a/build.sbt b/build.sbt new file mode 100644 index 00000000..6056c2c0 --- /dev/null +++ b/build.sbt @@ -0,0 +1,166 @@ +import com.typesafe.sbt.pgp.PgpKeys + +lazy val projectSettings = Seq( + name := "monix-kafka", + organization := "io.monix", + scalaVersion := "2.11.8", + crossScalaVersions := Seq("2.10.6", "2.11.8", "2.12.0-RC1"), + + scalacOptions ++= Seq( + // warnings + "-unchecked", // able additional warnings where generated code depends on assumptions + "-deprecation", // emit warning for usages of deprecated APIs + "-feature", // emit warning usages of features that should be imported explicitly + // Features enabled by default + "-language:higherKinds", + "-language:implicitConversions", + "-language:experimental.macros", + // possibly deprecated options + "-Ywarn-dead-code", + "-Ywarn-inaccessible" + ), + + // Force building with Java 8 + initialize := { + val required = "1.8" + val current = sys.props("java.specification.version") + assert(current == required, s"Unsupported build JDK: java.specification.version $current != $required") + }, + + // Targeting Java 6, but only for Scala <= 2.11 + javacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { + case Some((2, majorVersion)) if majorVersion <= 11 => + // generates code with the Java 6 class format + Seq("-source", "1.6", "-target", "1.6") + case _ => + // For 2.12 we are targeting the Java 8 class format + Seq.empty + }), + + // Targeting Java 6, but only for Scala <= 2.11 + scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { + case Some((2, majorVersion)) if majorVersion <= 11 => + // generates code with the Java 6 class format + Seq("-target:jvm-1.6") + case _ => + // For 2.12 we are targeting the Java 8 class format + Seq.empty + }), + + // version specific compiler options + scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { + case Some((2, majorVersion)) if majorVersion >= 11 => + Seq( + // Turns all warnings into errors ;-) + "-Xfatal-warnings", + // Enables linter options + "-Xlint:adapted-args", // warn if an argument list is modified to match the receiver + "-Xlint:nullary-unit", // warn when nullary methods return Unit + "-Xlint:inaccessible", // warn about inaccessible types in method signatures + "-Xlint:nullary-override", // warn when non-nullary `def f()' overrides nullary `def f' + "-Xlint:infer-any", // warn when a type argument is inferred to be `Any` + "-Xlint:missing-interpolator", // a string literal appears to be missing an interpolator id + "-Xlint:doc-detached", // a ScalaDoc comment appears to be detached from its element + "-Xlint:private-shadow", // a private field (or class parameter) shadows a superclass field + "-Xlint:type-parameter-shadow", // a local type parameter shadows a type already in scope + "-Xlint:poly-implicit-overload", // parameterized overloaded implicit methods are not visible as view bounds + "-Xlint:option-implicit", // Option.apply used implicit view + "-Xlint:delayedinit-select", // Selecting member of DelayedInit + "-Xlint:by-name-right-associative", // By-name parameter of right associative operator + "-Xlint:package-object-classes", // Class or object defined in package object + "-Xlint:unsound-match" // Pattern match may not be typesafe + ) + case _ => + Seq.empty + }), + + // For warning of unused imports + scalacOptions += "-Ywarn-unused-import", + scalacOptions in (Compile, console) ~= {_.filterNot("-Ywarn-unused-import" == _)}, + scalacOptions in (Test, console) <<= (scalacOptions in (Compile, console)), + + scalacOptions in doc ++= + Opts.doc.title(s"Monix"), + scalacOptions in doc ++= + Opts.doc.sourceUrl(s"https://github.com/monixio/monix-kafka/tree/v${version.value}€{FILE_PATH}.scala"), + scalacOptions in doc ++= + Seq("-doc-root-content", file("docs/rootdoc.txt").getAbsolutePath), + scalacOptions in doc ++= + Opts.doc.version(s"${version.value}"), + + // ScalaDoc settings + autoAPIMappings := true, + scalacOptions in ThisBuild ++= Seq( + // Note, this is used by the doc-source-url feature to determine the + // relative path of a given source file. If it's not a prefix of a the + // absolute path of the source file, the absolute path of that file + // will be put into the FILE_SOURCE variable, which is + // definitely not what we want. + "-sourcepath", file(".").getAbsolutePath.replaceAll("[.]$", "") + ), + + parallelExecution in Test := false, + parallelExecution in IntegrationTest := false, + testForkedParallel in Test := false, + testForkedParallel in IntegrationTest := false, + concurrentRestrictions in Global += Tags.limit(Tags.Test, 1), + + resolvers ++= Seq( + "Typesafe Releases" at "http://repo.typesafe.com/typesafe/releases", + Resolver.sonatypeRepo("releases") + ), + + libraryDependencies ++= Seq( + "io.monix" %% "monix-reactive" % "2.0.1", + "org.apache.kafka" % "kafka-clients" % "0.10.0.1", + "com.typesafe" % "config" % "1.3.0", + "org.scalatest" %% "scalatest" % "2.2.4" % "test", + "net.manub" %% "scalatest-embedded-kafka" % "0.7.1" % "test" + ), + + // -- Settings meant for deployment on oss.sonatype.org + + useGpg := true, + useGpgAgent := true, + usePgpKeyHex("2673B174C4071B0E"), + + publishMavenStyle := true, + releaseCrossBuild := true, + releasePublishArtifactsAction := PgpKeys.publishSigned.value, + + publishTo := { + val nexus = "https://oss.sonatype.org/" + if (isSnapshot.value) + Some("snapshots" at nexus + "content/repositories/snapshots") + else + Some("releases" at nexus + "service/local/staging/deploy/maven2") + }, + + publishArtifact in Test := false, + pomIncludeRepository := { _ => false }, // removes optional dependencies + + pomExtra := + https://github.com/monixio/monix-kafka/ + + + Apache License, Version 2.0 + https://www.apache.org/licenses/LICENSE-2.0 + repo + + + + git@github.com:monixio/monix-kafka.git + scm:git:git@github.com:monixio/monix-kafka.git + + + + alex_ndc + Alexandru Nedelcu + https://alexn.org/ + + +) + +lazy val monixKafka = project.in(file(".")) + .settings(projectSettings) + diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 00000000..e42d27dc --- /dev/null +++ b/project/build.properties @@ -0,0 +1,18 @@ +# +# Copyright (c) 2014-2016 by its authors. Some rights reserved. +# See the project homepage at: https://github.com/monixio/monix-kafka +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +sbt.version=0.13.12 diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 00000000..82219ed2 --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1,2 @@ +addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0") +addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.0") diff --git a/version.sbt b/version.sbt new file mode 100644 index 00000000..15406820 --- /dev/null +++ b/version.sbt @@ -0,0 +1 @@ +version in ThisBuild := "0.1-SNAPSHOT"