diff options
author | Zipeng WU <zipeng.wu@sonarsource.com> | 2021-11-18 16:56:25 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2021-11-19 20:03:27 +0000 |
commit | aa640be9e2b9cfa2c027ef0768940b31ebb5536c (patch) | |
tree | 9d57ada5f04f5b83fe7e03525ef67766234f4009 | |
parent | a3d88ea27c35921647d7602755828ca73e15e865 (diff) | |
download | sonarqube-aa640be9e2b9cfa2c027ef0768940b31ebb5536c.tar.gz sonarqube-aa640be9e2b9cfa2c027ef0768940b31ebb5536c.zip |
SONAR-15639 Measure time of SQ analysis step on Cirrus CI
-rw-r--r-- | build.gradle | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/build.gradle b/build.gradle index 3cb1467fffb..042beb69d0a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,3 +1,5 @@ +import groovy.json.JsonOutput + plugins { // Ordered alphabeticly id 'com.github.ben-manes.versions' version '0.33.0' @@ -689,13 +691,26 @@ gradle.projectsEvaluated { gradle -> } ext.osAdaptiveCommand = { commands -> - def newCommands = [] - - if (System.properties['os.name'].toLowerCase().contains('windows')) { - newCommands = ['cmd', '/c'] - } + def newCommands = [] - newCommands.addAll(commands) + if (System.properties['os.name'].toLowerCase().contains('windows')) { + newCommands = ['cmd', '/c'] + } - return newCommands + newCommands.addAll(commands) + + return newCommands } + +tasks.named('sonarqube') { + long taskStart + doFirst { + taskStart = System.currentTimeMillis() + } + doLast { + long taskDuration = System.currentTimeMillis() - taskStart + File outputFile = new File("/tmp/analysis-monitoring.log") + outputFile.append(JsonOutput.toJson([category: "Analysis", suite: "Standalone", operation: "total", duration: taskDuration]) + '\n') + } +} + |