98
98
]
99
99
}
100
100
101
- task setLocalRepo ( type : Exec ) {
101
+ tasks . register( ' setLocalRepo ' , Exec ) {
102
102
commandLine ' git' , ' worktree' , ' list'
103
103
standardOutput = new ByteArrayOutputStream ()
104
104
@@ -109,7 +109,8 @@ task setLocalRepo(type:Exec) {
109
109
}
110
110
111
111
// No group so it does not show up in the output of `gradlew tasks`
112
- task installGitHooks (type : Copy , dependsOn : ' setLocalRepo' ) {
112
+ tasks. register(' installGitHooks' , Copy ) {
113
+ dependsOn (' setLocalRepo' )
113
114
description = ' Copies git hooks to .git directory'
114
115
from files(' checker/bin-devel/git.post-merge' , ' checker/bin-devel/git.pre-commit' )
115
116
rename(' git\\ .(.*)' , ' $1' )
@@ -406,15 +407,15 @@ allprojects { currentProj ->
406
407
// Add the fat checker.jar to the classpath of every Javadoc task. This allows Javadoc in
407
408
// any module to reference classes in any other module.
408
409
// Also, build and use ManualTaglet as a taglet.
409
- tasks. withType(Javadoc ) {
410
+ tasks. withType(Javadoc ). configureEach {
410
411
dependsOn(' :checker:shadowJar' )
411
412
dependsOn(" :framework-test:tagletClasses" )
412
413
doFirst {
413
414
options. encoding = ' UTF-8'
414
415
if (! name. equals(' javadocDoclintAll' )) {
415
416
options. memberLevel = javadocMemberLevel
416
417
}
417
- classpath + = configurations. getByName (' checkerFatJar' ). asFileTree
418
+ classpath + = configurations. named (' checkerFatJar' ) . get( ). asFileTree
418
419
options. taglets ' org.checkerframework.taglet.ManualTaglet'
419
420
options. tagletPath(project(' :framework-test' ). sourceSets. taglet. output. classesDirs. getFiles() as File [])
420
421
@@ -587,8 +588,9 @@ allprojects { currentProj ->
587
588
} // end afterEvaluate
588
589
} // end allProjects
589
590
590
- task version ( group : ' Documentation ' ) {
591
+ tasks . register( ' version ' ) {
591
592
description = ' Print Checker Framework version'
593
+ group = ' Documentation'
592
594
doLast {
593
595
println version
594
596
}
@@ -604,9 +606,10 @@ task version(group: 'Documentation') {
604
606
* @param args list of arguments to pass to the checker
605
607
*/
606
608
def createCheckTypeTask (projectName , taskName , checker , args = []) {
607
- project(" ${ projectName} " ). tasks. create( name : " check${ taskName} " , type : JavaCompile , dependsOn : ' :checker:shadowJar ' ) {
609
+ project(" ${ projectName} " ). tasks. register( " check${ taskName} " , JavaCompile ) {
608
610
description = " Run the ${ taskName} Checker on the main sources."
609
611
group = ' Verification'
612
+ dependsOn(' :checker:shadowJar' )
610
613
// Always run the task.
611
614
outputs. upToDateWhen { false }
612
615
source = project(" ${ projectName} " ). sourceSets. main. java
@@ -635,8 +638,9 @@ def createCheckTypeTask(projectName, taskName, checker, args = []) {
635
638
}
636
639
}
637
640
638
- task htmlValidate ( type : Exec , group : ' Format ' ) {
641
+ tasks . register( ' htmlValidate ' , Exec ) {
639
642
description = ' Validate that HTML files are well-formed'
643
+ group = ' Format'
640
644
// This is the Nu Html Checker (v.Nu): https://github.com/validator/validator
641
645
executable ' html5validator'
642
646
args = [
@@ -649,7 +653,7 @@ task htmlValidate(type: Exec, group: 'Format') {
649
653
]
650
654
}
651
655
652
- task addFavicon ( type : Exec ) {
656
+ tasks . register( ' addFavicon ' , Exec ) {
653
657
dependsOn ' allJavadoc'
654
658
655
659
doFirst {
@@ -674,8 +678,9 @@ task addFavicon(type: Exec) {
674
678
// It's needed to create the Javadoc jars that we release in Maven Central.
675
679
// To make javadoc for only one subproject, run `./gradlew javadoc`
676
680
// in the subproject or `./gradlew :checker:javadoc` at the top level.
677
- task allJavadoc ( type : Javadoc , group : ' Documentation ' ) {
681
+ tasks . register( ' allJavadoc ' , Javadoc ) {
678
682
description = ' Generates API documentation that includes all the modules.'
683
+ group = ' Documentation'
679
684
dependsOn(' :checker:shadowJar' , ' getPlumeScripts' , ' getHtmlTools' , ' :checker-qual:jar' )
680
685
681
686
doFirst {
@@ -820,8 +825,9 @@ configurations {
820
825
dependencies {
821
826
requireJavadoc ' org.plumelib:require-javadoc:2.0.0'
822
827
}
823
- task requireJavadoc ( type : JavaExec , group : ' Documentation ' ) {
828
+ tasks . register( ' requireJavadoc ' , JavaExec ) {
824
829
description = ' Ensures that Javadoc documentation exists in source code.'
830
+ group = ' Documentation'
825
831
mainClass = ' org.plumelib.javadoc.RequireJavadoc'
826
832
classpath = configurations. requireJavadoc
827
833
args ' --exclude=module-info.java' , ' checker/src/main/java' , ' checker-qual/src/main/java' , ' checker-util/src/main/java' , ' dataflow/src/main/java' , ' framework/src/main/java' , ' framework-test/src/main/java' , ' javacutil/src/main/java'
@@ -847,7 +853,7 @@ task requireJavadoc(type: JavaExec, group: 'Documentation') {
847
853
* @return the new task
848
854
*/
849
855
def createJavadocTask (taskName , taskDescription , memberLevel ) {
850
- tasks. create( name : taskName, type : Javadoc ) {
856
+ tasks. register( taskName, Javadoc ) {
851
857
description = taskDescription
852
858
destinationDir = file(" ${ rootDir} /docs/tmpapi" )
853
859
destinationDir. mkdirs()
@@ -923,19 +929,21 @@ tasks.register('getDoLikeJavac', CloneTask) {
923
929
}
924
930
925
931
// No group so it does not show up in the output of `gradlew tasks`
926
- task pythonIsInstalled ( type : Exec ) {
932
+ tasks . register( ' pythonIsInstalled ' , Exec ) {
927
933
description = ' Check that the python3 executable is installed.'
928
934
executable = ' python3'
929
935
args ' --version'
930
936
}
931
937
932
- task docTags (type : Exec , group : ' Emacs' ) {
938
+ tasks. register(' docTags' , Exec ) {
939
+ group = ' Emacs'
933
940
commandLine ' make' , ' -C' , ' docs/manual/' , ' tags'
934
941
}
935
942
936
- task tags ( type : Exec , group : ' Emacs ' ) {
943
+ tasks . register( ' tags ' , Exec ) {
937
944
dependsOn docTags
938
945
description = ' Create Emacs TAGS table'
946
+ group = ' Emacs'
939
947
// running this task will also run the tags task in the subprojects, which is defined later in this file.
940
948
commandLine ' etags' , ' -i' , ' annotation-file-utilities/TAGS' , ' -i' , ' checker/TAGS' , ' -i' , ' checker-qual/TAGS' , ' -i' , ' checker-util/TAGS' , ' -i' , ' dataflow/TAGS' , ' -i' , ' framework/TAGS' , ' -i' , ' framework-test/TAGS' , ' -i' , ' javacutil/TAGS' , ' -i' , ' docs/manual/TAGS'
941
949
}
@@ -978,7 +986,7 @@ subprojects {
978
986
}
979
987
980
988
if (! project. name. startsWith(' checker-qual-android' )) {
981
- task tags( type : Exec ) {
989
+ tasks . register( ' tags ' , Exec ) {
982
990
description = ' Create Emacs TAGS table'
983
991
// `ctags -e -f TAGS` used to work in place of `etags`, but apparently no longer.
984
992
commandLine ' bash' , ' -c' , " find . \\ ( -name build -o -name jtreg -o -name tests \\ ) -prune -o -name '*.java' -print | sort-directory-order | xargs etags"
@@ -994,7 +1002,7 @@ subprojects {
994
1002
// until the project is evaluated.
995
1003
afterEvaluate {
996
1004
// Adds manifest to all Jar files
997
- tasks. withType(Jar ) {
1005
+ tasks. withType(Jar ). configureEach {
998
1006
includeEmptyDirs = false
999
1007
if (archiveFileName. get(). startsWith(' checker-qual' ) || archiveFileName. get(). startsWith(' checker-util' )) {
1000
1008
metaInf {
@@ -1008,7 +1016,7 @@ subprojects {
1008
1016
manifest {
1009
1017
attributes(' Implementation-Version' : " ${ project.version} " )
1010
1018
attributes(' Implementation-URL' : ' https://checkerframework.org' )
1011
- if (! archiveFileName. get(). endsWith(' source.jar' ) && ! archiveFileName. get(). startsWith(' checker-qual' )) {
1019
+ if (! archiveFileName. get(). endsWith(' source.jar' ) && ! archiveFileName. get(). startsWith(' checker-qual' )) {
1012
1020
attributes(' Automatic-Module-Name' : ' org.checkerframework.' + project. name. replaceAll(' -' , ' .' ))
1013
1021
}
1014
1022
if (archiveFileName. get(). startsWith(' checker-qual' ) || archiveFileName. get(). startsWith(' checker-util' )) {
@@ -1079,8 +1087,9 @@ subprojects {
1079
1087
1080
1088
// Add jtregTests to framework and checker modules
1081
1089
if (project. name. is(' framework' ) || project. name. is(' checker' )) {
1082
- tasks. create( name : ' jtregTests' , type : Exec , group : ' Verification ' ) {
1090
+ tasks. register( ' jtregTests' , Exec ) {
1083
1091
description = ' Run the jtreg tests. Requires jtreg to be installed.'
1092
+ group = ' Verification'
1084
1093
dependsOn(' compileJava' )
1085
1094
dependsOn(' compileTestJava' )
1086
1095
dependsOn(' shadowJar' )
@@ -1137,7 +1146,7 @@ subprojects {
1137
1146
// Create a task for each JUnit test class whose name is the same as the JUnit class name.
1138
1147
sourceSets. test. allJava. filter { it. path. contains(' test/junit' ) }. forEach { file ->
1139
1148
String junitClassName = file. name. replaceAll(' .java' , ' ' )
1140
- tasks. create( name : " ${ junitClassName} " , type : Test ) {
1149
+ tasks. register( " ${ junitClassName} " , Test ) {
1141
1150
description = " Run ${ junitClassName} tests."
1142
1151
include " **/${ name} .class"
1143
1152
testClassesDirs = testing. suites. test. sources. output. classesDirs
@@ -1166,7 +1175,7 @@ subprojects {
1166
1175
1167
1176
// Fork the test to try to improve performance.
1168
1177
// https://docs.gradle.org/current/userguide/performance.html#fork_tests_into_multiple_processes
1169
- tasks. withType(Test ). configureEach {
1178
+ tasks. withType(Test ) {
1170
1179
forkEvery = 25
1171
1180
}
1172
1181
}
@@ -1194,8 +1203,9 @@ subprojects {
1194
1203
}
1195
1204
1196
1205
// Create a nonJunitTests task per project
1197
- tasks. create( name : ' nonJunitTests' , group : ' Verification ' ) {
1206
+ tasks. register( ' nonJunitTests' ) {
1198
1207
description = ' Run all Checker Framework tests except for the Junit tests and inference tests.'
1208
+ group = ' Verification'
1199
1209
if (project. name. is(' framework' ) || project. name. is(' checker' )) {
1200
1210
dependsOn(' jtregTests' )
1201
1211
}
@@ -1213,20 +1223,23 @@ subprojects {
1213
1223
}
1214
1224
1215
1225
// Create an inferenceTests task per project
1216
- tasks. create( name : ' inferenceTests' , group : ' Verification ' ) {
1226
+ tasks. register( ' inferenceTests' ) {
1217
1227
description = ' Run inference tests.'
1228
+ group = ' Verification'
1218
1229
if (project. name. is(' checker' )) {
1219
1230
dependsOn(' inferenceTests-part1' , ' inferenceTests-part1' )
1220
1231
}
1221
1232
}
1222
- tasks. create( name : ' inferenceTests-part1' , group : ' Verification ' ) {
1233
+ tasks. register( ' inferenceTests-part1' ) {
1223
1234
description = ' Run inference tests (part 1).'
1235
+ group = ' Verification'
1224
1236
if (project. name. is(' checker' )) {
1225
1237
dependsOn(' ainferTest' , ' wpiManyTest' )
1226
1238
}
1227
1239
}
1228
- tasks. create( name : ' inferenceTests-part2' , group : ' Verification ' ) {
1240
+ tasks. register( ' inferenceTests-part2' ) {
1229
1241
description = ' Run inference tests (part 2).'
1242
+ group = ' Verification'
1230
1243
if (project. name. is(' checker' )) {
1231
1244
dependsOn(' wpiPlumeLibTest' )
1232
1245
}
@@ -1235,16 +1248,19 @@ subprojects {
1235
1248
// Create a typecheck task per project (dogfooding the Checker Framework on itself).
1236
1249
// This isn't a test of the Checker Framework as the test and nonJunitTests tasks are.
1237
1250
// Tasks such as 'checkInterning' are constructed by createCheckTypeTask.
1238
- tasks. create( name : ' typecheck' , group : ' Verification ' ) {
1251
+ tasks. register( ' typecheck' ) {
1239
1252
description = ' Run the Checker Framework on itself'
1253
+ group = ' Verification'
1240
1254
dependsOn(' typecheck-part1' , ' typecheck-part2' )
1241
1255
}
1242
- tasks. create( name : ' typecheck-part1' , group : ' Verification ' ) {
1256
+ tasks. register( ' typecheck-part1' ) {
1243
1257
description = ' Run the Checker Framework on itself (part 1)'
1258
+ group = ' Verification'
1244
1259
dependsOn(' checkCompilerMessages' , ' checkFormatter' , ' checkInterning' , ' checkOptional' , ' checkPurity' )
1245
1260
}
1246
- tasks. create( name : ' typecheck-part2' , group : ' Verification ' ) {
1261
+ tasks. register( ' typecheck-part2' ) {
1247
1262
description = ' Run the Checker Framework on itself (part 2)'
1263
+ group = ' Verification'
1248
1264
dependsOn(' checkResourceLeak' , ' checkSignature' )
1249
1265
if (! (project. name. is(' framework' ) || project. name. is(' checker' ))) {
1250
1266
dependsOn(' checkNullness' )
@@ -1253,13 +1269,15 @@ subprojects {
1253
1269
1254
1270
// Create an allTests task per project.
1255
1271
// allTests = test + nonJunitTests + inferenceTests + typecheck
1256
- tasks. create( name : ' allTests' , group : ' Verification ' ) {
1272
+ tasks. register( ' allTests' ) {
1257
1273
description = ' Run all Checker Framework tests'
1274
+ group = ' Verification'
1258
1275
// The 'test' target is just the JUnit tests.
1259
1276
dependsOn(' test' , ' nonJunitTests' , ' inferenceTests' , ' typecheck' )
1260
1277
}
1261
1278
1262
- task javadocPrivate(dependsOn : javadoc) {
1279
+ tasks. register(' javadocPrivate' ){
1280
+ dependsOn(javadoc)
1263
1281
doFirst {
1264
1282
javadocMemberLevel = JavadocMemberLevel . PRIVATE
1265
1283
}
@@ -1279,8 +1297,9 @@ assemble.dependsOn(':checker:assembleForJavac')
1279
1297
1280
1298
assemble. mustRunAfter(clean)
1281
1299
1282
- task buildAll ( group : ' Build ' ) {
1300
+ tasks . register( ' buildAll ' ) {
1283
1301
description = ' Build all jar files and the manuals, including source and javadoc jars'
1302
+ group = ' Build'
1284
1303
dependsOn(allJavadoc)
1285
1304
subprojects { Project subproject ->
1286
1305
dependsOn(" ${ subproject.name} :assemble" )
0 commit comments