diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2018-06-22 14:23:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-22 14:23:42 +0200 |
commit | 86354a29a40fb97e334f951428239ab8e171e2dd (patch) | |
tree | 2f0d8cc2680aa4ccbaf865b427976b3f810b6920 /deno2 | |
parent | ef9dc2464e10510bdcc4be9eae431e3dcf7f7999 (diff) |
Delete go implementation (#276)
The go prototype will remain at https://github.com/ry/deno/tree/golang
Diffstat (limited to 'deno2')
-rw-r--r-- | deno2/README.md | 68 | ||||
-rw-r--r--[l---------] | deno2/msg.proto | 103 | ||||
-rwxr-xr-x | deno2/tools/build.py | 67 |
3 files changed, 102 insertions, 136 deletions
diff --git a/deno2/README.md b/deno2/README.md deleted file mode 100644 index 2b05da52f..000000000 --- a/deno2/README.md +++ /dev/null @@ -1,68 +0,0 @@ -# Deno Prototype 2 - -## Status - -This code is a rewrite of the privileged parts of Deno. It will soon become -the root of the project. - -There are several goals: - -* Use the gn build system for fast builds, sane configuration, and easy - linking into Chrome. - -* Use V8 snapshots to improve startup time. - -* Remove Golang. Although it has been working nicely, I am concerned the - double GC will become a problem sometime down the road. - -* Distribute a C++ library called libdeno, containing the snapshotted - typescript runtime. - -* Test the message passing and other functionality at that layer before - involving higher level languages. - -The contenders for building the privileged part of Deno are Rust and C++. -Thanks to Chrome and gn, using C++ to link into high level libraries is not -untenable. However, there's a lot of interest in Rust in the JS community and -it seems like a reasonable choice. TBD. - -There are many people exploring the project, so care will be taken to keep the -original code functional while this is developed. However, once it's ready -the code in this deno2/ directory will be moved to the root. - - -## Prerequisites - -Get Depot Tools and make sure it's in your path. -http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up - -For linux you need these prereqs: - - sudo apt-get install libgtk-3-dev pkg-config ccache - - -## Build - -First install the javascript deps. - - cd js; yarn install - -TODO(ry) Remove the above step by a deps submodule. - -Wrapper around the gclient/gn/ninja for end users. Try this first: - - ./tools/build.py --use_ccache --debug - -If that doesn't work, or you need more control, try calling gn manually: - - gn gen out/Debug --args='cc_wrapper="ccache" is_debug=true ' - -Then build with ninja: - - ninja -C out/Debug/ deno - - -Other useful commands: - - gn args out/Debug/ --list # List build args - gn args out/Debug/ # Modify args in $EDITOR diff --git a/deno2/msg.proto b/deno2/msg.proto index e0ce41a3a..6c4d1f9e1 120000..100644 --- a/deno2/msg.proto +++ b/deno2/msg.proto @@ -1 +1,102 @@ -../msg.proto
\ No newline at end of file +// Copyright 2018 Ryan Dahl <ry@tinyclouds.org> +// All rights reserved. MIT License. +syntax = "proto3"; +package deno; +option go_package = "deno"; + +message BaseMsg { + string channel = 1; + bytes payload = 2; +} + +message Msg { + enum Command { + ERROR = 0; + START = 1; + CODE_FETCH = 2; + CODE_FETCH_RES = 3; + CODE_CACHE = 4; + EXIT = 5; + TIMER_START = 6; + TIMER_READY = 7; + TIMER_CLEAR = 8; + FETCH_REQ = 9; + FETCH_RES = 10; + READ_FILE_SYNC = 11; + READ_FILE_SYNC_RES = 12; + WRITE_FILE_SYNC = 13; + } + Command command = 1; + + // We avoid creating a message for each command (and use oneof or any types) + // In order to reduce code in the size of the generated javascript + // "msg.pb.js". It seems that each new message adds 20k and we want to + // potentially add many hundreds of commands. Therefore we just prefix command + // arguments by their name. + + // ERROR + string error = 2; + + // START + string start_cwd = 10; + repeated string start_argv = 11; + bool start_debug_flag = 12; + string start_main_js = 13; // The contents of dist/main.js + string start_main_map = 14; // The contents of dist/main.map + + // CODE_FETCH + string code_fetch_module_specifier = 20; + string code_fetch_containing_file = 21; + + // CODE_FETCH_RES + // If it's a non-http module, moduleName and filename will be the same. + // For http modules, moduleName is its resolved http URL, and filename + // is the location of the locally downloaded source code. + string code_fetch_res_module_name = 30; + string code_fetch_res_filename = 31; + string code_fetch_res_source_code = 32; + string code_fetch_res_output_code = 33; // Non-empty only if cached. + + // CODE_CACHE + string code_cache_filename = 41; + string code_cache_source_code = 42; + string code_cache_output_code = 43; + + // EXIT + int32 exit_code = 50; + + // TIMER_START + int32 timer_start_id = 60; + bool timer_start_interval = 61; + int32 timer_start_delay = 62; // In milliseconds. + + // TIMER_READY + int32 timer_ready_id = 70; + bool timer_ready_done = 71; + + // TIMER_CLEAR + int32 timer_clear_id = 80; + + // FETCH_REQ + int32 fetch_req_id = 90; + string fetch_req_url = 91; + // repeated string fetch_req_header_line = 91 + + // FETCH_RES + int32 fetch_res_id = 100; + int32 fetch_res_status = 101; + repeated string fetch_res_header_line = 102; + bytes fetch_res_body = 103; + + // READ_FILE_SYNC + string read_file_sync_filename = 110; + + // READ_FILE_SYNC_RES + bytes read_file_sync_data = 120; + + // WRITE_FILE_SYNC + string write_file_sync_filename = 130; + bytes write_file_sync_data = 131; + uint32 write_file_sync_perm = 132; + // write_file_sync_perm specified by https://godoc.org/os#FileMode +} diff --git a/deno2/tools/build.py b/deno2/tools/build.py deleted file mode 100755 index 25f30f4f8..000000000 --- a/deno2/tools/build.py +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env python -# Get Depot Tools and make sure it's in your path. -# http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up -# Use .gclient to modify the deps. -import os -import sys -import subprocess -import argparse - -TARGET = "deno" - -parser = argparse.ArgumentParser(description="build.py") -parser.add_argument('--debug', dest='debug', action='store_true') -parser.add_argument('--use_ccache', dest='use_ccache', action='store_true') -parser.add_argument('--sync', dest='sync', action='store_true') -parser.set_defaults(debug=False, use_ccache=False, sync=False) -args = parser.parse_args() - -root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) - - -def main(): - os.chdir(root_path) - buildName = "Debug" if args.debug else "Default" - buildDir = os.path.join(root_path, "out", buildName) - # Run sync if any of the dep dirs don't exist. - # Or the user supplied the --sync flag. - if args.sync or dirsMissing(): - run(["gclient", "sync", "--no-history"]) - - # Run gn gen out/Default if out doesn't exist. - if not os.path.exists(buildDir): - gn_gen = ["gn", "gen", buildDir] - gn_args = [] - if args.debug: - gn_args.append("is_debug=true") - if args.use_ccache: - gn_args.append("cc_wrapper=\"ccache\"") - if len(gn_args) > 0: - gn_gen += ["--args=%s" % " ".join(gn_args)] - run(gn_gen) - - # Always run ninja. - run(["ninja", "-C", buildDir, TARGET]) - - -def run(args): - print " ".join(args) - env = os.environ.copy() - subprocess.check_call(args, env=env) - - -def dirsMissing(): - dirsToLoad = [ - "v8", - "third_party/protobuf", - "tools/protoc_wrapper", - "third_party/zlib", - ] - for d in dirsToLoad: - if not os.path.exists(d): - return True - return False - - -if '__main__' == __name__: - main() |