123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659 |
- import groovy.json.JsonOutput
-
- import static org.gradle.api.JavaVersion.VERSION_17
-
- plugins {
- // Ordered alphabetically
- id 'com.github.hierynomus.license' version '0.16.1'
- id "com.github.hierynomus.license-report" version "0.16.1" apply false
- id 'com.github.johnrengelman.shadow' version '7.1.2' apply false
- id 'com.google.protobuf' version '0.8.19' apply false
- id 'com.jfrog.artifactory' version '4.31.8'
- id "de.undercouch.download" version "5.4.0" apply false
- id 'io.spring.dependency-management' version '1.1.0'
- id "org.cyclonedx.bom" version "1.7.4" apply false
- id 'org.sonarqube' version '4.0.0.2929'
- }
-
- if (!JavaVersion.current().isCompatibleWith(VERSION_17)) {
- throw new GradleException("JDK 17+ is required to perform this build. It's currently " + System.getProperty("java.home") + ".")
- }
-
- /**
- * The BOM related tasks are disabled by default, activated by:
- * - running in the CI and being on a main branch or a nightly build,
- * - or using '-Dbom' project property
- * - or by explicit call to 'cyclonedxBom' Gradle task
- */
- def bomTasks = "cyclonedxBom"
- def ghBranch = System.getenv()["GITHUB_BRANCH"]
- def isMainBranch = ghBranch in ['master'] || ghBranch ==~ 'branch-[\\d.]+'
- def isNightlyBuild = ghBranch == "branch-nightly-build"
- boolean enableBom = System.getenv('CI') == "true" && (isMainBranch || isNightlyBuild) ||
- System.getProperty("bom") != null ||
- gradle.startParameter.taskNames.findAll({ it.matches(".*:($bomTasks)") })
-
- allprojects {
- apply plugin: 'com.jfrog.artifactory'
- apply plugin: 'maven-publish'
-
- ext.versionInSources = version
- ext.buildNumber = System.getProperty("buildNumber")
- // when no buildNumber is provided, then project version must end with '-SNAPSHOT'
- if (ext.buildNumber == null) {
- version = "${version}-SNAPSHOT".toString()
- ext.versionWithoutBuildNumber = version
- } else {
- ext.versionWithoutBuildNumber = version
- version = (version.toString().count('.') == 1 ? "${version}.0.${ext.buildNumber}" : "${version}.${ext.buildNumber}").toString()
- }
-
-
- task cacheDependencies {
- doLast {
- configurations.each { conf ->
- if (conf.isCanBeResolved()) {
- if (conf.getName() != 'appZip')
- conf.resolve()
- }
- }
- }
- }
-
- ext {
- release = project.hasProperty('release') && project.getProperty('release')
- official = project.hasProperty('official') && project.getProperty('official')
- }
-
- ext.enableBom = enableBom
- if (!enableBom) {
- tasks.matching { it.name.matches(bomTasks) }.all({
- logger.info("{} disabled", it.name);
- it.enabled = false
- })
- }
-
- repositories {
- def repository = project.hasProperty('qa') ? 'sonarsource-qa' : 'sonarsource'
- // The environment variables ARTIFACTORY_PRIVATE_USERNAME and ARTIFACTORY_PRIVATE_PASSWORD are used on QA env (Jenkins)
- // On local box, please add artifactoryUsername and artifactoryPassword to ~/.gradle/gradle.properties
- def artifactoryUsername = System.env.'ARTIFACTORY_PRIVATE_USERNAME' ?: (project.hasProperty('artifactoryUsername') ? project.getProperty('artifactoryUsername') : '')
- def artifactoryPassword = System.env.'ARTIFACTORY_PRIVATE_PASSWORD' ?: (project.hasProperty('artifactoryPassword') ? project.getProperty('artifactoryPassword') : '')
-
- maven {
- if (artifactoryUsername && artifactoryPassword) {
- credentials {
- username artifactoryUsername
- password artifactoryPassword
- }
- } else {
- // Workaround for artifactory
- // https://www.jfrog.com/jira/browse/RTFACT-13797
- repository = 'public'
- }
- url "https://repox.jfrog.io/repox/${repository}"
- }
- ivy {
- if (artifactoryUsername && artifactoryPassword) {
- credentials {
- username artifactoryUsername
- password artifactoryPassword
- }
- url "https://repox.jfrog.io/repox/sonarsource-bucket"
-
- patternLayout {
- artifact '/[organisation]/[module]/[module]-[revision].[ext]'
- }
- } else {
- // For public build
- url "https://artifacts.elastic.co/downloads/"
-
- patternLayout {
- artifact '/[organisation]/[module]-[revision].[ext]'
- }
- }
-
- metadataSources { artifact() }
- }
- }
-
- task allDependencies {
- dependsOn 'dependencies'
- }
-
- artifactory {
- clientConfig.setIncludeEnvVars(true)
- clientConfig.setEnvVarsExcludePatterns('*pass*,*psw*,*secret*,*MAVEN_CMD_LINE_ARGS*,sun.java.command,*token*,*login*,*key*,*signing*,*auth*,*pwd*')
- contextUrl = System.getenv('ARTIFACTORY_URL')
- publish {
- repository {
- repoKey = System.getenv('ARTIFACTORY_DEPLOY_REPO')
- username = System.getenv('ARTIFACTORY_DEPLOY_USERNAME') ?: project.properties.artifactoryUsername
- password = System.getenv('ARTIFACTORY_DEPLOY_PASSWORD') ?: project.properties.artifactoryPaswword
- }
- defaults {
- properties = [
- 'build.name': 'sonar-enterprise',
- 'build.number': System.getenv('BUILD_NUMBER'),
- 'pr.branch.target': System.getenv('GITHUB_BASE_BRANCH'),
- 'pr.number': System.getenv('PULL_REQUEST'),
- 'vcs.branch': ghBranch,
- 'vcs.revision': System.getenv('GIT_SHA1'),
- 'version': version
- ]
- publications('mavenJava')
- publishPom = true
- publishIvy = false
- }
- }
- clientConfig.info.setBuildName('sonar-enterprise')
- clientConfig.info.setBuildNumber(System.getenv('BUILD_NUMBER'))
- // Define the artifacts to be deployed to https://binaries.sonarsource.com on releases
- clientConfig.info.addEnvironmentProperty('ARTIFACTS_TO_PUBLISH',
- "${project.group}:sonar-application:zip," +
- "com.sonarsource.sonarqube:sonarqube-developer:zip," +
- "com.sonarsource.sonarqube:sonarqube-datacenter:zip," +
- "com.sonarsource.sonarqube:sonarqube-enterprise:zip")
- // The name of this variable is important because it's used by the delivery process when extracting version from Artifactory build info.
- clientConfig.info.addEnvironmentProperty('PROJECT_VERSION', "${version}")
- }
- }
-
- apply plugin: 'org.sonarqube'
- sonar {
- properties {
- property 'sonar.projectName', projectTitle
- property 'sonar.projectVersion', "${versionInSources}-SNAPSHOT"
- property 'sonar.buildString', version
- }
- }
-
- tasks.named('wrapper') {
- distributionType = Wrapper.DistributionType.ALL
- }
-
- subprojects {
- apply plugin: 'com.github.hierynomus.license'
- apply plugin: 'io.spring.dependency-management'
- apply plugin: 'jacoco'
- apply plugin: 'java-library'
- apply plugin: 'idea'
- apply plugin: 'signing'
-
- // do not deploy to Artifactory by default
- artifactoryPublish.skip = true
-
- compileJava.options.encoding = "UTF-8"
- compileTestJava.options.encoding = "UTF-8"
-
- def testFixtureSrc = 'src/testFixtures'
- if (file(testFixtureSrc).exists()) {
- apply plugin: 'java-test-fixtures'
- }
-
- ext {
- protobufVersion = '3.22.2'
- springVersion = '5.3.27'
- }
-
- sonar {
- properties {
- property 'sonar.moduleKey', project.group + ':' + project.name
- }
- }
-
- sourceSets {
- test {
- resources {
- srcDirs += ['src/it/resources']
- }
- java {
- srcDirs += ['src/it/java']
- }
- }
- }
-
- // Central place for definition dependency versions and exclusions.
- dependencyManagement {
- dependencies {
- // bundled plugin list -- keep it alphabetically ordered
- dependency 'com.sonarsource.abap:sonar-abap-plugin:3.12.0.4303'
- dependency 'com.sonarsource.cobol:sonar-cobol-plugin:5.3.0.6122'
- dependency 'com.sonarsource.cpp:sonar-cfamily-plugin:6.45.0.62016'
- dependency 'com.sonarsource.dbd:sonar-dbd-plugin:1.15.0.4060'
- dependency 'com.sonarsource.dbd:sonar-dbd-java-frontend-plugin:1.15.0.4060'
- dependency 'com.sonarsource.dbd:sonar-dbd-python-frontend-plugin:1.15.0.4060'
- dependency 'com.sonarsource.pli:sonar-pli-plugin:1.13.0.3651'
- dependency 'com.sonarsource.plsql:sonar-plsql-plugin:3.9.0.5181'
- dependency 'com.sonarsource.plugins.vb:sonar-vb-plugin:2.10.0.3598'
- dependency 'com.sonarsource.rpg:sonar-rpg-plugin:3.4.0.3394'
- dependency 'com.sonarsource.security:sonar-security-csharp-frontend-plugin:10.1.0.21056'
- dependency 'com.sonarsource.security:sonar-security-java-frontend-plugin:10.1.0.21056'
- dependency 'com.sonarsource.security:sonar-security-php-frontend-plugin:10.1.0.21056'
- dependency 'com.sonarsource.security:sonar-security-plugin:10.1.0.21056'
- dependency 'com.sonarsource.security:sonar-security-python-frontend-plugin:10.1.0.21056'
- dependency 'com.sonarsource.security:sonar-security-js-frontend-plugin:10.1.0.21056'
- dependency 'com.sonarsource.slang:sonar-apex-plugin:1.13.0.4374'
- dependency 'com.sonarsource.swift:sonar-swift-plugin:4.8.0.5759'
- dependency 'com.sonarsource.tsql:sonar-tsql-plugin:1.9.0.5692'
- dependency 'org.sonarsource.config:sonar-config-plugin:1.2.0.267'
- dependency 'org.sonarsource.dotnet:sonar-csharp-plugin:9.3.0.71466'
- dependency 'org.sonarsource.dotnet:sonar-vbnet-plugin:9.3.0.71466'
- dependency 'org.sonarsource.flex:sonar-flex-plugin:2.8.0.3166'
- dependency 'org.sonarsource.html:sonar-html-plugin:3.7.1.3306'
- dependency 'org.sonarsource.jacoco:sonar-jacoco-plugin:1.3.0.1538'
- dependency 'org.sonarsource.java:sonar-java-plugin:7.20.0.31692'
- dependency 'org.sonarsource.javascript:sonar-javascript-plugin:10.3.0.21893'
- dependency 'org.sonarsource.php:sonar-php-plugin:3.30.0.9766'
- dependency 'org.sonarsource.plugins.cayc:sonar-cayc-plugin:2.0.0.334'
- dependency 'org.sonarsource.python:sonar-python-plugin:4.3.0.11660'
- dependency 'org.sonarsource.slang:sonar-go-plugin:1.13.0.4374'
- dependency 'org.sonarsource.kotlin:sonar-kotlin-plugin:2.15.0.2579'
- dependency 'org.sonarsource.slang:sonar-ruby-plugin:1.13.0.4374'
- dependency 'org.sonarsource.slang:sonar-scala-plugin:1.13.0.4374'
- dependency "org.sonarsource.api.plugin:sonar-plugin-api:$pluginApiVersion"
- dependency "org.sonarsource.api.plugin:sonar-plugin-api-test-fixtures:$pluginApiVersion"
- dependency 'org.sonarsource.xml:sonar-xml-plugin:2.8.1.4006'
- dependency 'org.sonarsource.iac:sonar-iac-plugin:1.17.0.3976'
- dependency 'org.sonarsource.text:sonar-text-plugin:2.1.0.1163'
-
- // please keep this list alphabetically ordered
- dependencySet(group: 'ch.qos.logback', version: '1.3.5') {
- entry 'logback-access'
- entry 'logback-classic'
- entry 'logback-core'
- }
- dependency('commons-beanutils:commons-beanutils:1.9.4') {
- exclude 'commons-logging:commons-logging'
- }
- dependency 'commons-codec:commons-codec:1.15'
- dependency 'commons-dbutils:commons-dbutils:1.7'
- dependency 'commons-io:commons-io:2.11.0'
- dependency 'commons-lang:commons-lang:2.6'
- imports { mavenBom 'com.fasterxml.jackson:jackson-bom:2.15.1' }
- dependency 'com.eclipsesource.minimal-json:minimal-json:0.9.5'
- dependencySet(group: 'com.github.scribejava', version: '8.3.3') {
- entry 'scribejava-apis'
- entry 'scribejava-core'
- }
- dependency 'com.github.everit-org.json-schema:org.everit.json.schema:1.14.0'
- // This project is no longer maintained and was forked
- // by https://github.com/java-diff-utils/java-diff-utils
- // (io.github.java-diff-utils:java-diff-utils).
- dependency 'com.googlecode.java-diff-utils:diffutils:1.3.0'
- dependency('com.googlecode.json-simple:json-simple:1.1.1') {
- exclude 'junit:junit'
- }
- dependency 'io.prometheus:simpleclient:0.16.0'
- dependency 'io.prometheus:simpleclient_common:0.16.0'
- dependency 'io.prometheus:simpleclient_servlet:0.16.0'
- dependency 'com.google.code.findbugs:jsr305:3.0.2'
- dependency 'com.google.code.gson:gson:2.10.1'
- dependency('com.google.guava:guava:31.1-jre') {
- exclude 'com.google.errorprone:error_prone_annotations'
- exclude 'com.google.guava:listenablefuture'
- exclude 'com.google.j2objc:j2objc-annotations'
- exclude 'org.checkerframework:checker-qual'
- exclude 'org.codehaus.mojo:animal-sniffer-annotations'
- }
- dependency "com.google.protobuf:protobuf-java:${protobufVersion}"
- dependency 'com.h2database:h2:2.1.214'
- dependencySet(group: 'com.hazelcast', version: '5.2.3') {
- entry 'hazelcast'
- }
- // Documentation must be updated if mssql-jdbc is updated: https://github.com/SonarSource/sonarqube/commit/03e4773ebf6cba854cdcf57a600095f65f4f53e7
- dependency('com.microsoft.sqlserver:mssql-jdbc:12.2.0.jre11') {
- exclude 'com.fasterxml.jackson.core:jackson-databind'
- }
- dependency 'com.onelogin:java-saml:2.9.0'
- dependency 'com.oracle.database.jdbc:ojdbc11:21.9.0.0'
- dependency 'org.aspectj:aspectjtools:1.9.19'
- dependencySet(group: 'com.squareup.okhttp3', version: '4.10.0') {
- entry 'okhttp'
- entry 'mockwebserver'
- }
- dependency 'org.json:json:20230227'
- dependency 'com.tngtech.java:junit-dataprovider:1.13.1'
- dependencySet(group: 'io.jsonwebtoken', version: '0.11.5') {
- entry 'jjwt-api'
- entry 'jjwt-impl'
- entry 'jjwt-jackson'
- }
- dependency 'com.auth0:java-jwt:4.4.0'
- dependency 'io.netty:netty-all:4.1.90.Final'
- dependency 'com.sun.mail:javax.mail:1.6.2'
- dependency 'javax.annotation:javax.annotation-api:1.3.2'
- dependency 'javax.inject:javax.inject:1'
- dependency 'javax.servlet:javax.servlet-api:4.0.1'
- dependency 'javax.xml.bind:jaxb-api:2.3.1'
- dependency 'junit:junit:4.13.2'
- dependency 'org.xmlunit:xmlunit-core:2.9.1'
- dependency 'org.xmlunit:xmlunit-matchers:2.9.1'
- dependency 'net.jpountz.lz4:lz4:1.3.0'
- dependency 'net.lightbody.bmp:littleproxy:1.1.0-beta-bmp-17'
- dependency 'org.awaitility:awaitility:4.2.0'
- dependency 'org.apache.commons:commons-csv:1.10.0'
- dependency 'org.apache.commons:commons-email:1.5'
- dependency 'com.zaxxer:HikariCP:5.0.1'
- dependency('org.apache.httpcomponents:httpclient:4.5.14') {
- exclude 'commons-logging:commons-logging'
- }
- // Be aware that Log4j is used by Elasticsearch client
- dependencySet(group: 'org.apache.logging.log4j', version: '2.20.0') {
- entry 'log4j-core'
- entry 'log4j-api'
- entry 'log4j-to-slf4j'
- }
- dependencySet(group: 'org.apache.tomcat.embed', version: '9.0.74') {
- entry 'tomcat-embed-core'
- entry('tomcat-embed-jasper') {
- exclude 'org.eclipse.jdt.core.compiler:ecj'
- }
- }
- dependency 'org.assertj:assertj-core:3.24.2'
- dependency 'org.assertj:assertj-guava:3.24.2'
- dependency('org.codehaus.sonar:sonar-channel:4.2') {
- exclude 'org.slf4j:slf4j-api'
- }
- dependency 'org.codehaus.sonar:sonar-classloader:1.0'
- dependency 'com.fasterxml.staxmate:staxmate:2.4.0'
- dependencySet(group: 'org.eclipse.jetty', version: '9.4.6.v20170531') {
- entry 'jetty-proxy'
- entry 'jetty-server'
- entry 'jetty-servlet'
- }
- // "elasticsearchDownloadUrlFile" and "elasticsearchDownloadSha512" must also be updated in gradle.properties
- dependency('org.elasticsearch.client:elasticsearch-rest-high-level-client:7.17.9') {
- exclude 'org.apache.logging.log4j:log4j-core'
- }
- dependency 'org.elasticsearch.plugin:transport-netty4-client:7.17.9'
- dependency 'org.elasticsearch:mocksocket:1.2'
- dependency 'org.codelibs.elasticsearch.module:analysis-common:7.17.9'
- dependency 'org.codelibs.elasticsearch.module:reindex:7.17.9'
- dependency 'org.eclipse.jgit:org.eclipse.jgit:6.5.0.202303070854-r'
- dependency 'org.tmatesoft.svnkit:svnkit:1.10.11'
- dependency 'org.hamcrest:hamcrest-all:1.3'
- dependency 'org.jsoup:jsoup:1.15.4'
- dependency 'org.mindrot:jbcrypt:0.4'
- dependency('org.mockito:mockito-core:5.2.0') {
- exclude 'org.hamcrest:hamcrest-core'
- }
- dependency "org.springframework:spring-test:${springVersion}"
- dependency 'org.mybatis:mybatis:3.5.13'
- dependencySet(group: 'org.slf4j', version: '2.0.7') {
- entry 'jcl-over-slf4j'
- entry 'jul-to-slf4j'
- entry 'log4j-over-slf4j'
- entry 'slf4j-api'
- }
- dependency 'org.postgresql:postgresql:42.6.0'
- dependency 'org.reflections:reflections:0.10.2'
- dependency 'org.simpleframework:simple:5.1.6'
- dependency 'org.sonarsource.git.blame:git-files-blame:1.0.1.169'
- dependency 'org.sonarsource.orchestrator:sonar-orchestrator:3.42.0.312'
- dependency 'org.sonarsource.update-center:sonar-update-center-common:1.29.0.1000'
- dependency("org.springframework:spring-context:${springVersion}") {
- exclude 'commons-logging:commons-logging'
- }
- dependency ("org.springframework:spring-webmvc:${springVersion}") {
- exclude 'commons-logging:commons-logging'
- }
- dependency 'org.springdoc:springdoc-openapi-ui:1.7.0'
- dependency 'org.subethamail:subethasmtp:3.1.7'
- dependency 'org.yaml:snakeyaml:2.0'
-
- // please keep this list alphabetically ordered
- }
- }
-
- // global exclusions
- configurations.all {
- // do not conflict with com.sun.mail:javax.mail
- exclude group: 'javax.mail', module: 'mail'
- }
-
- tasks.withType(Javadoc) {
- options.addStringOption('Xdoclint:none', '-quiet')
- options.encoding = 'UTF-8'
- title = project.name + ' ' + versionWithoutBuildNumber
- }
-
- task sourcesJar(type: Jar, dependsOn: classes) {
- archiveClassifier = 'sources'
- from sourceSets.main.allSource
- }
-
- task javadocJar(type: Jar, dependsOn: javadoc) {
- archiveClassifier = 'javadoc'
- from javadoc.destinationDir
- }
-
- // generate code before opening project in IDE (Eclipse or Intellij)
- task ide() {
- // empty by default. Dependencies are added to the task
- // when needed (see protobuf modules for example)
- }
-
- jacocoTestReport {
- reports {
- xml.required = true
- csv.required = false
- html.required = false
- }
- }
-
- normalization {
- runtimeClasspath {
- // Following classpath resources contain volatile data that changes in each CI build (build number, commit id, time),
- // so we exclude them from calculation of build cache key of test tasks:
- ignore 'META-INF/MANIFEST.MF'
- ignore 'sonar-api-version.txt'
- ignore 'sq-version.txt'
- }
- }
-
-
- ext.failedTests = []
- test {
- jvmArgs '-Dfile.encoding=UTF8'
- maxHeapSize = '1G'
- systemProperty 'java.awt.headless', true
- testLogging {
- events "skipped", "failed" // verbose log for failed and skipped tests (by default the name of the tests are not logged)
- exceptionFormat 'full' // log the full stack trace (default is the 1st line of the stack trace)
- }
- jacoco {
- enabled = true // do not disable recording of code coverage, so that remote Gradle cache entry can be used locally
- includes = ['com.sonar.*', 'com.sonarsource.*', 'org.sonar.*', 'org.sonarqube.*', 'org.sonarsource.*']
- }
- if (project.hasProperty('maxParallelTests')) {
- maxParallelForks = project.maxParallelTests as int
- }
- if (project.hasProperty('parallelTests')) {
- // See https://guides.gradle.org/performance/#parallel_test_execution
- maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
- }
-
- afterTest { descriptor, result ->
- if (result.resultType == TestResult.ResultType.FAILURE) {
- String failedTest = " ${descriptor.className} > ${descriptor.name}"
- failedTests << failedTest
- }
- }
- }
-
-
- gradle.buildFinished {
- if (!failedTests.empty) {
- println "\nFailed tests:"
- failedTests.each { failedTest ->
- println failedTest
- }
- println ""
- }
- }
-
- def protoMainSrc = 'src/main/protobuf'
- def protoTestSrc = 'src/test/protobuf'
- if (file(protoMainSrc).exists() || file(protoTestSrc).exists()) {
- // protobuf must be applied after java
- apply plugin: 'com.google.protobuf'
-
- sourceSets.main.proto.srcDir protoMainSrc // in addition to the default 'src/main/proto'
- sourceSets.test.proto.srcDir protoTestSrc // in addition to the default 'src/test/proto'
- protobuf {
- protoc {
- artifact = "com.google.protobuf:protoc:${protobufVersion}"
- }
- }
- jar {
- exclude('**/*.proto')
- }
- idea {
- module {
- sourceDirs += file("${protobuf.generatedFilesBaseDir}/main/java")
- testSourceDirs += file("${protobuf.generatedFilesBaseDir}/test/java")
- generatedSourceDirs += file("${protobuf.generatedFilesBaseDir}/main/java")
- generatedSourceDirs += file("${protobuf.generatedFilesBaseDir}/test/java")
- }
- }
- ide.dependsOn(['generateProto', 'generateTestProto'])
- }
-
- if (official) {
- jar {
- // do not break incremental build on non official versions
- manifest {
- attributes(
- 'Version': "${version}",
- 'Implementation-Build': System.getenv('GIT_SHA1'),
- 'Build-Time': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
- )
- }
- }
- }
-
- license {
- header = rootProject.file('HEADER')
- strictCheck true
- encoding = 'UTF-8'
- mapping {
- java = 'SLASHSTAR_STYLE'
- js = 'SLASHSTAR_STYLE'
- ts = 'SLASHSTAR_STYLE'
- tsx = 'SLASHSTAR_STYLE'
- css = 'SLASHSTAR_STYLE'
- }
- includes(['**/*.java', '**/*.js', '**/*.ts', '**/*.tsx', '**/*.css'])
- }
-
- tasks.withType(GenerateModuleMetadata) {
- enabled = false
- }
-
- publishing {
- publications {
- mavenJava(MavenPublication) {
- pom {
- name = 'SonarQube'
- description = project.description
- url = 'http://www.sonarqube.org/'
- organization {
- name = 'SonarSource'
- url = 'http://www.sonarsource.com'
- }
- licenses {
- license {
- name = 'GNU LGPL 3'
- url = 'http://www.gnu.org/licenses/lgpl.txt'
- distribution = 'repo'
- }
- }
- scm {
- url = 'https://github.com/SonarSource/sonarqube'
- }
- developers {
- developer {
- id = 'sonarsource-team'
- name = 'SonarSource Team'
- }
- }
- }
- }
- }
- }
-
-
- tasks.withType(Test) {
-
- configurations {
- utMonitoring
- }
-
- dependencies {
- testImplementation project(":ut-monitoring")
-
- utMonitoring 'org.aspectj:aspectjweaver:1.9.19'
- }
- }
-
- if (isNightlyBuild) {
- tasks.withType(Test) {
- doFirst {
- ext {
- aspectJWeaver = configurations.utMonitoring.resolvedConfiguration.resolvedArtifacts.find { it.name == 'aspectjweaver' }
- }
- jvmArgs "-javaagent:${aspectJWeaver.file}"
- }
- }
- }
-
-
- signing {
- def signingKeyId = findProperty("signingKeyId")
- def signingKey = findProperty("signingKey")
- def signingPassword = findProperty("signingPassword")
- useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
- required {
- return isMainBranch && gradle.taskGraph.hasTask(":artifactoryPublish")
- }
- sign publishing.publications
- }
-
- tasks.withType(Sign) {
- onlyIf {
- return !artifactoryPublish.skip && isMainBranch && gradle.taskGraph.hasTask(":artifactoryPublish")
- }
- }
- }
-
- gradle.projectsEvaluated { gradle ->
- // yarn_run tasks can't all run in parallel without random issues
- // this script ensure all yarn_run tasks run sequentially
- def yarnRunTasks = allprojects.findResults { it -> it.tasks.findByName('yarn_run') }
- yarnRunTasks.drop(1).eachWithIndex { it, i -> it.mustRunAfter(yarnRunTasks[0..i]) }
- }
-
- ext.osAdaptiveCommand = { commands ->
- def newCommands = []
-
- if (System.properties['os.name'].toLowerCase().contains('windows')) {
- newCommands = ['cmd', '/c']
- }
-
- 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')
- }
- }
|