Skip to content

Commit

Permalink
update to 0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ngbinh committed Dec 16, 2014
1 parent 2cd47f7 commit 33f0d8c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 24 deletions.
13 changes: 10 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ apply plugin: 'signing' // For pushing to Sonatype OSS Staging repository
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven-publish'

version = '0.5.1'
version = '0.6.0'
group = "org.github.ngbinh.scalastyle"

ext {
Expand All @@ -31,11 +31,12 @@ ext {

versions.scalaDist = "2.11"
versions.scalaStyle = "0.6.0"
versions.scala = "2.11.4"
versions.junit = "4.11"

dependencies {
runtime "org.scalastyle:scalastyle_${versions.scalaDist}:${versions.scalaStyle}"
runtime "org.scala-lang:scala-library:_${versions.scalaDist}"
runtime "org.scala-lang:scala-library:${versions.scala}"
}

buildscript {
Expand All @@ -57,7 +58,7 @@ dependencies {
compile localGroovy()

compile "org.scalastyle:scalastyle_${versions.scalaDist}:${versions.scalaStyle}"
compile "org.scala-lang:scala-library:_${versions.scalaDist}"
compile "org.scala-lang:scala-library:${versions.scala}"
testCompile 'junit:junit:${versions.junit}'
}

Expand Down Expand Up @@ -118,6 +119,12 @@ bintray {
desc = 'gradle-scalastyle is a Gradle plugin for running the Scalastyle style checker.'
licenses = ['Apache-2.0']
labels = [version]
desc = 'Gradle plugin for scalaStyle'
websiteUrl = 'https://github.com/ngbinh/gradle-scalastyle-plugin'
issueTrackerUrl = 'https://github.com/ngbinh/gradle-scalastyle-plugin/issues'
vcsUrl = 'https://github.com/ngbinh/gradle-scalastyle-plugin.git'
licenses = ['Apache-2.0']
publicDownloadNumbers = true
}
}

Expand Down
43 changes: 22 additions & 21 deletions src/main/groovy/org/github/ngbinh/scalastyle/ScalaStyleTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class ScalaStyleTask extends SourceTask {
Boolean failOnWarning = false
Boolean skip = false
Boolean verbose = false
Boolean quiet = true
Boolean includeTestSourceDirectory = false
Boolean quiet = false
Boolean includeTestSourceDirectory = true
String inputEncoding = "UTF-8"
ScalaStyleUtils scalaStyleUtils = new ScalaStyleUtils()
String testSource
Expand All @@ -63,19 +63,21 @@ class ScalaStyleTask extends SourceTask {
def configuration = ScalastyleConfiguration.readFromXml(configLocation)
def fileToProcess = scalaStyleUtils.getFilesToProcess(source.getFiles().toList(), testSourceDir.getFiles().toList(), inputEncoding, includeTestSourceDirectory)
def messages = new ScalastyleChecker().checkFiles(configuration, fileToProcess)
def config = ConfigFactory.load().copy()
def config = ConfigFactory.load()

def outputResult = new TextOutput(config, verbose, quiet).output(messages)

getLogger().debug("Saving to outputFile={}", project.file(outputFile).getCanonicalPath());
outputResult.println()

project.getLogger().debug("Saving to outputFile={}", project.file(outputFile).getCanonicalPath());
XmlOutput.save(config, outputFile, outputEncoding, messages)

def stopMs = System.currentTimeMillis()
if (!quiet) {
getLogger().info("Processed {} file(s)", outputResult.files())
getLogger().info("Found {} warnings", outputResult.warnings())
getLogger().info("Found {} errors", outputResult.errors())
getLogger().info("Finished in {} ms", stopMs - startMs)
project.getLogger().info("Processed {} file(s)", outputResult.files())
project.getLogger().warn("Found {} warnings", outputResult.warnings())
project.getLogger().error("Found {} errors", outputResult.errors())
project.getLogger().info("Finished in {} ms", stopMs - startMs)
}

def violations = outputResult.errors() + ((failOnWarning) ? outputResult.warnings() : 0)
Expand All @@ -85,7 +87,7 @@ class ScalaStyleTask extends SourceTask {
throw new Exception("Scala check error", e)
}
} else {
getLogger().info("Skipping Scalastyle")
project.getLogger().info("Skipping Scalastyle")
}
}

Expand Down Expand Up @@ -120,7 +122,6 @@ class ScalaStyleTask extends SourceTask {
throw new Exception("configLocation " + configLocation + " does not exist")
}


if (buildDirectory == null) {
buildDirectory = project.buildDir
}
Expand All @@ -135,17 +136,17 @@ class ScalaStyleTask extends SourceTask {
}

if (verbose) {
getLogger().info("configLocation: {}", configLocation)
getLogger().info("buildDirectory: {}", buildDirectory)
getLogger().info("outputFile: {}", outputFile)
getLogger().info("outputEncoding: {}", outputEncoding)
getLogger().info("failOnViolation: {}", failOnViolation)
getLogger().info("failOnWarning: {}", failOnWarning)
getLogger().info("verbose: {}", verbose)
getLogger().info("quiet: {}", quiet)
getLogger().info("skip: {}", skip)
getLogger().info("includeTestSourceDirectory: {}", includeTestSourceDirectory)
getLogger().info("inputEncoding: {}", inputEncoding)
project.getLogger().info("configLocation: {}", configLocation)
project.getLogger().info("buildDirectory: {}", buildDirectory)
project.getLogger().info("outputFile: {}", outputFile)
project.getLogger().info("outputEncoding: {}", outputEncoding)
project.getLogger().info("failOnViolation: {}", failOnViolation)
project.getLogger().info("failOnWarning: {}", failOnWarning)
project.getLogger().info("verbose: {}", verbose)
project.getLogger().info("quiet: {}", quiet)
project.getLogger().info("skip: {}", skip)
project.getLogger().info("includeTestSourceDirectory: {}", includeTestSourceDirectory)
project.getLogger().info("inputEncoding: {}", inputEncoding)
}
}
}

0 comments on commit 33f0d8c

Please sign in to comment.