-
Notifications
You must be signed in to change notification settings - Fork 122
/
build.gradle
103 lines (87 loc) · 2.87 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
buildscript {
ext {
// Airship Version - major.minor.patch
airshipVersion = '18.3.3'
// Airship Version Qualifier beta, release, etc...
// airshipVersionQualifier = "alpha"
// Android SDK Versions
minSdkVersion = 21
compileSdkVersion = 34
targetSdkVersion = 34
// Looking for dependency versions?
// See: ./gradle/libs.versions.toml
}
dependencies {
classpath "com.android.tools.build:gradle:${libs.versions.androidGradlePlugin.get()}"
classpath "com.google.gms:google-services:${libs.versions.googleServicesPlugin.get()}"
classpath "org.jetbrains.kotlin:kotlin-allopen:${libs.versions.kotlin.get()}"
}
}
plugins {
id 'airship-doclava'
id 'airship-dokka'
id 'airship-publish'
alias(libs.plugins.benmanes.versions)
alias(libs.plugins.spotless)
}
tasks.register('packageDocs') {
dependsOn(packageJavadoc, packageKDoc)
group = JavaBasePlugin.DOCUMENTATION_GROUP
description = "Generate Javadoc and KDoc archives for release"
}
tasks.register('getVersion') {
doLast {
def version = airshipVersion
if (project.hasProperty("airshipVersionQualifier")) {
version += "-" + airshipVersionQualifier
}
println version
}
}
// TODO: need to update ktlint for compatibility with kotlin 1.9, but they've changed
// how to configure it. Disabling ktlint for now, and we'll revisit later.
spotless {
java {
target '**/*.java'
targetExclude '.idea/**'
trimTrailingWhitespace()
indentWithSpaces()
endWithNewline()
}
def ktlintVersion = libs.versions.ktlint.get()
def ktlintUserData = [
'android': 'true',
'max_line_length': 'off',
// Match Android Kotlin style guide import order.
// https://developer.android.com/kotlin/style-guide
'kotlin_imports_layout': 'ascii',
// Disable 'indent' to avoid overly aggressive wrapping of function parameters.
'disabled_rules': 'indent'
]
kotlin {
target '**/*.kt'
targetExclude '.idea/**', 'buildSrc/**'
//ktlint(ktlintVersion).userData(ktlintUserData)
trimTrailingWhitespace()
indentWithSpaces()
endWithNewline()
}
kotlinGradle {
target 'buildSrc/**/*.kts', 'buildSrc/**/*.kt'
targetExclude 'buildSrc/build/**'
//ktlint(ktlintVersion).userData(ktlintUserData)
trimTrailingWhitespace()
indentWithSpaces()
endWithNewline()
}
}
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 {
it.rejectVersionIf {
isNonStable(it.candidate.version)
}
}