aboutsummaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
Diffstat (limited to 'project')
-rw-r--r--project/Dependencies.scala8
-rw-r--r--project/Projects.scala10
-rw-r--r--project/Sigar.scala115
-rw-r--r--project/UnzipTask.scala64
4 files changed, 3 insertions, 194 deletions
diff --git a/project/Dependencies.scala b/project/Dependencies.scala
index 5b1b9724..4eec01c1 100644
--- a/project/Dependencies.scala
+++ b/project/Dependencies.scala
@@ -27,7 +27,6 @@ object Dependencies {
val aspectjVersion = "1.8.4"
val slf4jVersion = "1.7.6"
val playVersion = "2.3.5"
- val sigarVersion = "1.6.5.132"
val sprayJson = "io.spray" %% "spray-json" % "1.3.0"
val sprayJsonLenses = "net.virtual-void" %% "json-lenses" % "0.5.4"
@@ -51,13 +50,8 @@ object Dependencies {
val slf4Api = "org.slf4j" % "slf4j-api" % slf4jVersion
val slf4nop = "org.slf4j" % "slf4j-nop" % slf4jVersion
val scalaCompiler = "org.scala-lang" % "scala-compiler" % Settings.ScalaVersion
- val sigar = "org.fusesource" % "sigar" % "1.6.4" // TODO remove
val scalazConcurrent = "org.scalaz" %% "scalaz-concurrent" % "7.1.0"
- //
- val sigarJar = "org.hyperic" % "sigar" % sigarVersion withSources() withJavadoc()
- val sigarZip = "org.hyperic" % "sigar-dist" % sigarVersion
- val junit = "junit" % "junit" % "4.11"
- val junitInterface = "com.novocode" % "junit-interface" % "0.11"
+ val sigarLoader = "io.kamon" % "sigar-loader" % "1.6.5-rev001"
def compile (deps: ModuleID*): Seq[ModuleID] = deps map (_ % "compile")
def provided (deps: ModuleID*): Seq[ModuleID] = deps map (_ % "provided")
diff --git a/project/Projects.scala b/project/Projects.scala
index dfdf5c0e..a284da11 100644
--- a/project/Projects.scala
+++ b/project/Projects.scala
@@ -23,7 +23,7 @@ object Projects extends Build {
lazy val root = Project("root", file("."))
.aggregate(kamonCore, kamonSpray, kamonNewrelic, kamonPlayground, kamonDashboard, kamonTestkit, kamonPlay, kamonStatsD,
- kamonDatadog, kamonSystemMetrics, kamonLogReporter, kamonAkkaRemote, kamonSigar)
+ kamonDatadog, kamonSystemMetrics, kamonLogReporter, kamonAkkaRemote)
.settings(basicSettings: _*)
.settings(formatSettings: _*)
.settings(noPublishing: _*)
@@ -168,15 +168,9 @@ object Projects extends Build {
.settings(fork in Test := true)
.settings(
libraryDependencies ++=
- compile(sigar) ++
+ compile(sigarLoader) ++
test(scalatest, akkaTestKit, slf4Api, slf4nop))
.dependsOn(kamonCore)
- .dependsOn(kamonSigar)
-
- lazy val kamonSigar = Project("kamon-sigar", file("kamon-sigar"))
- .settings(basicSettings: _*)
- .settings(formatSettings: _*)
- .settings(Sigar.settings: _*)
val noPublishing = Seq(publish := (), publishLocal := (), publishArtifact := false)
}
diff --git a/project/Sigar.scala b/project/Sigar.scala
deleted file mode 100644
index 621938c2..00000000
--- a/project/Sigar.scala
+++ /dev/null
@@ -1,115 +0,0 @@
-/* =========================================================================================
- * Copyright © 2013-2014 the kamon project <http://kamon.io/>
- *
- * 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._
-
-/** Sigar build specific settings. */
-object Sigar {
- import UnzipTask._
- import sbt.Package._
- import Dependencies._
-
- /** Helper settings for extracted sigar sources. */
- lazy val sigarSources = SettingKey[File]("sigar-sources", "Location of extracted sigar sources.")
-
- /** Native o/s libraries folder inside kamon-sigar.jar. Hardcoded in [SigarAgent.java]. */
- lazy val nativeFolder = "native"
-
- /** Full class name of the sigar load time agent. Provides Agent-Class and Premain-Class contracts. */
- lazy val agentClass = "kamon.sigar.SigarAgent"
-
- /** A name filter which matches java source files. */
- lazy val sourceFilter: NameFilter = new PatternFilter(
- java.util.regex.Pattern.compile("""(.+\.java)""")
- )
-
- /** A name filter which matches java class files. */
- lazy val classFilter: NameFilter = new PatternFilter(
- java.util.regex.Pattern.compile("""(.+\.class)""")
- )
-
- /** A name filter which matches native o/s libraries. */
- lazy val nativeFilter: NameFilter = new PatternFilter(
- java.util.regex.Pattern.compile("""(.+\.dll)|(.+\.dylib)|(.+\.lib)|(.+\.sl)|(.+\.so)""")
- )
-
- /** Location of latest sigar artifacts. */
- lazy val redhatResolver = "RedHat/JBoss Repository" at "http://repository.jboss.org/nexus/content/groups/public-jboss"
-
- /** Sigar build specific settings. */
- lazy val settings = Seq(
-
- /** Pure java build.*/
- autoScalaLibrary := false,
-
- /** Use RedHat artifacts. */
- resolvers += redhatResolver,
-
- /** Ensure no transitive dependency. */
- libraryDependencies ++=
- provided(sigarJar, sigarZip) ++
- test(junit, junitInterface, slf4Api, logback),
-
- /** Location of sigar source extraction. */
- sigarSources := target.value / "sigar-sources",
-
- /** Origianl sigar resources extraction and relocation. */
- unzipTask := {
- val log = streams.value.log
- val report = update.value
-
- log.debug(s"Unpack SRC: ${sigarJar}")
- val srcTarget = sigarSources.value
- val srcArtifact = locateArtifact(report, sigarJar, "sources")
- val srcFileList = extractArtifact(srcArtifact, srcTarget, sourceFilter, false)
-
- log.debug(s"Unpack JAR: ${sigarJar}")
- val jarTarget = (classDirectory in Compile).value
- val jarArtifact = locateArtifact(report, sigarJar)
- val jarFileList = extractArtifact(jarArtifact, jarTarget, classFilter, false)
-
- log.debug(s"Unpack ZIP ${sigarZip}")
- val zipTarget = jarTarget / nativeFolder
- val zipArtifact = locateArtifact(report, sigarZip)
- val zipFileList = extractArtifact(zipArtifact, zipTarget, nativeFilter, true)
- },
-
- /** Unpack sigar resources before compile. */
- (Keys.compile in Compile) <<= (Keys.compile in Compile) dependsOn unzipTask,
-
- /** Include original sigar sources as our own. */
- (packageSrc in Compile) <<= (packageSrc in Compile) dependsOn unzipTask,
- (mappings in (Compile, packageSrc)) ++= {
- val base = sigarSources.value
- val finder = base ** sourceFilter
- val pairList = finder x relativeTo(base)
- pairList
- },
-
- /** Invoke verbose tesing in separate JVM. */
- testOptions += Tests.Argument(TestFrameworks.JUnit, "-v", "-a"),
- fork in Test := true,
-
- /** Ensure JVM agent packaging. */
- packageOptions in (Compile, packageBin) ++= Seq(
- ManifestAttributes("Agent-Class" -> agentClass),
- ManifestAttributes("Premain-Class" -> agentClass),
- ManifestAttributes("Kamon-Sigar-Version" -> sigarVersion)
- )
-
- )
-
-}
diff --git a/project/UnzipTask.scala b/project/UnzipTask.scala
deleted file mode 100644
index 022f485e..00000000
--- a/project/UnzipTask.scala
+++ /dev/null
@@ -1,64 +0,0 @@
-/* =========================================================================================
- * Copyright © 2013-2014 the kamon project <http://kamon.io/>
- *
- * 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._
-
-/** Helper task for jar/zip artifact unpacking. */
-object UnzipTask {
-
- /** Helper task for jar/zip artifact unpacking. */
- lazy val unzipTask = TaskKey[Unit]("unzip-task", "Unpack the jar/zip archive.")
-
- /** Find artifact path by the module and classifier. */
- def locateArtifact(report: UpdateReport, module: ModuleID,
- classifier: String = ""): File =
- {
- val mf = moduleFilter(
- organization = module.organization, name = module.name, revision = module.revision
- )
- val af = artifactFilter(
- classifier = classifier
- )
- val pathList = report.select(module = mf, artifact = af)
- require(pathList.size == 1, s"Wrong select: ${pathList}")
- pathList(0)
- }
-
- /** Extract zip/jar artifact content into a target dir. */
- def extractArtifact(zip: File, dir: File,
- filter: NameFilter = AllPassFilter, flatten: Boolean = false): Set[java.io.File] =
- {
- IO createDirectory dir
- if (flatten) {
- /** Remove original directory structure. */
- val tmp = IO createTemporaryDirectory
- val sourceList = IO unzip (zip, tmp, filter)
- val targetList = for {
- source <- sourceList
- } yield {
- val target = dir / source.name
- IO copyFile (source, target)
- target
- }
- IO delete tmp
- targetList
- } else {
- /** Prserve original directory structure. */
- IO unzip (zip, dir, filter)
- }
- }
-
-}