16 Star 34 Fork 6

ideal(harbby) / gadtry

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
build.gradle 5.72 KB
一键复制 编辑 原始数据 按行查看 历史
ideal(harbby) 提交于 2022-01-28 22:15 . update code style
plugins {
id 'java'
id 'java-library'
id 'signing'
id 'checkstyle'
id "com.github.hierynomus.license" version "0.16.1"
id "jacoco"
id 'maven-publish'
}
group = "com.github.harbby"
version = "1.9.10-SNAPSHOT" //SNAPSHOT
def jdk = project.hasProperty('jdk') ? project.jdk : 'java11' //default -Pjdk=java11
//def jdk = System.getProperty("jdk") ?: " -Djdk=java11
apply from: "profile-${jdk}.gradle"
sourceSets {
main {
java {
srcDirs += ["src/main/$jdk"]
}
resources {
srcDirs += ["src/main/resources", "src/main/profile/$jdk"]
}
}
test {
java {
srcDirs += ['src/test/java', "src/test/$jdk"]
}
}
}
repositories {
mavenLocal()
mavenCentral()
}
tasks.named("processResources") {
duplicatesStrategy = 'include'
}
tasks.withType(org.gradle.jvm.tasks.Jar) { duplicatesStrategy = 'include' }
dependencies {
implementation group: 'org.javassist', name: 'javassist', version: '3.28.0-GA'
implementation group: 'net.java.dev.jna', name: 'jna-platform-jpms', version: '5.9.0'
testImplementation group: 'junit', name: 'junit', version: '4.12'
testImplementation group: "org.openjdk.jmh", name: "jmh-core", version: "1.32"
testImplementation group: 'org.fusesource.jansi', name: 'jansi', version: '1.17.1'
//testAnnotationProcessor group: "org.openjdk.jmh", name: "jmh-generator-annprocess", version: "1.32"
}
jar {
manifest {
// Set the required manifest attributes for the Java agent, cf.
// https://docs.oracle.com/javase/8/docs/api/java/lang/instrument/package-summary.html.
attributes 'Premain-Class': 'com.github.harbby.gadtry.jvm.JvmAgent'
attributes 'Can-Redefine-Classes': true
attributes 'Can-Retransform-Classes': true
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
tasks.withType(Javadoc) {
options.encoding = "UTF-8"
}
checkstyle {
toolVersion '8.12'
showViolations true
configFile = rootProject.file('src/checkstyle/facebook_checks.xml')
//configFile = file("${rootDir}/src/checkstyle/facebook_checks.xml")
}
//assemble.dependsOn 'checkstyle'
license {
headerDefinitions { //see: http://code.mycila.com/license-maven-plugin/#supported-comment-types
javadoc_style {
firstLine = "/*"
endLine = " */"
beforeEachLine = " * "
afterEachLine = ""
firstLineDetectionPattern = "(\\s|\\t)*/\\*.*\$"
lastLineDetectionPattern = ".*\\*/(\\s|\\t)*\$"
allowBlankLines = false
padLines = false
//skipLine = "//"
isMultiline = true
}
}
header rootProject.file('src/license/LICENSE-HEADER.txt')
strictCheck true
excludes(["**/*.properties", "**/*.sql", "**/*.txt"])
//include "**/*.java"
}
jacocoTestReport {
reports {
xml.enabled true
html.enabled true
}
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it,
exclude: [
"**/com/github/harbby/gadtry/spi/ServiceLoad.class",
"**/com/github/harbby/gadtry/collection/IntArrayBuffer**",
"**/com/github/harbby/gadtry/base/JavaParameterizedTypeImpl.class",
"**/com/github/harbby/gadtry/base/Platform**"
])
}))
}
}
check.dependsOn jacocoTestReport
task checkstyle(type: Checkstyle) {
configFile = file("${rootProject.projectDir}/src/checkstyle/facebook_checks.xml")
source 'src'
include '**/*.java'
exclude '**/gen/**', '**/test/**', '**/build/**', '**/module-info.java'
classpath = files()
}
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
javadoc.failOnError = false
}
ext {
shouldSign = project.hasProperty('mavenUsername')
mavenUsername = project.hasProperty('mavenUsername') ? project.mavenUsername : ''
mavenPassword = project.hasProperty('mavenPassword') ? project.mavenPassword : ''
}
//--- gradle clean build publish
publishing {
publications {
mavenJava(MavenPublication) {
from project.components.java
//artifact jar
artifact sourcesJar
artifact javadocJar
version = "$project.version"
artifactId = "$project.name"
groupId = "$project.group"
pom {
name = 'gadtry'
description = 'Gadtry A collection of java tool libraries. Contains: ioc. aop. exec. graph ...'
url = 'https://github.com/harbby/gadtry'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
developers {
developer {
id = 'harbby'
name = 'harbby'
email = 'yezhixinghai@gmail.com'
}
}
scm {
url = 'https://github.com/harbby/gadtry'
connection = 'https://github.com/harbby/gadtry.git'
developerConnection = 'https://github.com/harbby/gadtry.git'
}
}
}
}
repositories {
maven {
credentials {
username = "${mavenUsername}"
password = "${mavenPassword}"
}
// change URLs to point to your repos, e.g. http://my.org/repo
def repository_url = project.version.endsWith('-SNAPSHOT') ?
'https://oss.sonatype.org/content/repositories/snapshots' :
'https://oss.sonatype.org/service/local/staging/deploy/maven2'
url = repository_url
}
mavenLocal()
}
artifacts {
archives sourcesJar, javadocJar
}
signing {
required { shouldSign }
sign publishing.publications.mavenJava
}
task install(dependsOn: publishToMavenLocal) {
}
task upload(dependsOn: publish) {
}
}
Java
1
https://gitee.com/idela-hp/gadtry.git
git@gitee.com:idela-hp/gadtry.git
idela-hp
gadtry
gadtry
master

搜索帮助