-
Notifications
You must be signed in to change notification settings - Fork 11
/
build.gradle
176 lines (137 loc) · 5.91 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
apply plugin: "base"
// The task deletes the files that are listed inside the task. These files are
// generated by cmake but are not deleted by the clean task by default because they
// are not inside a build directory
task cleanGeneratedFiles {
delete 'jvm-enclave-common/include/enclave_jni.h'
}
tasks['clean'].dependsOn(cleanGeneratedFiles)
task generateHostJniHeaders(type: Copy) {
dependsOn ":conclave-host:compileJava"
def buildDir = project(":conclave-host").buildDir
from ("$buildDir/generated/sources/headers/java/main") {
include "com_r3_conclave_host_internal_Native.h"
rename "com_r3_conclave_host_internal_Native.h","host_jni.h"
}
into ("$projectDir/jvm-host/include")
}
task generateHostSharedJniHeaders(type: Copy) {
dependsOn ":conclave-host:compileJava"
def buildDir = project(":conclave-host").buildDir
from ("$buildDir/generated/sources/headers/java/main") {
include "com_r3_conclave_host_internal_NativeSharedInternal.h"
rename "com_r3_conclave_host_internal_NativeSharedInternal.h", "host_jni_shared.h"
}
into ("$projectDir/jvm-host-shared/include")
}
task generateEnclaveJniHeaders(type: Copy) {
dependsOn ":conclave-enclave:compileJava"
def buildDir = project(":conclave-enclave").buildDir
from ("$buildDir/generated/sources/headers/java/main") {
include "com_r3_conclave_enclave_internal_Native.h"
rename "com_r3_conclave_enclave_internal_Native.h","enclave_jni.h"
}
into ("$projectDir/jvm-enclave-common/include")
}
// Native components can be built either in "Debug" or "Release" mode.
// These modes are not to be confused with the Debug/Simulation/Release modes of the enclave.
// The values correspond directly to the strings passed to -DCMAKE_BUILD_TYPE when building native components
// Release mode will enable optimisations, and Debug mode will ensure that compiled objects and libraries
// contain debugging symbols. Either mode will produce all the components required to build enclaves in any
// enclave mode. To build native components in debug mode, use -PnativeDebug when starting your build.
for (cmakeBuildType in ["Debug", "Release"]) {
String cmakeBuildDir = "$buildDir/$cmakeBuildType"
String createCmakeBuild = "createCmakeBuild$cmakeBuildType"
String compileLinuxSgx = "compileLinuxSgx$cmakeBuildType"
String compileHostShared = "compileHostShared$cmakeBuildType"
String compileJvmEdl = "compileJvmEdl$cmakeBuildType"
String compileHost = "compileHost$cmakeBuildType"
String compileJvmEnclaveCommon = "compileJvmEnclaveCommon$cmakeBuildType"
String compileSubstrateVMLib = "compileSubstrateVMLib$cmakeBuildType"
String compileFatFsHost = "compileFatFsHost$cmakeBuildType"
String compileFatFsEnclave = "compileFatFsEnclave$cmakeBuildType"
String runCppUnitTests = "runCppUnitTests$cmakeBuildType"
tasks.create(createCmakeBuild, Exec) {
workingDir(cmakeBuildDir)
commandLine("/usr/bin/env", "cmake", "-DCMAKE_BUILD_TYPE=$cmakeBuildType", projectDir)
inputs.files(
"$projectDir/CMakeLists.txt",
"$projectDir/*/CMakeLists.txt"
)
outputs.files(
"$cmakeBuildDir/Makefile"
)
}
tasks.create(compileLinuxSgx, Exec) {
dependsOn(createCmakeBuild)
workingDir(cmakeBuildDir)
commandLine("/usr/bin/env", "cmake",
"--build", cmakeBuildDir,
"--target", "linux-sgx-ext"
)
}
tasks.create(compileJvmEdl, Exec) {
dependsOn(createCmakeBuild, compileLinuxSgx)
workingDir(cmakeBuildDir)
commandLine("/usr/bin/env", "cmake",
"--build", cmakeBuildDir,
"--target", "jvm_host_edl", "jvm_enclave_edl"
)
}
tasks.create(compileHostShared, Exec) {
dependsOn(createCmakeBuild, generateHostSharedJniHeaders, compileLinuxSgx)
workingDir(cmakeBuildDir)
commandLine("/usr/bin/env", "cmake",
"--build", cmakeBuildDir,
"--target", "jvm_host_shared"
)
}
tasks.create(compileHost, Exec) {
dependsOn(createCmakeBuild, generateHostJniHeaders, compileLinuxSgx, compileHostShared)
workingDir(cmakeBuildDir)
commandLine("/usr/bin/env", "cmake",
"--build", cmakeBuildDir,
"--target", "jvm_host", "jvm_host_sim"
)
}
tasks.create(compileJvmEnclaveCommon, Exec) {
dependsOn(createCmakeBuild, compileJvmEdl, generateEnclaveJniHeaders)
workingDir(cmakeBuildDir)
commandLine("/usr/bin/env", "cmake",
"--build", cmakeBuildDir,
"--target", "jvm_enclave_common_simulation", "jvm_enclave_common_debug", "jvm_enclave_common_release"
)
}
tasks.create(compileSubstrateVMLib, Exec) {
dependsOn(createCmakeBuild, generateEnclaveJniHeaders)
workingDir(cmakeBuildDir)
commandLine("/usr/bin/env", "cmake",
"--build", cmakeBuildDir,
"--target", "substratevm"
)
}
tasks.create(compileFatFsHost, Exec) {
dependsOn(createCmakeBuild, generateHostJniHeaders, compileLinuxSgx, compileHostShared)
workingDir(cmakeBuildDir)
commandLine("/usr/bin/env", "cmake",
"--build", cmakeBuildDir,
"--target", "fatfs_host"
)
}
tasks.create(compileFatFsEnclave, Exec) {
dependsOn(createCmakeBuild, generateEnclaveJniHeaders)
workingDir(cmakeBuildDir)
commandLine("/usr/bin/env", "cmake",
"--build", cmakeBuildDir,
"--target", "fatfs_enclave"
)
}
tasks.create(runCppUnitTests, Exec) {
dependsOn(createCmakeBuild)
workingDir(cmakeBuildDir)
commandLine("/usr/bin/env", "cmake",
"--build", cmakeBuildDir,
"--target", "build_tests_and_run"
)
}
}