加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
build.gradle 9.49 KB
一键复制 编辑 原始数据 按行查看 历史
wanghuanyu3 提交于 2019-08-21 19:24 . init bds-tron
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.3'
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.2'
}
}
plugins {
id "org.sonarqube" version "2.6"
}
group 'org.tron'
version '1.0.0'
apply plugin: 'java'
apply plugin: 'com.google.protobuf'
apply plugin: 'application'
apply plugin: 'checkstyle'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: "jacoco"
apply plugin: 'maven-publish'
jar.enabled = false
shadowJar.enabled = true
sourceCompatibility = 1.8
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
mainClassName = 'org.tron.program.FullNode'
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourceJar
}
}
repositories {
mavenLocal()
}
}
task sourceJar(type: Jar, dependsOn: classes) {
classifier 'sources'
from sourceSets.main.allSource
}
repositories {
mavenLocal()
mavenCentral()
maven { url 'http://repo.spring.io/plugins-release' }
}
def versions = [
checkstyle: '8.7',
]
jacoco {
toolVersion = "0.8.1"
}
configurations {
checkstyleConfig
}
configurations.getByName('checkstyleConfig') {
transitive = false
}
static def isWindows() {
return org.gradle.internal.os.OperatingSystem.current().isWindows()
}
if (isWindows()) {
ext {
leveldbGroup = "org.ethereum"
leveldbName = "leveldbjni-all"
leveldbVersion = "1.18.3"
}
} else {
ext {
leveldbGroup = "org.fusesource.leveldbjni"
leveldbName = "leveldbjni-all"
leveldbVersion = "1.8"
}
}
task version(type: Exec) {
commandLine 'bash', '-c', './ver.sh'
}
dependencies {
//local libraries
compile fileTree(dir: 'libs', include: '*.jar')
// end local libraries
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.mockito', name: 'mockito-core', version: '2.13.0'
testCompile group: 'org.hamcrest', name: 'hamcrest-junit', version: '1.0.0.1'
testCompile group: 'org.testng', name: 'testng', version: '6.14.3'
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'
compile group: 'org.slf4j', name: 'jcl-over-slf4j', version: '1.7.25'
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
// compile "org.projectlombok:lombok:1.16.18"
compile group: 'org.projectlombok', name: 'lombok', version: '1.18.2'
compile group: 'commons-codec', name: 'commons-codec', version: '1.11'
compile "com.madgag.spongycastle:core:1.58.0.0"
compile "com.madgag.spongycastle:prov:1.58.0.0"
compile group: 'com.google.guava', name: 'guava', version: '24.1-jre'
compile group: 'com.google.protobuf', name: 'protobuf-java', version: '3.4.0'
compile group: 'com.google.protobuf', name: 'protobuf-java-util', version: '3.4.0'
compile "org.iq80.leveldb:leveldb:0.7"
compile group: 'org.rocksdb', name: 'rocksdbjni', version: '5.15.10'
compile group: leveldbGroup, name: leveldbName, version: leveldbVersion
compile "org.apache.commons:commons-collections4:4.0"
compile group: 'com.typesafe', name: 'config', version: '1.3.2'
compile "com.google.code.findbugs:jsr305:3.0.0"
compile "com.cedarsoftware:java-util:1.8.0"
compile "org.apache.commons:commons-lang3:3.4"
compile "commons-httpclient:commons-httpclient:3.1"
compile group: 'org.springframework', name: 'spring-context', version: '4.2.0.RELEASE'
compile group: 'org.springframework', name: 'spring-tx', version: '4.2.0.RELEASE'
compile group: 'com.beust', name: 'jcommander', version: '1.72'
compile group: 'junit', name: 'junit', version: '4.12'
compile group: 'net.jcip', name: 'jcip-annotations', version: '1.0'
compile group: 'org.fusesource.jansi', name: 'jansi', version: '1.16'
compile group: 'com.alibaba', name: 'fastjson', version: '1.2.44'
compile group: 'com.google.inject', name: 'guice', version: '4.1.0'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.8.5'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.8.5'
compile group: 'org.apache.commons', name: 'commons-math', version: '2.2'
compile group: 'joda-time', name: 'joda-time', version: '2.3'
compile group: 'io.dropwizard.metrics', name: 'metrics-core', version: '3.1.2'
// checkstyleConfig "com.puppycrawl.tools:checkstyle:${versions.checkstyle}"
// google grpc
compile group: 'io.grpc', name: 'grpc-netty', version: '1.14.0'
compile group: 'io.grpc', name: 'grpc-protobuf', version: '1.14.0'
compile group: 'io.grpc', name: 'grpc-stub', version: '1.14.0'
// end google grpc
compile group: 'com.carrotsearch', name: 'java-sizeof', version: '0.0.5'
compile 'org.aspectj:aspectjrt:1.8.13'
compile 'org.aspectj:aspectjweaver:1.8.13'
compile 'org.aspectj:aspectjtools:1.8.13'
compile 'com.googlecode.cqengine:cqengine:2.12.4'
compile group: 'com.google.api.grpc', name: 'googleapis-common-protos', version: '0.0.3'
// http
compile 'org.eclipse.jetty:jetty-server:9.4.11.v20180605'
compile 'org.eclipse.jetty:jetty-servlet:9.4.11.v20180605'
compile 'com.alibaba:fastjson:1.2.47'
compile group: 'org.apache.httpcomponents', name:'httpasyncclient', version:'4.1.1'
// end http
compile "io.vavr:vavr:0.9.2"
compile group: 'org.pf4j', name: 'pf4j', version: '2.5.0'
compile group: 'org.zeromq', name: 'jeromq', version: '0.5.0'
}
check.dependsOn 'lint'
//checkstyle {
// toolVersion = "${versions.checkstyle}"
// config = resources.text.fromArchiveEntry(configurations.checkstyleConfig, 'google_checks.xml')
//
//}
checkstyle {
toolVersion = "${versions.checkstyle}"
configFile = file("config/checkstyle/checkStyleAll.xml")
}
checkstyleMain {
source = 'src/main/java'
}
task lint(type: Checkstyle) {
// Cleaning the old log because of the creation of the new ones (not sure if totaly needed)
delete fileTree(dir: "${project.rootDir}/app/build/reports")
source 'src'
include '**/*.java'
exclude 'main/gen/**'
exclude 'test/**'
// empty classpath
classpath = files()
//Failing the build
ignoreFailures = false
}
tasks.matching { it instanceof Test }.all {
testLogging.events = ["failed", "passed", "skipped"]
}
if (project.hasProperty("mainClass")) {
mainClassName = mainClass
}
sourceSets {
main {
proto {
srcDir 'src/main/protos'
}
java {
srcDir 'src/main/gen'
srcDir 'src/main/java'
}
}
}
protobuf {
generatedFilesBaseDir = "$projectDir/src/"
protoc {
artifact = "com.google.protobuf:protoc:3.5.1-1"
}
plugins {
grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:1.9.0'
}
}
generateProtoTasks {
all().each { task ->
task.builtins {
java { outputSubDir = "gen" }
}
}
all()*.plugins {
grpc {
outputSubDir = "gen"
}
}
}
}
run {
if (project.hasProperty('witness')) {
standardInput = System.in
args = ['--witness']
}
}
shadowJar {
baseName = 'java-tron'
classifier = null
version = null
}
test {
testLogging {
exceptionFormat = 'full'
}
jacoco {
append = true
destinationFile = file("$buildDir/jacoco/jacocoTest.exec")
classDumpDir = file("$buildDir/jacoco/classpathdumps")
}
}
task stest(type: Test) {
useTestNG {
suites(file('src/test/resources/testng.xml'))
parallel 'tests'
threadCount 4
}
testLogging {
exceptionFormat = 'full'
showStackTraces = "true"
}
jacoco {
append = false
destinationFile = file("$buildDir/jacoco/jacocoTest.exec")
classDumpDir = file("$buildDir/jacoco/classpathdumps")
}
}
task dailyBuild(type: Test) {
useTestNG {
suites(file('src/test/resources/daily-build.xml'))
parallel 'tests'
threadCount 1
}
}
jacocoTestReport {
reports {
xml.enabled true
csv.enabled false
html.destination file("${buildDir}/jacocoHtml")
}
executionData = files('build/jacoco/jacocoTest.exec')
}
def binaryRelease(taskName, jarName, mainClass) {
return tasks.create("${taskName}", Jar) {
baseName = jarName
version = null
from(sourceSets.main.output) {
include "/**"
}
from {
configurations.compile.collect {
it.isDirectory() ? it : zipTree(it)
}
}
manifest {
attributes "Main-Class": "${mainClass}"
}
}
}
artifacts {
archives(binaryRelease('buildSolidityNodeJar', 'SolidityNode', 'org.tron.program.SolidityNode'),
binaryRelease('buildFullNodeJar', 'FullNode', 'org.tron.program.FullNode'),
binaryRelease('buildKeystoreFactoryJar', 'KeystoreFactory', 'org.tron.program.KeystoreFactory'),
binaryRelease('buildDBConvertJar', 'DBConvert', 'org.tron.program.DBConvert'))
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化