Add Ooui.Wasm package

This commit is contained in:
Frank A. Krueger 2018-03-13 14:44:35 -07:00
parent 95adaad77c
commit 8054b898fc
No known key found for this signature in database
GPG Key ID: 0471C67474FFE664
7 changed files with 53 additions and 143 deletions

13
.gitignore vendored
View File

@ -1,17 +1,8 @@
# Wasm SDK # Wasm SDK
/Ooui.Wasm/bcl /Ooui.Wasm/*.nupkg
/Ooui.Wasm/debug
/Ooui.Wasm/release
/Ooui.Wasm/managed
/Ooui.Wasm/driver.c
/Ooui.Wasm/mono.js
/Ooui.Wasm/ooui.js
/Ooui.Wasm/server.py
/Ooui.Wasm/sample*
/Ooui.Wasm/lib*
/Ooui.Wasm/*.w*
/Ooui.Wasm.Test /Ooui.Wasm.Test
/Ooui.Wasm.Old
# Social media files # Social media files
/Media /Media

View File

@ -1,9 +1,4 @@
all: all:
msbuild /t:Restore ../Ooui.Forms/Ooui.Forms.csproj msbuild /p:Configuration=Release /t:Restore ../Ooui.Wasm.Build.Tasks/Ooui.Wasm.Build.Tasks.csproj
msbuild ../Ooui.Forms/Ooui.Forms.csproj msbuild /p:Configuration=Release ../Ooui.Wasm.Build.Tasks/Ooui.Wasm.Build.Tasks.csproj
cp ../Ooui.Forms/bin/Debug/netstandard1.0/Ooui.Forms.dll managed/ nuget pack
cp ../Ooui/bin/Debug/netstandard1.0/Ooui.dll managed/
csc /nostdlib /target:library \
/r:managed/mscorlib.dll /r:managed/System.Runtime.dll /r:managed/Xamarin.Forms.Core.dll /r:managed/Xamarin.Forms.Xaml.dll /r:managed/Ooui.dll /r:managed/Ooui.Forms.dll \
/out:managed/Ooui.Sample.dll ../Samples/ISample.cs ../Samples/XamlPreviewPageSample.cs ooui-sample.cs

View File

@ -0,0 +1,26 @@
<?xml version="1.0"?>
<package >
<metadata>
<id>Ooui.Wasm</id>
<version>1.0.0</version>
<title>Ooui.Wasm</title>
<authors>praeclarum</authors>
<owners>praeclarum</owners>
<licenseUrl>https://github.com/praeclarum/Ooui/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/praeclarum/Ooui</projectUrl>
<iconUrl>https://github.com/praeclarum/Ooui/raw/master/Documentation/Icon.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>WebAssembly support for Ooui apps</description>
<copyright>Copyright 2018 Frank A. Krueger</copyright>
<tags>Ooui UI CrossPlatform Xamarin.Forms</tags>
<dependencies>
<group>
<dependency id="Ooui" version="1.0.0" />
</group>
</dependencies>
</metadata>
<files>
<file src="Ooui.Wasm.targets" target="build/netstandard2.0/Ooui.Wasm.targets" />
<file src="../Ooui.Wasm.Build.Tasks/bin/Release/netstandard2.0/Ooui.Wasm.Build.Tasks.dll" target="build/netstandard2.0/Ooui.Wasm.Build.Tasks.dll" />
</files>
</package>

View File

@ -0,0 +1,22 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="Ooui.Wasm.Build.Tasks.BuildDistTask" AssemblyFile="$(MSBuildThisFileDirectory)Ooui.Wasm.Build.Tasks.dll" />
<!-- BuildDist -->
<PropertyGroup>
<CompileDependsOn>
$(CompileDependsOn);
BuildDist;
</CompileDependsOn>
</PropertyGroup>
<Target Name="BuildDist" AfterTargets="AfterBuild" Condition="'$(_BuildDistAlreadyExecuted)'!='true'">
<PropertyGroup>
<_BuildDistAlreadyExecuted>true</_BuildDistAlreadyExecuted>
</PropertyGroup>
<BuildDistTask
Assembly = "$(OutputPath)$(TargetFileName)"
ReferencePath = "@(ReferencePath)" />
</Target>
</Project>

View File

@ -1,26 +0,0 @@
## Install
Download [Mono WebAssembly support on Jenkins](https://jenkins.mono-project.com//job/test-mono-mainline-webassembly/) by
grabbing the latest build's Azure Artifact.
[mono-wasm-03914603a3b.zip](https://jenkins.mono-project.com/job/test-mono-mainline-webassembly/71/label=highsierra/Azure/processDownloadRequest/71/highsierra/sdks/wasm/mono-wasm-03914603a3b.zip)
Expand that into this directory.
## Build
```bash
csc /nostdlib /target:library /r:managed/mscorlib.dll /r:managed/System.Runtime.dll /r:managed/Xamarin.Forms.Core.dll /r:managed/Ooui.dll /r:managed/Ooui.Forms.dll /out:managed/Ooui.Sample.dll ../Samples/ISample.cs ../Samples/BoxViewClockSample.cs ooui-sample.cs
```
## Run
```bash
python server.py
```
Go to [locahost:8000/ooui-sample.html](http://locahost:8000/ooui-sample.html)

View File

@ -1,38 +0,0 @@
using System;
using Ooui;
public class Program
{
static Element GetButtonElement ()
{
var l = new Label { Text = "Hello" };
var b = new Button ("Click Me");
var e = new Div (new Div (l), b);
int count = 0;
b.Click += (s, ee) => {
count++;
b.Text = $"Clicked {count} times";
};
return e;
}
static Element GetXamarinFormsElement ()
{
var s = new Samples.XamlPreviewPageSample ();
return s.CreateElement ();
}
public static string Main (string a0, string a1)
{
Xamarin.Forms.Forms.Init ();
try {
var e = GetXamarinFormsElement ();
UI.SetGlobalElement ("main", e);
return e.ToString ();
}
catch (Exception e) {
Console.WriteLine (e);
return e.ToString ();
}
}
}

View File

@ -1,60 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Ooui Wasm</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<div id="ooui-body" class="container-fluid">
<p id="loading"><i class="fa fa-refresh fa-spin" style="font-size:14px;margin-right:0.5em;"></i> Loading...</p>
<textarea rows="10" cols="100" id="output" hidden="true"></textarea>
</div>
<script type="text/javascript" src="ooui.js"></script>
<script type='text/javascript'>
var mainAsmName = "Ooui.Sample";
var assemblies = [
"mscorlib.dll",
"Microsoft.CSharp.dll",
"Newtonsoft.Json.dll",
"System.dll",
"System.Collections.dll",
"System.ComponentModel.dll",
"System.ComponentModel.TypeConverter.dll",
"System.Core.dll",
"System.Diagnostics.Debug.dll",
"System.Dynamic.Runtime.dll",
"System.Globalization.dll",
"System.IO.dll",
"System.Linq.dll",
"System.Linq.Expressions.dll",
"System.ObjectModel.dll",
"System.Text.RegularExpressions.dll",
"System.Text.Encoding.dll",
"System.Text.Encoding.Extensions.dll",
"System.Threading.dll",
"System.Threading.Tasks.dll",
"System.Reflection.dll",
"System.Reflection.Extensions.dll",
"System.Resources.ResourceManager.dll",
"System.Runtime.dll",
"System.Runtime.Extensions.dll",
"System.Runtime.Serialization.dll",
"System.Runtime.Serialization.Primitives.dll",
"System.Xml.dll",
"System.Xml.ReaderWriter.dll",
"System.Xml.XDocument.dll",
"Xamarin.Forms.Core.dll",
"Xamarin.Forms.Platform.dll",
"Xamarin.Forms.Xaml.dll",
"Ooui.dll",
"Ooui.Forms.dll",
mainAsmName + ".dll"
];
oouiWasm (mainAsmName, "", "Program", "Main", assemblies);
</script>
<script async type="text/javascript" src="mono.js"></script>
</body>
</html>