Skip to content

Commit

Permalink
Merge pull request #6 from alisiikh/scalastyle_3.0
Browse files Browse the repository at this point in the history
Scalastyle version 3.0.0
  • Loading branch information
Oleksii Lisikh authored Mar 7, 2019
2 parents 1bf4799 + 0004d4c commit 6fd6105
Show file tree
Hide file tree
Showing 41 changed files with 447 additions and 594 deletions.
55 changes: 23 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,13 @@ Originally forked from: https://github.com/ngbinh/gradle-scalastyle-plugin

### Instructions

https://plugins.gradle.org/plugin/com.github.alisiikh.scalastyle_2.12
https://plugins.gradle.org/plugin/com.github.alisiikh.scalastyle

Use:

```groovy
plugins {
id "com.github.alisiikh.scalastyle_2.10"
}
```
```groovy
plugins {
id "com.github.alisiikh.scalastyle_2.11"
}
```
```groovy
plugins {
id "com.github.alisiikh.scalastyle_2.12"
id "com.github.alisiikh.scalastyle"
}
```

Expand All @@ -37,32 +27,33 @@ buildscript {
}
}
dependencies {
classpath "com.github.alisiikh:gradle-scalastyle-plugin_2.10:2.1.0" // or 2.11, 2.12
classpath "com.github.alisiikh:gradle-scalastyle-plugin:3.0.0"
}
}
apply plugin: "com.github.alisiikh.scalastyle_2.10" // or 2.11, 2.12
apply plugin: "com.github.alisiikh.scalastyle"
```

Configure the plugin

```groovy
scalaStyle {
config = file("/path/to/scalaStyle.xml")
scalastyle {
scalaVersion = '2.12' // default
scalastyleVersion = '1.0.0' // default
config = file("${projectDir}/scalastyle.xml")
}
```

Other optional properties are

```groovy
output //Default => ${buildDir}/scalastyle/${sourceSet.name}/scalastyle-check.xml
outputEncoding //Default => UTF-8
failOnViolation //Default => true
failOnWarning //Default => false
skip //Default => false
verbose //Default => false
quiet //Default => false
inputEncoding //Default => UTF-8
output = file("${buildDir}/scalastyle/${sourceSet.name}/scalastyle-check.xml") // default
inputEncoding = 'UTF-8' // default
outputEncoding = 'UTF-8' // default
failOnWarning = false // default
skip = false // default
verbose = false // default
quiet = false // default
```

#### Full Buildscript Example
Expand All @@ -74,14 +65,14 @@ Other optional properties are
}
dependencies {
classpath 'com.github.alisiikh:gradle-scalastyle-plugin_2.12:2.0.2'
classpath 'com.github.alisiikh:gradle-scalastyle-plugin:3.0.0'
}
}
apply plugin: 'com.github.alisiikh.scalastyle_2.12'
apply plugin: 'com.github.alisiikh.scalastyle'
scalaStyle {
config = file("$rootDir/scalastyle_config.xml")
scalastyle {
config = file("$rootDir/scalastyle-config.xml")
}
```

Expand All @@ -94,20 +85,20 @@ Other optional properties are
}
dependencies {
classpath 'com.github.alisiikh:gradle-scalastyle-plugin_2.12:2.0.2'
classpath 'com.github.alisiikh:gradle-scalastyle-plugin:3.0.0'
}
}
apply plugin: 'com.github.alisiikh.scalastyle_2.12'
apply plugin: 'com.github.alisiikh.scalastyle'
scalaStyle {
scalastyle {
config = file("$rootDir/scalastyle_config.xml")
sourceSets {
test {
// specifically configure scalastyle for test sourceSet
config = file("$rootDir/scalastyle_test.xml")
failOnWarnings = true
failOnWarning = true
}
intTest {
Expand Down
135 changes: 52 additions & 83 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,110 +23,79 @@ buildscript {
}
}

version = projectVersion
group = projectGroup
version = '3.0.0'
group = 'com.github.alisiikh'

ext {
pluginSrc = "$rootDir/src"
scalaVersion = '2.12'
}

task wrapper(type: Wrapper) {
gradleVersion = '4.7'
}

['2.10', '2.11', '2.12'].each { scalaVersion ->
project(":gradle-scalastyle-plugin_$scalaVersion") {
apply plugin: 'scala'
apply plugin: 'groovy'
apply plugin: 'maven-publish'
apply plugin: 'com.gradle.plugin-publish'
apply plugin: 'groovy'
apply plugin: 'maven-publish'
apply plugin: 'com.gradle.plugin-publish'

sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = 1.8
targetCompatibility = 1.8

version = projectVersion
group = projectGroup
ext {
projectGithub = 'https://github.com/alisiikh/gradle-scalastyle-plugin'

ext {
pluginDescription = "Gradle plugin for scalastyle ${scalaVersion}"
}
pluginId = 'com.github.alisiikh.scalastyle'
pluginDescription = 'Gradle plugin for scalastyle'
}

repositories {
mavenCentral()
jcenter()
}
repositories {
mavenCentral()
jcenter()
}

dependencies {
compile gradleApi()
compile localGroovy()
dependencies {
compile gradleApi()
compile localGroovy()

compile "org.scalastyle:scalastyle_${scalaVersion}:1.0.0"
testCompile gradleTestKit()
testCompile('org.spockframework:spock-core:1.1-groovy-2.4') {
exclude module: 'groovy-all'
}
testCompile 'commons-io:commons-io:2.5'
}
testCompile gradleTestKit()
testCompile('org.spockframework:spock-core:1.1-groovy-2.4') {
exclude module: 'groovy-all'
}
testCompile 'commons-io:commons-io:2.5'
}

sourceSets {
main {
scala {
srcDirs = ["$pluginSrc/main/scala"]
}
groovy {
srcDirs = ["$pluginSrc/main/groovy"]
compileClasspath += files([sourceSets.main.scala.outputDir])
}
resources {
srcDirs = ["$pluginSrc/main/resources"]
}
}
test {
groovy {
srcDirs = ["$pluginSrc/test/groovy"]
}
resources {
srcDirs = ["$pluginSrc/test/resources"]
}
}
}
test {
dependsOn 'publishToMavenLocal'

test {
dependsOn 'publishToMavenLocal'
testLogging {
showStandardStreams = true
}
systemProperty 'SCALA_VERSION', scalaVersion
systemProperty 'PLUGIN_VERSION', version
}

testLogging {
showStandardStreams = true
}
systemProperty 'SCALA_VERSION', scalaVersion
systemProperty 'PLUGIN_VERSION', version
publishing {
publications {
plugin(MavenPublication) {
from components.java
}
}
}

compileGroovy.dependsOn(compileScala)
pluginBundle {
mavenCoordinates {
groupId = project.group
}

publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
}
website = projectGithub
vcsUrl = projectGithub
description = pluginDescription
tags = ['scalastyle', 'scala', 'code analysis', 'checkstyle']

pluginBundle {
mavenCoordinates {
groupId = projectGroup
}

website = projectGithub
vcsUrl = projectGithub
description = pluginDescription
tags = ['scalastyle', 'scala', 'formatter', 'checkstyle']

plugins {
scalaStylePlugin {
id = "com.github.alisiikh.scalastyle_${scalaVersion}"
displayName = pluginDescription
}
}
plugins {
scalastylePlugin {
id = pluginId
displayName = pluginDescription
}
}
}
7 changes: 0 additions & 7 deletions gradle.properties

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.github.alisiikh:gradle-scalastyle-plugin_2.11:2.1.0'
classpath 'com.github.alisiikh:gradle-scalastyle-plugin:3.0.0'
}
}


apply plugin: 'scala'
apply plugin: 'com.github.alisiikh.scalastyle_2.11'
apply plugin: 'com.github.alisiikh.scalastyle'


sourceSets {
Expand All @@ -28,7 +28,10 @@ configurations {
garbageRuntime.extendsFrom compile
}

scalaStyle {
scalastyle {
scalaVersion = '2.12'
scalastyleVersion = '1.0.0'

// global config, used in case not overriden specifically
config = file("$rootDir/scalastyle.xml")
verbose = false
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
package org.gradle.sample.impl

import org.gradle.sample.api.Person
import org.apache.commons.collections.list.GrowthList;
package org.gradle.sample.impl;

/**
* Immutable implementation of {@link Person}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ buildscript {
}

dependencies {
classpath 'com.github.alisiikh:gradle-scalastyle-plugin_2.10:2.1.0'
classpath 'com.github.alisiikh:gradle-scalastyle-plugin:3.0.0'
}
}

apply plugin: 'scala'
apply plugin: 'com.github.alisiikh.scalastyle_2.10'
apply plugin: 'com.github.alisiikh.scalastyle'

scalastyle {
scalaVersion = '2.12'
scalastyleVersion = '1.0.0'

scalaStyle {
config = file("scalastyle.xml")
verbose = false
}
Expand All @@ -23,5 +26,5 @@ repositories {
}

dependencies {
compile 'org.scala-lang:scala-library:2.10.1'
compile "org.scala-lang:scala-library:2.12.6"
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
package org.gradle.sample.impl

import org.gradle.sample.api.Person
import org.apache.commons.collections.list.GrowthList;
package org.gradle.sample.impl;

/**
* Immutable implementation of {@link Person}.
Expand Down
6 changes: 1 addition & 5 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,4 @@
* limitations under the License.
*/

rootProject.name = projectName

include 'gradle-scalastyle-plugin_2.10',
'gradle-scalastyle-plugin_2.11',
'gradle-scalastyle-plugin_2.12'
rootProject.name = 'gradle-scalastyle-plugin'
Loading

0 comments on commit 6fd6105

Please sign in to comment.