1616
1717plugins {
1818 id ' java'
19+ id ' test-report-aggregation'
1920 id ' com.github.sherter.google-java-format' version ' 0.9'
2021 id " io.freefair.aggregate-javadoc-jar" version " 6.4.3"
2122 id " pl.allegro.tech.build.axion-release" version " 1.13.6"
2223}
2324
24- repositories {
25- mavenCentral()
26- }
27-
28- // Setup and configure Javadoc plugin
25+ // Setup and configure properties that are consistent across all projects, including sub-modules.
2926allprojects {
3027 group ' org.mobilitydata'
28+
3129 // Per the axion-release plugin, this computes the project version based
3230 // on the most recent tag in the repo.
3331 version scmVersion. version
3432
33+ repositories {
34+ mavenCentral()
35+ }
36+
37+ tasks. withType(JavaCompile ) {
38+ // All Java projects should target the same compatibility version.
39+ sourceCompatibility = JavaVersion . VERSION_11
40+ targetCompatibility = JavaVersion . VERSION_11
41+
42+ // Our source files should be encoded in UTF-8, regardless of the platform (e.g. Windows).
43+ compileJava. options. encoding = " UTF-8"
44+ compileTestJava. options. encoding = " UTF-8"
45+ }
46+
3547 tasks. withType(Javadoc ) {
3648 options. encoding = ' UTF-8'
3749 }
38- }
3950
40- // A resolvable configuration to collect test reports data
41- configurations {
42- testReportData {
43- canBeResolved = true
44- canBeConsumed = false
45- attributes {
46- attribute( Category . CATEGORY_ATTRIBUTE , objects . named( Category , Category . DOCUMENTATION ))
47- attribute( DocsType . DOCS_TYPE_ATTRIBUTE , objects . named( DocsType , ' test-report-data ' ))
51+ // All projects that include the 'java` plugin will have a Test task by default.
52+ tasks . withType( Test ) {
53+ // Always run tests, even when nothing changed.
54+ dependsOn ' cleanTest '
55+
56+ // Show test results.
57+ testLogging {
58+ events " passed " , " skipped " , " failed "
4859 }
49- }
50- }
5160
52- dependencies {
53- testReportData project(' main' )
54- testReportData project(' :processor' )
55- testReportData project(' :core' )
61+ // Define a system project for the project version
62+ systemProperty ' gtfsValidatorVersionForTest' , project. version
63+
64+ // Any project with a test should be added to test report aggregation in the root project.
65+ rootProject. dependencies. add(' testReportAggregation' , project)
66+ }
5667}
5768
58- tasks. register(' testReport' , TestReport ) {
59- destinationDir = file(" $buildDir /reports/allTests" )
60- // Use test results from testReportData configuration
61- testResultDirs. from(configurations. testReportData)
69+ reporting {
70+ reports {
71+ // Necessary for unit test result aggregation.
72+ testAggregateTestReport(AggregateTestReport ) {
73+ testType = TestSuiteType . UNIT_TEST
74+ }
75+ }
6276}
6377
6478task copyRulesToWebClient (type : Copy ) {
6579 from " ./RULES.md"
6680 into " ./web/client/static"
6781}
6882
69- build. dependsOn copyRulesToWebClient
83+ build. dependsOn copyRulesToWebClient
0 commit comments