@@ -124,52 +124,26 @@ rust_executable("deno") {
124
124
extern = main_extern
125
125
deps = [
126
126
" :libdeno" ,
127
+ " :snapshot" ,
127
128
]
128
129
}
129
130
130
- rust_executable (" hyper_hello" ) {
131
- source_root = " tools/hyper_hello.rs"
132
- extern = [
133
- " $rust_build :hyper" ,
134
- " $rust_build :ring" ,
135
- ]
136
- }
137
-
138
- rust_test (" test_rs" ) {
139
- source_root = " src/main.rs"
140
- extern = main_extern
141
- deps = [
142
- " :libdeno" ,
143
- ]
144
- }
145
-
146
- v8_executable (" test_cc" ) {
147
- testonly = true
148
- sources = [
149
- " libdeno/test.cc" ,
150
- ]
151
- deps = [
152
- " :deno_base_test" ,
153
- " //testing/gtest:gtest" ,
154
- ]
155
- configs = [ " :deno_config" ]
156
- }
157
-
158
- static_library (" libdeno" ) {
159
- complete_static_lib = true
131
+ source_set (" snapshot" ) {
160
132
sources = [
161
- " libdeno/from_snapshot .cc" ,
133
+ " src/snapshot .cc" ,
162
134
]
163
- inputs = [
135
+ configs += [ " :deno_config" ]
136
+ data = [
164
137
" $target_gen_dir /snapshot_deno.bin" ,
165
138
]
166
139
deps = [
167
140
" :create_snapshot_deno" ,
168
- " :deno_bindings" ,
169
141
]
170
- configs += [ " :deno_config" ]
171
142
172
- # from_snapshot.cc uses an assembly '.incbin' directive to embed the snapshot.
143
+ # snapshot.cc doesn't need to depend on libdeno, it just needs deno_buf.
144
+ include_dirs = [ " libdeno/" ]
145
+
146
+ # src/snapshot.cc uses an assembly '.incbin' directive to embed the snapshot.
173
147
# This causes trouble when using sccache: since the snapshot file is not
174
148
# inlined by the c preprocessor, sccache doesn't take its contents into
175
149
# consideration, leading to false-positive cache hits.
@@ -178,7 +152,9 @@ static_library("libdeno") {
178
152
# header file that contains the the sha256 hash of the snapshot.
179
153
if (cc_wrapper != " " && cc_wrapper != " ccache" ) {
180
154
hash_h = " $target_gen_dir /bundle/hash.h"
181
- inputs += [ hash_h ]
155
+ inputs = [
156
+ hash_h ,
157
+ ]
182
158
deps += [ " :bundle_hash_h" ]
183
159
if (is_win ) {
184
160
cflags = [ " /FI" + rebase_path (hash_h , target_out_dir ) ]
@@ -191,57 +167,69 @@ static_library("libdeno") {
191
167
}
192
168
}
193
169
194
- # Only functionality needed for libdeno_test and snapshot_creator
195
- # In particular no flatbuffers, no assets, no rust, no msg handlers.
196
- # Because snapshots are slow, it's important that snapshot_creator's
197
- # dependencies are minimal.
198
- v8_source_set (" deno_base" ) {
199
- sources = [
200
- " libdeno/binding.cc" ,
201
- " libdeno/deno.h" ,
202
- " libdeno/file_util.cc" ,
203
- " libdeno/file_util.h" ,
204
- " libdeno/internal.h" ,
170
+ rust_executable (" hyper_hello" ) {
171
+ source_root = " tools/hyper_hello.rs"
172
+ extern = [
173
+ " $rust_build :hyper" ,
174
+ " $rust_build :ring" ,
205
175
]
206
- public_deps = [
207
- " third_party/v8:v8_monolith" ,
176
+ }
177
+
178
+ rust_test (" test_rs" ) {
179
+ source_root = " src/main.rs"
180
+ extern = main_extern
181
+ deps = [
182
+ " :libdeno" ,
183
+ " :snapshot" ,
208
184
]
209
- configs = [ " :deno_config" ]
210
185
}
211
186
212
- v8_source_set ( " deno_base_test " ) {
187
+ v8_executable ( " test_cc " ) {
213
188
testonly = true
214
189
sources = [
215
190
" libdeno/file_util_test.cc" ,
216
- " libdeno/from_snapshot.cc" ,
217
191
" libdeno/libdeno_test.cc" ,
218
192
" libdeno/test.cc" ,
219
193
]
220
194
deps = [
221
195
" :create_snapshot_libdeno_test" ,
222
- " :deno_base " ,
196
+ " :libdeno " ,
223
197
" //testing/gtest:gtest" ,
224
198
]
225
199
data = [
226
200
" $target_gen_dir /snapshot_libdeno_test.bin" ,
227
201
]
228
- defines = [ " LIBDENO_TEST" ]
202
+ snapshot_abs_path = rebase_path (data [0 ])
203
+ defines = [ " SNAPSHOT_PATH=\" $snapshot_abs_path \" " ]
229
204
configs = [ " :deno_config" ]
230
205
}
231
206
232
- v8_source_set (" deno_bindings" ) {
233
- deps = [
234
- " :deno_base" ,
207
+ # Only functionality needed for libdeno_test and snapshot_creator
208
+ # In particular no flatbuffers, no assets, no rust, no msg handlers.
209
+ # Because snapshots are slow, it's important that snapshot_creator's
210
+ # dependencies are minimal.
211
+ static_library (" libdeno" ) {
212
+ complete_static_lib = true
213
+ sources = [
214
+ " libdeno/binding.cc" ,
215
+ " libdeno/deno.h" ,
216
+ " libdeno/file_util.cc" ,
217
+ " libdeno/file_util.h" ,
218
+ " libdeno/internal.h" ,
219
+ " libdeno/new.cc" ,
235
220
]
236
- configs = [ " :deno_config" ]
221
+ public_deps = [
222
+ " third_party/v8:v8_monolith" ,
223
+ ]
224
+ configs += [ " :deno_config" ]
237
225
}
238
226
239
227
executable (" snapshot_creator" ) {
240
228
sources = [
241
229
" libdeno/snapshot_creator.cc" ,
242
230
]
243
231
deps = [
244
- " :deno_base " ,
232
+ " :libdeno " ,
245
233
]
246
234
configs += [ " :deno_config" ]
247
235
}
0 commit comments