@@ -24,9 +24,15 @@ buildscript {
24
24
}
25
25
26
26
plugins {
27
+ `build- scan` version " 1.16"
27
28
id(" com.github.ben-manes.versions" ) version " 0.20.0"
28
29
}
29
30
31
+ buildScan {
32
+ setTermsOfServiceUrl(" https://gradle.com/terms-of-service" )
33
+ setTermsOfServiceAgree(" yes" )
34
+ }
35
+
30
36
// See https://github.com/gradle/kotlin-dsl/issues/607#issuecomment-375687119
31
37
subprojects { parent!! .path.takeIf { it != rootProject.path }?.let { evaluationDependsOn(it) } }
32
38
@@ -47,7 +53,7 @@ allprojects {
47
53
}
48
54
}
49
55
50
- tasks.withType<Wrapper > {
56
+ tasks.withType<Wrapper >().configureEach {
51
57
distributionType = Wrapper .DistributionType .ALL
52
58
}
53
59
@@ -115,10 +121,10 @@ fun Project.configureQuality() {
115
121
apply (plugin = " checkstyle" )
116
122
117
123
configure<CheckstyleExtension > { toolVersion = " 8.10.1" }
118
- check { dependsOn(" checkstyle" ) }
124
+ tasks.named( " check" ).configure { dependsOn(" checkstyle" ) }
119
125
120
- task <Checkstyle >(" checkstyle" ) {
121
- configFile = file(" $configDir /checkstyle.xml" )
126
+ tasks.register <Checkstyle >(" checkstyle" ) {
127
+ configFile = file(" ${project. configDir} /checkstyle.xml" )
122
128
source(" src" )
123
129
include(" **/*.java" )
124
130
exclude(" **/gen/**" )
@@ -127,85 +133,77 @@ fun Project.configureQuality() {
127
133
}
128
134
129
135
fun Project.setupPublishing () {
130
- val sourcesJar = task <Jar >(" sourcesJar" ) {
136
+ val sourcesJar = tasks.register <Jar >(" sourcesJar" ) {
131
137
classifier = " sources"
132
138
from(project.the<BaseExtension >().sourceSets[" main" ].java.srcDirs)
133
139
}
134
140
135
- val javadoc = task <Javadoc >(" javadoc" ) {
136
- afterEvaluate {
137
- dependsOn (project.the<LibraryExtension >().libraryVariants.map { it.assemble } )
141
+ val javadoc = tasks.register <Javadoc >(" javadoc" ) {
142
+ setSource(project.the< BaseExtension >().sourceSets[ " main " ].java.srcDirs)
143
+ classpath + = files (project.the<BaseExtension >().bootClasspath )
138
144
139
- setSource(project.the<BaseExtension >().sourceSets[" main" ].java.srcDirs)
140
- classpath + = files(project.the<BaseExtension >().bootClasspath)
141
- classpath + = files(project.the<LibraryExtension >().libraryVariants.map {
142
- (it.javaCompiler as AbstractCompile ).classpath
143
- })
145
+ project.the<LibraryExtension >().libraryVariants.configureEach {
146
+ dependsOn(assemble)
147
+ classpath + = files((javaCompiler as AbstractCompile ).classpath)
144
148
}
145
149
146
150
// Ignore warnings about incomplete documentation
147
151
(options as StandardJavadocDocletOptions ).addStringOption(" Xdoclint:none" , " -quiet" )
148
152
}
149
153
150
- val javadocJar = task <Jar >(" javadocJar" ) {
154
+ val javadocJar = tasks.register <Jar >(" javadocJar" ) {
151
155
dependsOn(javadoc)
152
156
classifier = " javadoc"
153
- from(javadoc.destinationDir)
157
+ from(javadoc.get(). destinationDir)
154
158
}
155
159
156
160
artifacts.add(" archives" , javadocJar)
157
161
artifacts.add(" archives" , sourcesJar)
158
162
159
- tasks.whenTaskAdded {
160
- if (name.contains(" publish" ) && name.contains(" publication" , true )) {
161
- dependsOn(" assembleRelease" )
162
- }
163
- }
164
-
165
163
afterEvaluate {
166
164
if (isLibrary) {
167
- task (" testAll" ) {
165
+ tasks.register (" testAll" ) {
168
166
dependsOn(* Config .submodules.map {
169
167
" :$it :testDebugUnitTest"
170
168
}.toTypedArray())
171
169
}
172
170
173
- task (" prepareArtifacts" ) {
171
+ tasks.register (" prepareArtifacts" ) {
174
172
dependsOn(javadocJar, sourcesJar, " assembleRelease" )
175
173
dependsOn(" generatePomFileForMonolithLibraryPublication" )
176
174
dependsOn(* Config .submodules.map {
177
175
" :$it :prepareArtifacts"
178
176
}.toTypedArray())
179
177
}
180
178
181
- task (" publishAllToMavenLocal" ) {
179
+ tasks.register (" publishAllToMavenLocal" ) {
182
180
dependsOn(" publishMonolithLibraryPublicationToMavenLocal" )
183
181
dependsOn(* Config .submodules.map {
184
182
" :$it :publish${it.capitalize()} LibraryPublicationToMavenLocal"
185
183
}.toTypedArray())
186
184
}
187
185
188
- task (" publishAllToCustomLocal" ) {
186
+ tasks.register (" publishAllToCustomLocal" ) {
189
187
dependsOn(" publishMonolithLibraryPublicationToCustomLocalRepository" )
190
188
dependsOn(* Config .submodules.map {
191
189
" :$it :publish${it.capitalize()} LibraryPublicationToCustomLocalRepository"
192
190
}.toTypedArray())
193
191
}
194
192
195
- task (" bintrayUploadAll" ) {
193
+ tasks.register (" bintrayUploadAll" ) {
196
194
dependsOn(" bintrayUpload" )
197
195
dependsOn(* Config .submodules.map {
198
196
" :$it :bintrayUpload"
199
197
}.toTypedArray())
200
198
}
201
199
} else {
202
200
val pomTask = " generatePomFileFor${name.capitalize()} LibraryPublication"
203
- task (" prepareArtifacts" ) {
201
+ tasks.register (" prepareArtifacts" ) {
204
202
dependsOn(javadocJar, sourcesJar, " assembleRelease" , pomTask)
205
203
}
206
204
}
207
205
208
- tasks[ " bintrayUpload" ]. dependsOn(" prepareArtifacts" )
206
+ tasks.named( " bintrayUpload" ).configure { dependsOn(" prepareArtifacts" ) }
209
207
}
210
208
211
209
apply (plugin = " maven-publish" )
@@ -251,8 +249,8 @@ fun Project.setupPublishing() {
251
249
""" .trimMargin())
252
250
253
251
artifact(releaseAar)
254
- artifact(javadocJar)
255
- artifact(sourcesJar)
252
+ artifact(javadocJar.get() )
253
+ artifact(sourcesJar.get() )
256
254
257
255
pom {
258
256
name.set(" FirebaseUI ${project.name.capitalize()} " )
@@ -325,6 +323,12 @@ fun Project.setupPublishing() {
325
323
}
326
324
}
327
325
326
+ tasks.matching {
327
+ it.name.contains(" publish" ) && it.name.contains(" publication" , true )
328
+ }.configureEach {
329
+ dependsOn(" assembleRelease" )
330
+ }
331
+
328
332
val bintrayUsername = properties[" bintrayUser" ] as String?
329
333
? : System .getProperty(" BINTRAY_USER" ) ? : System .getenv(" BINTRAY_USER" )
330
334
val bintrayKey = properties[" bintrayKey" ] as String?
@@ -341,7 +345,7 @@ fun Project.setupPublishing() {
341
345
})
342
346
}
343
347
344
- tasks.withType<ArtifactoryTask > { publications(publicationName) }
348
+ tasks.withType<ArtifactoryTask >().configureEach { publications(publicationName) }
345
349
346
350
configure<BintrayExtension > {
347
351
user = bintrayUsername
0 commit comments