-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
134 lines (117 loc) · 3.9 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
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
buildscript {
ext {
coroutines_version = "1.3.7"
protobuf_version = "3.11.1"
grpc_version = "1.29.0"
grpc_kotlin_version = "0.1.4"
}
// This is a workaround to issue
// https://github.com/web3j/web3j-gradle-plugin/issues/34
dependencies {
classpath ("org.web3j:codegen:4.6.3") {
force = true
}
}
}
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.3.72'
id 'application'
id 'idea'
id 'com.google.protobuf' version '0.8.12'
// The Web3J plugin is not compatible with Gradle 6 because of this issue:
// https://github.com/web3j/web3j-gradle-plugin/issues/31
id 'org.web3j' version '4.5.11'
}
configurations.all { configuration ->
// Workaround for dependency configuration issue:
// https://github.com/google/protobuf-gradle-plugin/issues/391
if (name.contains('Proto')) {
attributes.attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.class, Usage.JAVA_RUNTIME))
}
}
repositories {
jcenter()
mavenCentral()
// Local Maven repository
maven {
url 'file://Users/allirvin/.m2/repository'
}
}
dependencies {
implementation platform('org.jetbrains.kotlin:kotlin-bom')
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
testImplementation 'org.jetbrains.kotlin:kotlin-test'
testImplementation 'org.jetbrains.kotlin:kotlin-test-junit'
// Arrow is a functional library for Kotlin
implementation "io.arrow-kt:arrow-core:0.10.4"
// gRPC and protobuf dependencies
implementation "io.grpc:grpc-kotlin-stub:$grpc_kotlin_version"
implementation "com.google.protobuf:protobuf-java:$protobuf_version"
implementation "com.google.protobuf:protobuf-java-util:$protobuf_version"
implementation "io.grpc:grpc-netty-shaded:$grpc_version"
implementation "io.grpc:grpc-protobuf:$grpc_version"
implementation "io.grpc:grpc-stub:$grpc_version"
// Kotlin command line client library - Clikt
implementation "com.github.ajalt:clikt:2.7.1"
// RSA accumulator library
implementation "res.dlt.accumulator:rsa-accumulator:0.1"
// Library for interacting with Ethereum
implementation "org.web3j:core:4.6.3"
}
application {
mainClassName = 'external.client.AppKt'
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
kotlinOptions {
languageVersion = "1.3"
apiVersion = "1.3"
jvmTarget = "1.8"
javaParameters = true
}
}
// This is a workaround to the issue where compileSolidity comes before compileKotlin
// https://github.com/web3j/web3j-gradle-plugin/issues/24
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
dependsOn 'generateContractWrappers'
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
dependsOn 'generateTestContractWrappers'
}
sourceSets {
main.kotlin.srcDirs += "${web3j.generatedFilesBaseDir}/main/java"
test.kotlin.srcDirs += "${web3j.generatedFilesBaseDir}/test/java"
}
protobuf {
protoc { artifact = "com.google.protobuf:protoc:$protobuf_version" }
plugins {
// Specify protoc to generate using kotlin protobuf plugin
grpc {
artifact = "io.grpc:protoc-gen-grpc-java:$grpc_version"
}
// Specify protoc to generate using our grpc kotlin plugin
grpckt {
artifact = "io.grpc:protoc-gen-grpc-kotlin:$grpc_kotlin_version"
}
}
generateProtoTasks {
all().each { task ->
task.plugins {
// Generate Java gRPC classes
grpc { }
// Generate Kotlin gRPC using the custom plugin from library
grpckt { }
}
}
}
}
web3j {
generatedPackageName = 'external.client.contracts.generated'
excludedContracts = ['StringUtils']
}
solidity {
executable = "solc"
version = "0.7.1"
}