-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.gradle
More file actions
144 lines (119 loc) · 4.36 KB
/
build.gradle
File metadata and controls
144 lines (119 loc) · 4.36 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
buildscript {
ext.kotlin_version = '1.3.10'
ext.ktor_version = '1.0.0'
ext.notary_version = 'b3da53151bb88c7044f79a2a8dacab1775dd92ff'
ext.chain_adapter_client_version= '9e65b4e38dd82d9a2ddc1065326050d4dc296075'
ext.web3j_version = '4.2.0'
repositories {
mavenCentral()
jcenter()
// gradle plugins repository
gradlePluginPortal()
}
configurations.maybeCreate("pitest")
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.github.jengelman.gradle.plugins:shadow:4.0.1'
}
}
plugins {
id "org.sonarqube" version "2.7.1"
id "com.github.dolgopolovwork.testreport" version "1"
}
group = 'd3'
version = '1.0-SNAPSHOT'
apply plugin: 'com.github.johnrengelman.shadow'
testReport {
testFolders = Arrays.asList("notary-eth-integration-test")
}
allprojects {
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'maven'
repositories {
mavenCentral()
// for Ktor
jcenter()
maven { url = 'https://dl.bintray.com/kotlin/ktor' }
maven { url 'https://jitpack.io' }
}
}
allprojects{
sonarqube {
properties {
property "sonar.github.repository", "d3ledger/d3-eth"
property "sonar.projectKey", "d3:d3-eth"
property "sonar.java.binaries", "${project.projectDir}/build/classes"
property "sonar.java.libraries", "${project.projectDir}/build/libs"
property "sonar.java.test.binaries", "${project.projectDir}/build/test-results/test/binary"
property "sonar.exclusions", "notary-eth-integration-test/**, **/java/contract/**"
}
}
}
sourceCompatibility = 1.8
// ------------------| Test dependencies |------------------
allprojects {
dependencies {
// unit tests
testImplementation('org.junit.jupiter:junit-jupiter-api:5.2.0')
testRuntime('org.junit.jupiter:junit-jupiter-engine:5.2.0')
// https://mvnrepository.com/artifact/org.mockito/mockito-all
testImplementation group: 'org.mockito', name: 'mockito-all', version: '2.0.2-beta'
testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.1.0")
// for setting env variables in tests
testImplementation ('com.github.stefanbirkner:system-rules:1.18.0'){
exclude group: 'junit'
}
// to run both junit4 and junit5 tests
testRuntime("org.junit.vintage:junit-vintage-engine:5.2.0")
}
}
wrapper {
gradleVersion = 4.10
}
allprojects {
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
}
task buildEthereumContracts(type: Exec) {
description = 'Build Ethereum contracts'
String contract_path = projectDir.toString().concat("/deploy/ethereum/contract")
String bin_path = contract_path.concat("/bin")
file(bin_path).mkdirs()
doLast {
logger.info(standardOutput.toString())
logger.error(errorOutput.toString())
}
commandLine 'sh', '-c', 'solc <path>/*.sol --bin --abi --optimize -o <path>/bin --overwrite'.replace("<path>", contract_path)
}
task buildEthereumContractsBindings(type: Exec) {
String contract_path = projectDir.toString().concat("/deploy/ethereum/contract")
String bin_path = contract_path.concat("/bin")
String wildcard = "<path>/*.bin".replace("<path>", bin_path)
String cmd = 'for f in ' + wildcard + '; ' +
'do ' +
'name=$(echo "$f" | cut -f 1 -d \'.\'); ' +
'web3j solidity generate -b ${name}.bin --abiFile=${name}.abi -o <bin_path> -p contract \n'.replace("<bin_path>", bin_path) +
'done \n' +
'cp deploy/ethereum/contract/bin/contract/* eth/src/main/java/contract'
commandLine 'bash', '-c', cmd
}
buildEthereumContractsBindings.dependsOn ':buildEthereumContracts'
//Forms a list of ETH passwords from command line arguments
def getEthPasswordsArgs() {
List<String> args = new ArrayList<>()
if (project.hasProperty("credentialsPassword")) {
args.add(project.property("credentialsPassword").toString())
}
if (project.hasProperty("nodeLogin")) {
args.add(project.property("nodeLogin").toString())
}
if (project.hasProperty("nodePassword")) {
args.add(project.property("nodePassword").toString())
}
return args
}