Skip to content

Commit 9bc3658

Browse files
authored
jCenter removal and Gradle 7 Updates (#239)
* Version updates and compat fixes * More dependency updates * Updated PMD to execute Gradle plugin instead of embedded * Removed findbugs and added checkstyle plugin mode * jCenter removal * Added stkent diff parser to source * README updates and ktlint fixes * Fixed ktlint issue on subprojects not finding source * Publishing updates
1 parent c40dfc2 commit 9bc3658

File tree

65 files changed

+1676
-898
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1676
-898
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
*.hprof
12

23
.idea/
34
build/

README.md

Lines changed: 26 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,20 @@ Violations that are not associated with a specific line in your PR will be aggre
1919

2020
## Usage
2121

22-
**Requires JDK 8**
22+
**Requires JDK 12 or Higher**
2323

24-
Gnag is meant to be simple to use and easy to drop in to any Android project. Shown below is the simplest
25-
Gnag setup that will report violations to GitHub. By default this config will report PMD, Findbugs, Checkstyle and
24+
Gnag is meant to be simple to use and easy to drop in to any JVM based project. Shown below is the simplest
25+
Gnag setup that will report violations to GitHub. By default this config will report PMD, Checkstyle, ktlint, detekt and
2626
Android Lint to GitHub.
2727

2828
<details open>
2929
<summary><b>build.gradle (Groovy)</b></summary>
3030

3131
```groovy
32-
buildscript {
33-
repositories {
34-
jcenter()
35-
}
36-
dependencies {
37-
classpath 'com.btkelly:gnag:{current version}'
38-
}
32+
plugins {
33+
id "com.btkelly.gnag" version "{current version}"
3934
}
4035
41-
apply plugin: 'gnag'
42-
4336
gnag {
4437
github {
4538
repoName 'btkelly/repo'
@@ -55,17 +48,8 @@ gnag {
5548
<summary><b>build.gradle.kts (Kotlin)</b></summary>
5649

5750
```kotlin
58-
buildscript {
59-
repositories {
60-
jcenter()
61-
}
62-
dependencies {
63-
classpath("com.btkelly:gnag:{current version}")
64-
}
65-
}
66-
6751
plugins {
68-
id("gnag")
52+
id("com.btkelly.gnag") version "{current version}"
6953
}
7054

7155
gnag {
@@ -105,28 +89,25 @@ gnag {
10589
10690
checkstyle {
10791
enabled true
92+
toolVersion "8.45.1"
10893
reporterConfig project.file('config/checkstyle.xml')
10994
}
11095
11196
pmd {
11297
enabled true
98+
toolVersion "6.22.0"
11399
reporterConfig project.file('config/pmd.xml')
114100
}
115101
116-
findbugs {
117-
enabled true
118-
reporterConfig project.file('config/findbugs.xml')
119-
}
120-
121102
ktlint {
122103
enabled true
123-
toolVersion "0.35.0"
104+
toolVersion "0.42.0"
124105
}
125106
126107
detekt {
127108
enabled true
128109
reporterConfig project.file('config/detekt.yml')
129-
toolVersion "1.0.1"
110+
toolVersion "1.17.1"
130111
}
131112
132113
androidLint {
@@ -158,19 +139,16 @@ gnag {
158139

159140
checkstyle {
160141
isEnabled = true
142+
toolVersion("8.45.1")
161143
reporterConfig(project.file("config/checkstyle.xml"))
162144
}
163145

164146
pmd {
165147
isEnabled = true
148+
toolVersion("6.22.0")
166149
reporterConfig(project.file("config/pmd.xml"))
167150
}
168151

169-
findbugs {
170-
isEnabled = true
171-
reporterConfig(project.file("config/findbugs.xml"))
172-
}
173-
174152
ktlint {
175153
isEnabled = true
176154
toolVersion("0.35.0")
@@ -233,20 +211,19 @@ gnag {
233211
234212
- ***checkstyle*** - block to customize the checkstyle reporter
235213
- ***enabled*** - set if checkstyle should execute
214+
- ***toolVersion*** - override the checkstyle version
236215
- ***reporterConfig*** - provide a custom [checkstyle config](http://checkstyle.sourceforge.net/config.html) (see the default config [here](/plugin/src/main/resources/checkstyle.xml))
237216
- ***pmd*** - block to customize the PMD reporter
238217
- ***enabled*** - set if PMD should execute
218+
- ***toolVersion*** - override the PMD version
239219
- ***reporterConfig*** - provide a custom [PMD config](http://pmd.sourceforge.net/pmd-5.1.1/howtomakearuleset.html) (see the default config [here](/plugin/src/main/resources/pmd.xml))
240-
- ***findbugs*** - block to customize the findbugs reporter
241-
- ***enabled*** - set if findbugs should execute
242-
- ***reporterConfig*** - provide a custom [findbugs config](http://findbugs.sourceforge.net/manual/filter.html)
243220
- ***ktlint*** - block to customize the ktlint reporter
244221
- ***enabled*** - set if ktlint should execute
245-
- **toolVersion** - override the ktlint version compiled into Gnag
222+
- ***toolVersion*** - override the ktlint version
246223
- ***detekt*** - block to customize the detekt reporter
247224
- ***enabled*** - set if detekt should execute
248225
- ***reporterConfig*** - provide a custom [detekt config](https://arturbosch.github.io/detekt/configurations.html)
249-
- ***toolVersion*** - override the detekt version compiled into Gnag
226+
- ***toolVersion*** - override the detekt version
250227
- ***androidLint*** - block to customize the android lint reporter
251228
- ***enabled*** - set if the android lint reporter should look for a lint report
252229
- ***severity*** - can be 'Error' or 'Warning' (case insensitive) depending on which severity you want Gnag to check
@@ -267,20 +244,14 @@ To enforce the same quality checks across multiple Gradle modules, apply and con
267244
<summary><b>build.gradle (Groovy)</b></summary>
268245
269246
```groovy
270-
buildscript {
271-
repositories {
272-
// ...
273-
jcenter()
274-
}
275-
276-
dependencies {
277-
// ...
278-
classpath 'com.btkelly:gnag:2.4.1'
279-
}
247+
plugins {
248+
id "com.btkelly.gnag" version "{current version}" apply false
280249
}
281250
282251
subprojects {
283-
apply plugin: 'gnag'
252+
plugins {
253+
id "com.btkelly.gnag"
254+
}
284255
285256
gnag {
286257
// Standard Gnag configuration goes here.
@@ -297,20 +268,14 @@ subprojects {
297268
<summary><b>build.gradle.kts (Kotlin)</b></summary>
298269

299270
```kotlin
300-
buildscript {
301-
repositories {
302-
// ...
303-
jcenter()
304-
}
305-
306-
dependencies {
307-
// ...
308-
classpath("com.btkelly:gnag:2.4.1")
309-
}
271+
plugins {
272+
id("com.btkelly.gnag") version "{current version}" apply false
310273
}
311274

312275
subprojects {
313-
apply(plugin = "gnag")
276+
plugins {
277+
id("com.btkelly.gnag")
278+
}
314279

315280
configure<com.btkelly.gnag.extensions.GnagPluginExtension> {
316281
// Standard Gnag configuration goes here.

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
buildscript {
22
repositories {
3-
jcenter()
3+
mavenCentral()
44
}
55
}
66

77
allprojects {
88
repositories {
9-
jcenter()
9+
mavenCentral()
1010
}
1111
}

example-android-kts/app/build.gradle.kts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
plugins {
22
id("com.android.application")
33
id("kotlin-android")
4-
id("com.github.hierynomus.license").version("0.15.0")
5-
id("com.btkelly.gnag") version "2.5.0"
4+
id("com.btkelly.gnag") version "2.6.0"
65
}
76

87
apply {
@@ -30,24 +29,13 @@ android {
3029
sourceSets {
3130
getByName("main").java.srcDirs("src/main/kotlin")
3231
}
33-
34-
lintOptions {
35-
setAbortOnError(false)
36-
}
3732
}
3833

3934
dependencies {
40-
implementation("androidx.appcompat:appcompat:1.2.0")
41-
testImplementation("junit:junit:4.13")
35+
implementation("androidx.appcompat:appcompat:1.3.1")
36+
testImplementation("junit:junit:4.13.2")
4237
}
4338

44-
license {
45-
header = file("../../LICENSE_HEADER.txt")
46-
strictCheck = true
47-
}
48-
49-
tasks.getByName("clean").dependsOn("licenseFormat")
50-
5139
gnag {
5240
isEnabled = true
5341
setFailOnError(true)

example-android-kts/app/src/androidTest/java/com/gnag/example/ApplicationTest.java

Lines changed: 0 additions & 28 deletions
This file was deleted.

example-android-kts/build.gradle.kts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
buildscript {
22
repositories {
3-
mavenLocal()
4-
jcenter()
3+
mavenCentral()
54
google()
65
}
76

87
dependencies {
9-
classpath("com.android.tools.build:gradle:4.0.1")
10-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10")
8+
classpath("com.android.tools.build:gradle:7.0.0")
9+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21")
1110
}
1211
}
1312

1413
allprojects {
1514
repositories {
16-
jcenter()
1715
mavenCentral()
1816
google()
1917
}

example-android-kts/gradle.properties

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
android.enableJetifier=true
2-
android.useAndroidX=true
3-
org.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home
2+
android.useAndroidX=true
Binary file not shown.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Sun Sep 20 11:27:32 EDT 2020
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

example-android-kts/gradlew

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
#!/usr/bin/env sh
22

3+
#
4+
# Copyright 2015 the original author or authors.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# https://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
319
##############################################################################
420
##
521
## Gradle start up script for UN*X
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
2844
APP_BASE_NAME=`basename "$0"`
2945

3046
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31-
DEFAULT_JVM_OPTS=""
47+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
3248

3349
# Use the maximum available, or set MAX_FD != -1 to use that value.
3450
MAX_FD="maximum"
@@ -109,8 +125,8 @@ if $darwin; then
109125
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110126
fi
111127

112-
# For Cygwin, switch paths to Windows format before running java
113-
if $cygwin ; then
128+
# For Cygwin or MSYS, switch paths to Windows format before running java
129+
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
114130
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115131
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116132
JAVACMD=`cygpath --unix "$JAVACMD"`
@@ -138,19 +154,19 @@ if $cygwin ; then
138154
else
139155
eval `echo args$i`="\"$arg\""
140156
fi
141-
i=$((i+1))
157+
i=`expr $i + 1`
142158
done
143159
case $i in
144-
(0) set -- ;;
145-
(1) set -- "$args0" ;;
146-
(2) set -- "$args0" "$args1" ;;
147-
(3) set -- "$args0" "$args1" "$args2" ;;
148-
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149-
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150-
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151-
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152-
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153-
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
160+
0) set -- ;;
161+
1) set -- "$args0" ;;
162+
2) set -- "$args0" "$args1" ;;
163+
3) set -- "$args0" "$args1" "$args2" ;;
164+
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
165+
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
166+
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
167+
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
168+
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
169+
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154170
esac
155171
fi
156172

@@ -159,14 +175,9 @@ save () {
159175
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160176
echo " "
161177
}
162-
APP_ARGS=$(save "$@")
178+
APP_ARGS=`save "$@"`
163179

164180
# Collect all arguments for the java command, following the shell quoting and substitution rules
165181
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166182

167-
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168-
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169-
cd "$(dirname "$0")"
170-
fi
171-
172183
exec "$JAVACMD" "$@"

0 commit comments

Comments
 (0)