forked from dev-dennis-guye/aion-json-rpc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
96 lines (81 loc) · 2.43 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
def workingDir = rootDir.absolutePath
def generatedFolderPath = "${workingDir}/out/"
def generatorPath = "${workingDir}/generator"
def javaTemplatePath = "${workingDir}/rpc-lib4j/templates"
def rustTemplatePath = "${workingDir}/rpc-lib4j/templates"
def javaConfigurationPath = "${workingDir}/rpc-lib4j/configuration/configuration.xml"
def rustConfigurationPath = "${workingDir}/rpc-lib4j/configuration/configuration.xml"
def specPath = "${workingDir}/spec/"
def buildRoot = "${rootDir.absolutePath}/build"
allprojects{
apply plugin: 'idea'
apply plugin: 'base'
buildDir="${buildRoot}/${project.name}"
}
wrapper{
gradleVersion = '5.6'
distributionType = Wrapper.DistributionType.BIN
}
subprojects {
}
task cleanGenerated(type:Delete) {
delete ("${generatorPath}")
delete ("${generatedFolderPath}")
}
task cleanOut(type: Delete){
delete ("${buildRoot}")
}
clean{
dependsOn 'cleanGenerated'
dependsOn 'cleanOut'
}
task createGenerator(type: Copy){
dependsOn(":rpc-gen:build")
def rpcZipFile = file("${rootDir.absolutePath}/build/rpc-gen/distributions/generator.zip")
def outputDir = file("${rootDir}/.")
from zipTree(rpcZipFile)
into outputDir
}
task printSpec(type: Exec){
dependsOn 'clean'
dependsOn('createGenerator')
if (project.hasProperty('filePath')) {
commandLine("$generatorPath/bin/generator",
"print",
'-f',
project.property('filePath'))
} else {
commandLine("$generatorPath/bin/generator",
"print",
'--help')
}
}
task genJava(type:Exec){
dependsOn 'clean', 'createGenerator'
commandLine("$generatorPath/bin/generator",
'-s',
"$specPath",
'-o', "$generatedFolderPath",
"--templates", "$javaTemplatePath",
"--config", "$javaConfigurationPath")
finalizedBy {
':rpc-lib4j:packageGeneratedFiles4J'
}
}
task genRust(type:Exec){
dependsOn 'clean', 'createGenerator'
commandLine("$generatorPath/bin/generator",
'-s',
"$specPath",
'-o', "$generatedFolderPath",
"--templates", "$rustTemplatePath",
"--config", "$rustConfigurationPath")
finalizedBy {
':rpc_lib_4_rust:packageGeneratedFiles4R'
}
}
static def getCommitHash() {
def proc = "git rev-parse --short HEAD".execute()
proc.waitFor()
return proc.text.trim()
}