Skip to content

Commit

Permalink
fixed #3
Browse files Browse the repository at this point in the history
  • Loading branch information
Pawel Raszewski committed Dec 16, 2015
1 parent 538d8b2 commit 458e430
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/sonarrunner-test-project/target
*.class
*.log

Expand Down
2 changes: 1 addition & 1 deletion DEV.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
publish local

`setJdk6`
`sbt publishLocal`

test
Expand Down
9 changes: 8 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,11 @@ bintrayPackageLabels := Seq("sbt", "sonar", "sbt-native-packager")

bintrayRepository := "scala"

licenses +=("MIT", url("http://opensource.org/licenses/MIT"))
licenses +=("MIT", url("http://opensource.org/licenses/MIT"))

resourceGenerators in Compile <+= (resourceManaged in Compile, name, version) map { (dir, n, v) =>
val file = dir / "latest-version.properties"
val contents = "name=%s\nversion=%s".format(n, v)
IO.write(file, contents)
Seq(file)
}
2 changes: 2 additions & 0 deletions sonarrunner-test-project/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ val root = (project in file("."))
sonarProperties := Map(
"sonar.host.url" -> "http://testurl.com",
"sonar.jdbc.username" -> "sonar",
"sonar.test.windows.path" -> """c:\test1\path1\file1""",
"sonar.test.windows.path2" -> """c:/test2/path2/file2""",
"sonar.coverage.exclusions" -> "**/MobileAppController.java,**/LegacyArticleController.java"
)
)
Expand Down
14 changes: 9 additions & 5 deletions src/main/scala/SonarRunnerPlugin.scala
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package com.aol.sbt.sonar

import java.io.File
import java.io.{File, FileOutputStream}
import java.util.Properties

import org.sonar.runner.Main
import sbt.Keys._
import sbt._

import scala.collection.JavaConversions
;

object SonarRunnerPlugin extends AutoPlugin {

object autoImport {
Expand Down Expand Up @@ -50,9 +54,9 @@ object SonarRunnerPlugin extends AutoPlugin {
private[this] def filePathsToString(files: Seq[File]) = files.filter(_.exists).map(_.getAbsolutePath).toSet.mkString(",")

private[this] def makeConfiguration(configPath: String, props: Map[String, String]): File = {
val propertiesAsString = (props).toSeq.map { case (k, v) => "%s=%s".format(k, v)}.mkString("\n")
val propertiesFile = file(configPath)
IO.write(propertiesFile, propertiesAsString)
propertiesFile
val p = new Properties()
p.putAll(JavaConversions.mapAsJavaMap(props))
p.store(new FileOutputStream(configPath), null)
file(configPath)
}
}

0 comments on commit 458e430

Please sign in to comment.