From c0401a4096b55cfacf0aa848df1ba74d48a05e3d Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Sun, 10 Jun 2018 14:24:39 +0200 Subject: [PATCH] Organize BUILD.gn --- deno2/BUILD.gn | 129 ++++++++++++++++++++--------------------- deno2/deno.cc | 10 ++-- deno2/from_snapshot.cc | 1 - 3 files changed, 67 insertions(+), 73 deletions(-) diff --git a/deno2/BUILD.gn b/deno2/BUILD.gn index a7a414ad0b..16b1114c54 100644 --- a/deno2/BUILD.gn +++ b/deno2/BUILD.gn @@ -2,6 +2,68 @@ import("//third_party/protobuf/proto_library.gni") import("//v8/gni/v8.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") { sources = [ "msg.proto", @@ -85,70 +147,3 @@ create_snapshot("deno") { ":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", - ] -} diff --git a/deno2/deno.cc b/deno2/deno.cc index 0afda5e908..6b26077be0 100644 --- a/deno2/deno.cc +++ b/deno2/deno.cc @@ -49,7 +49,7 @@ static inline v8::Local v8_str(const char* x) { // Exits the process. void HandleException(v8::Local context, v8::Local exception) { - auto isolate = context->GetIsolate(); + auto* isolate = context->GetIsolate(); v8::HandleScope handle_scope(isolate); v8::Context::Scope context_scope(context); @@ -163,7 +163,7 @@ void Send(const v8::FunctionCallbackInfo& args) { bool Load(v8::Local context, const char* name_s, const char* source_s) { - auto isolate = context->GetIsolate(); + auto* isolate = context->GetIsolate(); v8::Isolate::Scope isolate_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::SetSnapshotDataBlob(prev_snapshot_blob); - auto creator = new v8::SnapshotCreator(external_references); + auto* creator = new v8::SnapshotCreator(external_references); auto* isolate = creator->GetIsolate(); v8::Isolate::Scope isolate_scope(isolate); { @@ -257,7 +257,7 @@ extern "C" { void deno_init() { // v8::V8::InitializeICUDefaultLocation(argv[0]); // v8::V8::InitializeExternalStartupData(argv[0]); - auto p = v8::platform::CreateDefaultPlatform(); + auto* p = v8::platform::CreateDefaultPlatform(); v8::V8::InitializePlatform(p); 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(); } 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::Isolate::Scope isolate_scope(isolate); v8::HandleScope handle_scope(isolate); diff --git a/deno2/from_snapshot.cc b/deno2/from_snapshot.cc index 6702aa4197..1a55a1ef06 100644 --- a/deno2/from_snapshot.cc +++ b/deno2/from_snapshot.cc @@ -6,7 +6,6 @@ #include #include -#include "v8/include/libplatform/libplatform.h" #include "v8/include/v8.h" #include "./deno_internal.h"