• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3  */
4 
5 import ru.vyarus.gradle.plugin.animalsniffer.*
6 
<lambda>null7 configure(subprojects) {
8     // Skip JDK 8 projects or unpublished ones
9     if (!shouldSniff()) return@configure
10     apply(plugin = "ru.vyarus.animalsniffer")
11     project.plugins.withType(JavaPlugin::class.java) {
12         configure<AnimalSnifferExtension> {
13             sourceSets = listOf((project.extensions.getByName("sourceSets") as SourceSetContainer).getByName("main"))
14         }
15         val signature: Configuration by configurations
16         dependencies {
17             signature("net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature")
18             signature("org.codehaus.mojo.signature:java17:1.0@signature")
19         }
20 
21         if (project.name == coreModule) {
22             // Specific files so nothing from core is accidentally skipped
23             tasks.withType<AnimalSniffer>().configureEach {
24                 exclude("**/future/FutureKt*")
25                 exclude("**/future/ContinuationHandler*")
26                 exclude("**/future/CompletableFutureCoroutine*")
27 
28                 exclude("**/stream/StreamKt*")
29                 exclude("**/stream/StreamFlow*")
30 
31                 exclude("**/time/TimeKt*")
32             }
33         }
34     }
35 }
36 
Projectnull37 fun Project.shouldSniff(): Boolean {
38     // Skip all non-JVM projects
39     if (platformOf(project) != "jvm") return false
40     val name = project.name
41     if (name in unpublished || name in sourceless || name in androidNonCompatibleProjects) return false
42     return true
43 }
44