mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
deno2: build on Windows
This commit is contained in:
parent
36f657c0d2
commit
1676822888
8 changed files with 53 additions and 10 deletions
|
@ -11,7 +11,6 @@ solutions = [{
|
||||||
'v8/testing/gmock': None,
|
'v8/testing/gmock': None,
|
||||||
'v8/tools/swarming_client': None,
|
'v8/tools/swarming_client': None,
|
||||||
'v8/third_party/instrumented_libraries': None,
|
'v8/third_party/instrumented_libraries': None,
|
||||||
'v8/tools/gyp': None,
|
|
||||||
'v8/third_party/android_tools': None,
|
'v8/third_party/android_tools': None,
|
||||||
'v8/test/wasm-js': None,
|
'v8/test/wasm-js': None,
|
||||||
'v8/test/benchmarks/data': None,
|
'v8/test/benchmarks/data': None,
|
||||||
|
|
|
@ -88,7 +88,7 @@ run_node("bundle") {
|
||||||
":run_tsc",
|
":run_tsc",
|
||||||
]
|
]
|
||||||
args = [
|
args = [
|
||||||
"./node_modules/.bin/browserify",
|
"./node_modules/browserify/bin/cmd.js",
|
||||||
rebase_path(main_source, root_build_dir),
|
rebase_path(main_source, root_build_dir),
|
||||||
"-o",
|
"-o",
|
||||||
rebase_path(main_output, root_build_dir),
|
rebase_path(main_output, root_build_dir),
|
||||||
|
@ -112,7 +112,7 @@ run_node("run_tsc") {
|
||||||
":pbjs_hack",
|
":pbjs_hack",
|
||||||
]
|
]
|
||||||
args = [
|
args = [
|
||||||
"./node_modules/.bin/tsc",
|
"./node_modules/typescript/bin/tsc",
|
||||||
"-p",
|
"-p",
|
||||||
rebase_path("js/tsconfig.json", root_build_dir),
|
rebase_path("js/tsconfig.json", root_build_dir),
|
||||||
"--outDir",
|
"--outDir",
|
||||||
|
|
|
@ -243,7 +243,7 @@ v8::StartupData MakeSnapshot(v8::StartupData* prev_natives_blob,
|
||||||
CHECK(global->Set(context, deno::v8_str("denoPub"), pub_val).FromJust());
|
CHECK(global->Set(context, deno::v8_str("denoPub"), pub_val).FromJust());
|
||||||
|
|
||||||
bool r = Execute(context, js_filename, js_source);
|
bool r = Execute(context, js_filename, js_source);
|
||||||
assert(r);
|
CHECK(r);
|
||||||
|
|
||||||
creator->SetDefaultContext(context, v8::SerializeInternalFieldsCallback(
|
creator->SetDefaultContext(context, v8::SerializeInternalFieldsCallback(
|
||||||
SerializeInternalFields, nullptr));
|
SerializeInternalFields, nullptr));
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
{
|
{
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/base64-js": "^1.2.5",
|
||||||
|
"@types/source-map-support": "^0.4.1",
|
||||||
"browserify": "^16.2.2",
|
"browserify": "^16.2.2",
|
||||||
"protobufjs": "^6.8.6",
|
"protobufjs": "^6.8.6",
|
||||||
|
"source-map-support": "^0.5.6",
|
||||||
"typescript": "^2.9.1"
|
"typescript": "^2.9.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,9 @@ import os
|
||||||
|
|
||||||
js_path = os.path.dirname(os.path.realpath(__file__))
|
js_path = os.path.dirname(os.path.realpath(__file__))
|
||||||
#bin_path = os.path.join(js_path, "deno_protobufjs", "bin")
|
#bin_path = os.path.join(js_path, "deno_protobufjs", "bin")
|
||||||
bin_path = os.path.join(js_path, "node_modules", ".bin")
|
pbjs_path = os.path.join(js_path, "node_modules", "protobufjs", "bin")
|
||||||
pbjs_bin = os.path.join(bin_path, "pbjs")
|
pbjs_bin = os.path.join(pbjs_path, "pbjs")
|
||||||
pbts_bin = os.path.join(bin_path, "pbts")
|
pbts_bin = os.path.join(pbjs_path, "pbts")
|
||||||
msg_pbjs_out = os.path.join(js_path, "msg.pb.js")
|
msg_pbjs_out = os.path.join(js_path, "msg.pb.js")
|
||||||
msg_pbts_out = os.path.join(js_path, "msg.pb.d.ts")
|
msg_pbts_out = os.path.join(js_path, "msg.pb.d.ts")
|
||||||
assert os.path.exists(pbjs_bin)
|
assert os.path.exists(pbjs_bin)
|
||||||
|
@ -29,10 +29,11 @@ def touch(fname):
|
||||||
open(fname, 'a').close()
|
open(fname, 'a').close()
|
||||||
|
|
||||||
subprocess.check_call([
|
subprocess.check_call([
|
||||||
|
"node",
|
||||||
pbjs_bin,
|
pbjs_bin,
|
||||||
#"--dependency=./deno_protobufjs/minimal",
|
#"--dependency=./deno_protobufjs/minimal",
|
||||||
"--target=static-module",
|
"--target=static-module",
|
||||||
"--wraper=commonjs",
|
"--wrapper=commonjs",
|
||||||
"--out=" + msg_pbjs_out,
|
"--out=" + msg_pbjs_out,
|
||||||
proto_in
|
proto_in
|
||||||
])
|
])
|
||||||
|
|
|
@ -6,13 +6,26 @@ import subprocess
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
def symlink(target, name, target_is_dir=False):
|
||||||
|
if os.name == "nt":
|
||||||
|
from ctypes import windll, WinError
|
||||||
|
CreateSymbolicLinkW = windll.kernel32.CreateSymbolicLinkW
|
||||||
|
flags = 0x02 # SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE
|
||||||
|
if (target_is_dir):
|
||||||
|
flags |= 0x01 # SYMBOLIC_LINK_FLAG_DIRECTORY
|
||||||
|
if not CreateSymbolicLinkW(name.encode('utf-16le'),
|
||||||
|
target.encode('utf-16le'),
|
||||||
|
flags):
|
||||||
|
raise WinError()
|
||||||
|
else:
|
||||||
|
os.symlink(target, name)
|
||||||
|
|
||||||
js_path = os.path.dirname(os.path.realpath(__file__))
|
js_path = os.path.dirname(os.path.realpath(__file__))
|
||||||
node_modules_path = os.path.join(js_path, "node_modules")
|
node_modules_path = os.path.join(js_path, "node_modules")
|
||||||
|
|
||||||
# root_out_dir
|
# root_out_dir
|
||||||
if not os.path.exists("node_modules"):
|
if not os.path.exists("node_modules"):
|
||||||
os.symlink(node_modules_path, "node_modules")
|
symlink(node_modules_path, "node_modules", True)
|
||||||
|
|
||||||
args = ["node"] + sys.argv[1:]
|
args = ["node"] + sys.argv[1:]
|
||||||
sys.exit(subprocess.call(args))
|
sys.exit(subprocess.call(args))
|
||||||
|
|
|
@ -45,14 +45,28 @@
|
||||||
version "1.1.0"
|
version "1.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570"
|
resolved "https://registry.yarnpkg.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570"
|
||||||
|
|
||||||
|
"@types/base64-js@^1.2.5":
|
||||||
|
version "1.2.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/base64-js/-/base64-js-1.2.5.tgz#582b2476169a6cba460a214d476c744441d873d5"
|
||||||
|
|
||||||
"@types/long@^3.0.32":
|
"@types/long@^3.0.32":
|
||||||
version "3.0.32"
|
version "3.0.32"
|
||||||
resolved "https://registry.yarnpkg.com/@types/long/-/long-3.0.32.tgz#f4e5af31e9e9b196d8e5fca8a5e2e20aa3d60b69"
|
resolved "https://registry.yarnpkg.com/@types/long/-/long-3.0.32.tgz#f4e5af31e9e9b196d8e5fca8a5e2e20aa3d60b69"
|
||||||
|
|
||||||
|
"@types/node@*":
|
||||||
|
version "10.3.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.3.2.tgz#3840ec6c12556fdda6e0e6d036df853101d732a4"
|
||||||
|
|
||||||
"@types/node@^8.9.4":
|
"@types/node@^8.9.4":
|
||||||
version "8.10.19"
|
version "8.10.19"
|
||||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.19.tgz#66b5b6325c048cbf4512b7a88b0e79c2ee99d3d2"
|
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.19.tgz#66b5b6325c048cbf4512b7a88b0e79c2ee99d3d2"
|
||||||
|
|
||||||
|
"@types/source-map-support@^0.4.1":
|
||||||
|
version "0.4.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/source-map-support/-/source-map-support-0.4.1.tgz#ad77158e8c6695a16629ef82b9fb9dfe7c610ac0"
|
||||||
|
dependencies:
|
||||||
|
"@types/node" "*"
|
||||||
|
|
||||||
JSONStream@^1.0.3:
|
JSONStream@^1.0.3:
|
||||||
version "1.3.3"
|
version "1.3.3"
|
||||||
resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.3.tgz#27b4b8fbbfeab4e71bcf551e7f27be8d952239bf"
|
resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.3.tgz#27b4b8fbbfeab4e71bcf551e7f27be8d952239bf"
|
||||||
|
@ -826,6 +840,17 @@ shell-quote@^1.6.1:
|
||||||
array-reduce "~0.0.0"
|
array-reduce "~0.0.0"
|
||||||
jsonify "~0.0.0"
|
jsonify "~0.0.0"
|
||||||
|
|
||||||
|
source-map-support@^0.5.6:
|
||||||
|
version "0.5.6"
|
||||||
|
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.6.tgz#4435cee46b1aab62b8e8610ce60f788091c51c13"
|
||||||
|
dependencies:
|
||||||
|
buffer-from "^1.0.0"
|
||||||
|
source-map "^0.6.0"
|
||||||
|
|
||||||
|
source-map@^0.6.0:
|
||||||
|
version "0.6.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
|
||||||
|
|
||||||
source-map@~0.5.3:
|
source-map@~0.5.3:
|
||||||
version "0.5.7"
|
version "0.5.7"
|
||||||
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
|
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
|
||||||
|
|
|
@ -130,12 +130,14 @@ int main(int argc, char** argv) {
|
||||||
v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
|
v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
|
||||||
|
|
||||||
auto js_data = ReadFile(js_fn);
|
auto js_data = ReadFile(js_fn);
|
||||||
|
// Ensure js_source is null-terminated.
|
||||||
|
std::string js_source(js_data.data, js_data.raw_size);
|
||||||
auto natives_blob = ReadFile(natives_in_bin);
|
auto natives_blob = ReadFile(natives_in_bin);
|
||||||
auto snapshot_in_blob = ReadFile(snapshot_in_bin);
|
auto snapshot_in_blob = ReadFile(snapshot_in_bin);
|
||||||
|
|
||||||
deno_init();
|
deno_init();
|
||||||
auto snapshot_blob =
|
auto snapshot_blob =
|
||||||
deno::MakeSnapshot(&natives_blob, &snapshot_in_blob, js_fn, js_data.data);
|
deno::MakeSnapshot(&natives_blob, &snapshot_in_blob, js_fn, js_source.c_str());
|
||||||
|
|
||||||
StartupDataCppWriter nativesWriter("natives", natives_out_cc, natives_blob);
|
StartupDataCppWriter nativesWriter("natives", natives_out_cc, natives_blob);
|
||||||
nativesWriter.Write();
|
nativesWriter.Write();
|
||||||
|
|
Loading…
Reference in a new issue