-
Notifications
You must be signed in to change notification settings - Fork 727
/
build.gradle
84 lines (73 loc) · 2.64 KB
/
build.gradle
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
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.KOTLIN_VERSION = "1.8.21"
ext.ANDROID_PLUGIN_VERSION = '7.4.0'
ext.KSP_VERSION = '1.8.21-1.0.11'
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath "com.android.tools.build:gradle:$ANDROID_PLUGIN_VERSION"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION"
// Upload with: (see RELEASING.md)
// ./gradlew publishAllPublicationsToMavenCentral --no-configuration-cache
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.22.0'
// Dokka is needed on classpath for vanniktech publish plugin
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.6.10"
}
}
plugins {
// Run ./gradlew dependencyUpdates to see avilable version updates
id 'com.github.ben-manes.versions' version '0.42.0'
id "com.google.devtools.ksp" version "$KSP_VERSION"
}
allprojects {
repositories {
google()
mavenCentral()
}
// Prevent javadoc task complaining about errors with kotlin files
tasks.withType(Javadoc) {
excludes = ['**/*.kt']
}
}
subprojects { project ->
apply from: "$rootDir/blessedDeps.gradle"
apply plugin: 'com.github.ben-manes.versions'
apply from: "${project.rootDir}/ktlint.gradle"
afterEvaluate {
if (project.tasks.findByName('check')) {
check.dependsOn('ktlint')
}
if (project.extensions.findByType(com.android.build.gradle.LibraryExtension.class) != null) {
project.android.libraryVariants.all { variant ->
def outputFolder = new File("build/generated/ksp/${variant.name}/kotlin")
variant.addJavaSourceFoldersToModel(outputFolder)
android.sourceSets.getAt(variant.name).java {
srcDir(outputFolder)
}
}
} else if (project.extensions.findByType(com.android.build.gradle.AbstractAppExtension.class) != null) {
project.android.applicationVariants.all { variant ->
def outputFolder = new File("build/generated/ksp/${variant.name}/kotlin")
variant.addJavaSourceFoldersToModel(outputFolder)
android.sourceSets.getAt(variant.name).java {
srcDir(outputFolder)
}
}
}
}
}
def isNonStable = { String version ->
def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { it -> version.toUpperCase().contains(it) }
def regex = /^[0-9,.v-]+(-r)?$/
return !stableKeyword && !(version ==~ regex)
}
tasks.named("dependencyUpdates").configure {
// disallow release candidates as upgradable versions from stable versions
rejectVersionIf {
isNonStable(it.candidate.version) && !isNonStable(it.currentVersion)
}
}