1 Star 0 Fork 70

huawei/CAS

forked from Gitee 极速下载/CAS 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
build.gradle 16.90 KB
一键复制 编辑 原始数据 按行查看 历史
tduehr 提交于 2018-11-20 04:03 . only apply groovy if needed (#3663)
import java.util.concurrent.ConcurrentHashMap
description = "Apereo Central Authentication Service $version"
defaultTasks "clean", "build"
ext {
srcTagMap = new ConcurrentHashMap<File, Set<String>>()
publishSnapshots = Boolean.getBoolean("publishSnapshots")
publishReleases = Boolean.getBoolean("publishReleases")
sonatypeUsername = System.getProperty("sonatypeUsername")
sonatypePassword = System.getProperty("sonatypePassword")
testCategoryType = System.getProperty("testCategoryType")
skipBootifulArtifact = System.getProperty("skipBootifulArtifact")
skipErrorProneCompiler = System.getProperty("skipErrorProneCompiler")
forceBom = Boolean.getBoolean("forceBom")
enableRemoteDebugging = Boolean.getBoolean("enableRemoteDebugging")
remoteDebuggingSuspend = Boolean.getBoolean("remoteDebuggingSuspend") ? "y" : "n"
continuousIntegrationBuild = Boolean.getBoolean("CI") || Boolean.getBoolean("TRAVIS") || Boolean.getBoolean("CONTINUOUS_INTEGRATION")
publishingRelease = publishReleases && rootProject.sonatypeUsername != null && rootProject.sonatypePassword != null
/*
Open the project git repository in the current directory.
Get commit id of HEAD.
*/
git = org.ajoberstar.grgit.Grgit.open(dir: file('.').canonicalPath)
def gitHead = git.head()
currentRevision = gitHead.id
currentAbbreviatedRevision = gitHead.abbreviatedId
}
def isArtifactSigningRequired = {
return (publishReleases && sonatypeUsername != null && sonatypePassword != null)
}
apply from: rootProject.file("gradle/overrides.gradle")
apply from: rootProject.file("gradle/dependencies.gradle")
apply plugin: "com.github.ben-manes.versions"
if (project.ext.continuousIntegrationBuild) {
apply plugin: "com.gradle.build-scan"
}
if (!Boolean.getBoolean("skipSonarqube")) {
apply plugin: "org.sonarqube"
}
buildscript {
repositories {
mavenLocal()
jcenter()
maven { url "https://maven.eveoh.nl/content/repositories/releases" }
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://repo.spring.io/plugins-release" }
maven { url "https://repo.spring.io/libs-milestone" }
}
dependencies {
classpath "com.gradle:build-scan-plugin:2.0.2"
classpath "gradle.plugin.com.ewerk.gradle.plugins:jaxb2-plugin:1.0.9"
classpath "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion"
classpath "com.netflix.nebula:gradle-lint-plugin:$gradleLintVersion"
classpath "io.franzbecker:gradle-lombok:$gradleLombokVersion"
classpath "com.github.ben-manes:gradle-versions-plugin:$gradleDependencyVersionsVersion"
classpath "io.spring.gradle:propdeps-plugin:$gradlePropDepsVersion"
classpath "org.ajoberstar:grgit:$gradleGitVersion"
classpath "net.ltgt.gradle:gradle-errorprone-javacplugin-plugin:$gradleErrorProneVersion"
classpath "com.moowork.gradle:gradle-node-plugin:$gradleNodeVersion"
classpath "org.owasp:dependency-check-gradle:$gradleDependencyCheckVersion"
classpath "gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:$gradleSpotbugsVersion"
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:$gradleSonarqubeVersion"
}
}
if (rootProject.continuousIntegrationBuild) {
buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'
}
}
apply plugin: "org.owasp.dependencycheck"
dependencyCheck {
/*
* Specifies if the build should be failed if a CVSS score equal
* to or above a specified level is identified.
*/
failBuildOnCVSS = 7
skipTestGroups = true
suppressionFile = file("$rootProject.projectDir/style/dependency-check-suppressions.xml")
analyzers {
assemblyEnabled = false
swiftEnabled = false
cocoapodsEnabled = false
nspEnabled = false
autoconfEnabled = false
cmakeEnabled = false
pathToMono = false
nuspecEnabled = false
rubygemsEnabled = false
pyPackageEnabled = false
pyDistributionEnabled = false
nexusEnabled = false
centralEnabled = false
}
}
allprojects {
apply plugin: "idea"
apply plugin: "eclipse"
apply plugin: "maven"
apply plugin: "signing"
apply plugin: "jacoco"
apply plugin: "java"
project.ext["forceBootifulArtifact"] = null
if (!rootProject.publishSnapshots && !Boolean.getBoolean("skipGradleLint")) {
apply plugin: "nebula.lint"
gradleLint.rules = ["dependency-parentheses", "dependency-tuple"]
}
if (project.name == "cas-server-support-bom") {
logger.info "Skipping pom generation for [$project.name], letting it create <dependency-management> entries on its own."
} else {
apply from: rootProject.file("gradle/maven.gradle")
}
jacoco {
toolVersion = "$gradleJacocoVersion"
}
signing {
required = isArtifactSigningRequired
sign configurations.archives
}
idea {
module {
downloadSources = false
downloadJavadoc = false
excludeDirs << file(".gradle")
["classes", "bin", "docs", "dependency-cache", "libs", "reports", "resources", "test-results", "tmp"].each {
excludeDirs << file("$buildDir/$it")
}
}
}
signArchives.enabled = rootProject.publishingRelease || rootProject.publishSnapshots
/*
Do NOT publish test dependencies into the final POM.
*/
conf2ScopeMappings.mappings.remove(configurations.findByName("testCompileOnly"))
conf2ScopeMappings.mappings.remove(configurations.findByName("testRuntimeOnly"))
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven { url "https://repo.spring.io/libs-milestone" }
maven { url "$sonatypeReleasesRepositoryUrl" }
}
javadoc {
options.addBooleanOption('html5', true)
failOnError = Boolean.getBoolean("ignoreJavadocFailures")
excludes = ['**/generated/**']
}
}
subprojects {
task dependencyCheckAnalyze(type: org.owasp.dependencycheck.gradle.tasks.Analyze)
task allDependenciesInsight(type: DependencyInsightReportTask,
description: "Produce insight information for all dependencies") {
doLast {}
}
task allDependencies(type: DependencyReportTask,
description: "Display a graph of all project dependencies") {
doLast {}
}
apply plugin: "java-library"
if (!rootProject.skipErrorProneCompiler) {
apply plugin: "net.ltgt.errorprone-javacplugin"
}
apply plugin: "checkstyle"
apply plugin: "io.franzbecker.gradle-lombok"
if (!Boolean.getBoolean("skipFindbugs")) {
apply plugin: "com.github.spotbugs"
}
apply plugin: "propdeps"
apply plugin: "propdeps-maven"
apply plugin: "propdeps-idea"
apply plugin: "propdeps-eclipse"
apply from: rootProject.file("gradle/tasks.gradle")
apply from: rootProject.file("gradle/tests.gradle")
ext.libraries = rootProject.ext.libraries
repositories {
mavenLocal()
mavenCentral()
maven { url "https://build.shibboleth.net/nexus/content/repositories/releases" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
maven { url "https://repo.spring.io/plugins-release/" }
maven { url "https://repo.spring.io/milestone/" }
maven { url "https://repo.spring.io/snapshot/" }
maven { url "https://repo.spring.io/libs-milestone" }
maven { url "https://dl.bintray.com/uniconiam/maven" }
maven { url "https://oss.jfrog.org/artifactory/oss-snapshot-local" }
maven { url "https://jitpack.io" }
jcenter()
}
configurations {
tests
developmentOnly
runtimeClasspath {
extendsFrom developmentOnly
}
}
configurations.all {
resolutionStrategy {
if (!Boolean.getBoolean("skipVersionConflict")) {
failOnVersionConflict()
}
preferProjectModules()
cacheDynamicVersionsFor 1, "days"
cacheChangingModulesFor 5, "days"
/**
* Required for all JRadius modules
*/
eachDependency { DependencyResolveDetails details ->
if (details.requested.group == "gnu-getopt") {
details.useTarget group: "gnu.getopt", name: "java-getopt", version: details.requested.version
}
}
}
exclude(group: "ch.qos.logback", module: "logback-core")
exclude(group: "ch.qos.logback", module: "logback-classic")
exclude(group: "cglib", module: "cglib")
exclude(group: "cglib", module: "cglib-full")
exclude(group: "org.slf4j", module: "slf4j-log4j12")
exclude(group: "org.apache.logging.log4j", module: "log4j-to-slf4j")
}
artifacts {
tests testJar
if (!rootProject.publishSnapshots) {
archives sourcesJar
archives javadocJar
archives resourcesJar
archives testJar
}
}
sourceSets {
main {
java {
srcDirs = ["${projectDir}/src/main/java", "${projectDir}/src/main/groovy"]
}
resources {
srcDirs = ["${projectDir}/src/main/resources"]
}
}
test {
java {
srcDirs = ["${projectDir}/src/test/java", "${projectDir}/src/test/groovy"]
}
resources {
srcDirs = ["${projectDir}/src/test/resources"]
}
}
}
ext.buildDate = null
ext.buildJarFile = new File(project.buildDir, "libs/${project.name}-${project.version}.jar")
[compileTestJava, compileJava].each {
it.options.fork = false
it.options.incremental = false
def casCompilerArgs = ["-parameters"]
if (!rootProject.skipErrorProneCompiler) {
it.options.errorprone.allErrorsAsWarnings = false
it.options.errorprone.disableWarningsInGeneratedCode = true
it.options.errorprone.errorproneArgs += ['-Xep:ParameterName:OFF', '-Xep:MissingOverride:OFF']
casCompilerArgs.add("-XDcompilePolicy=byfile")
}
it.options.compilerArgs += casCompilerArgs
}
def currentTime = java.time.ZonedDateTime.now()
compileJava.doLast {
buildDate = currentTime
jar.manifest {
attributes("Implementation-Date": project.buildDate)
}
}
tasks.jar.onlyIf {
project.buildDate != null || !project.buildJarFile.exists()
}
lombok {
version = "$lombokVersion"
}
jar {
manifest {
attributes(
"Automatic-Module-Name": project.name,
"Implementation-Title": project.name,
"Implementation-Vendor": project.group,
"Created-By": project.group,
"Specification-Version": rootProject.currentRevision,
"Implementation-Version": project.version)
}
}
if (!Boolean.getBoolean("skipCheckstyle")) {
checkstyle {
configFile new File(rootDir, "style/checkstyle-rules.xml")
configProperties = ["checkstyle.suppressions.file": new File(rootDir, "style/checkstyle-suppressions.xml")]
ignoreFailures false
showViolations true
toolVersion "${checkstyleVersion}"
}
}
if (!Boolean.getBoolean("skipFindbugs")) {
spotbugs {
toolVersion = "${spotbugsVersion}"
sourceSets = [sourceSets.main]
ignoreFailures = true
reportsDir = file("$project.buildDir/findbugsReports")
effort = "max"
reportLevel = "low"
includeFilter = file("$rootProject.projectDir/style/findbugs-rules.xml")
excludeFilter = file("$rootProject.projectDir/style/findbugs-excludes.xml")
//jvmArgs = ["-Xms2g", "-Xmx4g"]
extraArgs = ["maxHeap 4000"]
}
[spotbugsMain, spotbugsTest].each {
it.reports {
xml.enabled = true
html.enabled = false
}
it.finalizedBy outputSpotbugsReports
}
}
dependencies {
optional libraries.springcomponentindexer
implementation libraries.aspectj
implementation libraries.validationapi
api libraries.jaxb
api libraries.log4j
api libraries.guava
api libraries.commons
api libraries.jodatime
api libraries.inspektr
api libraries.persondirectory
api libraries.spring
api libraries.jackson
api libraries.httpclient
api libraries.quartz
api libraries.hibernate
api libraries.groovy
api libraries.springcloud
api libraries.springboot
api libraries.javax
if (!Boolean.getBoolean("skipFindbugs")) {
spotbugs libraries.findbugs
spotbugs configurations.spotbugsPlugins.dependencies
spotbugsPlugins libraries.findbugscontrib
spotbugsPlugins libraries.findbugssec
}
if (!Boolean.getBoolean("skipErrorProneCompiler")) {
errorprone "com.google.errorprone:error_prone_core:$errorProneVersion"
errorproneJavac "com.google.errorprone:javac:$errorproneJavacVersion"
}
testImplementation libraries.tests
testImplementation libraries.groovy
compileOnly libraries.findbugsannotations
}
if (project.name != 'cas-server-core-api-test-category') {
dependencies {
testImplementation project(path: ":api:cas-server-core-api-test-category", configuration: "tests")
}
}
}
wrapper {
gradleVersion = project.gradleVersion
}
task javadoc(type: Javadoc, description: "Aggregate all Javadocs into a single directory", overwrite: true) {
source subprojects.collect { project -> project.sourceSets.main.allJava }
destinationDir = new File(buildDir, "javadoc")
classpath = files(subprojects.collect { project -> project.sourceSets.main.compileClasspath })
options.addBooleanOption('html5', true)
failOnError = Boolean.getBoolean("ignoreJavadocFailures")
}
task aggregateJavadocsIntoJar(type: Jar, dependsOn: javadoc, description: "Aggregate all Javadocs into a single directory") {
classifier = "javadoc"
from javadoc
}
task rootSourcesJar(type: Jar, description: "Build JAR for the root CAS module") {
baseName = "${project.archivesBaseName}"
from rootProject.file("src")
}
task gradleHome(description: "Display GRADLE_HOME environment variable") {
doFirst {
println "\nexport GRADLE_HOME=" + gradle.gradleHomeDir
}
}
artifacts {
archives aggregateJavadocsIntoJar
archives rootSourcesJar
}
def publishedProjects = subprojects.findAll { !it.path.contains(':docs') }
task jacocoMerge(type: JacocoMerge) {
publishedProjects.each { subproject ->
executionData subproject.tasks.withType(Test)
dependsOn tasks.withType(Test)
}
doFirst {
executionData = files(executionData.findAll { it.exists() })
}
}
task jacocoRootReport(type: JacocoReport, group: 'Coverage reports') {
description = 'Generates an aggregate report from all subprojects'
subprojects.each {
if (!it.path.contains(":docs")) {
it.tasks.withType(Test).each { task -> dependsOn(task) }
}
}
dependsOn jacocoMerge
additionalSourceDirs = files(publishedProjects.sourceSets.main.allSource.srcDirs)
sourceDirectories = files(publishedProjects.sourceSets.main.allSource.srcDirs)
classDirectories = files(files(subprojects.sourceSets.main.output).collect {
fileTree(dir: it,
include: '**/*.class',
exclude: [
'**/**Configuration.class',
'**/shell/cli/**',
'**/shell/commands/**',
'**/**Configuration$**',
'**/**Controller**',
'**/**ConfigurationMetadataGenerator**',
'**/**Application.class',
'**/**Application$**',
'**/**WebflowConfigurer.class',
'**/**WebflowConfigurer$**',
'**/**Exception.class',
'**/**Banner.class',
'**/**Exception$**',
'**/**Properties.class',
'**/**Properties$**'
])
})
executionData jacocoMerge.destinationFile
reports {
html.enabled = false
xml.enabled = true
}
}
task casVersion(description: "Display current CAS version") {
doLast {
println project.version
}
}
task signingKey(description: "Display CAS signing key id") {
doLast {
println "Signing key: " + project.findProperty("signing.keyId")
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/weizai118/CAS.git
git@gitee.com:weizai118/CAS.git
weizai118
CAS
CAS
master

搜索帮助