-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuild.gradle
More file actions
147 lines (109 loc) · 3.12 KB
/
build.gradle
File metadata and controls
147 lines (109 loc) · 3.12 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
144
145
146
147
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.5'
}
}
allprojects {
group = 'uk.co.froot'
version = '0.0.1-SNAPSHOT'
}
subprojects {
apply plugin: 'java'
apply plugin: 'idea'
sourceCompatibility = 1.8
ext {
protobufVersion = '3.5.1'
}
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
// USB (wrapper for libusb-1.0 with javax.usb extensions)
compile "org.usb4java:usb4java-javax:1.2.0"
// Google protobuf for serialisation on the wire
compile "com.google.protobuf:protobuf-java:$protobufVersion"
// Logging with slf4j and logback
compile "org.slf4j:slf4j-api:1.7.25"
compile "ch.qos.logback:logback-classic:1.+"
// Testing with junit
testCompile "junit:junit:4.4"
// Mockito for mocking
testCompile "org.mockito:mockito-core:2.18.3"
}
}
// ///////////////////////////////////////////////////////////////////////////////////////////////////////
// Core project
project(':core') {
apply plugin: 'com.google.protobuf'
jar {
manifest {
attributes 'Implementation-Title': 'Trezor Java Core',
'Implementation-Version': version
}
}
sourceSets {
main {
// Set an additional source tree for supplied .proto files
proto {
srcDir "$projectDir/trezor-common/protob"
}
// Set an additional source tree for generated protobuf files
java {
srcDirs "$projectDir/gen/main/java"
}
}
}
protobuf {
// Target for generated code (main/java is appended and it is cleaned on a rebuild so keep it out of src)
generatedFilesBaseDir = "$rootDir/core/gen"
protoc {
artifact = "com.google.protobuf:protoc:$protobufVersion"
}
generateProtoTasks {
// Ensure all protobuf tasks use generated output correctly
all().each { task ->
if (task.name == "generateProto") {
task.outputs.upToDateWhen {
new File(generatedFilesBaseDir).exists()
}
}
}
// Task to clean generated code
task deleteGeneratedProto {
doLast {
delete generatedFilesBaseDir
}
}
// Task to recompile protobuf sources
task recompileProto {}
recompileProto.dependsOn(deleteGeneratedProto)
recompileProto.dependsOn(generateProto)
// Java compilation should happen after protobuf sources are generated
compileJava.dependsOn(generateProto)
// Clean task should remove generated code
clean.dependsOn(deleteGeneratedProto)
}
}
}
// ///////////////////////////////////////////////////////////////////////////////////////////////////////
// Service project
project(':service') {
dependencies {
// Require core
compile project(':core')
// Bitcoinj for Bitcoin operations on Java
compile "org.bitcoinj:bitcoinj-core:0.14.7"
}
}
// ///////////////////////////////////////////////////////////////////////////////////////////////////////
// Examples project
project(':examples') {
dependencies {
// Require core
compile project(':service')
}
}