Updated to be IAW new build process
parent
9e1b35bbef
commit
5a035b37c2
@ -0,0 +1,50 @@
|
|||||||
|
[env]
|
||||||
|
# all workspace members can use this Makefile
|
||||||
|
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = "true"
|
||||||
|
|
||||||
|
# ---- BUILD & CREATE WASMS ----
|
||||||
|
[tasks.build]
|
||||||
|
description = "Build only Seed without examples"
|
||||||
|
workspace = false
|
||||||
|
command = "cargo"
|
||||||
|
args = ["build"]
|
||||||
|
|
||||||
|
[tasks.build_release]
|
||||||
|
description = "Build only Seed without examples"
|
||||||
|
workspace = false
|
||||||
|
command = "cargo"
|
||||||
|
args = ["build", "--release"]
|
||||||
|
|
||||||
|
|
||||||
|
[tasks.create_wasms]
|
||||||
|
description = "Build examples with wasm-pack"
|
||||||
|
workspace = false
|
||||||
|
command = "cargo"
|
||||||
|
args = ["make", "create_wasm"]
|
||||||
|
|
||||||
|
[tasks.all]
|
||||||
|
description = "Build all - Seed + examples and create wasms"
|
||||||
|
workspace = false
|
||||||
|
dependencies = ["build", "create_wasms"]
|
||||||
|
|
||||||
|
[tasks.all_release]
|
||||||
|
description = "Build all - Seed + examples and create wasms, with the --release flag"
|
||||||
|
workspace = false
|
||||||
|
dependencies = ["build_release", "build_examples", "create_wasms"]
|
||||||
|
|
||||||
|
[tasks.serve]
|
||||||
|
description = "Start server for given example"
|
||||||
|
install_crate = { crate_name = "https", binary = "http", test_arg = "--help" }
|
||||||
|
workspace = false
|
||||||
|
command = "http"
|
||||||
|
args = []
|
||||||
|
|
||||||
|
# ---- PRIVATE TASKS - run only inside another task ----
|
||||||
|
# private atribute is ignored (bug?)
|
||||||
|
|
||||||
|
[tasks.create_wasm]
|
||||||
|
description = "Build example with wasm-pack"
|
||||||
|
# private = true
|
||||||
|
install_crate = "wasm-pack"
|
||||||
|
command = "wasm-pack"
|
||||||
|
args = ["build", "--target", "no-modules", "--out-name", "package"]
|
@ -1,5 +0,0 @@
|
|||||||
cargo build --target wasm32-unknown-unknown
|
|
||||||
wasm-bindgen target/wasm32-unknown-unknown/debug/appname.wasm --no-modules --out-dir ./pkg --out-name package
|
|
||||||
|
|
||||||
#cargo build --target wasm32-unknown-unknown --release
|
|
||||||
#wasm-bindgen target/wasm32-unknown-unknown/release/appname.wasm --no-modules --out-dir ./pkg --out-name package
|
|
@ -1,6 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
cargo build --target wasm32-unknown-unknown
|
|
||||||
wasm-bindgen target/wasm32-unknown-unknown/debug/appname.wasm --no-modules --out-dir ./pkg --out-name package
|
|
||||||
|
|
||||||
#cargo build --target wasm32-unknown-unknown --release
|
|
||||||
#wasm-bindgen target/wasm32-unknown-unknown/release/appname.wasm --no-modules --out-dir ./pkg --out-name package
|
|
@ -1,41 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
import http.server
|
|
||||||
import os
|
|
||||||
import socketserver
|
|
||||||
import urllib
|
|
||||||
import sys
|
|
||||||
|
|
||||||
PORT = 8000
|
|
||||||
|
|
||||||
|
|
||||||
class Handler(http.server.SimpleHTTPRequestHandler):
|
|
||||||
# Allow SPA routing by redirecting subpaths.
|
|
||||||
def do_GET(self):
|
|
||||||
urlparts = urllib.parse.urlparse(self.path)
|
|
||||||
request_file_path = urlparts.path.strip('/')
|
|
||||||
if not os.path.exists(request_file_path):
|
|
||||||
self.path = '/'
|
|
||||||
|
|
||||||
return http.server.SimpleHTTPRequestHandler.do_GET(self)
|
|
||||||
|
|
||||||
|
|
||||||
handler = Handler
|
|
||||||
# Add support for the WASM mime type.
|
|
||||||
handler.extensions_map.update({
|
|
||||||
'.wasm': 'application/wasm',
|
|
||||||
})
|
|
||||||
|
|
||||||
socketserver.TCPServer.allow_reuse_address = True
|
|
||||||
print("Serving at port", PORT)
|
|
||||||
print("View at: http://localhost:{}/".format(PORT))
|
|
||||||
# The context manager protocol is support only since python 3.6 and higher.
|
|
||||||
if (3 <= sys.version_info[0]) and (6 <= sys.version_info[1]):
|
|
||||||
with socketserver.TCPServer(("", PORT), handler) as httpd:
|
|
||||||
httpd.allow_reuse_address = True
|
|
||||||
httpd.serve_forever()
|
|
||||||
else:
|
|
||||||
httpd = socketserver.TCPServer(("", PORT), handler)
|
|
||||||
httpd.allow_reuse_address = True
|
|
||||||
httpd.serve_forever()
|
|
||||||
httpd.serve_close()
|
|
Loading…
Reference in New Issue