Skip to content

Commit

Permalink
don't try to import to an existing db
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Florentine <[email protected]>
  • Loading branch information
jflo committed Oct 3, 2024
1 parent 9d36a99 commit 2dad09c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 84 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_ORGANIZATION: ${{ vars.SONAR_ORGANIZATION }}
SONAR_PROJECT_KEY: ${{ vars.SONAR_PROJECT_KEY }}
run: ./gradlew sonarqube --continue --stacktrace -Dorg.gradle.parallel=true -Dorg.gradle.caching=true
run: ./gradlew sonarqube --continue -Dorg.gradle.parallel=true -Dorg.gradle.caching=true
59 changes: 5 additions & 54 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ plugins {
id 'me.champeau.jmh' version '0.7.2' apply false
id 'net.ltgt.errorprone' version '4.0.1'
id 'maven-publish'
id 'jacoco'
id 'jacoco-report-aggregation'
id 'org.sonarqube' version '5.1.0.4882'
}

Expand All @@ -40,15 +42,12 @@ sonarqube {
property "sonar.organization", "$System.env.SONAR_ORGANIZATION"
property "sonar.gradle.skipCompile", "true"
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.coverage.jacoco.xmlReportPaths", "${buildDir}/reports/jacoco/jacocoRootReport/jacocoRootReport.xml"
property "sonar.coverage.jacoco.xmlReportPaths", "${buildDir}/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml"
property "sonar.coverage.exclusions", "acceptance-tests/**/*"
}
}

project.tasks["sonarqube"].dependsOn "jacocoRootReport"
project.gradle.taskGraph.whenReady {
println project.gradle.taskGraph.getAllTasks()
}
project.tasks["sonarqube"].dependsOn "testCodeCoverageReport"

if (!JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_21)) {
throw new GradleException("Java 21 or later is required to build Besu.\n" +
Expand Down Expand Up @@ -363,6 +362,7 @@ allprojects {
}
}
useJUnitPlatform {}
finalizedBy jacocoTestReport // report is always generated after tests run
}

javadoc {
Expand Down Expand Up @@ -965,55 +965,6 @@ jacocoTestReport {
}
}

task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {

def excludedProjects = [':ethereum:referencetests']
def tasksList = [
'classes',
'compileJava',
'compileSolidity',
'compileTestJava',
'compileTestSupportJava',
'evmToolStartScripts',
'generateContractWrappers',
'generateLicenseReport',
'javadoc',
'processResources',
'processTestResources',
'processTestSupportResources',
'spotlessCheck',
'startScripts',
'test',
'testClasses',
'testJar',
'testSupportClasses',
'testSupportJar',
'untunedStartScripts',
'validateReferenceTestSubmodule'
]

subprojects {
if (!excludedProjects.contains(it.path)) {
additionalSourceDirs.from files(it.sourceSets.main.allSource.srcDirs)
sourceDirectories.from files(it.sourceSets.main.allSource.srcDirs)
classDirectories.from files(it.sourceSets.main.output).asFileTree.matching { exclude 'org/hyperledger/besu/tests/acceptance/**' }
tasksList.each { taskName ->
tasks.matching { it.name == taskName }.all {
jacocoRootReport.dependsOn(it)
}
}
}
}

executionData.from fileTree(dir: '.', includes: ['**/jacoco/*.exec'])
reports {
xml.required = true
csv.required = true
html.destination file("build/reports/jacocoHtml")
}
onlyIf = { true }
}

// http://label-schema.org/rc1/
// using the RFC3339 format "2016-04-12T23:20:50.52Z"
def buildTime() {
Expand Down
61 changes: 32 additions & 29 deletions ethereum/api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -130,41 +130,44 @@ artifacts { testSupportArtifacts testSupportJar }

tasks.register('generateTestBlockchain') {
def srcFiles = 'src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/trace/chain-data'
def dataPath = "$buildDir/generated/data"
def dataPath = new File("$buildDir/generated/data")
def blocksBin = "$buildDir/resources/test/org/hyperledger/besu/ethereum/api/jsonrpc/trace/chain-data/blocks.bin"
inputs.dir(srcFiles)
outputs.file(blocksBin)
dependsOn(configurations.testResourceGeneration)
dependsOn(processTestResources)
doLast {
mkdir(dataPath)
javaexec {
main = 'org.hyperledger.besu.Besu'
classpath = configurations.testResourceGeneration
args = [
"--logging=ERROR",
"--data-path=$dataPath",
"--genesis-file=$srcFiles/genesis.json",
"blocks",
"import",
"--format=JSON",
"--from=$srcFiles/blocks.json",
"--start-time=1438269971"
]
}
javaexec {
main = 'org.hyperledger.besu.Besu'
classpath = configurations.testResourceGeneration
args = [
"--logging=ERROR",
"--data-path=$dataPath",
"--genesis-file=$srcFiles/genesis.json",
"blocks",
"export",
"--format=RLP",
"--start-block=0",
"--to=$blocksBin"
]
if(!dataPath.exists()) {
mkdir(dataPath)

javaexec {
main = 'org.hyperledger.besu.Besu'
classpath = configurations.testResourceGeneration
args = [
"--logging=ERROR",
"--data-path=$dataPath",
"--genesis-file=$srcFiles/genesis.json",
"blocks",
"import",
"--format=JSON",
"--from=$srcFiles/blocks.json",
"--start-time=1438269971"
]
}
javaexec {
main = 'org.hyperledger.besu.Besu'
classpath = configurations.testResourceGeneration
args = [
"--logging=ERROR",
"--data-path=$dataPath",
"--genesis-file=$srcFiles/genesis.json",
"blocks",
"export",
"--format=RLP",
"--start-block=0",
"--to=$blocksBin"
]
}
}
}
}
Expand Down

0 comments on commit 2dad09c

Please sign in to comment.