[infra] Deduplicate serve.py

Change-Id: I25bd987faedd7e9c322bcec487ab07583bad6b9a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/458197
Reviewed-by: Erik Rose <erikrose@google.com>
This commit is contained in:
Kevin Lubick 2021-10-11 15:47:47 -04:00
parent bcda412af7
commit f32ad08ac4
11 changed files with 10 additions and 96 deletions

View File

@ -45,4 +45,4 @@ clean_npm:
serve:
echo "Go check out http://localhost:8001/"
cd examples && python3 ../serve.py
cd examples && python3 python3 ../../../tools/serve_wasm.py

View File

@ -16,7 +16,7 @@ release:
serve:
echo "Go check out http://localhost:8000/npm_build/example.html"
python3 serve.py
python3 ../../tools/serve_wasm.py
lint:
npx eslint . --ext .ts

View File

@ -1,21 +0,0 @@
#!/usr/bin/env python3
# Copyright 2018 Google LLC
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import http.server
import socketserver
PORT = 8000
class Handler(http.server.SimpleHTTPRequestHandler):
pass
Handler.extensions_map['.js'] = 'application/javascript'
# Without the correct MIME type, async compilation doesn't work
Handler.extensions_map['.wasm'] = 'application/wasm'
httpd = socketserver.TCPServer(("", PORT), Handler)
httpd.serve_forever()

View File

@ -1,21 +0,0 @@
#!/usr/bin/env python3
# Copyright 2018 Google LLC
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import http.server
import socketserver
PORT = 8000
class Handler(http.server.SimpleHTTPRequestHandler):
pass
Handler.extensions_map['.js'] = 'application/javascript'
# Without the correct MIME type, async compilation doesn't work
Handler.extensions_map['.wasm'] = 'application/wasm'
httpd = socketserver.TCPServer(("", PORT), Handler)
httpd.serve_forever()

View File

@ -98,7 +98,7 @@ local-example:
mkdir -p node_modules
ln -s ../npm_build node_modules/canvaskit
echo "Go check out http://localhost:8000/npm_build/example.html"
python3 serve.py
python3 ../../tools/serve_wasm.py
test-continuous:
echo "Assuming npm ci has been run by user"

View File

@ -1,21 +0,0 @@
#!/usr/bin/env python3
# Copyright 2018 Google LLC
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import http.server
import socketserver
PORT = 8000
class Handler(http.server.SimpleHTTPRequestHandler):
pass
Handler.extensions_map['.js'] = 'application/javascript'
# Without the correct MIME type, async compilation doesn't work
Handler.extensions_map['.wasm'] = 'application/wasm'
httpd = socketserver.TCPServer(("", PORT), Handler)
httpd.serve_forever()

View File

@ -33,4 +33,4 @@ grep -f wasm_simd_types.txt output/simd_test.wat
# Serve the compiled WASM so output can be manually inspected for correctness.
echo "Go check out http://localhost:8000/output/simd_test.html in Chrome Canary 86.0.4186.0 \
or later and enable the chrome://flags#enable-webassembly-simd flag!"
python3 ../../serve.py
python3 ../../../../tools/serve_wasm.py

View File

@ -109,7 +109,7 @@ npm-debug:
example:
npm install pathkit-asmjs pathkit-wasm
echo "Go check out localhost:8000/npm-wasm/example.html"
python3 serve.py
python3 ../../tools/serve_wasm.py
local-example:
rm -rf node_modules/pathkit-wasm
@ -119,7 +119,7 @@ local-example:
ln -s -T ../npm-asmjs node_modules/pathkit-asmjs
echo "Go check out http://localhost:8000/npm-wasm/example.html"
echo "or http://localhost:8000/npm-asmjs/example.html"
python3 serve.py
python3 ../../tools/serve_wasm.py
local-example-test:
rm -rf node_modules/pathkit-wasm
@ -130,7 +130,7 @@ local-example-test:
ln -s -T ../../npm-asmjs/bin/test node_modules/pathkit-asmjs/bin
echo "Go check out localhost:8000/npm-wasm/example.html"
echo "or http://localhost:8000/npm-asmjs/example.html"
python3 serve.py
python3 ../../tools/serve_wasm.py
local-example-debug:
rm -rf node_modules/pathkit-wasm
@ -141,5 +141,5 @@ local-example-debug:
ln -s -T ../../npm-asmjs/bin/debug node_modules/pathkit-asmjs/bin
echo "Go check out localhost:8000/npm-wasm/example.html"
echo "or http://localhost:8000/npm-asmjs/example.html"
python3 serve.py
python3 ../../tools/serve_wasm.py

View File

@ -125,8 +125,4 @@ $OUTPUT \
$BASE_DIR/pathkit_wasm_bindings.cpp \
${BUILD_DIR}/libpathkit.a
if [[ $@ == *serve* ]]; then
pushd $BUILD_DIR
python3 serve.py
fi

View File

@ -1,21 +0,0 @@
#!/usr/bin/env python3
# Copyright 2018 Google LLC
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import http.server
import socketserver
PORT = 8000
class Handler(http.server.SimpleHTTPRequestHandler):
pass
Handler.extensions_map['.js'] = 'application/javascript'
# Without the correct MIME type, async compilation doesn't work
Handler.extensions_map['.wasm'] = 'application/wasm'
httpd = socketserver.TCPServer(("", PORT), Handler)
httpd.serve_forever()

View File

@ -3,6 +3,8 @@
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# This is a simple webserver that applies the correct MIME type for .wasm files.
import http.server
import socketserver