From 58a538af45fe545dbb9468764c4e9a92851a8335 Mon Sep 17 00:00:00 2001 From: Ivan Topolnjak Date: Tue, 17 Jan 2017 11:04:01 +0100 Subject: use kamon-sbt-umbrella on the build. --- build.sbt | 20 ++--------- project/Dependencies.scala | 44 ------------------------ project/Publish.scala | 50 --------------------------- project/Release.scala | 80 -------------------------------------------- project/Settings.scala | 65 ----------------------------------- project/VersionWithSHA.scala | 28 ---------------- project/plugins.sbt | 14 ++------ 7 files changed, 4 insertions(+), 297 deletions(-) delete mode 100644 project/Dependencies.scala delete mode 100644 project/Publish.scala delete mode 100644 project/Release.scala delete mode 100644 project/Settings.scala delete mode 100644 project/VersionWithSHA.scala diff --git a/build.sbt b/build.sbt index acbccee7..c8fff2c9 100644 --- a/build.sbt +++ b/build.sbt @@ -14,35 +14,26 @@ */ -import Settings._ -import Dependencies._ - lazy val kamon = (project in file(".")) .settings(moduleName := "root") - .settings(basicSettings: _*) - .settings(formatSettings: _*) .settings(noPublishing: _*) .aggregate(core, autoweave, testkit, bench) lazy val core = (project in file("kamon-core")) .settings(moduleName := "kamon-core") - .settings(basicSettings: _*) - .settings(formatSettings: _*) .settings( libraryDependencies ++= compileScope(akkaDependency("actor").value, hdrHistogram, slf4jApi) ++ providedScope(aspectJ) ++ - optionalScope(logback) ++ - testScope(scalatest, akkaDependency("testkit").value, akkaDependency("slf4j").value, logback)) + optionalScope(logbackClassic) ++ + testScope(scalatest, akkaDependency("testkit").value, akkaDependency("slf4j").value, logbackClassic)) lazy val autoweave = (project in file("kamon-autoweave")) .dependsOn(core) .settings(moduleName := "kamon-autoweave") - .settings(basicSettings: _*) - .settings(formatSettings: _*) .settings( libraryDependencies ++= compileScope(aspectJ) ++ @@ -52,8 +43,6 @@ lazy val autoweave = (project in file("kamon-autoweave")) lazy val testkit = (project in file("kamon-testkit")) .dependsOn(core) .settings(moduleName := "kamon-testkit") - .settings(basicSettings: _*) - .settings(formatSettings: _*) .settings( libraryDependencies ++= compileScope(akkaDependency("actor").value, akkaDependency("testkit").value) ++ @@ -63,10 +52,5 @@ lazy val testkit = (project in file("kamon-testkit")) lazy val bench = (project in file("kamon-bench")) .dependsOn(core) .settings(moduleName := "kamon-bench") - .settings(basicSettings: _*) - .settings(formatSettings: _*) .settings(noPublishing: _*) .enablePlugins(JmhPlugin) - - -lazy val noPublishing = Seq(publish := (), publishLocal := (), publishArtifact := false) diff --git a/project/Dependencies.scala b/project/Dependencies.scala deleted file mode 100644 index 14d837e4..00000000 --- a/project/Dependencies.scala +++ /dev/null @@ -1,44 +0,0 @@ -/* ========================================================================================= - * Copyright © 2013-2016 the kamon project - * - * 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. - * ========================================================================================= - */ - -import sbt._ -import Keys._ - -object Dependencies { - - val resolutionRepos = Seq( - "typesafe repo" at "http://repo.typesafe.com/typesafe/releases/", - "Kamon Repository Snapshots" at "http://snapshots.kamon.io" - ) - - val aspectJ = "org.aspectj" % "aspectjweaver" % "1.8.10" - val hdrHistogram = "org.hdrhistogram" % "HdrHistogram" % "2.1.9" - val slf4jApi = "org.slf4j" % "slf4j-api" % "1.7.7" - val slf4jnop = "org.slf4j" % "slf4j-nop" % "1.7.7" - val logback = "ch.qos.logback" % "logback-classic" % "1.0.13" - val scalatest = "org.scalatest" %% "scalatest" % "3.0.1" - - def akkaDependency(moduleName: String) = Def.setting { - scalaBinaryVersion.value match { - case "2.10" | "2.11" => "com.typesafe.akka" %% s"akka-$moduleName" % "2.3.15" - case "2.12" => "com.typesafe.akka" %% s"akka-$moduleName" % "2.4.14" - } - } - - def compileScope (deps: ModuleID*): Seq[ModuleID] = deps map (_ % "compile") - def testScope (deps: ModuleID*): Seq[ModuleID] = deps map (_ % "test") - def providedScope (deps: ModuleID*): Seq[ModuleID] = deps map (_ % "provided") - def optionalScope (deps: ModuleID*): Seq[ModuleID] = deps map (_ % "compile,optional") -} diff --git a/project/Publish.scala b/project/Publish.scala deleted file mode 100644 index ddb64d2d..00000000 --- a/project/Publish.scala +++ /dev/null @@ -1,50 +0,0 @@ -/* ========================================================================================= - * Copyright © 2013-2014 the kamon project - * - * 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. - * ========================================================================================= - */ - -import sbt._ -import sbt.Keys._ - -object Publish { - - lazy val settings = Seq( - crossPaths := true, - pomExtra := kamonPomExtra, - publishTo := kamonRepo, - organization := "io.kamon", - pomIncludeRepository := { x => false }, - publishMavenStyle := true, - publishArtifact in Test := false - ) - - def kamonRepo = Some(Resolver.sftp("Kamon Snapshots Repository", "snapshots.kamon.io", "/var/local/snapshots-repo")) - - def kamonPomExtra = { - http://kamon.io - - - Apache 2 - http://www.apache.org/licenses/LICENSE-2.0.txt - - - - git://github.com/kamon-io/Kamon.git - scm:git:git@github.com:kamon-io/Kamon.git - - - ivantopoIvan Topolnjakhttps://twitter.com/ivantopo - dpsoftDiego Parrahttps://twitter.com/diegolparra - - } -} diff --git a/project/Release.scala b/project/Release.scala deleted file mode 100644 index a388a66f..00000000 --- a/project/Release.scala +++ /dev/null @@ -1,80 +0,0 @@ -/* ========================================================================================= - * Copyright © 2013-2014 the kamon project - * - * 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. - * ========================================================================================= - */ - -import com.typesafe.sbt.pgp._ -import sbt._ -import sbt.Keys._ -import sbtrelease.ReleasePlugin._ -import sbtrelease.ReleaseStateTransformations._ -import sbtrelease.ReleaseStep -import sbtrelease.Utilities._ -import xerial.sbt.Sonatype._ - -object Release { - - def settings = Seq.empty ++ - releaseSettings ++ - Seq( - ReleaseKeys.releaseProcess := Seq[ReleaseStep]( - checkSnapshotDependencies, - inquireVersions, - runClean, - runTest, - setReleaseVersion, - commitReleaseVersion, // .copy(check = identity), // FIX 0: to skip "all changes committed" precondition - tagRelease, - publishSignedArtifacts, // FIX 1: publish signed. Otherwise sonatype won't sync artifact to maven central - setNextVersion, - commitNextVersion, - pushChanges, - refreshVersionWithSHA // FIX 2: update "version" by replacing the "-SNAPSHOT" with "-WHATEVER_COMMIT_SHA" - ) - ) ++ - sonatypeSettings ++ - Seq( - // sbt-sonatype overrides publishTo. So we need to restore kamon repo declaration for snapshots - publishTo := { if (isSnapshot.value) Publish.kamonRepo else publishTo.value } - ) - - - def kamonSonatypeCredentials = - Credentials.toDirect(Credentials(Path.userHome / ".ivy2" / "kamon-credentials-sonatype.properties")) - - /** - * Hijacked from [[sbtrelease.ReleaseStateTransformations.publishArtifacts]] - */ - lazy val publishSignedArtifacts = ReleaseStep( - action = { st: State => - val extracted = st.extract - val ref = extracted.get(thisProjectRef) - extracted.runAggregated(PgpKeys.publishSigned in Global in ref, st) - }, - check = st => { - // getPublishTo fails if no publish repository is set up. - val ex = st.extract - val ref = ex.get(thisProjectRef) - Classpaths.getPublishTo(ex.get(publishTo in Global in ref)) - st - }, - enableCrossBuild = true - ) - - lazy val refreshVersionWithSHA = ReleaseStep(st => { - reapply(Seq( - version in ThisBuild := VersionWithSHA.kamonVersionWithSHA(st.extract.get(version)) - ), st) - }) - -} \ No newline at end of file diff --git a/project/Settings.scala b/project/Settings.scala deleted file mode 100644 index 2b6b093d..00000000 --- a/project/Settings.scala +++ /dev/null @@ -1,65 +0,0 @@ -/* ========================================================================================= - * Copyright © 2013-2016 the kamon project - * - * 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. - * ========================================================================================= - */ - -import sbt._ -import Keys._ -import com.typesafe.sbt.SbtScalariform -import com.typesafe.sbt.SbtScalariform.ScalariformKeys -import Publish.{settings => publishSettings} -import Release.{settings => releaseSettings} -import scalariform.formatter.preferences._ - -object Settings { - - val SVersion = "2.12.1" - - lazy val basicSettings = Seq( - ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) }, - scalaVersion := SVersion, - crossScalaVersions := Seq("2.10.6", "2.11.8", "2.12.1"), - resolvers ++= Dependencies.resolutionRepos, - fork in run := true, - parallelExecution in Global := false, - scalacOptions := commonScalacOptions, - javacOptions := commonJavaOptions - ) ++ publishSettings ++ releaseSettings - - lazy val commonJavaOptions = Seq("-Xlint:-options") - - lazy val commonScalacOptions = Seq( - "-encoding", - "utf8", - "-g:vars", - "-feature", - "-unchecked", - "-deprecation", - "-language:postfixOps", - "-language:implicitConversions", - "-Xlog-reflective-calls", - "-Ywarn-dead-code" - ) - - lazy val formatSettings = SbtScalariform.scalariformSettings ++ Seq( - ScalariformKeys.preferences in Compile := formattingPreferences, - ScalariformKeys.preferences in Test := formattingPreferences - ) - - def formattingPreferences = - FormattingPreferences() - .setPreference(RewriteArrowSymbols, true) - .setPreference(AlignParameters, false) - .setPreference(AlignSingleLineCaseStatements, true) - .setPreference(DoubleIndentClassDeclaration, true) -} diff --git a/project/VersionWithSHA.scala b/project/VersionWithSHA.scala deleted file mode 100644 index 58139f7f..00000000 --- a/project/VersionWithSHA.scala +++ /dev/null @@ -1,28 +0,0 @@ -/* ========================================================================================= - * Copyright © 2013-2016 the kamon project - * - * 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. - * ========================================================================================= - */ - -import sbt.Process - -object VersionWithSHA { - - private lazy val VersionWithShaRegex = """(?:\d+\.)?(?:\d+\.)?(?:\d+)-[0-9a-f]{5,40}""" - - /** Don't use this. You should use version.value instead. */ - def kamonVersionWithSHA(version: String) = version.takeWhile(_ != '-') + "-" + Process("git rev-parse HEAD").lines.head - - /** Don't use this. You should use isSnapshot.value instead. */ - def kamonIsSnapshot(version: String) = (version matches VersionWithShaRegex) || (version endsWith "-SNAPSHOT") - -} \ No newline at end of file diff --git a/project/plugins.sbt b/project/plugins.sbt index 7cd8953d..5d8fc573 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,13 +1,3 @@ -resolvers += "Sonatype snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/" - -resolvers += "Kamon Releases" at "http://repo.kamon.io" - -addSbtPlugin("com.typesafe.sbt" % "sbt-aspectj" % "0.10.6") -addSbtPlugin("com.github.gseitz" % "sbt-release" % "0.8.2") -addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.6.0") -addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "0.2.1") -addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.1") -addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.8.1") -addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.2.18") - +resolvers += Resolver.bintrayIvyRepo("kamon-io", "sbt-plugins") +addSbtPlugin("io.kamon" % "kamon-sbt-umbrella" % "0.0.5") -- cgit v1.2.3