1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

Organize BUILD.gn

This commit is contained in:
Ryan Dahl 2018-06-10 14:24:39 +02:00
parent 9296b21b87
commit c0401a4096
3 changed files with 67 additions and 73 deletions

View file

@ -2,6 +2,68 @@ import("//third_party/protobuf/proto_library.gni")
import("//v8/gni/v8.gni") import("//v8/gni/v8.gni")
import("//v8/snapshot_toolchain.gni") import("//v8/snapshot_toolchain.gni")
executable("deno") {
sources = [
"main.cc",
]
deps = [
":libdeno",
]
}
executable("deno_test") {
testonly = true
sources = [
"deno_test.cc",
]
deps = [
":libdeno",
"//testing/gtest:gtest",
]
}
component("libdeno") {
deps = [
":deno_snapshot",
]
}
source_set("deno_nosnapshot") {
sources = [
"deno.cc",
"deno_internal.h",
"include/deno.h",
]
include_dirs = [ "include/" ]
deps = [
":msg_proto",
"v8:v8",
"v8:v8_libbase",
"v8:v8_libplatform",
"v8:v8_libsampler",
]
}
source_set("deno_snapshot") {
sources = [
"from_snapshot.cc",
]
deps = [
":create_snapshot_deno",
":deno_nosnapshot",
]
include_dirs = [ target_gen_dir ]
}
executable("snapshot_creator") {
sources = [
"snapshot_creator.cc",
]
deps = [
":deno_nosnapshot",
]
}
proto_library("msg_proto") { proto_library("msg_proto") {
sources = [ sources = [
"msg.proto", "msg.proto",
@ -85,70 +147,3 @@ create_snapshot("deno") {
":run_parcel", ":run_parcel",
] ]
} }
v8_executable("snapshot_creator") {
sources = [
"snapshot_creator.cc",
]
configs = [ "v8:libplatform_config" ]
deps = [
":deno_nosnapshot",
]
}
v8_executable("deno") {
sources = [
"main.cc",
]
configs = [ "v8:libplatform_config" ]
deps = [
":libdeno",
]
}
v8_component("libdeno") {
configs = [ "v8:libplatform_config" ]
deps = [
":deno_snapshot",
]
}
v8_source_set("deno_nosnapshot") {
sources = [
"deno.cc",
"deno_internal.h",
"include/deno.h",
]
include_dirs = [ "include/" ]
configs = [ "v8:libplatform_config" ]
deps = [
":msg_proto",
"v8:v8",
"v8:v8_libbase",
"v8:v8_libplatform",
"v8:v8_libsampler",
]
}
v8_source_set("deno_snapshot") {
sources = [
"from_snapshot.cc",
]
deps = [
":create_snapshot_deno",
":deno_nosnapshot",
]
include_dirs = [ target_gen_dir ]
configs = [ "v8:libplatform_config" ]
}
executable("deno_test") {
testonly = true
sources = [
"deno_test.cc",
]
deps = [
":libdeno",
"//testing/gtest:gtest",
]
}

View file

@ -49,7 +49,7 @@ static inline v8::Local<v8::String> v8_str(const char* x) {
// Exits the process. // Exits the process.
void HandleException(v8::Local<v8::Context> context, void HandleException(v8::Local<v8::Context> context,
v8::Local<v8::Value> exception) { v8::Local<v8::Value> exception) {
auto isolate = context->GetIsolate(); auto* isolate = context->GetIsolate();
v8::HandleScope handle_scope(isolate); v8::HandleScope handle_scope(isolate);
v8::Context::Scope context_scope(context); v8::Context::Scope context_scope(context);
@ -163,7 +163,7 @@ void Send(const v8::FunctionCallbackInfo<v8::Value>& args) {
bool Load(v8::Local<v8::Context> context, const char* name_s, bool Load(v8::Local<v8::Context> context, const char* name_s,
const char* source_s) { const char* source_s) {
auto isolate = context->GetIsolate(); auto* isolate = context->GetIsolate();
v8::Isolate::Scope isolate_scope(isolate); v8::Isolate::Scope isolate_scope(isolate);
v8::HandleScope handle_scope(isolate); v8::HandleScope handle_scope(isolate);
@ -203,7 +203,7 @@ v8::StartupData MakeSnapshot(v8::StartupData* prev_natives_blob,
v8::V8::SetNativesDataBlob(prev_natives_blob); v8::V8::SetNativesDataBlob(prev_natives_blob);
v8::V8::SetSnapshotDataBlob(prev_snapshot_blob); v8::V8::SetSnapshotDataBlob(prev_snapshot_blob);
auto creator = new v8::SnapshotCreator(external_references); auto* creator = new v8::SnapshotCreator(external_references);
auto* isolate = creator->GetIsolate(); auto* isolate = creator->GetIsolate();
v8::Isolate::Scope isolate_scope(isolate); v8::Isolate::Scope isolate_scope(isolate);
{ {
@ -257,7 +257,7 @@ extern "C" {
void deno_init() { void deno_init() {
// v8::V8::InitializeICUDefaultLocation(argv[0]); // v8::V8::InitializeICUDefaultLocation(argv[0]);
// v8::V8::InitializeExternalStartupData(argv[0]); // v8::V8::InitializeExternalStartupData(argv[0]);
auto p = v8::platform::CreateDefaultPlatform(); auto* p = v8::platform::CreateDefaultPlatform();
v8::V8::InitializePlatform(p); v8::V8::InitializePlatform(p);
v8::V8::Initialize(); v8::V8::Initialize();
} }
@ -271,7 +271,7 @@ void v8_set_flags(int* argc, char** argv) {
const char* deno_last_exception(Deno* d) { return d->last_exception.c_str(); } const char* deno_last_exception(Deno* d) { return d->last_exception.c_str(); }
int deno_load(Deno* d, const char* name_s, const char* source_s) { int deno_load(Deno* d, const char* name_s, const char* source_s) {
auto isolate = d->isolate; auto* isolate = d->isolate;
v8::Locker locker(isolate); v8::Locker locker(isolate);
v8::Isolate::Scope isolate_scope(isolate); v8::Isolate::Scope isolate_scope(isolate);
v8::HandleScope handle_scope(isolate); v8::HandleScope handle_scope(isolate);

View file

@ -6,7 +6,6 @@
#include <string.h> #include <string.h>
#include <string> #include <string>
#include "v8/include/libplatform/libplatform.h"
#include "v8/include/v8.h" #include "v8/include/v8.h"
#include "./deno_internal.h" #include "./deno_internal.h"