Mercurial > public > develkit
view metrics.gradle @ 336:6258c89efe9e
add a new init70 for github actions
author | marc_davis <davis@ssdt-ohio.org> |
---|---|
date | Tue, 30 May 2023 12:54:59 -0400 |
parents | 7cbf5d6a2714 |
children | de8c350c511a |
line wrap: on
line source
import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.tasks.bundling.Jar import org.gradle.api.DefaultTask import org.gradle.api.tasks.OutputDirectory import org.gradle.api.tasks.OutputFile import org.gradle.api.tasks.TaskAction import java.util.jar.JarFile final GradleVersion gradleCurrent = GradleVersion.current() final GradleVersion gradleV31 = GradleVersion.version('3.1') final boolean legacySonar = gradleCurrent < gradleV31 final boolean newSonar = !legacySonar buildscript { final GradleVersion gradleV421 = GradleVersion.version('4.2.1') repositories { maven { url 'https://docker.ssdt.io/artifactory/gradle-plugins' } maven { url 'https://docker.ssdt.io/artifactory/gradle-plugins-local' } maven { url 'https://docker.ssdt.io/artifactory/ssdt-repo' } } dependencies { classpath 'me.davesmith:jaranalyzerplugin:0.2.0-SNAPSHOT' classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:${GradleVersion.current() >= gradleV421 ? '2.6' : '2.2'}" } } apply plugin: JarAnalyzerPlugin /* apply plugin: me.davesmith.gradle.plugins.jaranalyzer.JarAnalyzerPlugin task("jaranalyzer") { dot = true packageFilter += 'org.slf4j*' packageFilter += 'groovyx.*' } */ if (newSonar) { apply plugin: org.sonarqube.gradle.SonarQubePlugin sonarqube { properties { property "sonar.host.url", "http://sonar.ssdt.io:9000" property "sonar.login", System.getenv('bamboo_SONAR_TOKEN') property "sonar.exclusions","**/ProjectVersion*" } } allprojects { afterEvaluate { project -> project.getTasksByName('sonarqube',false).each { it.enabled = gradle.branchStream in ['develop','release','hotfix' ] } } } } if (legacySonar) { task('sonar') << { println "legacy sonar disabled" } } /** * this is a stub plugin to replace old jaranalyzer until all projects remove the jaranalyzer task. */ class JarAnalyzerPlugin implements Plugin<Project> { @Override void apply(Project project) { project.extensions.create("jaranalyzer", JarAnalyzerExtension) project.tasks.create("jarAnalyzerReport",JarAnalyzerReportTask) project.afterEvaluate { Project p -> p.tasks.getByName('jarAnalyzerReport').dependsOn p.subprojects.collect { Project targetProject -> targetProject.tasks.withType(Jar) }.flatten() } } } class JarAnalyzerExtension { /** Generate dot report? */ boolean dot = false /** Generate xml report? */ boolean xml = true /** Generate html report? */ boolean html = true /** Generate osgi report? */ boolean osgi = false /** list of jars to exclude from analysis. */ List<String> jarFilter = [] String jarPrefix = "" List<String> packageFilter = [ ] String configuration = 'runtime' } class JarAnalyzerReportTask extends DefaultTask { @OutputDirectory File outputDir = new File(project.buildDir, "reports/jaranalyzer") File jarDir = new File("${project.buildDir.path}", "jars") @OutputFile File xmlReport = new File(outputDir, 'jaranalyzer.xml') @OutputFile File htmlReport = new File(outputDir, 'jaranalyzer.html') @OutputFile File dotReport = new File(outputDir, 'jaranalyzer.dot') @OutputFile File osgiReport = new File(outputDir, 'osgi-report.txt') @TaskAction def analyze() { println "jar analyser is obsolete, please remove it." //NOOP } }