1
0
mirror of https://github.com/mc1arke/sonarqube-community-branch-plugin.git synced 2025-02-21 19:20:09 +02:00
Michael Clarke fd5d52e4f0 Remove the unsupported Nodes GraphQL library
The library that had been used to integrate with GitHub's GraphQL APIs
is no longer maintained. As the rest of the project uses Rest APIs to
integrate with services, there's a fairly mature GitHub Java library,
and switching to any other GraphQL library is likely to require as much
effort as switching to a Rest implementation, this change is removing
the GraphQL implementation and moving to the github-api library bundled
within Sonarqube. As GitHub's Rest API does not support minimising
comments, old summary comments are being deleted rather than minimised
after a new summary comment is added. Additionally, the 'bridging'
features used in the github-api library cause issues when mockito
attempts to mock/spy a bridged class, so an unbridged version of the
library has been specified at the start of the test runtime classpath to
allow unit testing using the affected classes.

Includes an upgrade to the docker-compose file to use a newer Postgres
version and resolve some linting issues.
2024-11-13 13:57:40 +00:00

160 lines
4.9 KiB
Groovy

/*
* Copyright (C) 2020-2024 Michael Clarke
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
plugins {
id('java')
id('jacoco')
id('org.sonarqube') version('4.4.1.3373')
id('info.solidsoft.pitest') version('1.15.0')
id('com.github.johnrengelman.shadow') version('8.1.1')
id('net.researchgate.release') version('3.0.2')
}
group 'com.github.mc1arke.sonarqube.plugin'
repositories {
mavenCentral()
ivy {
url 'https://binaries.sonarsource.com/'
patternLayout({a ->
artifact '/Distribution/[module]/[module]-[revision].[ext]'
})
metadataSources(sources -> {
sources.artifact()
})
}
}
def sonarqubeVersion = '10.6.0.92116'
def sonarqubeLibDir = "${projectDir}/sonarqube-lib"
def sonarLibraries = "${sonarqubeLibDir}/sonarqube-${sonarqubeVersion}/lib"
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
configurations {
zip
customTestRuntime
}
compileJava {
options.compilerArgs += '-proc:none'
options.encoding = 'UTF-8'
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
dependencies {
customTestRuntime('org.kohsuke:github-api-unbridged:1.326')
compileOnly(fileTree(dir: sonarLibraries, include: '**/*.jar', exclude: 'extensions/*.jar'))
testImplementation(fileTree(dir: sonarLibraries, include: '**/*.jar', exclude: 'extensions/*.jar'))
testImplementation('org.mockito:mockito-core:5.14.2')
testImplementation('org.assertj:assertj-core:3.26.3')
testImplementation('org.wiremock:wiremock:3.9.2')
zip("sonarqube:sonarqube:${sonarqubeVersion}@zip")
runtimeOnly('com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.1')
compileOnly('com.google.code.findbugs:jsr305:3.0.2')
implementation('org.javassist:javassist:3.30.2-GA')
implementation('com.squareup.okhttp3:logging-interceptor:4.12.0')
testImplementation(platform('org.junit:junit-bom:5.11.3'))
testImplementation('org.junit.jupiter:junit-jupiter')
testImplementation('junit:junit:4.13.2')
testRuntimeOnly('org.junit.vintage:junit-vintage-engine')
}
sourceSets.test.runtimeClasspath = configurations.customTestRuntime + sourceSets.test.runtimeClasspath
project.afterEvaluate {
if (file("${sonarLibraries}").exists()) {
return
}
project.getLogger().lifecycle('Extracting SonarQube libraries (this may take a while)...')
configurations.zip.resolvedConfiguration.resolvedArtifacts.each { artifact ->
copy {
from zipTree(artifact.getFile())
into sonarqubeLibDir
}
}
}
jar {
manifest {
attributes 'Plugin-Description': 'Enables branch and pull request analysis in SonarQube Community Edition, without having to upgrade to Developer Edition',
'SonarLint-Supported': false,
'Plugin-Homepage': 'https://github.com/mc1arke/sonarqube-community-branch-plugin',
'Plugin-License': 'GNU LGPL 3',
'Plugin-Version': "${project.version}",
'Plugin-Organization': 'Michael Clarke',
'Sonar-Version': "9.14.0.375",
'Plugin-IssueTrackerUrl': 'https://github.com/mc1arke/sonarqube-community-branch-plugin/issues',
'Plugin-Key': 'communityBranchPlugin',
'Plugin-Class': 'com.github.mc1arke.sonarqube.plugin.CommunityBranchPluginBootstrap',
'Plugin-Name': 'Community Branch Plugin',
'Premain-Class': 'com.github.mc1arke.sonarqube.plugin.CommunityBranchAgent',
'Can-Retransform-Classes': 'true'
}
}
release {
git {
requireBranch.set('')
commitVersionFileOnly.set(true)
}
buildTasks.set(["assemble"])
}
tasks.jar.configure {
archiveClassifier = 'nodeps'
enabled = false
}
tasks.shadowJar.configure {
archiveClassifier = null
}
tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:unchecked'
options.deprecation = true
}
assemble.dependsOn('shadowJar')
pitest {
junit5PluginVersion = '1.2.1'
timestampedReports = false
avoidCallsTo = ['org.slf4j.Logger']
}
jacocoTestReport {
reports {
xml.required = true
}
}
plugins.withType(JacocoPlugin) {
tasks["test"].finalizedBy 'jacocoTestReport'
}
test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
}