Skip to content

Commit

Permalink
Updated versions of Ktlint, pmd and gradle (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
Janani-Subbiah authored and btkelly committed Oct 29, 2019
1 parent c3de8d0 commit 94f5be1
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 36 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ gnag {
ktlint {
enabled true
toolVersion "0.24.0"
toolVersion "0.35.0"
}
detekt {
Expand Down Expand Up @@ -161,7 +161,7 @@ gnag {

ktlint {
isEnabled = true
toolVersion("0.24.0")
toolVersion("0.35.0")
}

detekt {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.3.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions example-android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ android {
}

dependencies {
compile 'com.android.support:appcompat-v7:25.3.1'
testCompile 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:25.3.1'
testImplementation 'junit:junit:4.12'
}

license {
Expand Down
2 changes: 1 addition & 1 deletion example-android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions example-java-kotlin-kts/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ repositories {
}

dependencies {
compile("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.11")
testCompile(group = "junit", name = "junit", version = "4.12")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.11")
testImplementation(group = "junit", name = "junit", version = "4.12")
}

license {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions example-java-kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ repositories {
}

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.11"
testCompile group: 'junit', name: 'junit', version: '4.12'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.11"
testImplementation group: 'junit', name: 'junit', version: '4.12'
}

license {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
20 changes: 10 additions & 10 deletions plugin/bintray.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ javadoc {
failOnError = false
}

task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}

publishing {
publications {
GnagPublication(MavenPublication) {
Expand Down Expand Up @@ -37,16 +47,6 @@ bintray {
}
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

task createClasspathManifest {
def outputDir = file("$buildDir/$name")

Expand Down
2 changes: 1 addition & 1 deletion plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ dependencies {
}

compile 'com.google.code.findbugs:findbugs:3.0.1'
compile 'net.sourceforge.pmd:pmd-java:6.12.0'
compile 'net.sourceforge.pmd:pmd-java:6.18.0'

// Testing
testCompile group: 'junit', name: 'junit', version: '4.12'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ public static void addTask(ProjectHelper projectHelper, GnagPluginExtension gnag

if (gnagPluginExtension.ktlint.isEnabled() && projectHelper.hasKotlinSourceFiles()) {
String overrideToolVersion = gnagPluginExtension.ktlint.getToolVersion();
String toolVersion = overrideToolVersion != null ? overrideToolVersion : "0.24.0";
String toolVersion = overrideToolVersion != null ? overrideToolVersion : "0.35.0";

project.getConfigurations().create("gnagKtlint");
project.getDependencies().add("gnagKtlint", "com.github.shyiko:ktlint:" + toolVersion);
project.getDependencies().add("gnagKtlint", "com.pinterest:ktlint:" + toolVersion);

Task ktlintTask = KtlintTask.addTask(projectHelper);
gnagCheckTask.dependsOn(ktlintTask);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ final class KtlintTask {
taskOptions.put(Task.TASK_DESCRIPTION, "Runs ktlint and generates an XML report for parsing by Gnag")

return projectHelper.project.task(taskOptions, "gnagKtlint") { task ->
main = "com.github.shyiko.ktlint.Main"
main = "com.pinterest.ktlint.Main"
classpath = projectHelper.project.configurations.gnagKtlint
ignoreExitValue = true
args "--reporter=checkstyle,output=${projectHelper.getKtlintReportFile()}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,46 +29,46 @@ class ProjectHelper {
this.project = project
}

public Project getProject() {
Project getProject() {
return project
}

public boolean isAndroidProject() {
boolean isAndroidProject() {
return project.getExtensions().findByName("android") != null
}

public List<File> getJavaSourceFiles() {
return getSourceFilesWithSuffices(["java"] as String[])
}

public boolean hasJavaSourceFiles() {
boolean hasJavaSourceFiles() {
return !getJavaSourceFiles().isEmpty()
}

public List<File> getKotlinSourceFiles() {
List<File> getKotlinSourceFiles() {
return getSourceFilesWithSuffices(["kt", "kts"] as String[])
}

public boolean hasKotlinSourceFiles() {
boolean hasKotlinSourceFiles() {
return !getKotlinSourceFiles().isEmpty()
}

public File getReportsDir() {
File getReportsDir() {
File reportsDir = new File(project.buildDir.path + "/outputs/gnag/")
reportsDir.mkdirs()
return reportsDir
}

public File getKtlintReportFile() {
File getKtlintReportFile() {
return new File(getReportsDir(), "ktlint_report.xml")
}

public String getDetektReportFileName() {
String getDetektReportFileName() {
return "detekt_report"
}

private Collection<File> getSourceFilesWithSuffices(final String[] suffices) {
final Collection<File> allSourceFiles
Collection<File> allSourceFiles

if (isAndroidProject()) {
allSourceFiles = project.android.sourceSets.inject([]) { files, sourceSet ->
Expand Down

0 comments on commit 94f5be1

Please sign in to comment.