Skip to content

Commit

Permalink
Merge pull request #316 from FUSEEProjectTeam/feature/clean_wasm_on_d…
Browse files Browse the repository at this point in the history
…evelop

WebAssembly build via Blazor/Razor backend, updated solution to net6.0, netstandard2.1 dual target
  • Loading branch information
griestopf authored Nov 18, 2021
2 parents 41083af + 62e7061 commit d2faead
Show file tree
Hide file tree
Showing 1,331 changed files with 46,473 additions and 4,817 deletions.
66 changes: 61 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ on:

jobs:
lint:
runs-on: windows-latest
runs-on: windows-2022
name: Linting
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_NOLOGO: true
steps:
- uses: actions/checkout@v2
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: dotnet tool restore
run: dotnet tool restore
- name: dotnet format folder
Expand All @@ -44,11 +48,15 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ 'windows-latest', 'ubuntu-latest', 'macos-latest' ]
os: [ 'windows-2022', 'ubuntu-latest', 'macos-latest' ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: AssetStorage
run: dotnet test -c Release src/Tests/AssetStorage/Desktop/Fusee.Tests.AssetStorage.Desktop.csproj
- name: Math
Expand All @@ -73,11 +81,15 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ 'windows-latest', 'ubuntu-latest', 'macos-latest' ]
os: [ 'windows-2022', 'ubuntu-latest', 'macos-latest' ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Build Release-Desktop
run: dotnet build -c Release-Desktop Fusee.sln
- name: Upload Player-Artifact
Expand All @@ -96,16 +108,56 @@ jobs:
name: fusee-desktop-${{ matrix.os }}-examples
path: bin/Release/Examples/**/Desktop/

buildblazor:
needs: [tests]
name: Build Blazor
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_NOLOGO: true
strategy:
fail-fast: false
matrix:
os: [ 'windows-2022', 'ubuntu-latest', 'macos-latest' ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Setup dotnet macos workload
run: dotnet workload install macos
- name: Build Release-Blazor
run: dotnet build -c Release-Blazor Fusee.sln
- name: Install wasm-tools workload
run: dotnet workload install wasm-tools
- name: Publish F.E.Player.Blazor
run: dotnet publish -c Release -p:PublishProfile=FolderProfileRelease src/Engine/Player/Blazor/Fusee.Engine.Player.Blazor.csproj
- name: Upload Player-Artifact
uses: actions/upload-artifact@v2
with:
name: fusee-blazor-${{ matrix.os }}-player
path: bin/Release/Player/Blazor/net6.0/publish/

buildandroid:
name: Build Android
needs: [tests]
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_NOLOGO: true
runs-on: windows-latest
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1
with:
vs-version: '[17.0,]'
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1
- name: Build with MSBuild
Expand All @@ -117,14 +169,18 @@ jobs:
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_NOLOGO: true
runs-on: windows-latest
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
language: [ 'csharp', 'python' ]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion BuildNuget.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ dotnet pack dis\DnTemplate\DnTemplate.csproj -c Release -o bin\Release\nuget
msbuild dis\VSTemplate\VSTemplate.sln -t:restore,build -p:Configuration=Release
copy /Y dis\VSTemplate\VSTemplate\bin\Release\ProjectTemplates\CSharp\1033\Fusee.Template.VS.zip bin\Release\nuget\ >nul
copy /Y dis\VSTemplate\VSIX\bin\Release\Fusee.Template.VS.vsix bin\Release\nuget\ >nul
tar -c -a -f bin\Release\nuget\io_export_fus.zip -C bin\Release\Tools\CmdLine\netcoreapp3.1\BlenderScripts\addons *
tar -c -a -f bin\Release\nuget\io_export_fus.zip -C bin\Release\Tools\CmdLine\net6.0\BlenderScripts\addons *
goto END

:ERRORDOTNET
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<RootNamespace>Fusee.Examples.AdvancedUI.Android</RootNamespace>
Expand Down
3 changes: 2 additions & 1 deletion Examples/Complete/AdvancedUI/Core/AdvancedUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ public override void Init()

_gui = CreateGui();


// Create the interaction handler
_sih = new SceneInteractionHandler(_gui);

Expand Down Expand Up @@ -357,7 +358,7 @@ private SceneContainer CreateGui()
btnFuseeLogo.OnMouseDown += BtnLogoDown;

Texture guiFuseeLogo = new(AssetStorage.Get<ImageData>("FuseeText.png"));
TextureNode fuseeLogo = new(
TextureNode fuseeLogo = TextureNode.Create(
"fuseeLogo",
guiFuseeLogo,
GuiElementPosition.GetAnchors(AnchorPos.TopTopLeft),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.1;net5.0</TargetFrameworks>
<TargetFrameworks>netstandard2.1;net6.0</TargetFrameworks>
<OutputPath>$(BaseOutputPath)\Examples\AdvancedUI\Core\</OutputPath>
</PropertyGroup>

Expand Down
6 changes: 3 additions & 3 deletions Examples/Complete/AdvancedUI/Core/UserInterfaceHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ internal static void CreateAndAddCircleAnnotationAndLine(SceneNode parentUiEleme

private static SceneNode CreateAnnotation(float2 pos, float borderScaleFactor, string text, Texture iconTex, Texture frameTex)
{
TextureNode icon = new(
TextureNode icon = TextureNode.Create(
"icon",
iconTex,
new MinMaxRect
Expand All @@ -131,7 +131,7 @@ private static SceneNode CreateAnnotation(float2 pos, float borderScaleFactor, s
float2.One
);

TextNode annotationText = new(
TextNode annotationText = TextNode.Create(
text,
"annotation text",
new MinMaxRect
Expand All @@ -145,7 +145,7 @@ private static SceneNode CreateAnnotation(float2 pos, float borderScaleFactor, s
HorizontalTextAlignment.Center,
VerticalTextAlignment.Center);

TextureNode annotation = new(
TextureNode annotation = TextureNode.Create(
"Annotation",
frameTex,
new MinMaxRect
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>

<OutputType>Exe</OutputType>
<OutputPath>$(BaseOutputPath)\Examples\AdvancedUI\Desktop\</OutputPath>
</PropertyGroup>
Expand Down
20 changes: 13 additions & 7 deletions Examples/Complete/AdvancedUI/Desktop/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Fusee.Serialization;
using System.IO;
using System.Reflection;
using System.Threading.Tasks;

namespace Fusee.Examples.AdvancedUI.Desktop
{
Expand All @@ -17,18 +18,19 @@ public static void Main()
// Inject Fusee.Engine.Base InjectMe dependencies
IO.IOImp = new IOImp();

FileAssetProvider fap = new("Assets");
var fap = new Fusee.Base.Imp.Desktop.FileAssetProvider("Assets");
fap.RegisterTypeHandler(
new AssetHandler
{
ReturnedType = typeof(Font),
DecoderAsync = async (string id, object storage) =>
{
if (!Path.GetExtension(id).Contains("ttf", System.StringComparison.OrdinalIgnoreCase)) return null;
return await Task.FromResult(new Font { _fontImp = new FontImp((Stream)storage) });
},
Decoder = (string id, object storage) =>
{
if (!Path.GetExtension(id).Contains("ttf", System.StringComparison.OrdinalIgnoreCase))
{
return null;
}

if (!Path.GetExtension(id).Contains("ttf", System.StringComparison.OrdinalIgnoreCase)) return null;
return new Font { _fontImp = new FontImp((Stream)storage) };
},
Checker = id => Path.GetExtension(id).Contains("ttf", System.StringComparison.OrdinalIgnoreCase)
Expand All @@ -37,12 +39,16 @@ public static void Main()
new AssetHandler
{
ReturnedType = typeof(SceneContainer),
DecoderAsync = async (string id, object storage) =>
{
if (!Path.GetExtension(id).Contains("fus", System.StringComparison.OrdinalIgnoreCase)) return null;
return await FusSceneConverter.ConvertFromAsync(ProtoBuf.Serializer.Deserialize<FusFile>((Stream)storage), id);
},
Decoder = (string id, object storage) =>
{
if (!Path.GetExtension(id).Contains("fus", System.StringComparison.OrdinalIgnoreCase)) return null;
return FusSceneConverter.ConvertFrom(ProtoBuf.Serializer.Deserialize<FusFile>((Stream)storage), id);
},

Checker = id => Path.GetExtension(id).Contains("fus", System.StringComparison.OrdinalIgnoreCase)
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<RootNamespace>Fusee.Examples.Bone.Android</RootNamespace>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.1;net5.0</TargetFrameworks>
<TargetFrameworks>netstandard2.1;net6.0</TargetFrameworks>
<OutputPath>$(BaseOutputPath)\Examples\Bone\Core\</OutputPath>
<TargetFramework>netstandard2.1</TargetFramework>
<OutputPath>$(BaseOutputPath)\Examples\BoneAnimation\Core\</OutputPath>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Exe</OutputType>
<OutputPath>$(BaseOutputPath)\Examples\BoneAnimation\Desktop\</OutputPath>
</PropertyGroup>
Expand Down
11 changes: 11 additions & 0 deletions Examples/Complete/BoneAnimation/Desktop/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Fusee.Serialization;
using System.IO;
using System.Reflection;
using System.Threading.Tasks;

namespace Fusee.Examples.BoneAnimation.Desktop
{
Expand All @@ -22,6 +23,11 @@ public static void Main()
new AssetHandler
{
ReturnedType = typeof(Font),
DecoderAsync = async (string id, object storage) =>
{
if (!Path.GetExtension(id).Contains("ttf", System.StringComparison.OrdinalIgnoreCase)) return null;
return await Task.FromResult(new Font { _fontImp = new FontImp((Stream)storage) });
},
Decoder = (string id, object storage) =>
{
if (!Path.GetExtension(id).Contains("ttf", System.StringComparison.OrdinalIgnoreCase)) return null;
Expand All @@ -33,6 +39,11 @@ public static void Main()
new AssetHandler
{
ReturnedType = typeof(SceneContainer),
DecoderAsync = async (string id, object storage) =>
{
if (!Path.GetExtension(id).Contains("fus", System.StringComparison.OrdinalIgnoreCase)) return null;
return await FusSceneConverter.ConvertFromAsync(ProtoBuf.Serializer.Deserialize<FusFile>((Stream)storage), id);
},
Decoder = (string id, object storage) =>
{
if (!Path.GetExtension(id).Contains("fus", System.StringComparison.OrdinalIgnoreCase)) return null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<RootNamespace>Fusee.Examples.Camera.Android</RootNamespace>
Expand Down
10 changes: 10 additions & 0 deletions Examples/Complete/Camera/Blazor/App.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
</Found>
<NotFound>
<LayoutView Layout="@typeof(MainLayout)">
<p>Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
<BlazorEnableCompression>false</BlazorEnableCompression>
<BlazorCacheBootResources>false</BlazorCacheBootResources>
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
<Nullable>disable</Nullable>
<Platforms>AnyCPU</Platforms>
</PropertyGroup>

<PropertyGroup>
<OutputPath>$(BaseOutputPath)\Examples\Camera\Blazor\</OutputPath>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.JSInterop.WebAssembly" Version="6.0.0" />

</ItemGroup>

<ItemGroup>
<ProjectReference Include="$(FuseeEngineRoot)\src\Base\Imp\Blazor\Fusee.Base.Imp.Blazor.csproj" />
<ProjectReference Include="..\Core\Fusee.Examples.Camera.Core.csproj" />
</ItemGroup>

<ItemGroup>
<ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" />
</ItemGroup>

<Target Name="MovingAssetsToServerRoot" BeforeTargets="PostBuildEvent">
<ItemGroup>
<AssetsDir Include="$(OutputPath)$(TargetFramework)\Assets\**\*.*" />
</ItemGroup>
<Message Text="Moving 'Assets' folder to http server root folder" Importance="high" />
<Move SourceFiles="@(AssetsDir)" DestinationFolder="$(OutputPath)$(TargetFramework)\wwwroot\Assets\%(RecursiveDir)" />
<RemoveDir Directories="$(OutputPath)$(TargetFramework)\Assets" />
</Target>

</Project>
Loading

0 comments on commit d2faead

Please sign in to comment.