Remove apollo-plugin Gradle plugin

Replaces the old Gradle plugin with plain Gradle buildscripts.  Also cleans-up
the current Gradle extensions and re-adds detekt, along with JUnit 5 support to
all modules.
This commit is contained in:
Gary Tierney
2018-08-27 00:55:41 +01:00
parent 1f7eb78ddb
commit a53929a9a8
45 changed files with 886 additions and 753 deletions
+3 -1
View File
@@ -3,6 +3,7 @@ plugins {
id 'org.jetbrains.intellij' version '0.3.6' apply(false)
id 'org.jmailen.kotlinter' version '1.16.0' apply(false)
id 'org.sonarqube' version '2.6.2'
id "io.gitlab.arturbosch.detekt" version "1.0.0.RC8"
}
allprojects {
@@ -17,5 +18,6 @@ allprojects {
}
apply from: 'gradle/properties.gradle'
apply from: 'gradle/quality-gate.gradle'
apply from: 'gradle/code-quality.gradle'
apply from: 'gradle/testing.gradle'
apply from: 'gradle/wrapper.gradle'
-10
View File
@@ -1,10 +0,0 @@
apply plugin: 'groovy'
repositories {
mavenLocal()
maven { url "https://repo.maven.apache.org/maven2" }
}
dependencies {
compile gradleApi()
}
@@ -1,12 +0,0 @@
package org.apollo.build.plugin
import org.gradle.api.Plugin
import org.gradle.api.Project
class ApolloPlugin implements Plugin<Project> {
@Override
void apply(Project project) {
project.extensions.create('plugin', ApolloPluginExtension, project)
}
}
@@ -1,92 +0,0 @@
package org.apollo.build.plugin
import org.gradle.api.Project
class ApolloPluginExtension {
final Project project
/**
* The name of this plugin (defaults to the project name).
*/
String name
/**
* An optional description of this plugin.
*/
String description = "Empty description"
/**
* A list of other {@link ApolloPlugin}s that this plugin depends on.
*/
List<String> dependencies = []
/**
* A list of others who contributed to this plugin.
*/
List<String> authors = []
/**
* The directory that library files and script files are found under.
*/
final String srcDir = "src/"
/**
* The directory that tests are found under.
*/
final String testDir = "test/"
ApolloPluginExtension(Project project) {
this.project = project
this.name = project.name
init()
}
/**
* Setup the {@link Project} with the correct dependencies and tasks required to build the plugin
* and its scripts.
*/
def init() {
project.plugins.apply('kotlin')
project.dependencies {
implementation project.findProject(':game')
implementation project.findProject(':cache')
implementation project.findProject(':net')
implementation project.findProject(':util')
testImplementation project.findProject(':game:plugin-testing')
}
project.sourceSets {
main.kotlin.srcDirs += this.srcDir
test.kotlin.srcDirs += this.testDir
}
}
def getDependencies() {
return dependencies
}
def setDependencies(List<String> dependencies) {
dependencies.each {
def project = project.findProject(":game:plugin:$it")
if (project == null) {
throw new MissingPluginDependencyException(name, it)
}
this.project.dependencies.add('compile', project)
}
this.dependencies = dependencies
}
}
/**
* A {@link RuntimeException} thrown when a plugin dependency was missing.
*/
class MissingPluginDependencyException extends RuntimeException {
MissingPluginDependencyException(String plugin, String dependency) {
super("Missing dependency in the `$plugin` plugin: failed to resolve `$dependency`.")
}
}
@@ -1 +0,0 @@
implementation-class=org.apollo.build.plugin.ApolloPlugin
+6
View File
@@ -5,4 +5,10 @@ description = 'Apollo Cache'
dependencies {
implementation project(':util')
implementation group: 'com.google.guava', name: 'guava', version: guavaVersion
test.useJUnitPlatform()
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: junitJupiterVersion
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: junitJupiterVersion
testImplementation group: 'org.junit.vintage', name: 'junit-vintage-engine', version: junitVintageVersion
testImplementation group: 'org.junit.platform', name: 'junit-platform-launcher', version: junitPlatformVersion
}
+16 -4
View File
@@ -1,4 +1,16 @@
plugin {
name = "Apollo Plugin API"
description = "Helpers and API for common plugin usecases"
}
apply plugin: 'org.jetbrains.kotlin.jvm'
apply plugin: 'java'
description = 'Helpers and API for common plugin usecases'
test {
useJUnitPlatform()
}
dependencies {
implementation project(':game')
implementation project(':cache')
implementation project(':net')
implementation project(':util')
testImplementation project(':game:plugin-testing')
}
+12 -6
View File
@@ -1,6 +1,12 @@
plugin {
name = "Area listeners"
description = "Enables plugins to listen on mobs entering, moving inside of, or leaving a rectangular area."
authors = ["Major"]
dependencies = ["api"]
}
apply plugin: 'kotlin'
description = 'Enables plugins to listen on mobs entering, moving inside of, or leaving a rectangular area.'
dependencies {
implementation project(':game')
implementation project(':cache')
implementation project(':net')
implementation project(':util')
implementation project(':game:plugin:api')
testImplementation project(':game:plugin-testing')
}
+10 -6
View File
@@ -1,6 +1,10 @@
plugin {
name = "banking"
authors = [
"Major",
]
}
apply plugin: 'kotlin'
dependencies {
implementation project(':game')
implementation project(':cache')
implementation project(':net')
implementation project(':util')
testImplementation project(':game:plugin-testing')
}
+17 -5
View File
@@ -1,8 +1,21 @@
subprojects { subproj ->
if (subproj.buildFile.exists()) {
apply plugin: 'apollo-plugin'
gradle.projectsEvaluated {
configure(subprojects.findAll { it.buildFile.exists() }) { subproj ->
apply from: "$rootDir/gradle/kotlin.gradle"
sourceSets {
main {
kotlin {
srcDirs += "src"
}
}
test {
kotlin {
srcDirs += "test"
}
}
}
test {
useJUnitPlatform()
}
@@ -14,8 +27,7 @@ subprojects { subproj ->
}
dependencies {
test.useJUnitPlatform()
implementation group: 'com.google.guava', name: 'guava', version: guavaVersion
}
}
}
}
@@ -1,3 +1,10 @@
plugin {
name = "private_messaging"
}
apply plugin: 'kotlin'
dependencies {
implementation project(':game')
implementation project(':cache')
implementation project(':net')
implementation project(':util')
testImplementation project(':game:plugin-testing')
}
+10 -12
View File
@@ -1,12 +1,10 @@
plugin {
name = "chat_commands"
authors = [
"Graham",
"Major",
"lare96",
"cubeee",
]
dependencies = [
"api"
]
}
apply plugin: 'kotlin'
dependencies {
implementation project(':game')
implementation project(':cache')
implementation project(':net')
implementation project(':util')
implementation project(':game:plugin:api')
testImplementation project(':game:plugin-testing')
}
+10 -6
View File
@@ -1,6 +1,10 @@
plugin {
name = "consumables"
authors = [
"Gary Tierney",
]
}
apply plugin: 'kotlin'
dependencies {
implementation project(':game')
implementation project(':cache')
implementation project(':net')
implementation project(':util')
testImplementation project(':game:plugin-testing')
}
-325
View File
@@ -1,325 +0,0 @@
autoCorrect: true
failFast: false
build:
warningThreshold: 5
failThreshold: 10
weights:
complexity: 2
formatting: 1
LongParameterList: 1
comments: 1
processors:
active: true
exclude:
# - 'FunctionCountProcessor'
# - 'PropertyCountProcessor'
# - 'ClassCountProcessor'
# - 'PackageCountProcessor'
# - 'KtFileCountProcessor'
console-reports:
active: true
exclude:
# - 'ProjectStatisticsReport'
# - 'ComplexityReport'
# - 'NotificationReport'
# - 'FindingsReport'
# - 'BuildFailureReport'
output-reports:
active: true
exclude:
# - 'PlainOutputReport'
# - 'XmlOutputReport'
potential-bugs:
active: true
DuplicateCaseInWhenExpression:
active: true
EqualsAlwaysReturnsTrueOrFalse:
active: false
EqualsWithHashCodeExist:
active: true
WrongEqualsTypeParameter:
active: false
ExplicitGarbageCollectionCall:
active: true
UnreachableCode:
active: true
LateinitUsage:
active: false
UnsafeCallOnNullableType:
active: false
UnsafeCast:
active: false
UselessPostfixExpression:
active: false
performance:
active: true
ForEachOnRange:
active: true
SpreadOperator:
active: true
UnnecessaryTemporaryInstantiation:
active: true
exceptions:
active: true
ExceptionRaisedInUnexpectedLocation:
active: false
methodNames: 'toString,hashCode,equals,finalize'
SwallowedException:
active: false
TooGenericExceptionCaught:
active: true
exceptions:
- ArrayIndexOutOfBoundsException
- Error
- Exception
- IllegalMonitorStateException
- IndexOutOfBoundsException
- InterruptedException
- NullPointerException
- RuntimeException
TooGenericExceptionThrown:
active: true
exceptions:
- Throwable
- ThrowError
- ThrowException
- ThrowNullPointerException
- ThrowRuntimeException
- ThrowThrowable
InstanceOfCheckForException:
active: false
IteratorNotThrowingNoSuchElementException:
active: false
PrintExceptionStackTrace:
active: false
RethrowCaughtException:
active: false
ReturnFromFinally:
active: false
ThrowingExceptionFromFinally:
active: false
ThrowingExceptionInMain:
active: false
ThrowingNewInstanceOfSameException:
active: false
empty-blocks:
active: true
EmptyCatchBlock:
active: true
EmptyClassBlock:
active: true
EmptyDefaultConstructor:
active: true
EmptyDoWhileBlock:
active: true
EmptyElseBlock:
active: true
EmptyFinallyBlock:
active: true
EmptyForBlock:
active: true
EmptyFunctionBlock:
active: true
EmptyIfBlock:
active: true
EmptyInitBlock:
active: true
EmptySecondaryConstructor:
active: true
EmptyWhenBlock:
active: true
EmptyWhileBlock:
active: true
complexity:
active: true
LongMethod:
threshold: 20
LongParameterList:
threshold: 5
LargeClass:
threshold: 150
ComplexMethod:
threshold: 10
TooManyFunctions:
threshold: 10
ComplexCondition:
threshold: 3
LabeledExpression:
active: false
StringLiteralDuplication:
active: false
threshold: 2
ignoreAnnotation: true
excludeStringsWithLessThan5Characters: true
ignoreStringsRegex: '$^'
code-smell:
active: true
FeatureEnvy:
threshold: 0.5
weight: 0.45
base: 0.5
formatting:
active: true
useTabs: true
Indentation:
active: false
indentSize: 4
ConsecutiveBlankLines:
active: true
autoCorrect: true
MultipleSpaces:
active: true
autoCorrect: true
SpacingAfterComma:
active: true
autoCorrect: true
SpacingAfterKeyword:
active: true
autoCorrect: true
SpacingAroundColon:
active: true
autoCorrect: true
SpacingAroundCurlyBraces:
active: true
autoCorrect: true
SpacingAroundOperator:
active: true
autoCorrect: true
TrailingSpaces:
active: true
autoCorrect: true
UnusedImports:
active: true
autoCorrect: true
OptionalSemicolon:
active: true
autoCorrect: true
OptionalUnit:
active: true
autoCorrect: true
ExpressionBodySyntax:
active: false
autoCorrect: false
ExpressionBodySyntaxLineBreaks:
active: false
autoCorrect: false
OptionalReturnKeyword:
active: true
autoCorrect: false
style:
active: true
ReturnCount:
active: true
max: 2
NewLineAtEndOfFile:
active: true
OptionalAbstractKeyword:
active: true
OptionalWhenBraces:
active: false
EqualsNullCall:
active: false
ForbiddenComment:
active: true
values: 'TODO:,FIXME:,STOPSHIP:'
ForbiddenImport:
active: false
imports: ''
PackageDeclarationStyle:
active: false
ModifierOrder:
active: true
MagicNumber:
active: true
ignoreNumbers: '-1,0,1,2'
ignoreHashCodeFunction: false
ignorePropertyDeclaration: false
ignoreAnnotation: false
WildcardImport:
active: true
SafeCast:
active: true
MaxLineLength:
active: true
maxLineLength: 120
excludePackageStatements: false
excludeImportStatements: false
PackageNaming:
active: true
packagePattern: '^[a-z]+(\.[a-z][a-z0-9]*)*$'
ClassNaming:
active: true
classPattern: '[A-Z$][a-zA-Z$]*'
EnumNaming:
active: true
enumEntryPattern: '^[A-Z$][a-zA-Z_$]*$'
FunctionNaming:
active: true
functionPattern: '^[a-z$][a-zA-Z$0-9]*$'
FunctionMaxLength:
active: false
maximumFunctionNameLength: 30
FunctionMinLength:
active: false
minimumFunctionNameLength: 3
VariableNaming:
active: true
variablePattern: '^(_)?[a-z$][a-zA-Z$0-9]*$'
ConstantNaming:
active: true
constantPattern: '^([A-Z_]*|serialVersionUID)$'
VariableMaxLength:
active: false
maximumVariableNameLength: 30
VariableMinLength:
active: false
minimumVariableNameLength: 3
ForbiddenClassName:
active: false
forbiddenName: ''
ProtectedMemberInFinalClass:
active: false
UnnecessaryParentheses:
active: false
DataClassContainsFunctions:
active: false
UseDataClass:
active: false
UnnecessaryAbstractClass:
active: false
comments:
active: true
CommentOverPrivateMethod:
active: true
CommentOverPrivateProperty:
active: true
UndocumentedPublicClass:
active: false
searchInNestedClass: true
searchInInnerClass: true
searchInInnerObject: true
searchInInnerInterface: true
UndocumentedPublicFunction:
active: false
# *experimental feature*
# Migration rules can be defined in the same config file or a new one
migration:
active: true
imports:
# your.package.Class: new.package.or.Class
# for example:
# io.gitlab.arturbosch.detekt.api.Rule: io.gitlab.arturbosch.detekt.rule.Rule
+10 -6
View File
@@ -1,6 +1,10 @@
plugin {
name = "training_dummy"
authors = [
"Gary Tierney",
]
}
apply plugin: 'kotlin'
dependencies {
implementation project(':game')
implementation project(':cache')
implementation project(':net')
implementation project(':util')
testImplementation project(':game:plugin-testing')
}
+10 -6
View File
@@ -1,6 +1,10 @@
plugin {
name = "emote_tab"
authors = [
"Gary Tierney",
]
}
apply plugin: 'kotlin'
dependencies {
implementation project(':game')
implementation project(':cache')
implementation project(':net')
implementation project(':util')
testImplementation project(':game:plugin-testing')
}
+13 -10
View File
@@ -1,10 +1,13 @@
plugin {
name = "following"
authors = [
"Gary Tierney",
]
dependencies = [
"entity:walk-to",
"entity:player-action",
]
}
apply plugin: 'kotlin'
dependencies {
implementation project(':game')
implementation project(':cache')
implementation project(':net')
implementation project(':util')
implementation project(':game:plugin:entity:walk-to')
implementation project(':game:plugin:entity:player-action')
testImplementation project(':game:plugin-testing')
}
+10 -6
View File
@@ -1,6 +1,10 @@
plugin {
name = "player_action"
authors = [
"Gary Tierney",
]
}
apply plugin: 'kotlin'
dependencies {
implementation project(':game')
implementation project(':cache')
implementation project(':net')
implementation project(':util')
testImplementation project(':game:plugin-testing')
}
+10 -9
View File
@@ -1,9 +1,10 @@
plugin {
name = "spawning"
authors = [
"Gary Tierney",
]
dependencies = [
"api",
]
}
apply plugin: 'kotlin'
dependencies {
implementation project(':game')
implementation project(':cache')
implementation project(':net')
implementation project(':util')
implementation project(':game:plugin:api')
testImplementation project(':game:plugin-testing')
}
+10 -6
View File
@@ -1,6 +1,10 @@
plugin {
name = "walkto"
authors = [
"Gary Tierney",
]
}
apply plugin: 'kotlin'
dependencies {
implementation project(':game')
implementation project(':cache')
implementation project(':net')
implementation project(':util')
testImplementation project(':game:plugin-testing')
}
+13 -10
View File
@@ -1,10 +1,13 @@
plugin {
name = "al_kharid"
authors = [
"Jesse W",
"Arham 4"
]
dependencies = [
"entity:spawn", "shops"
]
}
apply plugin: 'kotlin'
dependencies {
implementation project(':game')
implementation project(':cache')
implementation project(':net')
implementation project(':util')
implementation project(':game:plugin:entity:spawn')
implementation project(':game:plugin:shops')
testImplementation project(':game:plugin-testing')
}
+13 -10
View File
@@ -1,10 +1,13 @@
plugin {
name = "edgeville"
authors = [
"Jesse W",
"Arham 4"
]
dependencies = [
"entity:spawn", "shops"
]
}
apply plugin: 'kotlin'
dependencies {
implementation project(':game')
implementation project(':cache')
implementation project(':net')
implementation project(':util')
implementation project(':game:plugin:entity:spawn')
implementation project(':game:plugin:shops')
testImplementation project(':game:plugin-testing')
}
+13 -10
View File
@@ -1,10 +1,13 @@
plugin {
name = "falador"
authors = [
"Jesse W",
"Arham 4"
]
dependencies = [
"entity:spawn", "shops"
]
}
apply plugin: 'kotlin'
dependencies {
implementation project(':game')
implementation project(':cache')
implementation project(':net')
implementation project(':util')
implementation project(':game:plugin:entity:spawn')
implementation project(':game:plugin:shops')
testImplementation project(':game:plugin-testing')
}
+13 -10
View File
@@ -1,10 +1,13 @@
plugin {
name = "lumbridge"
authors = [
"Gary Tierney",
"Arham 4"
]
dependencies = [
"entity:spawn", "shops"
]
}
apply plugin: 'kotlin'
dependencies {
implementation project(':game')
implementation project(':cache')
implementation project(':net')
implementation project(':util')
implementation project(':game:plugin:entity:spawn')
implementation project(':game:plugin:shops')
testImplementation project(':game:plugin-testing')
}
@@ -1,9 +1,10 @@
plugin {
name = "tutorial_island_npc_spawns"
authors = [
"Jesse W",
]
dependencies = [
"entity:spawn",
]
}
apply plugin: 'kotlin'
dependencies {
implementation project(':game')
implementation project(':cache')
implementation project(':net')
implementation project(':util')
implementation project(':game:plugin:entity:spawn')
testImplementation project(':game:plugin-testing')
}
+11 -11
View File
@@ -1,11 +1,11 @@
plugin {
name = "varrock"
authors = [
"Jesse W",
"Major",
"tlf30",
]
dependencies = [
"entity:spawn", "shops"
]
}
apply plugin: 'kotlin'
dependencies {
implementation project(':game')
implementation project(':cache')
implementation project(':net')
implementation project(':util')
implementation project(':game:plugin:entity:spawn')
implementation project(':game:plugin:shops')
testImplementation project(':game:plugin-testing')
}
+10 -3
View File
@@ -1,3 +1,10 @@
plugin {
name = "logout"
}
apply plugin: 'kotlin'
dependencies {
implementation project(':game')
implementation project(':cache')
implementation project(':net')
implementation project(':util')
testImplementation project(':game:plugin-testing')
}
+10 -8
View File
@@ -1,8 +1,10 @@
plugin {
name = "door"
dependencies = ["api"]
authors = [
"Shiver",
"Arin"
]
}
apply plugin: 'kotlin'
dependencies {
implementation project(':game')
implementation project(':cache')
implementation project(':net')
implementation project(':util')
implementation project(':game:plugin:api')
testImplementation project(':game:plugin-testing')
}
+10 -3
View File
@@ -1,3 +1,10 @@
plugin {
name = "run"
}
apply plugin: 'kotlin'
dependencies {
implementation project(':game')
implementation project(':cache')
implementation project(':net')
implementation project(':util')
testImplementation project(':game:plugin-testing')
}
+9 -10
View File
@@ -1,11 +1,10 @@
plugin {
name = "shops"
authors = [
"Stuart",
"Major",
"tlf30"
]
dependencies = [
"api",
]
apply plugin: 'kotlin'
dependencies {
implementation project(':game')
implementation project(':cache')
implementation project(':net')
implementation project(':util')
implementation project(':game:plugin:api')
testImplementation project(':game:plugin-testing')
}
+12 -11
View File
@@ -1,12 +1,13 @@
plugin {
name = "fishing_skill"
authors = [
"Linux",
"Major",
"tlf30"
]
dependencies = [
"api",
"entity:spawn",
]
apply plugin: 'kotlin'
dependencies {
implementation project(':game')
implementation project(':cache')
implementation project(':net')
implementation project(':util')
implementation project(':game:plugin:api')
implementation project(':game:plugin:entity:spawn')
testImplementation project(':game:plugin-testing')
}
+8 -8
View File
@@ -1,10 +1,10 @@
plugin {
name = "herblore_skill"
authors = [
"Chivvon",
"Chris Fletcher",
"Major"
]
apply plugin: 'kotlin'
dependencies = ["api"]
dependencies {
implementation project(':game')
implementation project(':cache')
implementation project(':net')
implementation project(':util')
implementation project(':game:plugin:api')
testImplementation project(':game:plugin-testing')
}
+9 -13
View File
@@ -1,14 +1,10 @@
plugin {
name = "mining-skill"
authors = [
"Graham",
"Mikey`",
"Major",
"WH:II:DOW",
"Requa",
"Clifton",
"tlf30"
]
apply plugin: 'kotlin'
dependencies = ["api"]
}
dependencies {
implementation project(':game')
implementation project(':cache')
implementation project(':net')
implementation project(':util')
implementation project(':game:plugin:api')
testImplementation project(':game:plugin-testing')
}
+9 -10
View File
@@ -1,11 +1,10 @@
plugin {
name = "prayer_skill"
authors = [
"Major",
"010253",
"tlf30"
]
dependencies = [
"api"
]
apply plugin: 'kotlin'
dependencies {
implementation project(':game')
implementation project(':cache')
implementation project(':net')
implementation project(':util')
implementation project(':game:plugin:api')
testImplementation project(':game:plugin-testing')
}
+9 -11
View File
@@ -1,12 +1,10 @@
plugin {
name = "runecrafting-skill"
authors = [
"Major",
"BugCrusher",
"tlf30"
]
apply plugin: 'kotlin'
dependencies = [
"api"
]
}
dependencies {
implementation project(':game')
implementation project(':cache')
implementation project(':net')
implementation project(':util')
implementation project(':game:plugin:api')
testImplementation project(':game:plugin-testing')
}
+10 -7
View File
@@ -1,7 +1,10 @@
plugin {
name = "woodcutting_skill"
authors = [
"tlf30"
]
dependencies = ["api"]
}
apply plugin: 'kotlin'
dependencies {
implementation project(':game')
implementation project(':cache')
implementation project(':net')
implementation project(':util')
implementation project(':game:plugin:api')
testImplementation project(':game:plugin-testing')
}
+24
View File
@@ -0,0 +1,24 @@
def detektAggregateReport = "$rootDir/reports/detekt-report.xml"
detekt {
version = detektVersion
defaultProfile {
output = file("$buildDir/reports")
outputName = "detekt-report"
config = file("$rootDir/gradle/config/detekt.yml")
parallel = true
}
}
dependencies {
detekt group: 'io.gitlab.arturbosch.detekt', name: 'detekt-formatting', version: detektVersion
}
sonarqube {
properties {
property "sonar.kotlin.detekt.reportPaths", detektAggregateReport
}
}
tasks["sonarqube"].dependsOn(detektCheck)
+474
View File
@@ -0,0 +1,474 @@
autoCorrect: true
failFast: false
test-pattern: # Configure exclusions for test sources
active: true
patterns: # Test file regexes
- '.*/test/.*'
- '.*Test.kt'
- '.*Spec.kt'
exclude-rule-sets:
- 'comments'
exclude-rules:
- 'NamingRules'
- 'WildcardImport'
- 'MagicNumber'
- 'MaxLineLength'
- 'LateinitUsage'
- 'StringLiteralDuplication'
- 'SpreadOperator'
- 'TooManyFunctions'
- 'ForEachOnRange'
build:
maxIssues: -1
weights:
# complexity: 2
# LongParameterList: 1
# style: 1
# comments: 1
processors:
active: true
exclude:
# - 'FunctionCountProcessor'
# - 'PropertyCountProcessor'
# - 'ClassCountProcessor'
# - 'PackageCountProcessor'
# - 'KtFileCountProcessor'
console-reports:
active: true
exclude:
# - 'ProjectStatisticsReport'
# - 'ComplexityReport'
# - 'NotificationReport'
# - 'FindingsReport'
# - 'BuildFailureReport'
output-reports:
active: true
exclude:
# - 'HtmlOutputReport'
# - 'PlainOutputReport'
# - 'XmlOutputReport'
comments:
active: true
CommentOverPrivateFunction:
active: false
CommentOverPrivateProperty:
active: false
EndOfSentenceFormat:
active: false
endOfSentenceFormat: ([.?!][ \t\n\r\f<])|([.?!]$)
UndocumentedPublicClass:
active: false
searchInNestedClass: true
searchInInnerClass: true
searchInInnerObject: true
searchInInnerInterface: true
UndocumentedPublicFunction:
active: false
complexity:
active: true
ComplexCondition:
active: false
threshold: 4
ComplexInterface:
active: false
threshold: 10
includeStaticDeclarations: false
ComplexMethod:
active: false
threshold: 10
ignoreSingleWhenExpression: false
LabeledExpression:
active: false
LargeClass:
active: true
threshold: 150
LongMethod:
active: false
threshold: 20
LongParameterList:
active: false
threshold: 6
ignoreDefaultParameters: false
MethodOverloading:
active: false
threshold: 6
NestedBlockDepth:
active: true
threshold: 4
StringLiteralDuplication:
active: false
threshold: 3
ignoreAnnotation: true
excludeStringsWithLessThan5Characters: true
ignoreStringsRegex: '$^'
TooManyFunctions:
active: true
thresholdInFiles: 11
thresholdInClasses: 11
thresholdInInterfaces: 11
thresholdInObjects: 11
thresholdInEnums: 11
ignoreDeprecated: false
ignorePrivate: false
empty-blocks:
active: true
EmptyCatchBlock:
active: true
allowedExceptionNameRegex: "^(_|(ignore|expected).*)"
EmptyClassBlock:
active: true
EmptyDefaultConstructor:
active: true
EmptyDoWhileBlock:
active: true
EmptyElseBlock:
active: true
EmptyFinallyBlock:
active: true
EmptyForBlock:
active: true
EmptyFunctionBlock:
active: true
ignoreOverriddenFunctions: false
EmptyIfBlock:
active: true
EmptyInitBlock:
active: true
EmptyKtFile:
active: true
EmptySecondaryConstructor:
active: true
EmptyWhenBlock:
active: true
EmptyWhileBlock:
active: true
exceptions:
active: true
ExceptionRaisedInUnexpectedLocation:
active: false
methodNames: 'toString,hashCode,equals,finalize'
InstanceOfCheckForException:
active: false
NotImplementedDeclaration:
active: false
PrintStackTrace:
active: false
RethrowCaughtException:
active: false
ReturnFromFinally:
active: false
SwallowedException:
active: false
ThrowingExceptionFromFinally:
active: false
ThrowingExceptionInMain:
active: false
ThrowingExceptionsWithoutMessageOrCause:
active: false
exceptions: 'IllegalArgumentException,IllegalStateException,IOException'
ThrowingNewInstanceOfSameException:
active: false
TooGenericExceptionCaught:
active: true
exceptionNames:
- ArrayIndexOutOfBoundsException
- Error
- Exception
- IllegalMonitorStateException
- NullPointerException
- IndexOutOfBoundsException
- RuntimeException
- Throwable
TooGenericExceptionThrown:
active: true
exceptionNames:
- Error
- Exception
- Throwable
- RuntimeException
formatting:
active: true
android: false
autoCorrect: true
ChainWrapping:
active: true
autoCorrect: true
CommentSpacing:
active: true
autoCorrect: true
Filename:
active: true
FinalNewline:
active: true
autoCorrect: true
ImportOrdering:
active: true
autoCorrect: true
Indentation:
active: true
autoCorrect: true
indentSize: 4
continuationIndentSize: 4
MaximumLineLength:
active: false
ModifierOrdering:
active: true
autoCorrect: true
NoBlankLineBeforeRbrace:
active: true
autoCorrect: true
NoConsecutiveBlankLines:
active: true
autoCorrect: true
NoEmptyClassBody:
active: true
autoCorrect: true
NoItParamInMultilineLambda:
active: false
NoLineBreakAfterElse:
active: true
autoCorrect: true
NoLineBreakBeforeAssignment:
active: true
autoCorrect: true
NoMultipleSpaces:
active: true
autoCorrect: true
NoSemicolons:
active: true
autoCorrect: true
NoTrailingSpaces:
active: true
autoCorrect: true
NoUnitReturn:
active: true
autoCorrect: true
NoUnusedImports:
active: true
autoCorrect: true
NoWildcardImports:
active: true
autoCorrect: true
ParameterListWrapping:
active: true
autoCorrect: true
indentSize: 4
SpacingAroundColon:
active: true
autoCorrect: true
SpacingAroundComma:
active: true
autoCorrect: true
SpacingAroundCurly:
active: true
autoCorrect: true
SpacingAroundKeyword:
active: true
autoCorrect: true
SpacingAroundOperators:
active: true
autoCorrect: true
SpacingAroundRangeOperator:
active: true
autoCorrect: true
StringTemplate:
active: true
autoCorrect: true
naming:
active: true
ClassNaming:
active: true
classPattern: '[A-Z$][a-zA-Z0-9$]*'
EnumNaming:
active: true
enumEntryPattern: '^[A-Z][_a-zA-Z0-9]*'
ForbiddenClassName:
active: false
forbiddenName: ''
FunctionMaxLength:
active: false
maximumFunctionNameLength: 30
FunctionMinLength:
active: false
minimumFunctionNameLength: 3
FunctionNaming:
active: true
functionPattern: '^([a-z$][a-zA-Z$0-9]*)|(`.*`)$'
excludeClassPattern: '$^'
MatchingDeclarationName:
active: true
MemberNameEqualsClassName:
active: false
ignoreOverriddenFunction: true
ObjectPropertyNaming:
active: true
propertyPattern: '[A-Za-z][_A-Za-z0-9]*'
constantPattern: '[A-Za-z][_A-Za-z0-9]*'
PackageNaming:
active: true
packagePattern: '^[a-z]+(\.[a-z][a-z0-9]*)*$'
TopLevelPropertyNaming:
active: false
constantPattern: '[A-Z][_A-Z0-9]*'
propertyPattern: '[A-Za-z][_A-Za-z0-9]*'
privatePropertyPattern: '(_)?[A-Za-z][A-Za-z0-9]*'
VariableMaxLength:
active: false
maximumVariableNameLength: 64
VariableMinLength:
active: false
minimumVariableNameLength: 1
VariableNaming:
active: false
variablePattern: '[a-z][A-Za-z0-9]*'
privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*'
excludeClassPattern: '$^'
performance:
active: true
ForEachOnRange:
active: true
SpreadOperator:
active: true
UnnecessaryTemporaryInstantiation:
active: true
potential-bugs:
active: true
DuplicateCaseInWhenExpression:
active: true
EqualsAlwaysReturnsTrueOrFalse:
active: false
EqualsWithHashCodeExist:
active: true
ExplicitGarbageCollectionCall:
active: true
InvalidRange:
active: false
IteratorHasNextCallsNextMethod:
active: false
IteratorNotThrowingNoSuchElementException:
active: false
LateinitUsage:
active: false
excludeAnnotatedProperties: ""
ignoreOnClassesPattern: ""
UnconditionalJumpStatementInLoop:
active: false
UnreachableCode:
active: true
UnsafeCallOnNullableType:
active: false
UnsafeCast:
active: false
UselessPostfixExpression:
active: false
WrongEqualsTypeParameter:
active: false
style:
active: true
CollapsibleIfStatements:
active: false
DataClassContainsFunctions:
active: false
conversionFunctionPrefix: 'to'
EqualsNullCall:
active: false
ExpressionBodySyntax:
active: false
includeLineWrapping: false
ForbiddenComment:
active: true
values: 'TODO:,FIXME:,STOPSHIP:'
ForbiddenImport:
active: false
imports: ''
FunctionOnlyReturningConstant:
active: false
ignoreOverridableFunction: true
excludedFunctions: 'describeContents'
LoopWithTooManyJumpStatements:
active: false
maxJumpCount: 1
MagicNumber:
active: false
MandatoryBracesIfStatements:
active: false
MaxLineLength:
active: false
maxLineLength: 120
excludePackageStatements: false
excludeImportStatements: false
excludeCommentStatements: false
MayBeConst:
active: false
ModifierOrder:
active: true
NestedClassesVisibility:
active: false
NewLineAtEndOfFile:
active: false
NoTabs:
active: true
OptionalAbstractKeyword:
active: true
OptionalUnit:
active: false
OptionalWhenBraces:
active: false
PreferToOverPairSyntax:
active: false
ProtectedMemberInFinalClass:
active: false
RedundantVisibilityModifierRule:
active: false
ReturnCount:
active: true
max: 2
excludedFunctions: "equals"
SafeCast:
active: true
SerialVersionUIDInSerializableClass:
active: false
SpacingBetweenPackageAndImports:
active: false
ThrowsCount:
active: true
max: 2
TrailingWhitespace:
active: false
UnnecessaryAbstractClass:
active: false
UnnecessaryInheritance:
active: false
UnnecessaryParentheses:
active: false
UntilInsteadOfRangeTo:
active: false
UnusedImports:
active: false
UnusedPrivateMember:
active: false
allowedNames: "(_|ignored|expected)"
UseDataClass:
active: false
excludeAnnotatedClasses: ""
UtilityClassWithPublicConstructor:
active: false
VarCouldBeVal:
active: false
WildcardImport:
active: true
excludeImports: 'java.util.*,kotlinx.android.synthetic.*'
-9
View File
@@ -1,10 +1 @@
apply plugin: 'org.jmailen.kotlinter'
kotlinter {
ignoreFailures = true
indentSize = 4
continuationIndentSize = 4
reporters = ['checkstyle', 'plain']
}
kotlin { experimental { coroutines 'enable' } }
+1
View File
@@ -16,4 +16,5 @@ ext {
junitJupiterVersion = '5.1.0'
mockkVersion = '1.7.15'
assertkVersion = '0.9'
detektVersion = '1.0.0.RC8'
}
-72
View File
@@ -1,72 +0,0 @@
apply plugin: 'jacoco'
def testedProjects() {
subprojects.findAll { subproject -> subproject.plugins.hasPlugin('java') || subproject.plugins.hasPlugin('kotlin') }
}
gradle.projectsEvaluated {
configure(testedProjects()) {
apply plugin: 'jacoco'
jacoco {
toolVersion = '0.8.1'
}
jacocoTestReport {
sourceDirectories = files(sourceSets.main.allSource.srcDirs)
classDirectories = files(sourceSets.main.output)
}
test {
reports {
junitXml.enabled = true
html.enabled = false
}
jacoco {
append = false
destinationFile = file("$buildDir/jacoco/jacocoTest.exec")
classDumpDir = file("$buildDir/jacoco/classpathdumps")
}
}
}
task jacocoTestReport(type: JacocoReport) {
def tests = []
def sourceDirs = files()
def classDirs = files()
def execData = files()
reports {
xml.enabled = true
html.enabled = false
}
testedProjects().each { subproject ->
sourceDirs += files(subproject.sourceSets.main.allSource.srcDirs)
classDirs += files(subproject.sourceSets.main.output)
execData += files(subproject.tasks.jacocoTestReport.executionData.findAll {
it.exists()
})
tests += subproject.tasks.test
}
dependsOn tests
sourceDirectories = sourceDirs
classDirectories = classDirs
executionData = execData
}
sonarqube {
properties {
property "sonar.organization", "apollo-rsps"
property "sonar.projectKey", "apollo:org.apollo"
property "sonar.projectName", "Apollo RSPS"
property "sonar.kotlin.file.suffixes", ".kt,.kts"
}
}
project.tasks["sonarqube"].dependsOn(jacocoTestReport)
}
+51
View File
@@ -0,0 +1,51 @@
apply plugin: 'jacoco'
def jacocoCoverageAggregate = "$buildDir/jacoco/jacocoTestAll.exec"
def testedProjects() {
subprojects.findAll { subproject -> subproject.plugins.hasPlugin('java') || subproject.plugins.hasPlugin('kotlin') }
}
configure(testedProjects()) {
jacoco {
toolVersion = '0.8.1'
}
jacocoTestReport {
sourceDirectories = files(sourceSets.main.allSource.srcDirs)
classDirectories = files(sourceSets.main.output)
}
test {
reports {
junitXml.enabled = true
html.enabled = false
}
jacoco {
append = false
destinationFile = file("$buildDir/jacoco/jacocoTest.exec")
classDumpDir = file("$buildDir/jacoco/classpathdumps")
}
}
}
task jacocoMerge(type: JacocoMerge) {
destinationFile = file(jacocoCoverageAggregate)
executionData = project.fileTree(dir: '.', include: '**/build/jacoco/test.exec')
}
sonarqube {
properties {
property "sonar.organization", "apollo-rsps"
property "sonar.projectKey", "apollo:org.apollo"
property "sonar.projectName", "Apollo RSPS"
property "sonar.kotlin.file.suffixes", ".kt,.kts"
property "sonar.jacoco.reportPaths", jacocoCoverageAggregate
}
}
tasks["sonarqube"].dependsOn(jacocoMerge)
+5 -1
View File
@@ -10,5 +10,9 @@ dependencies {
implementation group: 'com.google.guava', name: 'guava', version: guavaVersion
implementation group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: bouncycastleVersion
testImplementation group: 'junit', name: 'junit', version: junitVersion
test.useJUnitPlatform()
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: junitJupiterVersion
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: junitJupiterVersion
testImplementation group: 'org.junit.vintage', name: 'junit-vintage-engine', version: junitVintageVersion
testImplementation group: 'org.junit.platform', name: 'junit-platform-launcher', version: junitPlatformVersion
}
+5 -1
View File
@@ -9,7 +9,11 @@ dependencies {
implementation group: 'com.google.guava', name: 'guava', version: guavaVersion
implementation group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: bouncycastleVersion
testImplementation group: 'junit', name: 'junit', version: junitVersion
test.useJUnitPlatform()
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: junitJupiterVersion
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: junitJupiterVersion
testImplementation group: 'org.junit.vintage', name: 'junit-vintage-engine', version: junitVintageVersion
testImplementation group: 'org.junit.platform', name: 'junit-platform-launcher', version: junitPlatformVersion
}
task(genRsa, dependsOn: classes, type: JavaExec) {