-
Notifications
You must be signed in to change notification settings - Fork 123
/
Copy pathbuild.gradle
146 lines (122 loc) · 4.12 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
buildscript {
ext {
// Airship Version - major.minor.patch
airshipVersion = '19.0.0'
// Airship Version Qualifier beta, release, etc...
// airshipVersionQualifier = "alpha"
// Android SDK Versions
minSdkVersion = 23
compileSdkVersion = 35
targetSdkVersion = 35
// 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-publish'
id 'org.jetbrains.dokka'
alias(libs.plugins.benmanes.versions)
alias(libs.plugins.spotless)
}
dependencies {
dokkaPlugin(libs.dokka.android)
dokka(project(":urbanairship-adm"))
dokka(project(":urbanairship-automation"))
dokka(project(":urbanairship-automation-compose"))
dokka(project(":urbanairship-core"))
dokka(project(":urbanairship-fcm"))
dokka(project(":urbanairship-hms"))
dokka(project(":urbanairship-live-update"))
dokka(project(":urbanairship-message-center"))
dokka(project(":urbanairship-preference-center"))
dokka(project(":urbanairship-feature-flag"))
}
dokka {
moduleName.set("Airship Android SDK")
dokkaPublications.html {
suppressInheritedMembers.set(false)
outputDirectory.set(rootProject.layout.buildDirectory.dir("docs/kdoc"))
}
pluginsConfiguration.html {
customAssets.from("$rootDir/docs/dokka/logo-icon.svg")
footerMessage.set("©${Year.now().value} Airship")
}
}
tasks.register("packageKDoc", Tar) {
dependsOn("dokkaGenerate")
group = JavaBasePlugin.DOCUMENTATION_GROUP
description = "Generates documentation in KDoc format"
into("./") {
from("build/docs/kdoc")
}
archiveFileName.set("${rootProject.property("airshipVersion")}-kdoc.tar.gz")
destinationDirectory.set(file("build/docs"))
archiveExtension.set("tar.gz")
compression = Compression.GZIP
}
tasks.register("packageDocs") {
dependsOn("packageKDoc")
group = JavaBasePlugin.DOCUMENTATION_GROUP
description = "Generate 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)
}
}