-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathbuild.gradle
64 lines (59 loc) · 3.61 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
buildscript {
ext {
besuIdentifier = "besu-${besuVersion}"
besuFilename = "${besuIdentifier}.tar.gz"
besuUrl = "${distributionBaseUrl}${besuVersion}/${besuFilename}"
besuPluginsIdentifier = "${distributionIdentifier}-${version}"
besuPluginDir = File.createTempDir("plugins")
}
}
plugins {
id 'java-library'
id "org.sonarqube" version "4.3.1.3277"
}
sonar {
def tests = System.getProperty("tests")
def xmlTestReport = ""
// Conditional xmlReportPaths based on tests property
// Default is unit tests, we account only for the Unit tests jacoco coverage report
if(tests == null || tests=="Unit") {
print("Executing Sonarqube scanner Unit tests coverage report...\n")
xmlTestReport = "${project.projectDir}/arithmetization/build/reports/jacoco/test/jacocoTestReport.xml"
// If set to FastReplay, we account only for the Nightly tests coverage report
} else if(tests == "FastReplay") {
print("Executing Sonarqube scanner for FastReplay tests coverage report...\n")
xmlTestReport = "${project.projectDir}/arithmetization/build/reports/jacoco/jacocoFastReplayTestsReport/jacocoFastReplayTestsReport.xml"
// If set to Nightly, we account only for the Nightly tests coverage report
} else if(tests == "Nightly") {
print("Executing Sonarqube scanner for Nightly tests coverage report...\n")
xmlTestReport = "${project.projectDir}/arithmetization/build/reports/jacoco/jacocoNightlyTestsReport/jacocoNightlyTestsReport.xml"
// If set to Weekly, we account only for the Weekly tests coverage report
} else if(tests == "Weekly") {
print("Executing Sonarqube scanner for Weekly tests coverage report...\n")
xmlTestReport = "${project.projectDir}/arithmetization/build/reports/jacoco/jacocoWeeklyTestsReport/jacocoWeeklyTestsReport.xml"
// If set to ReferenceBlockchain, we account only for the Reference Blockchain tests coverage report
} else if(tests == "ReferenceBlockchain") {
print("Executing Sonarqube scanner for Reference Blockchain tests coverage report...\n")
xmlTestReport = "${project.projectDir}/reference-tests/build/reports/jacoco/jacocoReferenceBlockchainTestsReport/jacocoReferenceBlockchainTestsReport.xml"
// If set to ReferenceState, we account only for the Reference State tests coverage report
} else if(tests == "ReferenceState") {
print("Executing Sonarqube scanner for Reference State tests coverage report...\n")
xmlTestReport = "${project.projectDir}/reference-tests/build/reports/jacoco/jacocoReferenceGeneralStateTestsReport/jacocoReferenceGeneralStateTestsReport.xml"
} else if(tests == "All") {
print("Executing Sonarqube scanner for Unit, FastReplay, Nightly, Weekly, Reference Blockchain and State tests coverage report...\n")
xmlTestReport = "${project.projectDir}/arithmetization/build/reports/jacocoConcatenate/test/jacocoTestReport.xml"
} else {
// Force build failure if unknown concatenate value.
println("*** unknown tests property. Try '-Dconcatenate=Unit', '-Dconcatenate=FastReplay', '-Dconcatenate=Nightly', '-Dconcatenate=Weekly', '-Dconcatenate=ReferenceBlockchain','-Dconcatenate=ReferenceState' or '-Dconcatenate=All'\n\n")
assert false
}
properties {
property "sonar.projectKey", "linea-tracer"
property "sonar.host.url", "localhost:80"
property "sonar.login", "admin"
property "sonar.password", "Adminadmin123*"
property "sonar.coverage.exclusions", "reference-tests/**/*, testing/**/*, **/*/Trace.java"
property "sonar.coverage.jacoco.xmlReportPaths", "${xmlTestReport}"
}
}
version = project.hasProperty('releaseVersion') ? project.getProperty('releaseVersion') : 'snapshot'