-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinvert.init.script.gradle.kts
87 lines (81 loc) · 2.89 KB
/
invert.init.script.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import com.squareup.invert.InvertExtension
import com.squareup.invert.InvertGradlePlugin
initscript {
repositories {
mavenLocal()
mavenCentral()
gradlePluginPortal()
// SNAPSHOT Versions
maven {
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots")
}
}
dependencies {
val invertVersion = "0.0.4-dev-SNAPSHOT"
classpath("com.squareup.invert:invert-gradle-plugin:$invertVersion")
classpath("com.squareup.invert:invert-collectors:$invertVersion")
classpath("com.squareup.invert:invert-owners-github:$invertVersion")
}
}
apply<InvertInitScriptPlugin>()
class InvertInitScriptPlugin : Plugin<Gradle> {
override fun apply(gradle: Gradle) {
gradle.settingsEvaluated {
gradle.rootProject {
buildscript {
repositories {
mavenLocal()
mavenCentral()
gradlePluginPortal()
// SNAPSHOT Versions
maven {
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots")
}
}
dependencies {
val invertVersion = "0.0.4-dev-SNAPSHOT"
classpath("com.squareup.invert:invert-gradle-plugin:$invertVersion")
classpath("com.squareup.invert:invert-collectors:$invertVersion")
classpath("com.squareup.invert:invert-owners-github:$invertVersion")
}
}
}
gradle.rootProject {
afterEvaluate {
plugins.apply(com.squareup.invert.InvertGradlePlugin::class.java)
this.extensions.getByType(com.squareup.invert.InvertExtension::class.java).apply {
ownershipCollector(com.squareup.invert.owners.GitHubCodeOwnersInvertOwnershipCollector)
addStatCollector(
com.squareup.invert.collectors.linesofcode.LinesOfCodeStatCollector(
name = "Kotlin",
fileExtensions = listOf("kt", "kts"),
)
)
addStatCollector(
com.squareup.invert.collectors.linesofcode.LinesOfCodeStatCollector(
name = "Java",
fileExtensions = listOf("java"),
)
)
addStatCollector(
com.squareup.invert.collectors.contains.InvertContainsStatCollector(
statKey = "wildcard-imports",
statDescription = "Wildcard Imports",
linePredicate = { it.contains("import") && it.contains("*") },
filePredicate = { it.extension == "kt" || it.extension == "kts" },
)
)
addStatCollector(
com.squareup.invert.collectors.contains.InvertContainsStatCollector(
statKey = "todos",
statDescription = "TODOs",
linePredicate = { it.contains("TODO") },
filePredicate = { true },
)
)
}
}
}
}
}
}