-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added collectors to init scripts. Also publishing all artifacts.
- Loading branch information
1 parent
f8329b2
commit 29f364a
Showing
8 changed files
with
392 additions
and
349 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,84 @@ | ||
import com.squareup.invert.InvertGradlePlugin | ||
import com.squareup.invert.InvertExtension | ||
import com.squareup.invert.InvertGradlePlugin | ||
|
||
initscript { | ||
repositories { | ||
mavenCentral() | ||
gradlePluginPortal() | ||
// SNAPSHOT Versions | ||
maven { | ||
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots") | ||
} | ||
} | ||
dependencies { | ||
val invertVersion = "+" | ||
classpath("com.squareup.invert:invert-gradle-plugin:$invertVersion") | ||
repositories { | ||
mavenCentral() | ||
gradlePluginPortal() | ||
// SNAPSHOT Versions | ||
maven { | ||
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots") | ||
} | ||
} | ||
dependencies { | ||
val invertVersion = "+" | ||
classpath("com.squareup.invert:invert-gradle-plugin:$invertVersion") | ||
} | ||
} | ||
|
||
apply<InvertInitScriptPlugin>() | ||
|
||
class InvertInitScriptPlugin : Plugin<Gradle> { | ||
|
||
override fun apply(gradle: Gradle) { | ||
gradle.settingsEvaluated { | ||
gradle.rootProject { | ||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
gradlePluginPortal() | ||
mavenLocal() | ||
// 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") | ||
} | ||
} | ||
override fun apply(gradle: Gradle) { | ||
gradle.settingsEvaluated { | ||
gradle.rootProject { | ||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
gradlePluginPortal() | ||
mavenLocal() | ||
// SNAPSHOT Versions | ||
maven { | ||
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots") | ||
} | ||
} | ||
|
||
gradle.rootProject { | ||
afterEvaluate { | ||
plugins.apply(com.squareup.invert.InvertGradlePlugin::class.java) | ||
this.extensions.getByType(com.squareup.invert.InvertExtension::class.java).apply { | ||
// ownershipCollector(...) | ||
// addStatCollector(...) | ||
} | ||
} | ||
} | ||
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 }, | ||
) | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.