Use server.py from wasm sdk

This commit is contained in:
Frank A. Krueger 2018-03-13 14:03:46 -07:00
parent a1dab5fc06
commit 95adaad77c
No known key found for this signature in database
GPG Key ID: 0471C67474FFE664
1 changed files with 1 additions and 19 deletions

View File

@ -33,7 +33,6 @@ namespace Ooui.Wasm.Build.Tasks
ExtractClientJs ();
DiscoverEntryPoint ();
GenerateHtml ();
GenerateServer ();
return true;
}
catch (Exception ex) {
@ -96,6 +95,7 @@ namespace Ooui.Wasm.Build.Tasks
Log.LogMessage ($"Runtime {src} -> {dest}");
File.Copy (src, dest, true);
}
File.Copy (Path.Combine (sdkPath, "server.py"), Path.Combine (distPath, "server.py"), true);
}
List<string> linkedAsmPaths;
@ -288,23 +288,5 @@ namespace Ooui.Wasm.Build.Tasks
}
Log.LogMessage ($"HTML {htmlPath}");
}
void GenerateServer ()
{
var server = @"import SimpleHTTPServer
import SocketServer
PORT = 8000
class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler):
pass
Handler.extensions_map["".wasm""] = ""application/wasm""
httpd = SocketServer.TCPServer(("""", PORT), Handler)
print ""serving at port"", PORT
httpd.serve_forever()";
var serverPath = Path.Combine (distPath, "server.py");
using (var w = new StreamWriter (serverPath, false, new UTF8Encoding (false))) {
w.WriteLine (server);
}
Log.LogMessage ($"Server {serverPath}");
}
}
}