diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 82ef1c676..efb9cb783 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -14,7 +14,7 @@ on:
jobs:
build_and_deploy_job:
env:
- DIST_PATH: src/Uno.Wasm.Sample.RayTracer/bin/Release/net6.0/publish/wwwroot
+ DIST_PATH: src/Uno.Wasm.Sample.RayTracer/bin/Release/net9.0/publish/wwwroot
if: (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
@@ -38,15 +38,34 @@ jobs:
useConfigFile: true
configFilePath: gitversion.yml
- - name: Setup dotnet 8.0.100
+ # Daily builds install
+ # - run: |
+ # wget https://dot.net/v1/dotnet-install.sh
+ # chmod +x dotnet-install.sh
+ # ./dotnet-install.sh -c 9.0 -q daily
+ # echo ~/.dotnet >> $GITHUB_PATH
+ #
+ # name: Setup .NET
+ #
+
+ - name: Setup .NET
uses: actions/setup-dotnet@v1.7.2
with:
- dotnet-version: '8.0.100'
+ dotnet-version: '9.0.100-rc.1.24452.12'
include-prerelease: true
+
+ - run: |
+ cd src
+ dotnet workload install wasm-tools
+
+ name: Setup Workloads
+
+ - run: |
+ dotnet build -c Release src/Uno.Wasm.Bootstrap/Uno.Wasm.Bootstrap.csproj /bl:./artifacts-logs/build.binlog
+ name: Build Bootstrap
- run: |
- dotnet publish -c Release /p:DISABLE_CLIHOST_NET6=true src/Uno.Wasm.Bootstrap/Uno.Wasm.Bootstrap.csproj /bl:./artifacts-logs/build.binlog
- dotnet publish -c Release /p:DISABLE_CLIHOST_NET6=true src/Uno.Wasm.Sample.RayTracer/Uno.Wasm.Sample.RayTracer.csproj /bl:./artifacts-logs/build-sample.binlog
+ dotnet publish -c Release src/Uno.Wasm.Sample.RayTracer/Uno.Wasm.Sample.RayTracer.csproj /bl:./artifacts-logs/build-sample.binlog
name: Build WebAssembly app
- uses: actions/upload-artifact@v4
@@ -55,6 +74,7 @@ jobs:
path: ${{ env.DIST_PATH }}
- uses: actions/upload-artifact@v4
+ if: always()
with:
name: logs
path: artifacts-logs
diff --git a/.gitignore b/.gitignore
index 3f5a127b3..1d85e161a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -267,5 +267,7 @@ launchSettings.json
# Directory Cache files
.DS_Store
thumbs.db
+/src/Uno.Wasm.Bootstrap/tools
/src/Uno.Wasm.Bootstrap/build/packager
/src/Uno.Wasm.Bootstrap/build/wasm-tuner
+
diff --git a/.vsts-ci.yml b/.vsts-ci.yml
index 1f925c2d7..1b20c8ee0 100644
--- a/.vsts-ci.yml
+++ b/.vsts-ci.yml
@@ -54,4 +54,3 @@ stages:
parameters:
jobName: macOS_Tests
vmImage: macOS-12
- - template: build/ci/stage-build-wsl-tests.yml
diff --git a/Readme.md b/Readme.md
index 8bb41bc72..985ac2d11 100644
--- a/Readme.md
+++ b/Readme.md
@@ -2,15 +2,11 @@
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/unoplatform/Uno.Wasm.Bootstrap)
-Uno.Wasm.Bootstrap provides a simple way to package C# .NET code, and run it from a compatible browser environment.
+The Uno.Wasm.Bootstrap package provides a runtime bootstrapper of the `Microsoft.NET.Sdk.WebAssembly` SDK from .NET 9.
-It is a standalone .NET Web Assembly (Wasm) sdk bootstrapper taking the form of a nuget package.
+This package only provides the bootstrapping features to run a .NET assembly and write to the JavaScript console, through `Console.WriteLine`. To write an app that provides UI functionalities, make sur to check out https://aka.platform.uno/get-started.
-Installing it on a .NET project (5, 6, 7, 8 or .NET Standard 2.0) with an entry point allows to publish it as part of a Wasm distribution folder, along with CSS, JavaScript and content files.
-
-This package only provides the bootstrapping features to run a .NET assembly and write to the JavaScript console, through `Console.WriteLine`.
-
-This package is based on the excellent work from @praeclarum's [OOui Wasm MSBuild task](https://github.com/praeclarum/Ooui).
+This work is based on the excellent work from @praeclarum's [OOui Wasm MSBuild task](https://github.com/praeclarum/Ooui).
## Documentation
@@ -28,15 +24,11 @@ This package is based on the excellent work from @praeclarum's [OOui Wasm MSBuil
- [Splash screen](doc/features-splash-screen.md)
- [Threading](doc/features-threading.md)
- [Deep linking](doc/features-deep-linking.md)
- - [Pre-compression](doc/features-pre-compression.md)
- [Embedded mode](doc/features-embedded.mode.md)
- [Native Linker Optimization](doc/features-linker-opts.md)
- [Memory troubleshooting](doc/features-memory-corruption-troubleshooting.md)
- [Module Linking](doc/features-module-linking.md)
- [Profiling](doc/features-profiling.md)
- - [Node JS](doc/features-node-js.md)
- - [Nuget package overrides](doc/features-nuget-package-overrides.md)
- - [Prefetching](doc/features-prefetch.md)
- [PWA Support](doc/features-pwa.md)
- [4GB Support](doc/features-4gb.md)
- [HttpRequestMessage Extensions](doc/features-httprequestmessage-extensions.md)
@@ -45,3 +37,9 @@ This package is based on the excellent work from @praeclarum's [OOui Wasm MSBuil
- [Uno Version Checker](doc/features-version-checker.md)
- [Contributing](doc/contributing.md)
- [Release procedure](doc/release-procedure.md)
+
+## Previous releases documentation
+
+- [8.0.x](https://github.com/unoplatform/Uno.Wasm.Bootstrap/tree/release/stable/8.0/doc)
+- [7.0.x](https://github.com/unoplatform/Uno.Wasm.Bootstrap/tree/release/stable/7.0/doc)
+- [3.x](https://github.com/unoplatform/Uno.Wasm.Bootstrap/tree/release/stable/3.3/doc)
diff --git a/THIRD-PARTY-NOTICES.txt b/THIRD-PARTY-NOTICES.txt
new file mode 100644
index 000000000..4bac042ff
--- /dev/null
+++ b/THIRD-PARTY-NOTICES.txt
@@ -0,0 +1,59 @@
+The Uno Platform uses third-party libraries and resources that may be
+distributed under licenses different from the Uno Platform software.
+
+In the event of accidental failure to list a required notice, please
+bring it to our attention. Post an issue at :
+
+ https://github.com/unoplatform/uno/issues
+
+The attached notices are provided for information only.
+
+License notice for .NET Core
+----------------------------
+
+The MIT License (MIT)
+
+Copyright (c) .NET Foundation and Contributors
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+License notice for ProtoBufJsonConverter
+----------------------------
+
+Copyright(c) 2023 Stef Heyenrath
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/build/ci/cspell.json b/build/ci/cspell.json
index 4358070e9..e41eed86e 100644
--- a/build/ci/cspell.json
+++ b/build/ci/cspell.json
@@ -205,6 +205,6 @@
"Multi-line code blocks"
],
"ignorePaths": [
- "../doc/index.md"
+ "../doc/index.md",
]
}
\ No newline at end of file
diff --git a/build/ci/dotnet-install.yml b/build/ci/dotnet-install.yml
index 50543fdb6..70f263f0f 100644
--- a/build/ci/dotnet-install.yml
+++ b/build/ci/dotnet-install.yml
@@ -1,10 +1,40 @@
parameters:
- DotNetVersion: '7.0.200'
+ DotNetVersion: '9.0.100-rc.1.24452.12'
steps:
- task: UseDotNet@2
- displayName: 'Use .NET 6 SDK'
+ displayName: 'Use .NET SDK'
inputs:
version: ${{ parameters.DotNetVersion }}
includePreviewVersions: true
+
+ # Daily builds install
+ # - pwsh: |
+ # $DotNetRoot = "C:\hostedtoolcache\windows\dotnet"
+ # Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile "./build/installcli.ps1"
+ # & ./build/installcli.ps1 -c 9.0 -q daily -InstallDir $DotNetRoot
+
+ # condition: and(succeeded(), eq( variables['Agent.OS'], 'Windows_NT' ))
+ # displayName: 'Setup .NET (Windows)'
+
+ # - pwsh: |
+ # wget https://dot.net/v1/dotnet-install.sh
+ # chmod +x dotnet-install.sh
+ # ./dotnet-install.sh -c 9.0 -q daily
+ # echo "[task.setvariable variable=PATH;]${env:PATH}:$env:HOME/.dotnet"
+ # echo "[task.setvariable variable=DOTNET_ROOT;]$env:HOME/.dotnet"
+
+ # echo "##vso[task.setvariable variable=PATH;]$env:HOME/.dotnet:${env:PATH}"
+ # echo "##vso[task.setvariable variable=DOTNET_ROOT;]$env:HOME/.dotnet"
+
+ # condition: and(succeeded(), ne( variables['Agent.OS'], 'Windows_NT' ))
+ # displayName: 'Setup .NET (Linux/macOS)'
+
+ - pwsh: |
+ cd src
+ dotnet --version
+ dotnet --list-sdks
+ dotnet workload install wasm-tools
+
+ displayName: Setup Workloads
diff --git a/build/ci/stage-build-linux-tests.yml b/build/ci/stage-build-linux-tests.yml
index 4f1813746..380ec5ac8 100644
--- a/build/ci/stage-build-linux-tests.yml
+++ b/build/ci/stage-build-linux-tests.yml
@@ -17,6 +17,7 @@ jobs:
variables:
NUGET_PACKAGES: $(build.sourcesdirectory)/.nuget
+ WasmCachePath: $(Agent.TempDirectory)/emsdk-cache
steps:
- checkout: self
@@ -25,26 +26,19 @@ jobs:
- template: gitversion.yml
- template: dotnet-install.yml
- - task: UseDotNet@2
- displayName: 'Use .NET SDK'
- inputs:
- packageType: sdk
- version: 8.0.100
- includePreviewVersions: true
-
- bash: |
cd $(build.sourcesdirectory)/src/Uno.Wasm.Bootstrap
- dotnet msbuild /r /p:Configuration=Release /p:DISABLE_CLIHOST_NET6=true
+ dotnet msbuild /r /p:Configuration=Release
displayName: Build bootstrap
- bash: |
cd $(build.sourcesdirectory)/src
- dotnet publish -c Release /m:1 /p:DISABLE_CLIHOST_NET6=true Uno.Wasm.Bootstrap-netcore-only.slnf /bl:$(build.artifactstagingdirectory)/SampleNet5.binlog
+ dotnet publish -c Release /m:1 Uno.Wasm.Bootstrap-netcore-only.slnf /bl:$(build.artifactstagingdirectory)/SampleNet5.binlog
displayName: Build NetCore-Wasm Sample
- task: CopyFiles@2
inputs:
- SourceFolder: $(build.sourcesdirectory)/src/Uno.Wasm.Sample.RayTracer/bin/Release/net6.0/publish
+ SourceFolder: $(build.sourcesdirectory)/src/Uno.Wasm.Sample.RayTracer/bin/Release/net9.0/publish/wwwroot
Contents: '**/*.*'
TargetFolder: $(build.artifactstagingdirectory)/Uno.Wasm.Sample.RayTracer
CleanTargetFolder: false
@@ -54,7 +48,7 @@ jobs:
## Raytracer validation
- bash: |
$(build.sourcesdirectory)/build/scripts/run-tests.sh \
- "$(build.sourcesdirectory)/src/Uno.Wasm.Sample.RayTracer/bin/Release/net6.0/dist" \
+ "$(build.sourcesdirectory)/src/Uno.Wasm.Sample.RayTracer/bin/Release/net9.0/publish/wwwroot" \
"$(build.sourcesdirectory)/src/WasmAot.UITests" "http://localhost:8000/"
displayName: Raytracer UI Tests Net5
env:
@@ -63,43 +57,45 @@ jobs:
## Threads Interp validation
- bash: |
cd $(build.sourcesdirectory)/src/Uno.Wasm.Threads
- dotnet clean -c Release /p:DISABLE_CLIHOST_NET6=true
- dotnet publish -c Release /m:1 /p:DISABLE_CLIHOST_NET6=true "/p:WasmShellWebAppBasePath=/"
+ dotnet clean -c Release
+ dotnet publish -c Release /m:1 "/p:WasmShellWebAppBasePath=/"
displayName: Build Threads test
- bash: |
$(build.sourcesdirectory)/build/scripts/run-tests.sh \
- "$(build.sourcesdirectory)/src/Uno.Wasm.Threads/bin/Release/net8.0/dist" \
+ "$(build.sourcesdirectory)/src/Uno.Wasm.Threads/bin/Release/net9.0/publish/wwwroot" \
"$(build.sourcesdirectory)/src/Uno.Wasm.Threading.UITests" "http://localhost:8000/"
displayName: Threading UI Tests
+ condition: eq( variables['THREAD_TESTING'], 'true' )
env:
BUILD_SOURCESDIRECTORY: "$(build.sourcesdirectory)"
### Threads AOT validation
- bash: |
cd $(build.sourcesdirectory)/src/Uno.Wasm.Threads.Aot
- dotnet clean -c Release /p:DISABLE_CLIHOST_NET6=true
- dotnet publish -c Release /m:1 /p:DISABLE_CLIHOST_NET6=true "/p:WasmShellWebAppBasePath=/"
+ dotnet clean -c Release
+ dotnet publish -c Release /m:1 "/p:WasmShellWebAppBasePath=/"
displayName: Build Threads AOT test
- bash: |
$(build.sourcesdirectory)/build/scripts/run-tests.sh \
- "$(build.sourcesdirectory)/src/Uno.Wasm.Threads.Aot/bin/Release/net6.0/dist" \
+ "$(build.sourcesdirectory)/src/Uno.Wasm.Threads.Aot/bin/Release/net9.0/publish/wwwroot" \
"$(build.sourcesdirectory)/src/Uno.Wasm.Threading.UITests" "http://localhost:8000/"
displayName: Threading AOT UI Tests
+ condition: eq( variables['THREAD_TESTING'], 'true' )
env:
BUILD_SOURCESDIRECTORY: "$(build.sourcesdirectory)"
## SWA sub-path validation
- bash: |
cd $(build.sourcesdirectory)/src/Uno.Wasm.Sample.RayTracer
- dotnet clean -c Release /p:DISABLE_CLIHOST_NET6=true
- dotnet publish -c Release /m:1 /p:DISABLE_CLIHOST_NET6=true "/p:WasmShellWebAppBasePath=/"
+ dotnet clean -c Release
+ dotnet publish -c Release /m:1 "/p:WasmShellWebAppBasePath=/"
displayName: Build RayTracer with sub-path
- task: CopyFiles@2
inputs:
- SourceFolder: $(build.sourcesdirectory)/src/Uno.Wasm.Sample.RayTracer/bin/Release/net6.0/publish
+ SourceFolder: $(build.sourcesdirectory)/src/Uno.Wasm.Sample.RayTracer/bin/Release/net9.0/publish/wwwroot
Contents: '**/*.*'
TargetFolder: $(build.artifactstagingdirectory)/subpath-override
CleanTargetFolder: false
@@ -108,7 +104,7 @@ jobs:
- bash: |
$(build.sourcesdirectory)/build/scripts/run-tests-swa.sh \
- "$(build.sourcesdirectory)/src/Uno.Wasm.Sample.RayTracer/bin/Release/net6.0/dist" \
+ "$(build.sourcesdirectory)/src/Uno.Wasm.Sample.RayTracer/bin/Release/net9.0/publish/wwwroot" \
"$(build.sourcesdirectory)/src/WasmAot.UITests" "http://localhost:8000/test/inner"
displayName: Raytracer UI Tests Net5 (SWA)
env:
@@ -117,7 +113,7 @@ jobs:
## Static linking validation
- bash: |
$(build.sourcesdirectory)/build/scripts/run-tests.sh \
- "$(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.Aot.Net6/bin/Release/net6.0/dist" \
+ "$(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.Aot.Net6/bin/Release/net9.0/publish/wwwroot" \
"$(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.Aot.UITests" "http://localhost:8000/"
displayName: StaticLinking.Aot Tests net5
env:
@@ -126,7 +122,7 @@ jobs:
## Static linking validation (net7)
- bash: |
$(build.sourcesdirectory)/build/scripts/run-tests.sh \
- "$(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.net7/bin/Release/net7.0/dist" \
+ "$(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.net7/bin/Release/net9.0/publish/wwwroot" \
"$(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.Aot.UITests" "http://localhost:8000/"
displayName: StaticLinking.Aot Tests net7
env:
@@ -142,7 +138,7 @@ jobs:
## Static linking validation (net7)
- bash: |
$(build.sourcesdirectory)/build/scripts/run-tests-csp.sh \
- "$(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.net7/bin/Release/net7.0/dist" \
+ "$(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.net7/bin/Release/net9.0/publish/wwwroot" \
"$(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.Aot.UITests" "http://localhost:8000/"
displayName: StaticLinking.Aot Tests net7 (CSP Enabled)
env:
@@ -160,7 +156,7 @@ jobs:
- task: CopyFiles@2
condition: always()
inputs:
- SourceFolder: $(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.Server.net7/bin/Release/net7.0
+ SourceFolder: $(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.Server.net7/bin/Release/net9.0
Contents: '**/*.*'
TargetFolder: $(build.artifactstagingdirectory)/Uno.Wasm.StaticLinking.Server.net7
CleanTargetFolder: false
@@ -170,8 +166,8 @@ jobs:
# Interpreter debug for symbols copy issue
- bash: |
cd $(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.Interpreter
- dotnet clean -c Debug /p:DISABLE_CLIHOST_NET6=true
- dotnet publish -c Debug /m:1 /p:DISABLE_CLIHOST_NET6=true /p:WasmShellEmccLinkOptimization=false /bl:$(build.artifactstagingdirectory)/sample.debug-interpreter-linux-debug.binlog
+ dotnet clean -c Debug
+ dotnet publish -c Debug /m:1 /p:WasmShellEmccLinkOptimization=false /bl:$(build.artifactstagingdirectory)/sample.debug-interpreter-linux-debug.binlog
displayName: Build Debug Interpreter with linking Sample
- task: PublishBuildArtifacts@1
diff --git a/build/ci/stage-build-macos-tests.yml b/build/ci/stage-build-macos-tests.yml
index d6badf5bd..a90fc0e08 100644
--- a/build/ci/stage-build-macos-tests.yml
+++ b/build/ci/stage-build-macos-tests.yml
@@ -16,40 +16,14 @@ jobs:
- template: gitversion.yml
- template: dotnet-install.yml
- - task: UseDotNet@2
- displayName: 'Use .NET SDK'
- inputs:
- packageType: sdk
- version: 8.0.100
- includePreviewVersions: true
-
- - bash: brew install ninja
- displayName: 'Install Ninja'
-
- # - bash: |
- # source ~/emsdk/emsdk_env.sh
- # export PATH=$PATH:$(Agent.WorkFolder)/ninja-mac
- # msbuild /r /t:Publish /p:Configuration=Release src/Uno.Wasm.Bootstrap.sln
- #
- # displayName: MSBuild Validation
-
- # - task: CopyFiles@2
- # inputs:
- # SourceFolder: $(build.sourcesdirectory)/src/Uno.Wasm.AotTests/bin/Release/netstandard2.0/dist
- # Contents: '**/*.*'
- # TargetFolder: $(build.artifactstagingdirectory)
- # CleanTargetFolder: false
- # OverWrite: false
- # flattenFolders: false
-
- bash: |
cd $(build.sourcesdirectory)/src/Uno.Wasm.Bootstrap
dotnet msbuild /r /p:Configuration=Release
displayName: Build bootstrap
- bash: |
- cd $(build.sourcesdirectory)/src/Uno.Wasm.SampleNet6
- dotnet build -m:1 /bl:$(build.artifactstagingdirectory)/SampleNet6-mac.binlog
+ cd $(build.sourcesdirectory)/src/Uno.Wasm.SampleNet7
+ dotnet build -m:1 /bl:$(build.artifactstagingdirectory)/SampleNet7-mac.binlog
displayName: Build NetCore-Wasm Sample
# Static linking test (net5) without the linker
@@ -61,7 +35,7 @@ jobs:
- bash: |
$(build.sourcesdirectory)/build/scripts/run-tests.sh \
- "$(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.Interpreter/bin/Release/net5.0/dist" \
+ "$(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.Interpreter/bin/Release/net9.0/publish/wwwroot" \
"$(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.Aot.UITests" "http://localhost:8000/"
displayName: StaticLinking Interpreter Test
env:
diff --git a/build/ci/stage-build-packages.yml b/build/ci/stage-build-packages.yml
index b8aeb9b09..d9cee758d 100644
--- a/build/ci/stage-build-packages.yml
+++ b/build/ci/stage-build-packages.yml
@@ -2,7 +2,7 @@ jobs:
- job: Windows
pool:
- vmImage: 'windows-2019'
+ vmImage: 'windows-2022'
variables:
NUGET_PACKAGES: $(Agent.WorkFolder)\.nuget
@@ -11,13 +11,6 @@ jobs:
- checkout: self
clean: true
- - task: UseDotNet@2
- displayName: 'Use .NET SDK'
- inputs:
- packageType: sdk
- version: 8.0.100
- includePreviewVersions: true
-
- template: gitversion.yml
- template: dotnet-install.yml
@@ -42,7 +35,7 @@ jobs:
- script: |
cd $(build.sourcesdirectory)\src
- dotnet msbuild Uno.Wasm.Bootstrap-paclages-only.slnf /r /p:Configuration=Release /p:InformationalVersion=$(GITVERSION.INFORMATIONALVERSION) /p:PackageReleaseNotesFile=$(Build.SourcesDirectory)/build/CHANGELOG.md /p:PackageVersion=$(GITVERSION.FullSemVer) /p:PackageOutputPath=$(build.sourcesdirectory)\build\nuget /bl:$(build.artifactstagingdirectory)/win-packages.binlog
+ dotnet msbuild Uno.Wasm.Bootstrap-packages-only.slnf /r /p:Configuration=Release /p:InformationalVersion=$(GITVERSION.INFORMATIONALVERSION) /p:PackageReleaseNotesFile=$(Build.SourcesDirectory)/build/CHANGELOG.md /p:PackageVersion=$(GITVERSION.FullSemVer) /p:PackageOutputPath=$(build.sourcesdirectory)\build\nuget /bl:$(build.artifactstagingdirectory)/win-packages.binlog
displayName: Build packages
- script: |
diff --git a/build/ci/stage-build-windows-tests.yml b/build/ci/stage-build-windows-tests.yml
index a037ef209..d73463285 100644
--- a/build/ci/stage-build-windows-tests.yml
+++ b/build/ci/stage-build-windows-tests.yml
@@ -14,6 +14,7 @@ jobs:
variables:
NUGET_PACKAGES: $(build.sourcesdirectory)/.nuget
NETCORE_VERSION: ${{ parameters.netcore_version }}
+ # EMCC_DEBUG: 1
steps:
- checkout: self
@@ -22,45 +23,31 @@ jobs:
- template: gitversion.yml
- template: dotnet-install.yml
- - task: UseDotNet@2
- displayName: 'Use .NET SDK'
- inputs:
- packageType: sdk
- version: 8.0.100
- includePreviewVersions: true
-
- pwsh: |
attrib +r "$(build.sourcesdirectory)/src" /s /d
displayName: Set all repo files as readonly
- pwsh: |
cd $(build.sourcesdirectory)/src/Uno.Wasm.Bootstrap
- dotnet msbuild /r /p:Configuration=Release /p:DISABLE_CLIHOST_NET6=true
- displayName: Build bootstrap
-
- - pwsh: |
- cd $(build.sourcesdirectory)/src/Uno.Wasm.Bootstrap
- dotnet msbuild /r /p:Configuration=Release /p:DISABLE_CLIHOST_NET6=true
+ dotnet msbuild /r /p:Configuration=Release
displayName: Build bootstrap
- pwsh: |
- cd $(build.sourcesdirectory)/src/Uno.Wasm.SampleNet6
- $customMonoTempPath="$env:temp\with a space\test"
- mkdir $customMonoTempPath
- dotnet clean -c Release /p:DISABLE_CLIHOST_NET6=true
- dotnet publish /p:Configuration=Release /m:1 "/p:WasmShellMonoTempFolder=$customMonoTempPath" /p:DISABLE_CLIHOST_NET6=true /p:WasmShellEmccLinkOptimization=false /bl:$(build.artifactstagingdirectory)/SampleNet6-win-temp-with-space.binlog
+ cd $(build.sourcesdirectory)/src/Uno.Wasm.SampleNet7
+ dotnet clean -c Release
+ dotnet publish /p:WasmShellEmccLinkOptimization=false /bl:$(build.artifactstagingdirectory)/SampleNet7-win-temp-with-space.binlog
displayName: Build Raytracer Sample with Spaces
# Standalone Server publish
- pwsh: |
cd $(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.Server.net7
- dotnet clean -c Release /p:DISABLE_CLIHOST_NET6=true
- dotnet publish -c Release /m:1 /p:DISABLE_CLIHOST_NET6=true /p:WasmShellEmccLinkOptimization=false /bl:$(build.artifactstagingdirectory)/SampleServerNet7-win.binlog
+ dotnet clean -c Release
+ dotnet publish -c Release /m:1 /p:WasmShellEmccLinkOptimization=false /bl:$(build.artifactstagingdirectory)/SampleServerNet7-win.binlog
displayName: Build Standalone Server publish (net5)
- pwsh: |
$(build.sourcesdirectory)\build\scripts\run-tests-windows-server.ps1 `
- "$(build.sourcesdirectory)\src\Uno.Wasm.StaticLinking.Server.net7\bin\Release\net7.0\publish" `
+ "$(build.sourcesdirectory)\src\Uno.Wasm.StaticLinking.Server.net7\bin\Release\net9.0\publish" `
"Uno.Wasm.StaticLinking.Server.net7.exe" `
"$(build.sourcesdirectory)\src\Uno.Wasm.StaticLinking.Aot.UITests" `
"http://localhost:8000/"
@@ -73,21 +60,19 @@ jobs:
- pwsh: |
cd $(build.sourcesdirectory)/src/Uno.Wasm.Sample.RayTracer
- $customMonoTempPath="$env:temp\with a space\test2"
- mkdir $customMonoTempPath
dotnet clean -c Release
- dotnet publish -c Release /m:1 "/p:WasmShellMonoTempFolder=$customMonoTempPath" /p:DISABLE_CLIHOST_NET6=true /p:WasmShellEmccLinkOptimization=false /bl:$(build.artifactstagingdirectory)/aottest-win-temp-with-space.binlog
+ dotnet publish -c Release /m:1 "/p:WasmShellMonoTempFolder=$customMonoTempPath" /p:WasmShellEmccLinkOptimization=false /bl:$(build.artifactstagingdirectory)/aottest-win-temp-with-space.binlog
displayName: Build Raytracer Sample with Spaces
- pwsh: |
cd $(build.sourcesdirectory)/src/Uno.Wasm.Sample.RayTracer
- dotnet clean -c Release /p:DISABLE_CLIHOST_NET6=true
- dotnet publish -c Release /m:1 /p:DISABLE_CLIHOST_NET6=true /p:WasmShellEmccLinkOptimization=false /bl:$(build.artifactstagingdirectory)/SampleNet5-win.binlog
+ dotnet clean -c Release
+ dotnet publish -c Release /m:1 /p:WasmShellEmccLinkOptimization=false /bl:$(build.artifactstagingdirectory)/SampleNet5-win.binlog
displayName: Build Raytracer Sample
- pwsh: |
$(build.sourcesdirectory)\build\scripts\run-tests-windows.ps1 `
- "$(build.sourcesdirectory)\src\Uno.Wasm.Sample.RayTracer\bin\Release\net6.0\publish\wwwroot" `
+ "$(build.sourcesdirectory)\src\Uno.Wasm.Sample.RayTracer\bin\Release\net9.0\publish\wwwroot" `
"$(build.sourcesdirectory)\src\WasmAot.UITests" `
"http://localhost:8000/"
@@ -98,8 +83,8 @@ jobs:
# Static linking test (net5) without the linker
- pwsh: |
cd $(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.Interpreter
- dotnet clean -c Release /p:DISABLE_CLIHOST_NET6=true
- dotnet publish -c Release /m:1 /p:DISABLE_CLIHOST_NET6=true /p:WasmShellEmccLinkOptimization=false /p:WasmShellILLinkerEnabled=false /bl:$(build.artifactstagingdirectory)/SampleNet5-nolinker-win.binlog
+ dotnet clean -c Release
+ dotnet publish -c Release /m:1 /p:WasmShellEmccLinkOptimization=false /p:WasmShellILLinkerEnabled=false /bl:$(build.artifactstagingdirectory)/SampleNet5-nolinker-win.binlog
displayName: Build StaticLinking.Interpreter Sample (net5 without linker)
# Static linking test (net5) emsdk path with space test
@@ -107,20 +92,20 @@ jobs:
cd $(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.Interpreter
mkdir "emsdk test"
$env:WASMSHELL_WSLEMSDK="$(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.Interpreter/emsdk test"
- dotnet clean -c Release /p:DISABLE_CLIHOST_NET6=true
- dotnet publish -c Release /m:1 /p:DISABLE_CLIHOST_NET6=true /p:WasmShellEmccLinkOptimization=false /p:WasmShellILLinkerEnabled=false /bl:$(build.artifactstagingdirectory)/SampleNet5-emsdk-space.binlog
+ dotnet clean -c Release
+ dotnet publish -c Release /m:1 /p:WasmShellEmccLinkOptimization=false /p:WasmShellILLinkerEnabled=false /bl:$(build.artifactstagingdirectory)/SampleNet5-emsdk-space.binlog
displayName: Build StaticLinking.Interpreter Sample (emsdk path with space test)
# Static linking test with obsfucation enabled
- pwsh: |
cd $(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.Aot.Net6
- dotnet clean -c Release /p:DISABLE_CLIHOST_NET6=true
- dotnet publish -c Release /m:1 /p:DISABLE_CLIHOST_NET6=true /p:WasmShellEmccLinkOptimization=false /p:WasmShellObfuscateAssemblies=true /bl:$(build.artifactstagingdirectory)/SampleNet6-nolinker-win.binlog
+ dotnet clean -c Release
+ dotnet publish -c Release /m:1 /p:WasmShellEmccLinkOptimization=false /p:WasmShellObfuscateAssemblies=true /bl:$(build.artifactstagingdirectory)/SampleNet6-nolinker-win.binlog
displayName: Build StaticLinking.StaticLinking.Aot.Net6 Sample (net6 with obfuscation)
- pwsh: |
$(build.sourcesdirectory)\build\scripts\run-tests-windows.ps1 `
- "$(build.sourcesdirectory)\src\Uno.Wasm.StaticLinking.Aot.Net6\bin\Release\net6.0\dist" `
+ "$(build.sourcesdirectory)\src\Uno.Wasm.StaticLinking.Aot.Net6\bin\Release\net9.0\publish\wwwroot" `
"$(build.sourcesdirectory)\src\Uno.Wasm.StaticLinking.Aot.UITests" `
"http://localhost:8000/"
@@ -131,13 +116,13 @@ jobs:
# Static linking test with file name obsfucation enabled
- pwsh: |
cd $(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.Aot.Net6
- dotnet clean -c Release /p:DISABLE_CLIHOST_NET6=true
- dotnet publish -c Release /m:1 /p:DISABLE_CLIHOST_NET6=true /p:WasmShellEmccLinkOptimization=false /p:WasmShellAssembliesFileNameObfuscationMode=NoDots /bl:$(build.artifactstagingdirectory)/SampleNet5-nolinker-win.binlog
+ dotnet clean -c Release
+ dotnet publish -c Release /m:1 /p:WasmShellEmccLinkOptimization=false /p:WasmShellAssembliesFileNameObfuscationMode=NoDots /bl:$(build.artifactstagingdirectory)/SampleNet5-nolinker-win.binlog
displayName: Build StaticLinking.StaticLinking.Aot.Net5 Sample (net5 with file name obfuscation)
- pwsh: |
$(build.sourcesdirectory)\build\scripts\run-tests-windows.ps1 `
- "$(build.sourcesdirectory)\src\Uno.Wasm.StaticLinking.Aot.Net6\bin\Release\net6.0\dist" `
+ "$(build.sourcesdirectory)\src\Uno.Wasm.StaticLinking.Aot.Net6\bin\Release\net9.0\publish\wwwroot" `
"$(build.sourcesdirectory)\src\Uno.Wasm.StaticLinking.Aot.UITests" `
"http://localhost:8000/"
@@ -147,7 +132,7 @@ jobs:
- pwsh: |
$(build.sourcesdirectory)\build\scripts\run-tests-windows.ps1 `
- "$(build.sourcesdirectory)\src\Uno.Wasm.StaticLinking.Aot.Net6\bin\Release\net6.0\dist" `
+ "$(build.sourcesdirectory)\src\Uno.Wasm.StaticLinking.Aot.Net6\bin\Release\net9.0\publish\wwwroot" `
"$(build.sourcesdirectory)\src\Uno.Wasm.StaticLinking.Aot.UITests" `
"http://127.0.0.1:8000/"
@@ -158,13 +143,13 @@ jobs:
# Static linking test with dual obfuscation enabled
- pwsh: |
cd $(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.Aot.Net6
- dotnet clean -c Release /p:DISABLE_CLIHOST_NET6=true
- dotnet publish -c Release /m:1 /p:DISABLE_CLIHOST_NET6=true /p:WasmShellEmccLinkOptimization=false /p:WasmShellObfuscateAssemblies=true /p:WasmShellAssembliesFileNameObfuscationMode=NoDots /bl:$(build.artifactstagingdirectory)/SampleNet6-dual-win.binlog
+ dotnet clean -c Release
+ dotnet publish -c Release /m:1 /p:WasmShellEmccLinkOptimization=false /p:WasmShellObfuscateAssemblies=true /p:WasmShellAssembliesFileNameObfuscationMode=NoDots /bl:$(build.artifactstagingdirectory)/SampleNet6-dual-win.binlog
displayName: Build StaticLinking.Aot.Net6 Sample (dual obfuscation)
- pwsh: |
$(build.sourcesdirectory)\build\scripts\run-tests-windows.ps1 `
- "$(build.sourcesdirectory)\src\Uno.Wasm.StaticLinking.Aot.Net6\bin\Release\net6.0\dist" `
+ "$(build.sourcesdirectory)\src\Uno.Wasm.StaticLinking.Aot.Net6\bin\Release\net9.0\publish\wwwroot" `
"$(build.sourcesdirectory)\src\Uno.Wasm.StaticLinking.Aot.UITests" `
"http://localhost:8000/"
@@ -175,13 +160,13 @@ jobs:
# Static linking test (net5)
- pwsh: |
cd $(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.Aot.Net6
- dotnet clean -c Release /p:DISABLE_CLIHOST_NET6=true
- dotnet publish -c Release /m:1 /p:DISABLE_CLIHOST_NET6=true /p:WasmShellEmccLinkOptimization=false /bl:$(build.artifactstagingdirectory)/SampleNet5-win.binlog
+ dotnet clean -c Release
+ dotnet publish -c Release /m:1 /p:WasmShellEmccLinkOptimization=false /bl:$(build.artifactstagingdirectory)/SampleNet5-win.binlog
displayName: Build StaticLinking.Aot Sample (net5)
- pwsh: |
$(build.sourcesdirectory)\build\scripts\run-tests-windows.ps1 `
- "$(build.sourcesdirectory)\src\Uno.Wasm.StaticLinking.Aot.Net6\bin\Release\net6.0\dist" `
+ "$(build.sourcesdirectory)\src\Uno.Wasm.StaticLinking.Aot.Net6\bin\Release\net9.0\publish\wwwroot" `
"$(build.sourcesdirectory)\src\Uno.Wasm.StaticLinking.Aot.UITests" `
"http://localhost:8000/"
@@ -192,13 +177,13 @@ jobs:
# Static linking test (net7)
- pwsh: |
cd $(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.net7
- dotnet clean -c Release /p:DISABLE_CLIHOST_NET6=true
- dotnet publish -c Release /m:1 /p:DISABLE_CLIHOST_NET6=true /p:WasmShellEmccLinkOptimization=false /bl:$(build.artifactstagingdirectory)/SampleNet7-win.binlog
+ dotnet clean -c Release
+ dotnet publish -c Release /m:1 /p:WasmShellEmccLinkOptimization=false /bl:$(build.artifactstagingdirectory)/SampleNet7-win.binlog
displayName: Build StaticLinking.Aot Sample (net7)
- pwsh: |
$(build.sourcesdirectory)\build\scripts\run-tests-windows.ps1 `
- "$(build.sourcesdirectory)\src\Uno.Wasm.StaticLinking.Net7\bin\Release\net7.0\dist" `
+ "$(build.sourcesdirectory)\src\Uno.Wasm.StaticLinking.Net7\bin\Release\net9.0\publish\wwwroot" `
"$(build.sourcesdirectory)\src\Uno.Wasm.StaticLinking.Aot.UITests" `
"http://localhost:8000/"
@@ -214,20 +199,20 @@ jobs:
rm $(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.net7/obj -r -force
cd $(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.net7
- dotnet clean -c Release /p:DISABLE_CLIHOST_NET6=true
- dotnet publish -c Release /m:1 /p:DISABLE_CLIHOST_NET6=true /p:WasmShellEmccLinkOptimization=false /bl:$(build.artifactstagingdirectory)/SampleNet7-win-nuget-space.binlog
+ dotnet clean -c Release
+ dotnet publish -c Release /m:1 /p:WasmShellEmccLinkOptimization=false /bl:$(build.artifactstagingdirectory)/SampleNet7-win-nuget-space.binlog
displayName: Build StaticLinking with nuget space
# Embedded mode test (net6)
- pwsh: |
cd $(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.Embedded
- dotnet clean -c Release /p:DISABLE_CLIHOST_NET6=true
- dotnet publish -c Release /m:1 /p:DISABLE_CLIHOST_NET6=true /p:WasmShellEmccLinkOptimization=false /bl:$(build.artifactstagingdirectory)/SampleEmbedded-win.binlog
+ dotnet clean -c Release
+ dotnet publish -c Release /m:1 /p:WasmShellEmccLinkOptimization=false /bl:$(build.artifactstagingdirectory)/SampleEmbedded-win.binlog
displayName: Build StaticLinking.Embedded Sample (net6)
- pwsh: |
$(build.sourcesdirectory)\build\scripts\run-tests-windows.ps1 `
- "$(build.sourcesdirectory)\src\Uno.Wasm.StaticLinking.Embedded\bin\Release\net6.0\dist" `
+ "$(build.sourcesdirectory)\src\Uno.Wasm.StaticLinking.Embedded\bin\Release\net9.0\publish\wwwroot" `
"$(build.sourcesdirectory)\src\Uno.Wasm.StaticLinking.Aot.UITests" `
"http://localhost:8000/"
@@ -238,40 +223,42 @@ jobs:
# Thread test Debug build for emscripten LTO issue
- pwsh: |
cd $(build.sourcesdirectory)/src/Uno.Wasm.Threads
- dotnet clean -c Debug /p:DISABLE_CLIHOST_NET6=true
- dotnet publish -c Debug /m:1 /p:DISABLE_CLIHOST_NET6=true /p:WasmShellEmccLinkOptimization=false /bl:$(build.artifactstagingdirectory)/sample.threads-win-debug.binlog
+ dotnet clean -c Debug
+ dotnet publish -c Debug /m:1 /p:WasmShellEmccLinkOptimization=false /bl:$(build.artifactstagingdirectory)/sample.threads-win-debug.binlog
displayName: Build Threading Sample
# Thread test
- pwsh: |
cd $(build.sourcesdirectory)/src/Uno.Wasm.Threads
- dotnet clean -c Release /p:DISABLE_CLIHOST_NET6=true
- dotnet publish -c Release /m:1 /p:DISABLE_CLIHOST_NET6=true /p:WasmShellEmccLinkOptimization=false /bl:$(build.artifactstagingdirectory)/sample.threads-win-release.binlog
+ dotnet clean -c Release
+ dotnet publish -c Release /m:1 /p:WasmShellEmccLinkOptimization=false /bl:$(build.artifactstagingdirectory)/sample.threads-win-release.binlog
displayName: Build Threading Sample
- pwsh: |
$(build.sourcesdirectory)\build\scripts\run-tests-windows.ps1 `
- "$(build.sourcesdirectory)\src\Uno.Wasm.Threads\bin\Release\net8.0\dist" `
+ "$(build.sourcesdirectory)\src\Uno.Wasm.Threads\bin\Release\net9.0\publish\wwwroot" `
"$(build.sourcesdirectory)\src\Uno.Wasm.Threading.UITests" `
"http://localhost:8000/"
displayName: Threading Tests
+ condition: eq( variables['THREAD_TESTING'], 'true' )
env:
BUILD_SOURCESDIRECTORY: "$(build.sourcesdirectory)"
# Thread AOT test
- pwsh: |
cd $(build.sourcesdirectory)/src/Uno.Wasm.Threads.Aot
- dotnet clean -c Release /p:DISABLE_CLIHOST_NET6=true
- dotnet publish -c Release /m:1 /p:DISABLE_CLIHOST_NET6=true /p:WasmShellEmccLinkOptimization=false /bl:$(build.artifactstagingdirectory)/sample.threads-win.binlog
+ dotnet clean -c Release
+ dotnet publish -c Release /m:1 /p:WasmShellEmccLinkOptimization=false /bl:$(build.artifactstagingdirectory)/sample.threads-win.binlog
displayName: Build Threading AOT Sample
- pwsh: |
$(build.sourcesdirectory)\build\scripts\run-tests-windows.ps1 `
- "$(build.sourcesdirectory)\src\Uno.Wasm.Threads.Aot\bin\Release\net6.0\dist" `
+ "$(build.sourcesdirectory)\src\Uno.Wasm.Threads.Aot\bin\Release\net9.0\publish\wwwroot" `
"$(build.sourcesdirectory)\src\Uno.Wasm.Threading.UITests" `
"http://localhost:8000/"
displayName: Threading AOT Tests
+ condition: eq( variables['THREAD_TESTING'], 'true' )
env:
BUILD_SOURCESDIRECTORY: "$(build.sourcesdirectory)"
diff --git a/build/ci/stage-build-wsl-tests.yml b/build/ci/stage-build-wsl-tests.yml
deleted file mode 100644
index 134f42ba4..000000000
--- a/build/ci/stage-build-wsl-tests.yml
+++ /dev/null
@@ -1,115 +0,0 @@
-parameters:
- jobName: ''
-
-jobs:
-- job: WSL_Tests
- timeoutInMinutes: 90
-
- pool:
- vmImage: 'windows-2022'
-
- workspace:
- clean: all
-
- steps:
- - checkout: self
- clean: true
-
- - pwsh: |
- # Set-PSDebug -Trace 1
-
- # Workaround from https://github.com/actions/runner-images/issues/6844#issuecomment-1367225048
- # At the time of this comment (30-12-2022) this only works on Azure DevOps hosted
- # agents and doesn't work on 1ES images
- Write-Host "wsl --update --web-download"
- wsl --update --web-download | Out-String
-
- Write-Host "wsl --version"
- wsl --version
-
- write-host "WSL install of ubuntu."
- # wsl --install -d Ubuntu-22.04 --web-download # Similar to https://github.com/Azure/azure-sdk-for-cpp/issues/4397
-
- #
- # Manual installation of Ubuntu 20.04
- #
- $url = "https://aka.ms/wslubuntu2004" # URL of the file to download
- $appxInstaller = "$env:TEMP\appx-install" # Folder where the uncompressed files will be saved
- $distroInstaller = "$env:TEMP\wsl-install" # Folder for the inner
-
- mkdir $appxInstaller
- mkdir $distroInstaller
-
- # Download the file
- Invoke-WebRequest $url -OutFile "$appxInstaller\distro.zip"
-
- # Uncompress the file
- Expand-Archive -Path "$appxInstaller\distro.zip" -DestinationPath $appxInstaller
-
- Expand-Archive -Path "$appxInstaller\Ubuntu*_x64.appx" -DestinationPath $distroInstaller
-
- & $distroInstaller\ubuntu.exe install --root
-
- #
- # End Manual install
- #
-
- write-host "Launch WSL."
- $wsl = wsl -l -v | out-string
-
- write-host $wsl
-
- # workaround for encoding issue: https://github.com/microsoft/terminal/issues/110
- while ($wsl -notmatch "R`0u`0n`0n`0i`0n`0g") {
- start-sleep -seconds 1
- $wsl = wsl -l -v | out-string
- write-host $wsl
- }
- write-host "Ubuntu installed."
-
- displayName: Install WSL
-
- - pwsh: |
- wsl wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
- wsl sudo dpkg -i packages-microsoft-prod.deb
- wsl rm packages-microsoft-prod.deb
- wsl sudo apt-get update
- wsl sudo apt-get install -y ninja-build lbzip2
- wsl sudo apt-get install -y dotnet-sdk-7.0
- displayName: Install WSL dependencies
-
- - task: UseDotNet@2
- displayName: 'Use .NET SDK'
- inputs:
- packageType: sdk
- version: 8.0.100
- includePreviewVersions: true
-
- - pwsh: |
- cd $(build.sourcesdirectory)/src/Uno.Wasm.Bootstrap
- dotnet msbuild /r /p:Configuration=Release /p:DISABLE_CLIHOST_NET6=true
- displayName: Build bootstrap
-
- # Static linking test (WSL Forced)
- - pwsh: |
- cd $(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.net7
- dotnet clean -c Release /p:DISABLE_CLIHOST_NET6=true
- dotnet publish -c Release /m:1 /p:DISABLE_CLIHOST_NET6=true /p:WasmShellEnableEmscriptenWindows=false /p:WasmShellEmccLinkOptimization=false /bl:$(build.artifactstagingdirectory)/SampleNet7-win-wsl.binlog
- displayName: Build StaticLinking.Aot Sample (net7 WSL Forced)
-
- - pwsh: |
- $(build.sourcesdirectory)\build\scripts\run-tests-windows.ps1 `
- "$(build.sourcesdirectory)\src\Uno.Wasm.StaticLinking.Net7\bin\Release\net7.0\dist" `
- "$(build.sourcesdirectory)\src\Uno.Wasm.StaticLinking.Aot.UITests" `
- "http://localhost:8000/"
-
- displayName: StaticLinking.Aot Tests net7
- env:
- BUILD_SOURCESDIRECTORY: "$(build.sourcesdirectory)"
-
- - task: PublishBuildArtifacts@1
- condition: always()
- inputs:
- PathtoPublish: $(build.artifactstagingdirectory)
- ArtifactName: uno-wasm-bootstrap-windows-test
- ArtifactType: Container
diff --git a/doc/debugger-support.md b/doc/debugger-support.md
index e24c06203..2008d0119 100644
--- a/doc/debugger-support.md
+++ b/doc/debugger-support.md
@@ -4,75 +4,11 @@ uid: UnoWasmBootstrap.Features.Debugger
# .NET for WebAssembly Debugger Support
-Debugging is supported through the integration of a .NET Core CLI component, which acts as a static files server, as well as a debugger proxy for Chrome (other browsers are not supported).
+Debugging is support is provided by .NET, using the WasmApp host.
-## Enable the Debugger support
+## AOT Debugging and mono tracing
-In order to debug an **Uno.Wasm.Bootstrap** enabled project, the Mono runtime debugger must be enabled:
-
-```xml
-
- true
-
-```
-
-Debug symbols need to be emitted and be of the type `portable`:
-
-```xml
-
- portable
- true
-
-```
-
-Finally, the `DEBUG` constant must be defined
-
-```xml
-
- $(DefineConstants);TRACE;DEBUG
-
-```
-
-Doing so will enable the deployment of `pdb` files to the browser, and allow for the mono debugger proxy to use them.
-
-For the time being, you will also need to make sure that mscorlib is disabled in the Linker configuration file:
-
-```xml
-
-
-
-```
-
-.NET for WebAssembly now has integrated **preliminary** support for in-browser debugging. Refer to
-[this document for up-to-date information](https://github.com/dotnet/runtime/blob/main/docs/workflow/debugging/mono/wasm-debugging.md) on how to set up the debugging.
-
-## How to use the Browser debugger
-
-The bootstrapper also supports debugging directly in the browser debugging tools.
-
-In Visual Studio:
-
-- Make your project the startup project (right-click **set as startup**)
-- In the debugging toolbar:
- - Select **IIS Express** as the debugging target
- - Select **Chrome** as the Web Browser
- - Make sure script debugging is disabled
-- Start the debugging session using F5 (or Start Debug)
-- Once your application has started, press `Alt+Shift+D`
-- Follow the instructions on the web page
-- You may need to refresh the original tab if you want to debug the entry point (Main) of your application.
-
-## Debugger troubleshooting
-
-The debugger is still under development, and here are a few things to look for:
-
-- Breakpoints set sometimes disappear when the debugged page is reloaded
-- If none of your assemblies appear in the debugger window, it's generally caused
-by the debugger caching previously loaded files. Make sure to hit Ctrl+Shit+R to force reload the debugged page.
-
-## AOT Debugging and mono tracing (.NET 5 only)
-
-When running with PG-AOT, exceptions generally do not provide stack traces, as WebAssembly as of the MVP does not yet support stack walking.
+When running with AOT or Profiled AOT, exceptions generally do not provide complete stack traces, as WebAssembly as of the MVP does not yet support stack walking.
For the time being, it's still possible to view browser stack traces in the log by enabling mono tracing.
diff --git a/doc/deploy-and-publish.md b/doc/deploy-and-publish.md
index 1bbd278f3..414b06a98 100644
--- a/doc/deploy-and-publish.md
+++ b/doc/deploy-and-publish.md
@@ -6,9 +6,23 @@ uid: UnoWasmBootstrap.Features.Publish
The easiest way to publish the build results is to use the Visual Studio publish menu on your project. This will allow to use all the features provided by the standard experience, as described in the [Deploy to Azure App Service](https://docs.microsoft.com/en-us/visualstudio/deployment/quickstart-deploy-to-azure?view=vs-2017).
-The publication of the application must be done in .NET Framework hosting (and not .NET Core), as the app uses the `web.config` file for the server configuration, and to enable the use of pre-compression.
+In the command line, to publish the app, use the following:
-For deeper integration in the publishing pipeline, the `WasmShellOutputPackagePath` property is defined by the bootstrapper after the `BuildDist` target, which contains the path to the generated `package_XXX` content.
+```bash
+dotnet publish
+```
+
+The app will be located in the `bin/Release/net9.0/publish/wwwroot` folder. More information about `dotnet publish` can be [found in the Microsoft docs](https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-publish).
+
+## Localization publishing
+
+By default, the .NET runtime does not load all resource assemblies, but if you want to load all resources regardless of the user's culture, you can add the following to your project file:
+
+```xml
+
+ true
+
+```
## Integration with ASP.NET Core
@@ -29,18 +43,3 @@ In order to host an Uno Platform App, you'll need to the following:
- Add a project reference to the `Wasm` project
- Build and deploy `MyApp.Server`
-
-## Serve the Wasm app through Windows Linux Subsystem
-
-Using Windows 10/11, serving the app through a small Web Server is done through WSL.
-
-Here's how to install it:
-
-- Search for Ubuntu in the Microsoft Store: https://apps.microsoft.com/store/search/ubuntu
-- Install Ubuntu 18.04 or later, and follow the instructions during the first run
- - If you have another distribution installed make sure that the 18.04 is the default using `wslconfig /s "Ubuntu-20.04"`. You can list your active distributions with `wslconfig /l`
- - Note that WSL 2 is considerably slower than WSL 1 for the bootstrapper scenario. You will need to set your distribution to version 1 using `wsl --set-version "Ubuntu-20.04" 1`.
-- Once you've built your project, you should see a path to the project dll
-- In the Ubuntu shell, type ``cd `wslpath "[the_path_to_your_bin_folder]\dist"` ``
-- Type `python3 server.py`
- - If this command does not exist, run the following `sudo apt-get install python3`
diff --git a/doc/features-additional-files.md b/doc/features-additional-files.md
index 2f393143d..0c0763f05 100644
--- a/doc/features-additional-files.md
+++ b/doc/features-additional-files.md
@@ -56,7 +56,7 @@ Exclusions:
```
-Asset files: `dist/package_XXXX/uno-assets.txt` contains the package relative paths of the content files that were copied to the `dist/package_XXXX` folder. It can be used to identify which assets are packaged with the application at runtime and avoid costly probing operations. Important: Will only contain files deployed in `UnoDeploy="Package"` mode.
+Asset files: `wwwroot/uno-assets.txt` contains the package relative paths of the content files that were copied to the `wwwroot` folder. It can be used to identify which assets are packaged with the application at runtime and avoid costly probing operations. Important: Will only contain files deployed in `UnoDeploy="Package"` mode.
A few files extensions are excluded (`UnoDeploy="None")`by default such as `*.a`, `*.bc`.
`.html` files are those named `web.config` will default to `UnoDeploy="Root"`.
diff --git a/doc/features-interop.md b/doc/features-interop.md
index 4491e4461..d9d9a3567 100644
--- a/doc/features-interop.md
+++ b/doc/features-interop.md
@@ -13,8 +13,6 @@ Two techniques are available:
## Invoking C# code from Javascript
-### [**.NET 7 JSExport**](#tab/net7)
-
.NET 7 introduces the [`[JSExportAttribute]`](https://learn.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.javascript.jsexportattribute?view=net-7.0) which allows for Javascript to invoke C# static methods in a memory, threading and performance efficient way.
> [!IMPORTANT]
@@ -46,42 +44,9 @@ async function invokeCSMethod() {
invokeCSMethod();
```
-### [**.NET 6 `mono_bind_static_method`**](#tab/jseval)
-
-In your C# project (named `MyApp` for this example), add the following class:
-
-```csharp
-namespace MyNamespace;
-
-public static partial class Exports
-{
- public static string MyExportedMethod()
- {
- return $"Invoked";
- }
-}
-```
-
-Then in your Javascript, add the following:
-
-```js
-var myExportedMethod = Module.mono_bind_static_method("[MyApp] MyNamespace.Exports:MyExportedMethod");
-var result = myExportedMethod();
-```
-
-> [!IMPORTANT]
-> The interop infrastructure only supports primitive types for parameters and return value.
->
-> [!IMPORTANT]
-> This type of interop is not compatible with [strict CSP](xref:Uno.Wasm.Bootstrap.Security).
-
----
-
## Invoking Javascript code from C#
-### [**.NET 7 JSImport**](#tab/net7)
-
Invoking JS functions from C# can be done through [`[JSImportAttribute]`](https://learn.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.javascript.jsimportattribute?view=net-7.0).
> [!IMPORTANT]
@@ -108,36 +73,3 @@ function myJSMethod(){
```
In the C# code, call `Imports.MyJSMethod();` as you would any other method.
-
-### [**.NET 6 JSEval**](#tab/jseval)
-
-If you're not using Uno.UI, you'll need to define the following in the global namespace:
-
-```csharp
-internal sealed class Interop
-{
- internal sealed class Runtime
- {
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- public static extern string InvokeJS(string str, out int exceptional_result);
- }
-}
-```
-
-Then in your Javascript, add the following:
-
-```js
-function myJSMethod(){
- console.log("myJSMethod invoked!");
-}
-```
-
-And can be used from C# with:
-
-```cs
-InvokeJS("myJSMethod()");
-```
-
-Note that the interop only supports strings as the returned value, and parameters must formatted in the string passed to `InvokeJS`.
-
----
diff --git a/doc/features-module-linking.md b/doc/features-module-linking.md
index be62560cb..7ea7a7fe5 100644
--- a/doc/features-module-linking.md
+++ b/doc/features-module-linking.md
@@ -21,6 +21,8 @@ This allowing for p/invoke to be functional when resolving methods from the load
```
+The .NET SDK [`NativeFileReference`](https://learn.microsoft.com/en-us/aspnet/core/blazor/webassembly-native-dependencies) is also supported.
+
## WebAssembly Exceptions support
As of version 7.0 and later, WebAssembly Exceptions support is now required.
@@ -113,6 +115,8 @@ The file is provided as-is to `emcc` and its resulting object file is linked wit
This feature is meant to be used for small additions of native code. If more is needed (e.g. adding header directories, defines, options, etc...) it is best to use the emcc tooling directly.
+The .NET SDK [`NativeFileReference`](https://learn.microsoft.com/en-us/aspnet/core/blazor/webassembly-native-dependencies) is also supported to include C/C++ source files.
+
### Example
Here's an example of file:
diff --git a/doc/features-node-js.md b/doc/features-node-js.md
deleted file mode 100644
index 6bf0b60ab..000000000
--- a/doc/features-node-js.md
+++ /dev/null
@@ -1,30 +0,0 @@
----
-uid: UnoWasmBootstrap.NodeJS
----
-
-# Node.js support
-
-The bootstrapper supports having a project loaded as part of a node application. To do so:
-
-- Create a Wasm bootstrapper project, named `MyApp.Wasm`
-- Create a Node.js TypeScript project in Visual Studio, named `MyApp.Runner`
-- In bootstrapper project, add the following :
-
- ```xml
- ../MyApp.Runner/app
- node
- ```
-
-- In the `app.ts`, add the following:
-
- ```js
- require("./app/mono");
- ```
-
-Run the application and the main method of the `MyApp.Wasm` will be executed.
-
-The parameters of the node command line are provided to the app's main method when running the app as follows:
-
-```shell
-node app param1 param2
-```
diff --git a/doc/features-nuget-package-overrides.md b/doc/features-nuget-package-overrides.md
deleted file mode 100644
index 597811afd..000000000
--- a/doc/features-nuget-package-overrides.md
+++ /dev/null
@@ -1,18 +0,0 @@
----
-uid: UnoWasmBootstrap.PackageOverrides
----
-
-# Nuget package runtime overrides
-
-By default, when presented with an assembly present in both the runtime and a nuget package, the bootstrapper will favor the runtime's version of the assembly. This is generally required to avoid internal consistency errors with the runtime.
-
-In some rare cases though, it may still be required to override the runtime's version. To do this, you'll need to add the following to your csproj:
-
-```xml
-
-
-
-
-```
-
-This will ensure that the System.Text.Json.dll assembly coming from an explicit `PackageReference` will be favored over the runtime version.
diff --git a/doc/features-obfuscation.md b/doc/features-obfuscation.md
deleted file mode 100644
index d72791a32..000000000
--- a/doc/features-obfuscation.md
+++ /dev/null
@@ -1,81 +0,0 @@
----
-uid: UnoWasmBootstrap.Features.Obfuscation
----
-
-# Assemblies obfuscation
-
-The Bootstrapper provides a way to obfuscate served assemblies in order to avoid incorrect flagging by anti-virus and firewalls.
-
-## Description
-
-Assemblies currently a critical part of the behavior of .NET, [even when using AOT](runtime-execution-modes.md). Original assemblies are still required for metadata (Reflection) and non-AOTable pieces of code (as of .NET 7, part of try/catch/finally blocks).
-
-The Uno bootstrapper packages .NET assemblies as part of the final generated web content. Those files are fetched the application directly and the default extension used by the bootstrapper for these files are `.clr` as a minimal attempt to avoid blocking.
-
-## Changing the assemblies extensions
-
-This feature allows to change the `.clr` extension for another extension. Add the following to your `csproj` file:
-
-```xml
-
- .custom
-
-```
-
-> [!NOTE]
-> Changing this extension requires the adjustment of `web.config` or `staticwebapp.config.json` to provide the proper `application/octet-stream` mime type.
->
-> [!NOTE]
-> As of Bootstrapper 7.0, changing the extension does not permit local Visual Studio debugging and serving. Using [dotnet-serve](https://github.com/natemcmaster/dotnet-serve) is required.
-
-## Extension-less mode for assemblies
-
-This feature allows to remove the extension from the assemblies URI, by removing all `.` from the assembly file names.
-
-Add the following to your `csproj` file:
-
-```xml
-
- NoDots
-
-```
-
-Note that serving extension-less files requires a special fallback in servers:
-
-- For IIS:
-
- ```xml
-
- ...
-
-
- ```
-
-- For ASP.NET Core, using a [`StaticFileOptions`](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.builder.staticfileoptions?view=aspnetcore-7.0)
-
- ```csharp
- app.UseStaticFiles(new StaticFileOptions
- {
- ...
- DefaultContentType = MediaTypeNames.Application.Octet,
- ServeUnknownFileTypes = true
- });
- ```
-
-## Obfuscating the contents of assemblies
-
-This feature allows to change the contents of the files using a simple XOR transformation applied to the generated site.
-
-> [!WARNING]
-> Ensure that enabling this feature is conforming to the requirements of the deployment environment, commonly defined by an IT department.
-
-To use this feature, add the following to your `csproj` file:
-
-```xml
-
- true
-
-```
-
-> [!WARNING]
-> Enabling this feature has an impact on the startup time of the application, as additional process is required to de-obfuscate the downloaded assemblies.
diff --git a/doc/features-pre-compression.md b/doc/features-pre-compression.md
index 7892ef07e..3d9930f15 100644
--- a/doc/features-pre-compression.md
+++ b/doc/features-pre-compression.md
@@ -4,42 +4,4 @@ uid: UnoWasmBootstrap.Features.PreCompression
# Pre-Compression support
-Pre-compression has two modes:
-
-- In-place, where Brotli compressed files are placed next to original files
-- Legacy, where a `web.config` file url rewriter rule is used
-
-The parameters for the pre-compression are as follows:
-
-- `WasmShellGenerateCompressedFiles` which can be `true` or `false`. This property is ignored when building `MonoRuntimeDebuggerEnabled` is set to `true`, and `true` by default when the `Configuration` property is set to `Release`
-- `WasmShellCompressedExtension` is an item group which specifies which files to compress. By default, the `wasm`, `clr`, `js`, `json`, `css`, `html`, `dat`, `ttf`, and `txt` files are pre-compressed. More files can be added as follows:
-
- ```xml
-
-
-
- ```
-
-- `WasmShellBrotliCompressionQuality` which controls the compression quality used to pre-compress the files. Possible values are in the range from `0` to `11`. The default value is `7`.
-
- > [!WARNING]
- > Two-digit compression quality values (`10` and higher) are intended for extra-intensive CPU usage and can significantly slow down build time.
-
-- `WasmShellCompressionLayoutMode` which can be set to `InPlace` or `Legacy`. If not set and for backward compatibility reasons, `Legacy` is automatically selected if a `web.config` file is detected in the layout, and contains the `_compressed_br` string.
-
-## Support for in-place compression
-
-This mode is to be preferred for web servers that support `accept-encoding` header file rewriting. In the case of [**Azure Static WebApps**](https://docs.microsoft.com/en-us/azure/static-web-apps/get-started-portal), if a file next to the original one is suffixed with `.br`, and the client requested for brotli compressed files, the in-place compressed file will be served.
-> [!NOTE]
-> To achieve the same behavior in a standalone ASP.NET Core application the [CompressedStaticFiles](https://github.com/AnderssonPeter/CompressedStaticFiles) third-party library can be used.
-
-## Support for IIS / Azure WebApp GZip/Brotli pre-compression
-
-The IIS compression support has too many knobs for the size of generated WebAssembly files, which
-makes the serving of static files inefficient.
-
-The Bootstrapper tooling will generate two folders `_compressed_gz` and `_compressed_br` which contain compressed versions of the main files. A set IIS rewriting rules are used to redirect the queries to the requested pre-compressed files, with a preference for Brotli.
-
-When building an application, place [the following file](src/Uno.Wasm.SampleNet6/wwwroot/web.config) in the `wwwroot` folder to automatically enable the use of pre-compressed files.
-
-Note that the pre-compressed files are optional, and if the rewriting rules are removed or not used (because the site is served without IIS), the original files are available at their normal locations.
+Pre-compression support is provided by the .NET SDK, using the `EnableDefaultCompressedItems` feature.
diff --git a/doc/features-prefetch.md b/doc/features-prefetch.md
deleted file mode 100644
index 956479320..000000000
--- a/doc/features-prefetch.md
+++ /dev/null
@@ -1,11 +0,0 @@
----
-uid: UnoWasmBootstrap.Features.Prefetch
----
-
-# Support for Content prefetching
-
-The `WashShellGeneratePrefetchHeaders` controls the generation of ` ` nodes in the index.html header.
-
-It is disabled by default and allows for the browser to efficiently fetch the applications WebAssembly and .NET assemblies files, while the JavaScript and WebAssembly runtimes are being initialized.
-
-This prefetching feature is particularly useful if the HTTP server supports HTTP/2.0.
diff --git a/doc/features-security.md b/doc/features-security.md
index a58675a41..7c7bb34d8 100644
--- a/doc/features-security.md
+++ b/doc/features-security.md
@@ -33,7 +33,7 @@ Enabling CSP support can be done in three ways:
> [!IMPORTANT]
> The Uno.Wasm.Bootstrap package uses WebAssembly, it is required to provide the [`wasm-unsafe-eval`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src#unsafe_webassembly_execution) directive in the CSP configuration.
-Enabling CSP without `unsafe-eval` implies that the application will not be able to use [Runtime.JSInvoke](xref:Uno.Wasm.Bootstrap.JSInterop), and [JSImport/JSExport](xref:Uno.Wasm.Bootstrap.JSInterop) must be used instead.
+Enabling CSP without `unsafe-eval` implies that the application will not be able to use JavaScript's `eval()`, and [JSImport/JSExport](xref:Uno.Wasm.Bootstrap.JSInterop) must be used instead.
### Validation
diff --git a/doc/features-simd.md b/doc/features-simd.md
index fd190ed44..bc8b325b9 100644
--- a/doc/features-simd.md
+++ b/doc/features-simd.md
@@ -20,6 +20,8 @@ With .NET 8, SIMD support is enabled by default and can be disabled using:
```
+The .NET SDK [`WasmEnableSIMD`](https://learn.microsoft.com/en-us/aspnet/core/blazor/webassembly-build-tools-and-aot?view=aspnetcore-8.0#single-instruction-multiple-data-simd) property is also supported.
+
[WebAssembly Support for SIMD](https://github.com/webassembly/simd) enables faster execution for specialized pieces of code, and .NET increasingly uses those instructions to make applications run faster.
You can take a look at [this article](https://platform.uno/blog/safari-16-4-support-for-webassembly-fixed-width-simd-how-to-use-it-with-c/) for more information.
diff --git a/doc/linker-configuration.md b/doc/linker-configuration.md
index 9fd68bf27..2a00b62a1 100644
--- a/doc/linker-configuration.md
+++ b/doc/linker-configuration.md
@@ -40,7 +40,9 @@ It is also possible to provide the linker file as an embedded resource, which is
```
-The Linker can be disabled completely by setting the `WasmShellILLinkerEnabled` property to false. This property has no effect when building with AOT enabled.
+The Linker can be disabled completely by setting the `WasmShellILLinkerEnabled` or `PublishTrimmed` property to false. This property has no effect when building with AOT enabled.
+
+The .NET SDK configuration [options are also supported](https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/trim-self-contained).
## .NET 5 Feature Linker Configuration
diff --git a/doc/runtime-execution-modes.md b/doc/runtime-execution-modes.md
index dbd312fec..e220b410f 100644
--- a/doc/runtime-execution-modes.md
+++ b/doc/runtime-execution-modes.md
@@ -4,7 +4,7 @@ uid: Uno.Wasm.Bootstrap.Runtime.Execution
# Runtime Execution Modes
-The mono for WebAssembly runtime provides three execution modes, Interpreter, AOT (Ahead of Time), and Mixed Mode Interpreter/AOT.
+The mono for WebAssembly runtime provides three execution modes, Interpreter, and Mixed Mode Interpreter/AOT (Ahead of Time).
The execution mode can be set as follows:
@@ -17,8 +17,6 @@ The possible values are:
- `Interpreter` (the default mode)
- `InterpreterAndAOT`
-To setup your machine to use AOT modes on Windows, you will need to install [Python from Windows Store](https://www.microsoft.com/store/productId/9P7QFQMJRFP7), or manually through [Python's official site](https://www.python.org/downloads/).
-
## Interpreter mode
This mode is the slowest but allows for great flexibility and debugging, as well as an efficient payload size.
@@ -51,17 +49,20 @@ Finally, runtime statistics are maintained by the jiterpreter and can be display
This mode enables AOT compilation for most of the assemblies, with [some specific exceptions](https://github.com/dotnet/runtime/issues/50609).
-> [!IMPORTANT]
-> This mode is not supported on macOS. You'll need to use a [Linux container](https://hub.docker.com/r/unoplatform/wasm-build) to build with AOT, see below for more details.
+By default, this mode is only enabled when running `dotnet publish`.
+
+To enable AOT compilation on normal builds, use the following:
+
+```xml
+
+ true
+
+```
### Required configuration for Mixed AOT Mode or static linking on Linux
-- Ubuntu 18.04+ or a [container](https://hub.docker.com/r/unoplatform/wasm-build)
-- A [stable build of mono](https://www.mono-project.com/download/stable/#download-lin)
+- Ubuntu 20.04+ or a [container](https://hub.docker.com/r/unoplatform/wasm-build)
- A [.NET SDK](https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu) >= 6.0
-- ninja: `apt-get install ninja-build`
-
-The easiest is to build using the environment provided by the [unoplatform/wasm-build docker image](https://hub.docker.com/r/unoplatform/wasm-build).
## Profile Guided AOT
@@ -69,7 +70,7 @@ This mode allows for the AOT engine to selectively optimize methods to WebAssemb
This feature is used in two passes:
-- The first pass needs the creation of a profiled interpreter build, which records any methods invoked during the profiling session.
+- The first pass needs the creation of a profiled interpreted build, which records any methods invoked during the profiling session.
- The second pass rebuilds the application using the Mixed AOT/Interpreter mode augmented by the recording created during the first pass.
This mode gives very good results, where the RayTracer sample of this repository goes from an uncompressed size of 5.5MB to 2.9MB.
@@ -82,12 +83,6 @@ To create a profiled build:
true
```
-- In your `LinkerConfig.xml` file, add the following:
-
- ```xml
-
- ```
-
- Run the application once, without the debugger (e.g. Ctrl+F5)
- Navigate throughout the application in high-usage places.
- Once done, either:
@@ -187,59 +182,3 @@ In order to fix this, you'll need to set the [`INITIAL_MEMORY`](https://emscript
```
which will set the initial memory size accordingly. Note that setting this value to a sufficiently large value (based on your app's usual memory consumption) can improve the startup performance.
-
-## Required configuration for AOT, Mixed Mode, or external bitcode support compilation on Windows 10
-
-### Native windows tooling
-
-This is the default mode on Windows. It requires installing [Python from Windows Store](https://www.microsoft.com/store/productId/9P7QFQMJRFP7), or manually through [Python's official site](https://www.python.org/downloads/).
-
-This mode is compatible with CI servers that have Python installed by default, such as [Azure Devops Hosted Agents](https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops).
-
-#### Powershell setup
-
-The bootstrapper needs to use PowerShell, and configuration is needed.
-
-You'll need to run the following command in an elevated (administrator) PowerShell prompt:
-
-```pwsh
-Set-ExecutionPolicy RemoteSigned -Force
-```
-
-You may also need to enable the developer mode for Windows 10 and 11 by using **Control panel** / **System** / **Privacy & Security** / **For developers** / **PowerShell** and setting **Change execution policy to allow local scripts to run without signing** to **On**.
-
-### Using Windows Subsystem for Linux
-
-This mode can be enabled by adding this property to the `csproj`:
-
-```xml
-
- false
-
-```
-
-Requirements:
-
-- A Windows 10 machine with [WSL 1 or 2 with Ubuntu 20.04](https://docs.microsoft.com/en-us/windows/wsl/install-win10) installed.
-- A [stable build of mono](https://www.mono-project.com/download/stable/#download-lin)
-- A [.NET SDK](https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu) >= 3.1
-- ninja: `apt-get install ninja-build` in WSL
-
-If you have another distribution installed make sure that the 20.04 is the default using `wslconfig /s "Ubuntu-20.04"`. You can list your active distributions with `wslconfig /l`
-Note that WSL 2 is considerably slower than WSL 1 for the bootstrapper scenario. You will need to set your distribution to version 1 using `wsl --set-version "Ubuntu-20.04" 1`.
-
-During the first use of WSL, if the environment is not properly setup, you will be guided to run the [`dotnet-setup.sh`](xref:dotnet-setup.sh) script that will install Mono, .NET Core and some additional dependencies.
-
-The emscripten installation is automatically done as part of the build.
-
-The bootstrapper uses its own installation of emscripten, installed by default in `$HOME/.uno/emsdk` in the WSL filesystem. This can be globally overridden by setting the `WASMSHELL_WSLEMSDK` environment variable.
-
-### WSL Integration for Windows 10
-
-The integration with WSL provides a way to use AOT, Mixed mode, or external bitcode support using Windows 10.
-
-This feature is active only if one of those condition is true:
-
-- The `WasmShellMonoRuntimeExecutionMode` property is `InterpreterAndAOT`
-- There is a `*.bc` or `*.a` file in the `Content` item group
-- The `WasmShellForceUseWSL` is set to `true`
diff --git a/doc/toc.yml b/doc/toc.yml
index c3e525294..4c22f5107 100644
--- a/doc/toc.yml
+++ b/doc/toc.yml
@@ -9,8 +9,6 @@ items:
href: linker-configuration.md
- name: Runtime Execution Modes
href: runtime-execution-modes.md
-- name: Troubleshooting
- href: troubleshooting.md
- name: Features
items:
@@ -44,20 +42,12 @@ items:
href: features-simd.md
- name: Profiling
href: features-profiling.md
- - name: Node JS
- href: features-node-js.md
- - name: Nuget package overrides
- href: features-nuget-package-overrides.md
- - name: Prefetching
- href: features-prefetch.md
- name: PWA Support
href: features-pwa.md
- name: 4GB Support
href: features-4gb.md
- name: HttpRequestMessage Extensions
href: features-httprequestmessage-extensions.md
- - name: Assemblies obfuscation
- href: features-obfuscation.md
- name: Tools
items:
diff --git a/doc/troubleshooting.md b/doc/troubleshooting.md
deleted file mode 100644
index fa32a07d9..000000000
--- a/doc/troubleshooting.md
+++ /dev/null
@@ -1,9 +0,0 @@
----
-uid: UnoWasmBootstrap.Features.Troubleshooting
----
-
-# Windows Long Path support
-
-The bootstrapper supports Windows 10 long paths by default, but there may be cases where the `\\?\` [path format](https://web.archive.org/web/20160818035729/https://blogs.msdn.microsoft.com/jeremykuhne/2016/06/21/more-on-new-net-path-handling/) may not be supported.
-
-In such a case, setting the `false ` in the project file can disable this feature.
diff --git a/doc/using-the-bootstrapper.md b/doc/using-the-bootstrapper.md
index 0d625a891..b939c4a3c 100644
--- a/doc/using-the-bootstrapper.md
+++ b/doc/using-the-bootstrapper.md
@@ -4,32 +4,34 @@ uid: UnoWasmBootstrap.Overview
# Using the bootstrapper
-Uno.Wasm.Bootstrap provides a simple way to package C# .NET code, and run it from a compatible browser environment.
+The Uno.Wasm.Bootstrap package provides a runtime bootstrapper of the `Microsoft.NET.Sdk.WebAssembly` SDK from .NET 9.
-It is a standalone .NET Web Assembly (Wasm) sdk bootstrapper taking the form of a nuget package.
+This package only provides the bootstrapping features to run a .NET assembly and write to the javascript console, through `Console.WriteLine`. To write an app that provides UI functionalities, make sur to check out https://aka.platform.uno/get-started.
-Installing it on a .NET project (5, 6 or .NET Standard 2.0) with an entry point allows to publish it as part of a Wasm distribution folder, along with CSS, Javascript and content files.
+This work is based on the excellent work from @praeclarum's [OOui Wasm MSBuild task](https://github.com/praeclarum/Ooui).
-This package only provides the bootstrapping features to run a .NET assembly and write to the javascript console, through `Console.WriteLine`.
+## Prepare your machine
-This package is based on the excellent work from @praeclarum's [OOui Wasm MSBuild task](https://github.com/praeclarum/Ooui).
+On the command line, type the following to install the WebAssembly workload:
-## How to use the bootstrapper with .NET 5 and later
+```bash
+dotnet workload install wasm-tools
+```
+
+## How to use the Bootstrapper with .NET 9 and later
-- Create a .NET 5 Console Application, and update it with the following basic definition:
+- Create a .NET 9 Console Application, and update it with the following basic definition:
```xml
-
+
Exe
- net5.0
- true
+ net9.0
-
-
+
@@ -47,15 +49,13 @@ This package is based on the excellent work from @praeclarum's [OOui Wasm MSBuil
}
```
-- In Visual Studio 2019, press `Ctrl+F5` to start without the debugger (this will create the `launchSettings.json` needed below for debugging)
+- In Visual Studio 2022, press `F5` to start with the debugger
- A browser window will appear with your application
- The output of the Console.WriteLine will appear in the javascript debugging console
-## How to use the Visual Studio 2019/2022 Debugger
+## How to use the Visual Studio 2022 Debugger
-Starting from **Visual Studio 2019 16.6**, it is possible to debug a WebAssembly app.
-
-To enable the debugging, add the following line to your `launchSettings.json` file:
+To enable the debugging, make sure that the following line is present in your `Properties/launchSettings.json` file:
```json
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}"
@@ -77,30 +77,51 @@ Once installed, launch the server by using the following command:
```bash
cd MyApp.Wasm
-dotnet serve -d bin\Debug\net5.0\dist -p 8000
+dotnet publish -c Debug
+dotnet serve -d bin\Debug\net9.0\publish\wwwroot -p 8000
```
You application will be available `http://localhost:8000`.
## Upgrading from previous versions of the Uno.Wasm.Bootstrap package
-Previously, the suggested project structure was a .NET Standard 2.0 project using the non-web projects SDK. To enable debugging and easier deployment, the support for `Microsoft.NET.Sdk.Web` has been added.
-
-To upgrade a project from 1.1 to 1.2:
+Moving from version 8.x to 9.x may require changing the used MSBuild SDK for your project.
-- If you had a ` ` line, remove it
-- Add the ` ` item in the same item group as the other nuget packages.
+- If your project contains `Sdk="Uno.Sdk"`, you will need to update the Uno.Sdk to 5.5 or later.
+- If your project contains `Sdk="Microsoft.NET.Sdk.Web"`, you'll need to change it to `Sdk="Microsoft.NET.Sdk.WebAssembly"`.
-To upgrade a project from 1.0 to 1.1:
+Once done, make sure to install the WebAssembly tools from .NET:
-- Change `Microsoft.NET.Sdk` to `Microsoft.NET.Sdk.Web` in the Sdk attribute of your project
-- Add the ` ` item in the same item group as the other nuget packages.
+```bash
+dotnet workload install wasm-tools
+```
-## Changing the .NET SDKs install location
+By default, the .NET runtime does not load all resource assemblies, but if you want to load all resources regardless of the user's culture, you can add the following to your project file:
-The SDKs are installed under `Path.GetTempPath()` by default, you may change this by setting the following msbuild property(or environment variable): `WasmShellMonoTempFolder`.
+```xml
+
+ true
+
+```
-For example, on Windows, setting `WasmShellMonoTempFolder` to `C:\MonoWasmSDKs`, the `mono-wasm-e351637985e` sdk would be installed under `C:\MonoWasmSDKs\mono-wasm-e351637985e`
+### Deprecated APIs
+
+- The `Uno.Wasm.Boostrap.DevServer` package is not needed anymore and can be removed
+- `WasmShellOutputPackagePath` has been removed. Use `$(PublishDir)`
+- `WasmShellOutputDistPath` has been removed. Use `$(PublishDir)`
+- `WasmShellBrotliCompressionQuality`, `WasmShellCompressedExtension` and `WasmShellGenerateCompressedFiles` have been removed, the compression is done by the .NET SDK
+- `WasmShellEnableAotGSharedVT` has been removed.
+- `WasmShellEnableEmscriptenWindows` has been removed, the .NET SDK manages emscripten
+- `WasmShellEnableLongPathSupport` has been removed, the .NET SDK manages the build
+- `WasmShellEnableNetCoreICU`has been removed, the .NET SDK manages localization
+- `WasmShellForceDisableWSL` and `WasmShellForceUseWSL` have been removed, Windows and Linux are supported natively by the .NET SDK.
+- `WashShellGeneratePrefetchHeaders` has been removed.
+- `WasmShellNinjaAdditionalParameters` has been removed, the .NET SDK manages the build
+- `WasmShellObfuscateAssemblies`, `WasmShellAssembliesExtension` and `AssembliesFileNameObfuscationMode` have been removed, the .NET SDK uses WebCIL to achieve the same result.
+- `WasmShellPrintAOTSkippedMethods` has been removed
+- `WasmShellPThreadsPoolSize` has been removed in favor of the official .NET SDK parameters
+- `MonoRuntimeDebuggerEnabled` has been removed, the .NET SDK manages the debugger
+- `WashShellUseFileIntegrity` has been removed, the .NET SDK manages the assets integrity
## Bootstrapper versions and .NET runtimes
@@ -109,10 +130,17 @@ Each major version of the bootstrapper targets a different version of the .NET R
- 2.x: Mono runtime (https://github.com/mono/mono)
- 3.x: .NET 6 (https://github.com/dotnet/runtime/commits/release/6.0)
- 7.x: .NET 7 (https://github.com/dotnet/runtime/commits/release/7.0)
-- 8.x-dev: .NET 8 (https://github.com/dotnet/runtime/commits/main)
+- 8.0: .NET 8 (https://github.com/dotnet/runtime/commits/release/8.0)
+- 9.0: .NET 9 (https://github.com/dotnet/runtime/commits/release/9.0)
> [!NOTE]
-> Starting from version 3.x, the bootstrapper uses a custom build of the runtime, maintained here: https://github.com/unoplatform/Uno.DotnetRuntime.WebAssembly
+> Between version 3.x and 8.x, the bootstrapper is using custom builds of the runtime, maintained here: https://github.com/unoplatform/Uno.DotnetRuntime.WebAssembly
>
> [!NOTE]
> Bootstrapper builds version 4.x-dev were based on developments builds of .NET 7 and were later versioned 7.x-dev to match the appropriate runtime.
+
+## Previous releases documentation
+
+- [8.0.x](https://github.com/unoplatform/Uno.Wasm.Bootstrap/tree/release/stable/8.0/doc)
+- [7.0.x](https://github.com/unoplatform/Uno.Wasm.Bootstrap/tree/release/stable/7.0/doc)
+- [3.x](https://github.com/unoplatform/Uno.Wasm.Bootstrap/tree/release/stable/3.3/doc)
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 589a3f199..680dfc8fb 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -17,7 +17,7 @@
$(AssemblyName) ($(TargetFramework))
en-US
- 11.0
+ 12.0
diff --git a/src/LongPathTest/Uno.Wasm.LongPath.csproj b/src/LongPathTest/Uno.Wasm.LongPath.csproj
index 8a270b687..1e5b58718 100644
--- a/src/LongPathTest/Uno.Wasm.LongPath.csproj
+++ b/src/LongPathTest/Uno.Wasm.LongPath.csproj
@@ -1,7 +1,7 @@
-
+
- net5.0
+ net9.0
Exe
false
@@ -10,19 +10,14 @@
-
-
-
+
+
+
false
true
TargetFramework
-
- false
- true
- TargetFramework
-
diff --git a/src/Uno.Wasm.AotProfiler/AotProfilerSupport.cs b/src/Uno.Wasm.AotProfiler/AotProfilerSupport.cs
index adb377079..1f0db7f08 100644
--- a/src/Uno.Wasm.AotProfiler/AotProfilerSupport.cs
+++ b/src/Uno.Wasm.AotProfiler/AotProfilerSupport.cs
@@ -1,33 +1,16 @@
using System;
-using System.Collections.Generic;
using System.Runtime.CompilerServices;
-using System.Text;
-using WebAssembly;
namespace Uno
{
- public static class AotProfilerSupport
+ public static partial class AotProfilerSupport
{
- public static void Initialize()
- => Console.WriteLine("Profiler support initialized");
-
//
// Can be called by the app to stop profilings
//
[MethodImpl(MethodImplOptions.NoInlining)]
+ [System.Runtime.InteropServices.JavaScript.JSExport()]
public static void StopProfile()
- {
- }
-
- // Called by the AOT profiler to save profile data into Module.aot_profile_data
- [MethodImpl(MethodImplOptions.NoInlining)]
- public unsafe static void DumpAotProfileData(ref byte buf, int len, string s)
- {
- // Based on https://github.com/jeromelaban/runtime/blob/69e7d87aef627e5e0241123b3d4b5b1d598f8c21/src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/Interop/JavaScriptExports.cs#L224-L225
- fixed (void* p = &buf)
- {
- Runtime.InvokeJS($"Module.aot_profile_data = Module.HEAPU8.slice({(long)p}, {(long)p} + {len});");
- }
- }
+ => Console.WriteLine("Stopping AOT profile");
}
}
diff --git a/src/Uno.Wasm.AotProfiler/Runtime.cs b/src/Uno.Wasm.AotProfiler/Runtime.cs
deleted file mode 100644
index 4ef0a2268..000000000
--- a/src/Uno.Wasm.AotProfiler/Runtime.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-using System;
-using System.Runtime.CompilerServices;
-
-namespace WebAssembly
-{
- internal sealed class Runtime
- {
- ///
- /// Mono specific internal call.
- ///
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern string InvokeJS(string str, out int exceptional_result);
-
- // Disable inlining to avoid the interpreter to evaluate an internal call that may not be available
- [MethodImpl(MethodImplOptions.NoInlining)]
- private static string MonoInvokeJS(string str, out int exceptionResult) => InvokeJS(str, out exceptionResult);
-
- // Disable inlining to avoid the interpreter to evaluate an internal call that may not be available
- [MethodImpl(MethodImplOptions.NoInlining)]
- private static string NetCoreInvokeJS(string str, out int exceptionResult)
- => Interop.Runtime.InvokeJS(str, out exceptionResult);
-
- ///
- /// Invokes Javascript code in the hosting environment
- ///
- internal static string InvokeJS(string str)
- {
- var r = IsNetCore
- ? NetCoreInvokeJS(str, out var exceptionResult)
- : MonoInvokeJS(str, out exceptionResult);
-
- if (exceptionResult != 0)
- {
- Console.Error.WriteLine($"Error #{exceptionResult} \"{r}\" executing javascript: \"{str}\"");
- }
- return r;
- }
-
- internal static bool IsNetCore { get; } = Type.GetType("System.Runtime.Loader.AssemblyLoadContext") != null;
- }
-}
-
-internal sealed class Interop
-{
- internal sealed class Runtime
- {
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- public static extern string InvokeJS(string str, out int exceptional_result);
- }
-}
diff --git a/src/Uno.Wasm.Bootstrap-msbuild-only.slnf b/src/Uno.Wasm.Bootstrap-msbuild-only.slnf
index 51523cb69..1334f78c8 100644
--- a/src/Uno.Wasm.Bootstrap-msbuild-only.slnf
+++ b/src/Uno.Wasm.Bootstrap-msbuild-only.slnf
@@ -3,8 +3,6 @@
"path": "Uno.Wasm.Bootstrap.sln",
"projects": [
"LongPathTest\\Uno.Wasm.LongPath.csproj",
- "Uno.Wasm.Bootstrap.Cli\\Uno.Wasm.Bootstrap.Cli.csproj",
- "Uno.Wasm.Bootstrap.DevServer\\Uno.Wasm.Bootstrap.DevServer.csproj",
"Uno.Wasm.Bootstrap.Server\\Uno.Wasm.Bootstrap.Server.csproj",
"Uno.Wasm.Bootstrap.UnitTests\\Uno.Wasm.Bootstrap.UnitTests.csproj",
"Uno.Wasm.Bootstrap\\Uno.Wasm.Bootstrap.csproj",
@@ -26,4 +24,4 @@
"WasmAot.UITests\\WasmAot.UITests.njsproj"
]
}
-}
+}
\ No newline at end of file
diff --git a/src/Uno.Wasm.Bootstrap-netcore-only.slnf b/src/Uno.Wasm.Bootstrap-netcore-only.slnf
index da4281992..e68815783 100644
--- a/src/Uno.Wasm.Bootstrap-netcore-only.slnf
+++ b/src/Uno.Wasm.Bootstrap-netcore-only.slnf
@@ -3,19 +3,14 @@
"path": "Uno.Wasm.Bootstrap.sln",
"projects": [
"LongPathTest\\Uno.Wasm.LongPath.csproj",
- "Uno.Wasm.Sample.RayTracer.Shared\\Uno.Wasm.Sample.RayTracer.Shared.shproj",
- "Uno.Wasm.Sample.RayTracer\\Uno.Wasm.Sample.RayTracer.csproj",
- "Uno.Wasm.Bootstrap.Cli\\Uno.Wasm.Bootstrap.Cli.csproj",
- "Uno.Wasm.Bootstrap.DevServer\\Uno.Wasm.Bootstrap.DevServer.csproj",
"Uno.Wasm.Bootstrap\\Uno.Wasm.Bootstrap.csproj",
"Uno.Wasm.MixedModeRoslynSample\\Uno.Wasm.MixedModeRoslynSample.csproj",
"Uno.Wasm.MixedModeSample\\Uno.Wasm.MixedModeSample.csproj",
"Uno.Wasm.Node.Sample\\Uno.Wasm.Node.Sample.csproj",
+ "Uno.Wasm.Sample.RayTracer.Shared\\Uno.Wasm.Sample.RayTracer.Shared.shproj",
+ "Uno.Wasm.Sample.RayTracer\\Uno.Wasm.Sample.RayTracer.csproj",
"Uno.Wasm.Sample.Server.Net7\\Uno.Wasm.Sample.Server.Net7.csproj",
"Uno.Wasm.SampleNet6.Aot\\Uno.Wasm.SampleNet6.Aot.csproj",
- "Uno.Wasm.SampleNet6\\Uno.Wasm.SampleNet6.csproj",
- "Uno.Wasm.SampleNet6.LogProfiler\\Uno.Wasm.SampleNet6.LogProfiler.csproj",
- "Uno.Wasm.SampleNet6\\Uno.Wasm.SampleNet6.csproj",
"Uno.Wasm.SampleNet7\\Uno.Wasm.SampleNet7.csproj",
"Uno.Wasm.Sample\\Uno.Wasm.Sample.shproj",
"Uno.Wasm.Static Linking\\Uno.Wasm.StaticLinking.csproj",
@@ -27,10 +22,10 @@
"Uno.Wasm.StaticLinking.Shared\\Uno.Wasm.StaticLinking.Shared.shproj",
"Uno.Wasm.StaticLinking.Simd.net7\\Uno.Wasm.StaticLinking.Simd.net7.csproj",
"Uno.Wasm.StaticLinking.net7\\Uno.Wasm.StaticLinking.net7.csproj",
+ "Uno.Wasm.Tests.AbsoluteIntermediate\\Uno.Wasm.Tests.AbsoluteIntermediate.csproj",
"Uno.Wasm.Tests.Electron\\Uno.Wasm.Tests.Electron.csproj",
"Uno.Wasm.Tests.Empty\\Uno.Wasm.Test.Empty.csproj",
"Uno.Wasm.Tests.Shared\\Uno.Wasm.Tests.Shared.shproj",
- "Uno.Wasm.Tests.AbsoluteIntermediate\\Uno.Wasm.Tests.AbsoluteIntermediate.csproj",
"Uno.Wasm.Tests.TypeScript\\Uno.Wasm.Tests.TypeScript.csproj",
"Uno.Wasm.Threads.Aot\\Uno.Wasm.Threads.Aot.csproj",
"Uno.Wasm.Threads.Shared\\Uno.Wasm.Threads.Shared.shproj",
@@ -39,4 +34,4 @@
"Uno.WasmSample WithSpace\\Uno.WasmSample.WithSpace.csproj"
]
}
-}
+}
\ No newline at end of file
diff --git a/src/Uno.Wasm.Bootstrap-paclages-only.slnf b/src/Uno.Wasm.Bootstrap-packages-only.slnf
similarity index 79%
rename from src/Uno.Wasm.Bootstrap-paclages-only.slnf
rename to src/Uno.Wasm.Bootstrap-packages-only.slnf
index ac3b2ab4d..478e601a0 100644
--- a/src/Uno.Wasm.Bootstrap-paclages-only.slnf
+++ b/src/Uno.Wasm.Bootstrap-packages-only.slnf
@@ -2,18 +2,16 @@
"solution": {
"path": "Uno.Wasm.Bootstrap.sln",
"projects": [
- "Uno.Wasm.VersionChecker\\Uno.Wasm.VersionChecker.csproj",
"Uno.Wasm.AotProfiler\\Uno.Wasm.AotProfiler.csproj",
- "Uno.Wasm.Bootstrap.Cli\\Uno.Wasm.Bootstrap.Cli.csproj",
- "Uno.Wasm.Bootstrap.DevServer\\Uno.Wasm.Bootstrap.DevServer.csproj",
+ "Uno.Wasm.Bootstrap.DevServer\\Uno.Wasm.Bootstrap.DevServer.csproj.csproj",
"Uno.Wasm.Bootstrap.Server\\Uno.Wasm.Bootstrap.Server.csproj",
"Uno.Wasm.Bootstrap.UnitTests\\Uno.Wasm.Bootstrap.UnitTests.csproj",
"Uno.Wasm.Bootstrap\\Uno.Wasm.Bootstrap.csproj",
"Uno.Wasm.HttpRequestMessageExtensions\\Uno.Wasm.HttpRequestMessageExtensions.csproj",
"Uno.Wasm.LogProfiler\\Uno.Wasm.LogProfiler.csproj",
"Uno.Wasm.MetadataUpdater\\Uno.Wasm.MetadataUpdater.csproj",
- "Uno.Wasm.Packager\\Uno.Wasm.Packager.csproj",
- "Uno.Wasm.Tuner\\Uno.Wasm.Tuner.csproj"
+ "Uno.Wasm.VersionChecker\\Uno.Wasm.VersionChecker.csproj",
+ "Uno.Wasm.WebCIL\\Uno.Wasm.WebCIL.csproj"
]
}
-}
+}
\ No newline at end of file
diff --git a/src/Uno.Wasm.Bootstrap.Cli/Commands/Serve.cs b/src/Uno.Wasm.Bootstrap.Cli/Commands/Serve.cs
deleted file mode 100644
index 14db59610..000000000
--- a/src/Uno.Wasm.Bootstrap.Cli/Commands/Serve.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-//
-// Imported from https://github.com/aspnet/Blazor/tree/release/0.7.0
-//
-// History:
-// - 2019-01-14: update for Uno support
-//
-
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.CommandLineUtils;
-using System.Threading.Tasks;
-
-namespace Uno.Wasm.Bootstrap.Cli.Commands
-{
- internal class ServeCommand : CommandLineApplication
- {
- public ServeCommand(CommandLineApplication parent)
-
- // We pass arbitrary arguments through to the ASP.NET Core configuration
- : base(throwOnUnexpectedArg: false)
- {
- Parent = parent;
-
- Name = "serve";
- Description = "Serve requests to an Uno WebAssembly application";
-
- HelpOption("-?|-h|--help");
-
- OnExecute(() => Execute());
- }
-
- private int Execute()
- {
- Server.Program.BuildWebHost(RemainingArguments.ToArray()).Run();
- return 0;
- }
- }
-}
\ No newline at end of file
diff --git a/src/Uno.Wasm.Bootstrap.Cli/DebuggingProxy/DebugHostExtensions.cs b/src/Uno.Wasm.Bootstrap.Cli/DebuggingProxy/DebugHostExtensions.cs
deleted file mode 100644
index afac4b2f7..000000000
--- a/src/Uno.Wasm.Bootstrap.Cli/DebuggingProxy/DebugHostExtensions.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-#nullable enable
-
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-//
-// Based on https://github.com/dotnet/aspnetcore/blob/7a3f9fe66b641c7667e9122cbab5e6052525d030/src/Components/WebAssembly/Server/src/WebAssemblyNetDebugProxyAppBuilderExtensions.cs
-//
-
-using System;
-using System.Net;
-using System.Web;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Configuration;
-
-#if NET6_0_OR_GREATER
-using _RequestDelegate = Microsoft.AspNetCore.Http.RequestDelegate;
-#else
-using _RequestDelegate = System.Func;
-#endif
-
-namespace Uno.Wasm.Bootstrap.Cli.DebuggingProxy
-{
- internal static class DebuggerHostExtensions
- {
- ///
- /// Adds middleware needed for debugging Blazor WebAssembly applications
- /// inside Chromium dev tools.
- ///
- public static void UseWebAssemblyDebugging(this IApplicationBuilder app, IConfiguration configuration)
- => app.Map("/_framework/debug", app =>
- {
- app.Use(async (HttpContext context, _RequestDelegate next) =>
- {
- var queryParams = HttpUtility.ParseQueryString(context.Request.QueryString.Value!);
- var browserParam = queryParams.Get("browser");
- Uri? browserUrl = null;
- var devToolsHost = "http://localhost:9222";
- if (browserParam != null)
- {
- browserUrl = new Uri(browserParam);
- devToolsHost = $"http://{browserUrl.Host}:{browserUrl.Port}";
- }
-
- var debugProxyBaseUrl = await DebugProxyLauncher.EnsureLaunchedAndGetUrl(context.RequestServices, configuration, devToolsHost, browserUrl);
- var requestPath = context.Request.Path.ToString();
- if (requestPath == string.Empty)
- {
- requestPath = "/";
- }
-
- switch (requestPath)
- {
- case "/":
- var targetPickerUi = new TargetPickerUi(debugProxyBaseUrl, devToolsHost);
- await targetPickerUi.Display(context);
- break;
- case "/ws-proxy":
- context.Response.Redirect($"{debugProxyBaseUrl}{browserUrl!.PathAndQuery}");
- break;
- default:
- context.Response.StatusCode = (int)HttpStatusCode.NotFound;
- break;
- }
- });
- });
- }
-
-}
diff --git a/src/Uno.Wasm.Bootstrap.Cli/DebuggingProxy/DebugProxyLauncher.cs b/src/Uno.Wasm.Bootstrap.Cli/DebuggingProxy/DebugProxyLauncher.cs
deleted file mode 100644
index 37848ea4a..000000000
--- a/src/Uno.Wasm.Bootstrap.Cli/DebuggingProxy/DebugProxyLauncher.cs
+++ /dev/null
@@ -1,240 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-//
-// Based on https://github.com/dotnet/aspnetcore/blob/52eff90fbcfca39b7eb58baad597df6a99a542b0/src/Components/WebAssembly/Server/src/DebugProxyLauncher.cs
-//
-#nullable enable
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Net.Http;
-using System.Net.WebSockets;
-using System.Reflection;
-using System.Text.RegularExpressions;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.CommandLineUtils;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.DependencyInjection;
-
-namespace Uno.Wasm.Bootstrap.Cli
-{
- internal static class DebugProxyLauncher
- {
- private static readonly TimeSpan DebugProxyLaunchTimeout;
- private static Task? LaunchedDebugProxyUrl;
- private static SemaphoreSlim LaunchLock = new SemaphoreSlim(1);
- private static readonly Regex NowListeningRegex = new Regex(@"^\s*Now listening on: (?.*)$", RegexOptions.None, TimeSpan.FromSeconds(10));
- private static readonly Regex ApplicationStartedRegex = new Regex(@"^\s*Application started\. Press Ctrl\+C to shut down\.$", RegexOptions.None, TimeSpan.FromSeconds(10));
-
- private static Process? _debugProxyProcess;
- private static string? _devToolsHost;
- private static readonly HttpClient _aliveCheckClient;
-
- static DebugProxyLauncher()
- {
- if(!TimeSpan.TryParse(Environment.GetEnvironmentVariable("WASMSHELL_DEBUG_KEEPALIVE_TIMEOUT"), out var timespan))
- {
- timespan = TimeSpan.FromSeconds(10);
- }
-
- _aliveCheckClient = new HttpClient()
- {
- Timeout = timespan
- };
-
- if (!TimeSpan.TryParse(Environment.GetEnvironmentVariable("WASMSHELL_DEBUG_KEEPALIVE_TIMEOUT"), out DebugProxyLaunchTimeout))
- {
- DebugProxyLaunchTimeout = TimeSpan.FromSeconds(10);
- }
- }
-
- public static async Task EnsureLaunchedAndGetUrl(IServiceProvider serviceProvider, IConfiguration configuration, string devToolsHost, Uri? browserUrl)
- {
- try
- {
- await LaunchLock.WaitAsync();
-
- if (LaunchedDebugProxyUrl == null
- || (_debugProxyProcess?.HasExited ?? false)
- || (!await IsAlive()))
- {
- LaunchedDebugProxyUrl = LaunchAndGetUrl(serviceProvider, configuration, devToolsHost, browserUrl);
- }
-
- return await LaunchedDebugProxyUrl;
- }
- finally
- {
- LaunchLock.Release();
- }
- }
-
- ///
- /// Determines if the target host is available.
- ///
- ///
- private static async Task IsAlive()
- {
- if (_devToolsHost == null)
- {
- return false;
- }
-
- try
- {
- _ = await _aliveCheckClient.GetByteArrayAsync($"{_devToolsHost}");
- return true;
- }
- catch
- {
- return false;
- }
- }
-
- private static async Task LaunchAndGetUrl(IServiceProvider serviceProvider, IConfiguration configuration, string devToolsHost, Uri? browserUrl)
- {
- var tcs = new TaskCompletionSource();
-
- var environment = serviceProvider.GetRequiredService();
- var executablePath = LocateDebugProxyExecutable(environment, configuration);
- var muxerPath = DotNetMuxer.MuxerPathOrDefault();
- var ownerPid = Process.GetCurrentProcess().Id;
-
- var processStartInfo = new ProcessStartInfo
- {
- FileName = muxerPath,
- Arguments = $"exec \"{executablePath}\" --OwnerPid {ownerPid} --DevToolsUrl {devToolsHost}",
- UseShellExecute = false,
- RedirectStandardOutput = true,
- };
- RemoveUnwantedEnvironmentVariables(processStartInfo.Environment);
-
- _devToolsHost = devToolsHost;
-
- if(_debugProxyProcess != null && !_debugProxyProcess.HasExited)
- {
- _debugProxyProcess.Kill();
- }
-
- _debugProxyProcess = Process.Start(processStartInfo);
- if (_debugProxyProcess is null)
- {
- tcs.TrySetException(new InvalidOperationException("Unable to start debug proxy process."));
- }
- else
- {
- PassThroughConsoleOutputAndError(_debugProxyProcess);
- CompleteTaskWhenServerIsReady(_debugProxyProcess, tcs);
-
- new CancellationTokenSource(DebugProxyLaunchTimeout).Token.Register(() =>
- {
- tcs.TrySetException(new TimeoutException($"Failed to start the debug proxy within the timeout period of {DebugProxyLaunchTimeout.TotalSeconds} seconds."));
- });
- }
-
- return await tcs.Task;
- }
-
- private static void RemoveUnwantedEnvironmentVariables(IDictionary environment)
- {
- // Generally we expect to pass through most environment variables, since dotnet might
- // need them for arbitrary reasons to function correctly. However, we specifically don't
- // want to pass through any ASP.NET Core hosting related ones, since the child process
- // shouldn't be trying to use the same port numbers, etc. In particular we need to break
- // the association with IISExpress and the MS-ASPNETCORE-TOKEN check.
- // For more context on this, see https://github.com/dotnet/aspnetcore/issues/20308.
- var keysToRemove = environment.Keys.Where(key => key.StartsWith("ASPNETCORE_", StringComparison.Ordinal)).ToList();
- foreach (var key in keysToRemove)
- {
- environment.Remove(key);
- }
- }
-
- private static string LocateDebugProxyExecutable(IWebHostEnvironment environment, IConfiguration configuration)
- {
- var platform = configuration.GetValue("platform") ?? "";
- var buildConfiguration = configuration.GetValue("configuration") ?? "";
- var targetFramework = configuration.GetValue("targetframework") ?? "";
- var intermediatePath = configuration.GetValue("intermediateoutputpath") ?? "";
-
- var contentRoot = environment.ContentRootPath;
- var debuggerInfoRoot = intermediatePath is { Length: > 0 }
- // This is defined in when the bootstrapper is referenced through nuget
- ? Path.Combine(contentRoot, intermediatePath, "wasm-debugger")
- // Used as a fallback inside the bootstrapper solution
- : Path.Combine(contentRoot, "obj", platform, buildConfiguration, targetFramework, "wasm-debugger");
-
- var debuggerInfoFile = Path.Combine(debuggerInfoRoot, ".debuggerinfo");
- if (!File.Exists(debuggerInfoFile))
- {
- throw new FileNotFoundException(
- $"Cannot start debug proxy because its path cannot be determined.");
- }
-
- var debugProxyPath = Path.Combine(
- File.ReadAllText(debuggerInfoFile),
- "BrowserDebugHost.dll");
-
- if (!File.Exists(debugProxyPath))
- {
- throw new FileNotFoundException(
- $"Cannot start debug proxy because it cannot be found at '{debugProxyPath}'");
- }
-
- return debugProxyPath;
- }
-
- private static void PassThroughConsoleOutputAndError(Process process)
- {
- process.OutputDataReceived +=
- (sender, eventArgs) => Console.WriteLine(eventArgs.Data);
-
- process.ErrorDataReceived +=
- (sender, eventArgs) => Console.WriteLine("[DebuggerHost-ERROR] " + eventArgs.Data);
- }
-
- private static void CompleteTaskWhenServerIsReady(Process aspNetProcess, TaskCompletionSource taskCompletionSource)
- {
- string? capturedUrl = null;
- aspNetProcess.OutputDataReceived += OnOutputDataReceived;
- aspNetProcess.BeginOutputReadLine();
-
- void OnOutputDataReceived(object sender, DataReceivedEventArgs eventArgs)
- {
- if (string.IsNullOrEmpty(eventArgs.Data))
- {
- taskCompletionSource.TrySetException(new InvalidOperationException(
- "No output has been recevied from the application."));
- return;
- }
-
- if (ApplicationStartedRegex.IsMatch(eventArgs.Data))
- {
- aspNetProcess.OutputDataReceived -= OnOutputDataReceived;
- if (!string.IsNullOrEmpty(capturedUrl))
- {
- taskCompletionSource.TrySetResult(capturedUrl);
- }
- else
- {
- taskCompletionSource.TrySetException(new InvalidOperationException(
- "The application started listening without first advertising a URL"));
- }
- }
- else
- {
- var match = NowListeningRegex.Match(eventArgs.Data);
- if (match.Success)
- {
- capturedUrl = match.Groups["url"].Value;
- }
- }
- }
- }
- }
-}
diff --git a/src/Uno.Wasm.Bootstrap.Cli/DebuggingProxy/DotNetMuxer.cs b/src/Uno.Wasm.Bootstrap.Cli/DebuggingProxy/DotNetMuxer.cs
deleted file mode 100644
index b0dfca370..000000000
--- a/src/Uno.Wasm.Bootstrap.Cli/DebuggingProxy/DotNetMuxer.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-//
-// Based on https://github.com/dotnet/aspnetcore/blob/db4ef86f34815a992d79f02109983c3d9d4bdbf1/src/Shared/CommandLineUtils/Utilities/DotNetMuxer.cs
-//
-
-#nullable enable
-
-using System;
-using System.Diagnostics;
-using System.IO;
-using System.Runtime.InteropServices;
-
-namespace Uno.Wasm.Bootstrap.Cli
-{
- ///
- /// Utilities for finding the "dotnet.exe" file from the currently running .NET Core application
- ///
- internal static class DotNetMuxer
- {
- private const string MuxerName = "dotnet";
-
- static DotNetMuxer()
- {
- MuxerPath = TryFindMuxerPath(Process.GetCurrentProcess().MainModule?.FileName);
- }
-
- ///
- /// The full filepath to the .NET Core muxer.
- ///
- public static string? MuxerPath { get; }
-
- ///
- /// Finds the full filepath to the .NET Core muxer,
- /// or returns a string containing the default name of the .NET Core muxer ('dotnet').
- ///
- /// The path or a string named 'dotnet'.
- public static string MuxerPathOrDefault()
- => MuxerPath ?? MuxerName;
-
- internal static string? TryFindMuxerPath(string? mainModule)
- {
- var fileName = MuxerName;
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
- {
- fileName += ".exe";
- }
-
- if (!string.IsNullOrEmpty(mainModule)
- && string.Equals(Path.GetFileName(mainModule!), fileName, StringComparison.OrdinalIgnoreCase))
- {
- return mainModule;
- }
-
- return null;
- }
- }
-}
-
-
diff --git a/src/Uno.Wasm.Bootstrap.Cli/DebuggingProxy/TargetPickerUi.cs b/src/Uno.Wasm.Bootstrap.Cli/DebuggingProxy/TargetPickerUi.cs
deleted file mode 100644
index 75f77925b..000000000
--- a/src/Uno.Wasm.Bootstrap.Cli/DebuggingProxy/TargetPickerUi.cs
+++ /dev/null
@@ -1,245 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-//
-// Based on https://github.com/dotnet/aspnetcore/blob/bc5960e878140bc90484be799123ea1f25af0ba2/src/Components/WebAssembly/Server/src/TargetPickerUi.cs
-//
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Net;
-using System.Net.Http;
-using System.Runtime.InteropServices;
-using System.Text.Json;
-using System.Text.Json.Serialization;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Http;
-
-namespace Uno.Wasm.Bootstrap.Cli.DebuggingProxy
-{
- ///
- /// Class for the target picker ui.
- ///
- public class TargetPickerUi
- {
- private static readonly JsonSerializerOptions JsonOptions = new JsonSerializerOptions
- {
- PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
- PropertyNameCaseInsensitive = true,
- DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
- };
-
- private string _browserHost;
- private string _debugProxyUrl;
-
- ///
- /// Initialize a new instance of .
- ///
- /// The debug proxy url.
- /// The dev tools host.
- public TargetPickerUi(string debugProxyUrl, string devToolsHost)
- {
- _debugProxyUrl = debugProxyUrl;
- _browserHost = devToolsHost;
- }
-
- ///
- /// Display the ui.
- ///
- /// The .
- /// The .
- public async Task Display(HttpContext context)
- {
- context.Response.ContentType = "text/html";
-
- var request = context.Request;
- var targetApplicationUrl = request.Query["url"];
-
- var debuggerTabsListUrl = $"{_browserHost}/json";
- IEnumerable availableTabs;
-
- try
- {
- availableTabs = await GetOpenedBrowserTabs();
- }
- catch (Exception ex)
- {
- await context.Response.WriteAsync($@"
-Unable to find debuggable browser tab
-
- Could not get a list of browser tabs from {debuggerTabsListUrl}
.
- Ensure your browser is running with debugging enabled.
-
-Resolution
-
-
If you are using Google Chrome for your development, follow these instructions:
- {GetLaunchChromeInstructions(targetApplicationUrl)}
-
-
-
If you are using Microsoft Edge (80+) for your development, follow these instructions:
- {GetLaunchEdgeInstructions(targetApplicationUrl)}
-
-This should launch a new browser window with debugging enabled..
-Underlying exception:
-{ex}
- ");
-
- return;
- }
-
- var matchingTabs = string.IsNullOrEmpty(targetApplicationUrl)
- ? availableTabs.ToList()
- : availableTabs.Where(t => t.Url.Equals(targetApplicationUrl, StringComparison.Ordinal)).ToList();
-
- if (matchingTabs.Count == 1)
- {
- // We know uniquely which tab to debug, so just redirect
- var devToolsUrlWithProxy = GetDevToolsUrlWithProxy(request, matchingTabs.Single());
- context.Response.Redirect(devToolsUrlWithProxy);
- }
- else if (matchingTabs.Count == 0)
- {
- await context.Response.WriteAsync("No inspectable pages found ");
-
- var suffix = string.IsNullOrEmpty(targetApplicationUrl)
- ? string.Empty
- : $" matching the URL {WebUtility.HtmlEncode(targetApplicationUrl)}";
- await context.Response.WriteAsync($"The list of targets returned by {WebUtility.HtmlEncode(debuggerTabsListUrl)} contains no entries{suffix}.
");
- await context.Response.WriteAsync("Make sure your browser is displaying the target application.
");
- }
- else
- {
- await context.Response.WriteAsync("Inspectable pages ");
- await context.Response.WriteAsync(@"
-
- ");
-
- foreach (var tab in matchingTabs)
- {
- var devToolsUrlWithProxy = GetDevToolsUrlWithProxy(request, tab);
- await context.Response.WriteAsync(
- $""
- + $"{WebUtility.HtmlEncode(tab.Title)} {WebUtility.HtmlEncode(tab.Url)}"
- + $" ");
- }
- }
- }
-
- private string GetDevToolsUrlWithProxy(HttpRequest request, BrowserTab tabToDebug)
- {
- var underlyingV8Endpoint = new Uri(tabToDebug.WebSocketDebuggerUrl);
- var proxyEndpoint = new Uri(_debugProxyUrl);
- var devToolsUrlAbsolute = new Uri(_browserHost + tabToDebug.DevtoolsFrontendUrl);
- var devToolsUrlWithProxy = $"{devToolsUrlAbsolute.Scheme}://{devToolsUrlAbsolute.Authority}{devToolsUrlAbsolute.AbsolutePath}?{underlyingV8Endpoint.Scheme}={proxyEndpoint.Authority}{underlyingV8Endpoint.PathAndQuery}";
- return devToolsUrlWithProxy;
- }
-
- private string GetLaunchChromeInstructions(string targetApplicationUrl)
- {
- var profilePath = Path.Combine(Path.GetTempPath(), "blazor-chrome-debug");
- var debuggerPort = new Uri(_browserHost).Port;
-
- if (OperatingSystem.IsWindows())
- {
- return $@"Press Win+R and enter the following:
- chrome --remote-debugging-port={debuggerPort} --user-data-dir=""{profilePath}"" {targetApplicationUrl}
";
- }
- else if (OperatingSystem.IsLinux())
- {
- return $@"In a terminal window execute the following:
- google-chrome --remote-debugging-port={debuggerPort} --user-data-dir={profilePath} {targetApplicationUrl}
";
- }
- else if (OperatingSystem.IsMacOS())
- {
- return $@"Execute the following:
- open -n /Applications/Google\ Chrome.app --args --remote-debugging-port={debuggerPort} --user-data-dir={profilePath} {targetApplicationUrl}
";
- }
- else
- {
- throw new InvalidOperationException("Unknown OS platform");
- }
- }
-
- private string GetLaunchEdgeInstructions(string targetApplicationUrl)
- {
- var profilePath = Path.Combine(Path.GetTempPath(), "blazor-edge-debug");
- var debuggerPort = new Uri(_browserHost).Port;
-
- if (OperatingSystem.IsWindows())
- {
- return $@"Press Win+R and enter the following:
- msedge --remote-debugging-port={debuggerPort} --user-data-dir=""{profilePath}"" --no-first-run {targetApplicationUrl}
";
- }
- else if (OperatingSystem.IsMacOS())
- {
- return $@"In a terminal window execute the following:
- open -n /Applications/Microsoft\ Edge.app --args --remote-debugging-port={debuggerPort} --user-data-dir={profilePath} {targetApplicationUrl}
";
- }
- else
- {
- return $@"Edge is not current supported on your platform
";
- }
- }
-
- private static Uri GetProxyEndpoint(HttpRequest incomingRequest, string browserEndpoint)
- {
- var builder = new UriBuilder(
- schemeName: incomingRequest.IsHttps ? "wss" : "ws",
- hostName: incomingRequest.Host.Host)
- {
- Path = $"{incomingRequest.PathBase}/ws-proxy",
- Query = $"browser={WebUtility.UrlEncode(browserEndpoint)}"
- };
-
- if (incomingRequest.Host.Port.HasValue)
- {
- builder.Port = incomingRequest.Host.Port.Value;
- }
-
- return builder.Uri;
- }
-
- private async Task> GetOpenedBrowserTabs()
- {
- using var httpClient = new HttpClient { Timeout = TimeSpan.FromSeconds(5) };
- var jsonResponse = await httpClient.GetStringAsync($"{_browserHost}/json");
- return JsonSerializer.Deserialize(jsonResponse, JsonOptions)!;
- }
-
- public class BrowserTab
- {
- public string Id { get; set; }
- public string Type { get; set; }
- public string Url { get; set; }
- public string Title { get; set; }
- public string DevtoolsFrontendUrl { get; set; }
- public string WebSocketDebuggerUrl { get; set; }
- };
- }
-}
diff --git a/src/Uno.Wasm.Bootstrap.Cli/Program.cs b/src/Uno.Wasm.Bootstrap.Cli/Program.cs
deleted file mode 100644
index 42952bb5f..000000000
--- a/src/Uno.Wasm.Bootstrap.Cli/Program.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using Microsoft.Extensions.CommandLineUtils;
-using System;
-using Uno.Wasm.Bootstrap.Cli.Commands;
-
-namespace Uno.Wasm.Bootstrap.Cli
-{
- class Program
- {
- static int Main(string[] args)
- {
- var app = new CommandLineApplication(throwOnUnexpectedArg: false)
- {
- Name = "unowasm-cli"
- };
- app.HelpOption("-?|-h|--help");
-
- app.Commands.Add(new ServeCommand(app));
-
- app.OnExecute(() =>
- {
- app.ShowHelp();
- return 0;
- });
-
- try
- {
- return app.Execute(args);
- }
- catch (CommandParsingException cex)
- {
- app.Error.WriteLine(cex.Message);
- app.ShowHelp();
- return 1;
- }
- }
- }
-}
diff --git a/src/Uno.Wasm.Bootstrap.Cli/Server/Program.cs b/src/Uno.Wasm.Bootstrap.Cli/Server/Program.cs
deleted file mode 100644
index 69fdd230b..000000000
--- a/src/Uno.Wasm.Bootstrap.Cli/Server/Program.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using Microsoft.AspNetCore;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.Configuration;
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Uno.Wasm.Bootstrap.Cli.Server
-{
- class Program
- {
- public static IWebHost BuildWebHost(string[] args)
- {
- var initialData = new Dictionary()
- {
- [WebHostDefaults.EnvironmentKey] = "Development",
- ["Logging:LogLevel:Microsoft"] = "Warning",
- ["Logging:LogLevel:Microsoft.Hosting.Lifetime"] = "Information",
- };
-
- return WebHost.CreateDefaultBuilder(args)
- .UseConfiguration(new ConfigurationBuilder()
- .AddCommandLine(args)
- .AddInMemoryCollection(initialData)
- .Build())
- .UseStartup()
- .Build();
- }
- }
-}
diff --git a/src/Uno.Wasm.Bootstrap.Cli/Server/Startup.cs b/src/Uno.Wasm.Bootstrap.Cli/Server/Startup.cs
deleted file mode 100644
index 13c473c5d..000000000
--- a/src/Uno.Wasm.Bootstrap.Cli/Server/Startup.cs
+++ /dev/null
@@ -1,233 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-//
-// Imported from https://github.com/aspnet/Blazor/tree/release/0.7.0
-//
-// History:
-// 2019-01-14: Adjustments to make the debugger imported.
-//
-
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Http.Features;
-using Microsoft.AspNetCore.ResponseCompression;
-using Microsoft.AspNetCore.StaticFiles;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.FileProviders;
-using Microsoft.Extensions.Hosting;
-using Microsoft.Net.Http.Headers;
-using System;
-using System.IO;
-using System.Linq;
-using System.Net.Mime;
-using System.Threading.Tasks;
-using Uno.Wasm.Bootstrap.Cli.DebuggingProxy;
-
-namespace Uno.Wasm.Bootstrap.Cli.Server
-{
- class Startup
- {
- private readonly char OtherDirectorySeparatorChar = Path.DirectorySeparatorChar == '/' ? '\\' : '/';
-
- public void ConfigureServices(IServiceCollection services)
- {
- services.AddRouting();
- services.AddResponseCompression(options =>
- {
- options.EnableForHttps = true;
- options.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(new[]
- {
- MediaTypeNames.Application.Octet
- });
- });
- }
-
- public void Configure(IApplicationBuilder app, IConfiguration configuration)
- {
-
- var webHostEnvironment = app.ApplicationServices.GetRequiredService();
-
- var useSecureMode = ShouldUseSecureMode(webHostEnvironment, configuration);
- var isDebugBuild = IsDebugBuild(configuration);
-
- if (!isDebugBuild)
- {
- app.UseResponseCompression();
- }
-
- app.UseDeveloperExceptionPage();
-
- app.Use(async (context, next) =>
- {
- context.Response.Headers.Add("Access-Control-Allow-Origin", "*");
- context.Response.Headers.Add("Access-Control-Allow-Methods", "*");
- context.Response.Headers.Add("Access-Control-Allow-Headers", "*");
-
- if (useSecureMode)
- {
- // Required for SharedArrayBuffer: https://developer.chrome.com/blog/enabling-shared-array-buffer/
- context.Response.Headers.Add("Cross-Origin-Embedder-Policy", "require-corp");
- context.Response.Headers.Add("Cross-Origin-Opener-Policy", "same-origin");
- }
-
- await next();
- });
-
- var pathBase = FixupPath(configuration.GetValue("pathbase"));
-
- app.UseStaticFiles(new StaticFileOptions
- {
- ContentTypeProvider = CreateContentTypeProvider(true),
- FileProvider = new PhysicalFileProvider(pathBase),
- HttpsCompression = isDebugBuild ? HttpsCompressionMode.DoNotCompress : HttpsCompressionMode.Compress,
- OnPrepareResponse = SetCacheHeaders,
- DefaultContentType = MediaTypeNames.Application.Octet,
- ServeUnknownFileTypes = true
- });
-
- app.UseWebAssemblyDebugging(configuration);
-
- // foreach(DictionaryEntry entry in Environment.GetEnvironmentVariables())
- // {
- // Console.WriteLine($"Env: {entry.Key}={entry.Value}");
- // }
-
- app.MapWhen(
- ctx => ctx.Request.Path.StartsWithSegments("/_framework/unohotreload"),
- subBuilder =>
- {
- subBuilder.Use(async (HttpContext context, Func next) =>
- {
- context.Response.Headers.Append("Uno-Environment", webHostEnvironment.EnvironmentName);
-
- if (webHostEnvironment.IsDevelopment())
- {
- // DOTNET_MODIFIABLE_ASSEMBLIES is used by the runtime to initialize hot-reload specific environment variables and is configured
- // by the launching process (dotnet-watch / Visual Studio).
- // In Development, we'll transmit the environment variable to WebAssembly as a HTTP header. The bootstrapping code will read the header
- // and configure it as env variable for the wasm app.
- if (Environment.GetEnvironmentVariable("DOTNET_MODIFIABLE_ASSEMBLIES") is string dotnetModifiableAssemblies)
- {
- context.Response.Headers.Append("DOTNET-MODIFIABLE-ASSEMBLIES", dotnetModifiableAssemblies);
- }
-
- // See https://github.com/dotnet/aspnetcore/issues/37357#issuecomment-941237000
- // Translate the _ASPNETCORE_BROWSER_TOOLS environment configured by the browser tools agent in to a HTTP response header.
- if (Environment.GetEnvironmentVariable("__ASPNETCORE_BROWSER_TOOLS") is string browserTools)
- {
- context.Response.Headers.Append("ASPNETCORE-BROWSER-TOOLS", browserTools);
- }
- }
-
- context.Response.StatusCode = 200;
- await context.Response.WriteAsync("");
- });
- });
-
- // Use SPA fallback routing (serve default page for anything else,
- // excluding /_framework/*)
- app.MapWhen(IsNotFrameworkDir, childAppBuilder =>
- {
- var indexHtmlPath = FindIndexHtmlFile(pathBase);
- var indexHtmlStaticFileOptions = string.IsNullOrEmpty(indexHtmlPath)
- ? null : new StaticFileOptions
- {
- FileProvider = new PhysicalFileProvider(Path.GetDirectoryName(indexHtmlPath)),
- HttpsCompression = isDebugBuild ? HttpsCompressionMode.DoNotCompress : HttpsCompressionMode.Compress,
- OnPrepareResponse = SetCacheHeaders
- };
-
- childAppBuilder.UseSpa(spa =>
- {
- spa.Options.DefaultPageStaticFileOptions = indexHtmlStaticFileOptions;
- });
- });
- }
-
- private static bool IsDebugBuild(IConfiguration configuration)
- {
- var buildConfiguration = configuration.GetValue("configuration") ?? "";
-
- return buildConfiguration.Equals("Debug", StringComparison.OrdinalIgnoreCase);
- }
-
- private static bool ShouldUseSecureMode(IWebHostEnvironment environment, IConfiguration configuration)
- {
- var platform = configuration.GetValue("platform") ?? "";
- var buildConfiguration = configuration.GetValue("configuration") ?? "";
- var targetFramework = configuration.GetValue("targetframework") ?? "";
-
- var contentRoot = environment.ContentRootPath;
- var debuggerInfoRoot = Path.Combine(contentRoot, "obj", platform, buildConfiguration, targetFramework);
-
- var featuresInfoFile = Path.Combine(debuggerInfoRoot, ".unoappfeatures");
- if (File.Exists(featuresInfoFile))
- {
- var featuresRaw = File.ReadAllText(featuresInfoFile);
-
- return featuresRaw.Contains("threads", StringComparison.Ordinal);
- }
-
- return false;
- }
-
- private static string FindIndexHtmlFile(string basePath)
- {
- var distIndexHtmlPath = Path.Combine(basePath, "index.html");
- if (File.Exists(distIndexHtmlPath))
- {
- return distIndexHtmlPath;
- }
-
- // Since there's no index.html, we'll use the default DefaultPageStaticFileOptions,
- // hence we'll look for index.html in the host server app's wwwroot.
- return null;
- }
-
- private static bool IsNotFrameworkDir(HttpContext context)
- => !context.Request.Path.StartsWithSegments("/_framework");
-
- private static IContentTypeProvider CreateContentTypeProvider(bool enableDebugging)
- {
- var result = new FileExtensionContentTypeProvider();
- result.Mappings.Add(".blat", MediaTypeNames.Application.Octet);
- result.Mappings.Add(".br", MediaTypeNames.Application.Octet);
- result.Mappings.Add(".clr", MediaTypeNames.Application.Octet);
- result.Mappings.Add(".dat", MediaTypeNames.Application.Octet);
-
- if (enableDebugging)
- {
- result.Mappings.Add(".pdb", MediaTypeNames.Application.Octet);
- }
-
- return result;
- }
-
- private static void SetCacheHeaders(StaticFileResponseContext ctx)
- {
- // By setting "Cache-Control: no-cache", we're allowing the browser to store
- // a cached copy of the response, but telling it that it must check with the
- // server for modifications (based on Etag) before using that cached copy.
- // Longer term, we should generate URLs based on content hashes (at least
- // for published apps) so that the browser doesn't need to make any requests
- // for unchanged files.
- var headers = ctx.Context.Response.GetTypedHeaders();
- if (headers.CacheControl == null)
- {
- headers.CacheControl = new CacheControlHeaderValue
- {
- NoCache = true
- };
- }
- }
-
- ///
- /// Align paths to fix issues with mixed path
- ///
- string FixupPath(string path)
- => path.Replace(OtherDirectorySeparatorChar, Path.DirectorySeparatorChar);
- }
-}
diff --git a/src/Uno.Wasm.Bootstrap.Cli/Uno - Backup.Wasm.Bootstrap.Cli.csproj b/src/Uno.Wasm.Bootstrap.Cli/Uno - Backup.Wasm.Bootstrap.Cli.csproj
deleted file mode 100644
index 8840689d8..000000000
--- a/src/Uno.Wasm.Bootstrap.Cli/Uno - Backup.Wasm.Bootstrap.Cli.csproj
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
- Exe
- Uno.Wasm.Bootstrap.Cli.Program
- netcoreapp3.1;net5
- dotnet-unowasm
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
- External\Mono.Cecil.dll
- false
-
-
- External\netcoreapp3.1\Mono.WebAssembly.DebuggerProxy.dll
- false
-
-
- External\net5\BrowserDebugProxy.dll
- false
-
-
-
-
-
-
diff --git a/src/Uno.Wasm.Bootstrap.Cli/Uno.Wasm.Bootstrap.Cli.csproj b/src/Uno.Wasm.Bootstrap.Cli/Uno.Wasm.Bootstrap.Cli.csproj
deleted file mode 100644
index df99967b4..000000000
--- a/src/Uno.Wasm.Bootstrap.Cli/Uno.Wasm.Bootstrap.Cli.csproj
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
- Exe
- Uno.Wasm.Bootstrap.Cli.Program
- dotnet-unowasm
- false
-
-
- Major
-
-
-
- net5;net6;net7.0
-
-
-
-
-
- net7.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Uno.Wasm.Bootstrap.DevServer/Uno.Wasm.Bootstrap.DevServer.csproj b/src/Uno.Wasm.Bootstrap.DevServer/Uno.Wasm.Bootstrap.DevServer.csproj
deleted file mode 100644
index f2a99bf72..000000000
--- a/src/Uno.Wasm.Bootstrap.DevServer/Uno.Wasm.Bootstrap.DevServer.csproj
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-
- netstandard2.0
- 1701;1702;1705;649
- Uno.Wasm.Bootstrap.DevServer
- true
- false
- true
-
-
-
- This package provides the development server and debugger support for Wasm bootstrap projects
-
-
-
-
-
-
- build
- true
-
-
- tools\server\net5
- true
-
-
- tools\server\net6
- true
-
-
- tools\server\net7.0
- true
-
-
-
-
-
-
-
-
-
-
- false
- true
- TargetFramework
-
-
-
-
diff --git a/src/Uno.Wasm.Bootstrap.DevServer/Uno.Wasm.Bootstrap.DevServer.csproj.csproj b/src/Uno.Wasm.Bootstrap.DevServer/Uno.Wasm.Bootstrap.DevServer.csproj.csproj
new file mode 100644
index 000000000..de3cb00ff
--- /dev/null
+++ b/src/Uno.Wasm.Bootstrap.DevServer/Uno.Wasm.Bootstrap.DevServer.csproj.csproj
@@ -0,0 +1,15 @@
+
+
+
+ netstandard2.0
+ Uno.Wasm.Bootstrap.DevServer
+ true
+ false
+ true
+
+
+
+ [Deprecated] This package is not needed anymore and can be removed
+
+
+
diff --git a/src/Uno.Wasm.Bootstrap.DevServer/build/Uno.Wasm.Bootstrap.DevServer.targets b/src/Uno.Wasm.Bootstrap.DevServer/build/Uno.Wasm.Bootstrap.DevServer.targets
deleted file mode 100644
index a7cc42e9f..000000000
--- a/src/Uno.Wasm.Bootstrap.DevServer/build/Uno.Wasm.Bootstrap.DevServer.targets
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
- dotnet
-
-
- <_unoBinArgs>unowasm serve
-
- <_UnoDevServerBasePath Condition="'$(TargetFramework)'=='netstandard2.0'">netcoreapp3.1
- <_UnoDevServerBasePath Condition="'$(TargetFramework.substring(0,3))'=='net' and '$(TargetFramework)'!='netstandard2.0'">net5
- <_UnoDevServerBasePath Condition="'$([MSBuild]::GetTargetFrameworkVersion($(TargetFramework)))' > 5">net6
- <_UnoDevServerBasePath Condition="'$([MSBuild]::GetTargetFrameworkVersion($(TargetFramework)))' > 6">net7.0
-
- <_UnoBootstrapIsDevelopment>false
- <_UnoBootstrapIsDevelopment Condition="exists('$(MSBuildThisFileDirectory)../../Uno.Wasm.Bootstrap.Cli')">true
-
-
- <_unoBinArgs Condition="$(_UnoBootstrapIsDevelopment)">exec "$(MSBuildThisFileDirectory)../../Uno.Wasm.Bootstrap.Cli/bin/$(Configuration)/$(_UnoDevServerBasePath)/dotnet-unowasm.dll" serve $(_unoRunArgs)
- <_unoBinArgs Condition="!$(_UnoBootstrapIsDevelopment)">"$(MSBuildThisFileDirectory)../tools/server/$(_UnoDevServerBasePath)/dotnet-unowasm.dll" serve $(_unoRunArgs)
-
-
- <_UnoRunBasePath Condition="!$(_UnoBootstrapIsDevelopment) and '$(OutputPath)'!='' and !$([System.IO.Path]::IsPathRooted($(OutputPath)))">$(MSBuildProjectDirectory)/$(OutputPath)
- <_UnoRunBasePath Condition="!$(_UnoBootstrapIsDevelopment) and '$(OutputPath)'!='' and $([System.IO.Path]::IsPathRooted($(OutputPath)))">$(OutputPath)
-
-
-
- <_UnoMaybePlatform>
- <_UnoMaybePlatform Condition="'$(Platform)' != 'AnyCPU'">$(Platform)
-
- <_UnoBasePathMaybePlatform>
- <_UnoBasePathMaybePlatform Condition="'$(AppendPlatformToOutputPath)' == 'true' and '$(Platform)' != 'AnyCPU'">$(Platform)/
-
- <_UnoRunBasePath Condition="$(_UnoBootstrapIsDevelopment) and '$(OutputPath)'==''">$(MSBuildProjectDirectory)/bin/$(_UnoBasePathMaybePlatform)$(Configuration)/$(TargetFramework)/
- <_UnoRunBasePath Condition="$(_UnoBootstrapIsDevelopment) and '$(OutputPath)'!='' and $([System.IO.Path]::IsPathRooted($(OutputPath)))">$(OutputPath)
-
- $(_unoBinArgs) $(_unoRunArgs) --pathbase "$(_UnoRunBasePath)dist" --platform "$(_UnoMaybePlatform)" --configuration "$(Configuration)" --targetframework "$(TargetFramework)" --intermediateoutputpath "$(IntermediateOutputPath)/" $(AdditionalRunArguments)
-
-
-
diff --git a/src/Uno.Wasm.Bootstrap.sln b/src/Uno.Wasm.Bootstrap.sln
index aa8c2acb8..a8cb82d91 100644
--- a/src/Uno.Wasm.Bootstrap.sln
+++ b/src/Uno.Wasm.Bootstrap.sln
@@ -7,8 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Uno.Wasm.Bootstrap", "Uno.W
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Uno.Wasm.Test.Empty", "Uno.Wasm.Tests.Empty\Uno.Wasm.Test.Empty.csproj", "{2DFA7173-E4AD-44C6-B25A-2A455CB513FD}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Uno.Wasm.Bootstrap.Cli", "Uno.Wasm.Bootstrap.Cli\Uno.Wasm.Bootstrap.Cli.csproj", "{AA1C47D5-53C6-4BD6-9206-FDD812D67C13}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Uno.Wasm.MixedModeSample", "Uno.Wasm.MixedModeSample\Uno.Wasm.MixedModeSample.csproj", "{DF5FF703-BAC7-427B-BAEA-2E49B65DBF6E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Uno.Wasm.MixedModeRoslynSample", "Uno.Wasm.MixedModeRoslynSample\Uno.Wasm.MixedModeRoslynSample.csproj", "{15C3F459-5FE5-48F2-A33C-A7864969FEA4}"
@@ -40,8 +38,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Uno.Wasm.Threads", "Uno.Was
EndProject
Project("{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}") = "Uno.Wasm.Threading.UITests", "Uno.Wasm.Threading.UITests\Uno.Wasm.Threading.UITests.njsproj", "{3D59ACEE-12BF-4B69-AEF7-893514C0BA7D}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Uno.Wasm.Bootstrap.DevServer", "Uno.Wasm.Bootstrap.DevServer\Uno.Wasm.Bootstrap.DevServer.csproj", "{6ACB62AD-0DFF-4593-A7EC-5A4E21DA4ABE}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Uno.Wasm.StaticLinking", "Uno.Wasm.Static Linking\Uno.Wasm.StaticLinking.csproj", "{EBCB3142-593E-4815-915D-3B88B75161C1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Uno.WasmSample.WithSpace.Aot", "Uno.WasmSample WithSpace Aot\Uno.WasmSample.WithSpace.Aot.csproj", "{359A63C4-C5D0-4011-8C39-89D23190B22F}"
@@ -76,15 +72,12 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Uno.Wasm.Threads.Shared", "
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Uno.Wasm.Bootstrap.UnitTests", "Uno.Wasm.Bootstrap.UnitTests\Uno.Wasm.Bootstrap.UnitTests.csproj", "{E1458920-4A5A-4D54-882D-304A46359BEC}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Uno.Wasm.Packager", "Uno.Wasm.Packager\Uno.Wasm.Packager.csproj", "{5A0392DE-9D69-4183-9BD9-84D5723AFB76}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Uno.Wasm.Tuner", "Uno.Wasm.Tuner\Uno.Wasm.Tuner.csproj", "{13C116EE-6907-45D4-9CB2-F1E905C71387}"
-EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Uno.Wasm.Sample", "Uno.Wasm.Sample\Uno.Wasm.Sample.shproj", "{ADEFF1C4-A1B5-4FE8-9EB0-A1D81B65B995}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Uno.Wasm.SampleNet6", "Uno.Wasm.SampleNet6\Uno.Wasm.SampleNet6.csproj", "{2477F160-939B-4B9F-B9CD-9100FCD24E34}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Embedded", "Embedded", "{DF5C402A-5CB7-4692-BDB3-93F734E214FA}"
+ ProjectSection(SolutionItems) = preProject
+ Uno.Wasm.SampleNet7\web.config = Uno.Wasm.SampleNet7\web.config
+ EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Uno.Wasm.Embedded.Host", "Uno.Wasm.Embedded.Host\Uno.Wasm.Embedded.Host.csproj", "{EF3A95B2-32EE-4CAA-8235-B2AD6C540389}"
EndProject
@@ -94,10 +87,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Uno.Wasm.MetadataUpdater",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Uno.Wasm.StaticLinking.PgAot.ProfileGen.Net6", "Uno.Wasm.StaticLinking.PgAot.ProfileGen.Net6\Uno.Wasm.StaticLinking.PgAot.ProfileGen.Net6.csproj", "{2DF55561-12DD-4325-BDBF-F42AC72FC284}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Uno.Wasm.SampleNet6.LogProfiler", "Uno.Wasm.SampleNet6.LogProfiler\Uno.Wasm.SampleNet6.LogProfiler.csproj", "{92B22005-5A7B-4B38-8D09-68D7240EBE8C}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Uno.Wasm.LogProfiler", "Uno.Wasm.LogProfiler\Uno.Wasm.LogProfiler.csproj", "{3C2B9F04-972E-4A9F-AA08-545A67C7C455}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Uno.Wasm.Threads.Aot", "Uno.Wasm.Threads.Aot\Uno.Wasm.Threads.Aot.csproj", "{1CA3AA29-A8FC-4CB3-8803-5BD739F2BEC7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Uno.Wasm.SampleNet7", "Uno.Wasm.SampleNet7\Uno.Wasm.SampleNet7.csproj", "{D348EE61-E4D1-4DAF-A84F-086BA6AD659B}"
@@ -120,12 +109,17 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Uno.Wasm.VersionChecker", "
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Root", "_Root", "{70AAFC96-05F5-43A3-959A-95FB32CDE202}"
ProjectSection(SolutionItems) = preProject
- ..\.vsts-ci-linux.yml = ..\.vsts-ci-linux.yml
- ..\.vsts-ci-macos.yml = ..\.vsts-ci-macos.yml
- ..\.vsts-ci-windows-tests.yml = ..\.vsts-ci-windows-tests.yml
- ..\.vsts-ci-wsl-tests.yml = ..\.vsts-ci-wsl-tests.yml
- ..\.vsts-ci.yml = ..\.vsts-ci.yml
+ ..\build\ci\.markdownlint.json = ..\build\ci\.markdownlint.json
+ ..\build\ci\cspell.json = ..\build\ci\cspell.json
+ ..\build\ci\dotnet-install.yml = ..\build\ci\dotnet-install.yml
+ ..\build\ci\gitversion.yml = ..\build\ci\gitversion.yml
..\Readme.md = ..\Readme.md
+ ..\build\ci\stage-build-linux-tests.yml = ..\build\ci\stage-build-linux-tests.yml
+ ..\build\ci\stage-build-macos-tests.yml = ..\build\ci\stage-build-macos-tests.yml
+ ..\build\ci\stage-build-packages.yml = ..\build\ci\stage-build-packages.yml
+ ..\build\ci\stage-build-windows-tests.yml = ..\build\ci\stage-build-windows-tests.yml
+ ..\build\ci\stage-determine-changes.yml = ..\build\ci\stage-determine-changes.yml
+ ..\build\ci\stage-docs-validations.yml = ..\build\ci\stage-docs-validations.yml
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Uno.Wasm.Tests.AbsoluteIntermediate", "Uno.Wasm.Tests.AbsoluteIntermediate\Uno.Wasm.Tests.AbsoluteIntermediate.csproj", "{6584CC1B-2628-4872-851A-E85C0E572D39}"
@@ -145,6 +139,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{D9443716
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Uno.Wasm.Sample.Library", "Uno.Wasm.Sample.Library\Uno.Wasm.Sample.Library.csproj", "{42FC5421-72BC-41EA-A1C4-FF88A2DC820A}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Uno.Wasm.Bootstrap.DevServer.csproj", "Uno.Wasm.Bootstrap.DevServer\Uno.Wasm.Bootstrap.DevServer.csproj.csproj", "{E12B8472-7C20-42FA-843D-7E12F523CD36}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Uno.Wasm.LogProfiler", "Uno.Wasm.LogProfiler\Uno.Wasm.LogProfiler.csproj", "{39AAD91B-9927-49F1-A186-9C710862E2FB}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Uno.Wasm.WebCIL", "Uno.Wasm.WebCIL\Uno.Wasm.WebCIL.csproj", "{49124779-05D7-4611-A116-C0086F24DE9A}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -159,10 +159,6 @@ Global
{2DFA7173-E4AD-44C6-B25A-2A455CB513FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2DFA7173-E4AD-44C6-B25A-2A455CB513FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2DFA7173-E4AD-44C6-B25A-2A455CB513FD}.Release|Any CPU.Build.0 = Release|Any CPU
- {AA1C47D5-53C6-4BD6-9206-FDD812D67C13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {AA1C47D5-53C6-4BD6-9206-FDD812D67C13}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {AA1C47D5-53C6-4BD6-9206-FDD812D67C13}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {AA1C47D5-53C6-4BD6-9206-FDD812D67C13}.Release|Any CPU.Build.0 = Release|Any CPU
{DF5FF703-BAC7-427B-BAEA-2E49B65DBF6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DF5FF703-BAC7-427B-BAEA-2E49B65DBF6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DF5FF703-BAC7-427B-BAEA-2E49B65DBF6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -211,10 +207,6 @@ Global
{3D59ACEE-12BF-4B69-AEF7-893514C0BA7D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3D59ACEE-12BF-4B69-AEF7-893514C0BA7D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3D59ACEE-12BF-4B69-AEF7-893514C0BA7D}.Release|Any CPU.Build.0 = Release|Any CPU
- {6ACB62AD-0DFF-4593-A7EC-5A4E21DA4ABE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {6ACB62AD-0DFF-4593-A7EC-5A4E21DA4ABE}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {6ACB62AD-0DFF-4593-A7EC-5A4E21DA4ABE}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {6ACB62AD-0DFF-4593-A7EC-5A4E21DA4ABE}.Release|Any CPU.Build.0 = Release|Any CPU
{EBCB3142-593E-4815-915D-3B88B75161C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EBCB3142-593E-4815-915D-3B88B75161C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EBCB3142-593E-4815-915D-3B88B75161C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -251,18 +243,6 @@ Global
{E1458920-4A5A-4D54-882D-304A46359BEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E1458920-4A5A-4D54-882D-304A46359BEC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E1458920-4A5A-4D54-882D-304A46359BEC}.Release|Any CPU.Build.0 = Release|Any CPU
- {5A0392DE-9D69-4183-9BD9-84D5723AFB76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {5A0392DE-9D69-4183-9BD9-84D5723AFB76}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {5A0392DE-9D69-4183-9BD9-84D5723AFB76}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {5A0392DE-9D69-4183-9BD9-84D5723AFB76}.Release|Any CPU.Build.0 = Release|Any CPU
- {13C116EE-6907-45D4-9CB2-F1E905C71387}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {13C116EE-6907-45D4-9CB2-F1E905C71387}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {13C116EE-6907-45D4-9CB2-F1E905C71387}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {13C116EE-6907-45D4-9CB2-F1E905C71387}.Release|Any CPU.Build.0 = Release|Any CPU
- {2477F160-939B-4B9F-B9CD-9100FCD24E34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {2477F160-939B-4B9F-B9CD-9100FCD24E34}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {2477F160-939B-4B9F-B9CD-9100FCD24E34}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {2477F160-939B-4B9F-B9CD-9100FCD24E34}.Release|Any CPU.Build.0 = Release|Any CPU
{EF3A95B2-32EE-4CAA-8235-B2AD6C540389}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EF3A95B2-32EE-4CAA-8235-B2AD6C540389}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EF3A95B2-32EE-4CAA-8235-B2AD6C540389}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -279,14 +259,6 @@ Global
{2DF55561-12DD-4325-BDBF-F42AC72FC284}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2DF55561-12DD-4325-BDBF-F42AC72FC284}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2DF55561-12DD-4325-BDBF-F42AC72FC284}.Release|Any CPU.Build.0 = Release|Any CPU
- {92B22005-5A7B-4B38-8D09-68D7240EBE8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {92B22005-5A7B-4B38-8D09-68D7240EBE8C}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {92B22005-5A7B-4B38-8D09-68D7240EBE8C}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {92B22005-5A7B-4B38-8D09-68D7240EBE8C}.Release|Any CPU.Build.0 = Release|Any CPU
- {3C2B9F04-972E-4A9F-AA08-545A67C7C455}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {3C2B9F04-972E-4A9F-AA08-545A67C7C455}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {3C2B9F04-972E-4A9F-AA08-545A67C7C455}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {3C2B9F04-972E-4A9F-AA08-545A67C7C455}.Release|Any CPU.Build.0 = Release|Any CPU
{1CA3AA29-A8FC-4CB3-8803-5BD739F2BEC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1CA3AA29-A8FC-4CB3-8803-5BD739F2BEC7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1CA3AA29-A8FC-4CB3-8803-5BD739F2BEC7}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -335,6 +307,18 @@ Global
{42FC5421-72BC-41EA-A1C4-FF88A2DC820A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{42FC5421-72BC-41EA-A1C4-FF88A2DC820A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{42FC5421-72BC-41EA-A1C4-FF88A2DC820A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E12B8472-7C20-42FA-843D-7E12F523CD36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E12B8472-7C20-42FA-843D-7E12F523CD36}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E12B8472-7C20-42FA-843D-7E12F523CD36}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E12B8472-7C20-42FA-843D-7E12F523CD36}.Release|Any CPU.Build.0 = Release|Any CPU
+ {39AAD91B-9927-49F1-A186-9C710862E2FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {39AAD91B-9927-49F1-A186-9C710862E2FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {39AAD91B-9927-49F1-A186-9C710862E2FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {39AAD91B-9927-49F1-A186-9C710862E2FB}.Release|Any CPU.Build.0 = Release|Any CPU
+ {49124779-05D7-4611-A116-C0086F24DE9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {49124779-05D7-4611-A116-C0086F24DE9A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {49124779-05D7-4611-A116-C0086F24DE9A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {49124779-05D7-4611-A116-C0086F24DE9A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -369,12 +353,10 @@ Global
{B27FC2DE-70CA-4287-9FC1-D108F115D8AA} = {35E84E5F-1C9B-4168-8333-216B456C12DF}
{B474457D-DBCD-4795-A2AB-EC3F09E53198} = {B27FC2DE-70CA-4287-9FC1-D108F115D8AA}
{ADEFF1C4-A1B5-4FE8-9EB0-A1D81B65B995} = {00F3A4D2-5534-44AF-B655-6209355E32A9}
- {2477F160-939B-4B9F-B9CD-9100FCD24E34} = {00F3A4D2-5534-44AF-B655-6209355E32A9}
{DF5C402A-5CB7-4692-BDB3-93F734E214FA} = {35E84E5F-1C9B-4168-8333-216B456C12DF}
{EF3A95B2-32EE-4CAA-8235-B2AD6C540389} = {DF5C402A-5CB7-4692-BDB3-93F734E214FA}
{B401928C-600E-4450-ADFF-20EADC7CE3EC} = {DF5C402A-5CB7-4692-BDB3-93F734E214FA}
{2DF55561-12DD-4325-BDBF-F42AC72FC284} = {5F914B7D-AFA2-4145-9548-B1B3A16D77AE}
- {92B22005-5A7B-4B38-8D09-68D7240EBE8C} = {00F3A4D2-5534-44AF-B655-6209355E32A9}
{1CA3AA29-A8FC-4CB3-8803-5BD739F2BEC7} = {B27FC2DE-70CA-4287-9FC1-D108F115D8AA}
{D348EE61-E4D1-4DAF-A84F-086BA6AD659B} = {00F3A4D2-5534-44AF-B655-6209355E32A9}
{09FAA8FC-54FE-4602-A4A3-37CD98C99F74} = {5F914B7D-AFA2-4145-9548-B1B3A16D77AE}
@@ -382,6 +364,7 @@ Global
{2829B1BF-47C7-4284-9EAF-DEB48C4A0209} = {00F3A4D2-5534-44AF-B655-6209355E32A9}
{227B4962-4978-4712-8C52-630E2371A869} = {5F914B7D-AFA2-4145-9548-B1B3A16D77AE}
{A7F3B4BF-A73D-4769-A78D-5F3CAC362AAF} = {84D19B91-8728-4EBD-A6B2-D51F3B0EAB31}
+ {70AAFC96-05F5-43A3-959A-95FB32CDE202} = {35E84E5F-1C9B-4168-8333-216B456C12DF}
{6584CC1B-2628-4872-851A-E85C0E572D39} = {35E84E5F-1C9B-4168-8333-216B456C12DF}
{B7270680-8BCF-4246-834C-0F7CAF48FBB9} = {5F914B7D-AFA2-4145-9548-B1B3A16D77AE}
{D9443716-A385-4210-80A3-06B8688EDD96} = {70AAFC96-05F5-43A3-959A-95FB32CDE202}
@@ -396,13 +379,11 @@ Global
Uno.Wasm.Tests.Shared\Uno.Wasm.Tests.Shared.projitems*{1ca3aa29-a8fc-4cb3-8803-5bd739f2bec7}*SharedItemsImports = 5
Uno.Wasm.Threads.Shared\Uno.Wasm.Threads.Shared.projitems*{1ca3aa29-a8fc-4cb3-8803-5bd739f2bec7}*SharedItemsImports = 5
Uno.Wasm.Tests.Shared\Uno.Wasm.Tests.Shared.projitems*{237820d2-9ebd-4e55-b5c3-9b50e628b8d3}*SharedItemsImports = 13
- Uno.Wasm.Sample\Uno.Wasm.Sample.projitems*{2477f160-939b-4b9f-b9cd-9100fcd24e34}*SharedItemsImports = 5
Uno.Wasm.Sample.RayTracer.Shared\Uno.Wasm.Sample.RayTracer.Shared.projitems*{286b5778-da8b-4965-9fc6-bc6f4258e155}*SharedItemsImports = 13
Uno.Wasm.StaticLinking.Shared\Uno.Wasm.StaticLinking.Shared.projitems*{2df55561-12dd-4325-bdbf-f42ac72fc284}*SharedItemsImports = 5
Uno.Wasm.Tests.Shared\Uno.Wasm.Tests.Shared.projitems*{2df55561-12dd-4325-bdbf-f42ac72fc284}*SharedItemsImports = 5
Uno.Wasm.Sample.RayTracer.Shared\Uno.Wasm.Sample.RayTracer.Shared.projitems*{7ee991bb-c93d-4720-854c-1e708b652ef1}*SharedItemsImports = 5
Uno.Wasm.Tests.Shared\Uno.Wasm.Tests.Shared.projitems*{7ee991bb-c93d-4720-854c-1e708b652ef1}*SharedItemsImports = 5
- Uno.Wasm.Sample\Uno.Wasm.Sample.projitems*{92b22005-5a7b-4b38-8d09-68d7240ebe8c}*SharedItemsImports = 5
Uno.Wasm.StaticLinking.Shared\Uno.Wasm.StaticLinking.Shared.projitems*{97e9b56a-be43-4590-a009-9ac135b371be}*SharedItemsImports = 5
Uno.Wasm.Tests.Shared\Uno.Wasm.Tests.Shared.projitems*{97e9b56a-be43-4590-a009-9ac135b371be}*SharedItemsImports = 5
Uno.Wasm.StaticLinking.Shared\Uno.Wasm.StaticLinking.Shared.projitems*{9fff339e-bd09-4d1c-a756-92ae3625eafd}*SharedItemsImports = 5
diff --git a/src/Uno.Wasm.Bootstrap/Constants.cs b/src/Uno.Wasm.Bootstrap/Constants.cs
deleted file mode 100644
index ed1e1702a..000000000
--- a/src/Uno.Wasm.Bootstrap/Constants.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Uno.Wasm.Bootstrap
-{
- internal class Constants
- {
- public const string DefaultDotnetRuntimeSdkUrl = "https://unowasmbootstrap.azureedge.net/runtime/"
- + "dotnet-runtime-wasm-linux-498e18e-7331dcb60e0-8790049905-Release.zip";
-
- ///
- /// Min version of the emscripten SDK. Must be aligned with dotnet/runtime SDK build in .
- ///
- ///
- /// The emscripten version use by dotnet/runtime can be found here:
- /// https://github.com/dotnet/runtime/blob/f9bb1673708ca840da0e71f9a9444ea9b0d31911/src/mono/wasm/Makefile#L32
- ///
- public static Version DotnetRuntimeEmscriptenVersion { get; } = new Version("3.1.34");
- }
-}
diff --git a/src/Uno.Wasm.Bootstrap/Extensions/RuntimeHelpers.cs b/src/Uno.Wasm.Bootstrap/Extensions/RuntimeHelpers.cs
deleted file mode 100644
index ac0cc2e7f..000000000
--- a/src/Uno.Wasm.Bootstrap/Extensions/RuntimeHelpers.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Uno.Wasm.Bootstrap
-{
- class RuntimeHelpers
- {
- public static bool IsNetCore => Type.GetType("System.Runtime.Loader.AssemblyLoadContext", false) != null;
-
- public static bool IsMono => Type.GetType("Mono.Runtime") != null;
- }
-}
diff --git a/src/Uno.Wasm.Bootstrap/Extensions/ZipExtensions.cs b/src/Uno.Wasm.Bootstrap/Extensions/ZipExtensions.cs
deleted file mode 100644
index c23b98c12..000000000
--- a/src/Uno.Wasm.Bootstrap/Extensions/ZipExtensions.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.IO.Compression;
-using System.Text;
-
-namespace Uno.Wasm.Bootstrap.Extensions
-{
- public static class ZipExtensions
- {
- internal static void ExtractRelativeToDirectory(this ZipArchiveEntry source, string destinationDirectoryName, bool overwrite)
- {
- // Note that this will give us a good DirectoryInfo even if destinationDirectoryName exists:
- DirectoryInfo di = Directory.CreateDirectory(destinationDirectoryName);
- string destinationDirectoryFullPath = di.FullName;
- if (!destinationDirectoryFullPath.EndsWith(new string(Path.DirectorySeparatorChar, 1)))
- {
- destinationDirectoryFullPath += Path.DirectorySeparatorChar;
- }
-
- string fileDestinationPath = Path.GetFullPath(Path.Combine(destinationDirectoryFullPath, source.FullName));
-
- if (!fileDestinationPath.StartsWith(destinationDirectoryFullPath))
- {
- throw new IOException("ExtractingResultsInOutside");
- }
-
- if (Path.GetFileName(fileDestinationPath).Length == 0)
- {
- // If it is a directory:
-
- if (source.Length != 0)
- {
- throw new IOException("DirectoryNameWithData");
- }
-
- Directory.CreateDirectory(fileDestinationPath);
- }
- else
- {
- // If it is a file:
- // Create containing directory:
- Directory.CreateDirectory(Path.GetDirectoryName(fileDestinationPath));
- source.ExtractToFile(fileDestinationPath, overwrite: overwrite);
- }
- }
-
- }
-}
diff --git a/src/Uno.Wasm.Bootstrap/FileNameObfuscationMode.cs b/src/Uno.Wasm.Bootstrap/FileNameObfuscationMode.cs
deleted file mode 100644
index bd0b177e9..000000000
--- a/src/Uno.Wasm.Bootstrap/FileNameObfuscationMode.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-// ******************************************************************
-// Copyright � 2015-2022 Uno Platform inc. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-// ******************************************************************
-//
-// This file is based on the work from https://github.com/praeclarum/Ooui
-//
-namespace Uno.Wasm.Bootstrap
-{
- internal enum FileNameObfuscationMode
- {
- Original,
- NoDots
- }
-}
diff --git a/src/Uno.Wasm.Bootstrap/LinkOptimizationLevel.cs b/src/Uno.Wasm.Bootstrap/LinkOptimizationLevel.cs
deleted file mode 100644
index 62bad1382..000000000
--- a/src/Uno.Wasm.Bootstrap/LinkOptimizationLevel.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-// ******************************************************************
-// Copyright � 2015-2022 Uno Platform inc. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-// ******************************************************************
-//
-// This file is based on the work from https://github.com/praeclarum/Ooui
-//
-
-namespace Uno.Wasm.Bootstrap
-{
- enum LinkOptimizationLevel
- {
- None,
- Level1,
- Level2,
- Level3,
- Maximum,
- }
-}
diff --git a/src/Uno.Wasm.Bootstrap/MetadataKeys.cs b/src/Uno.Wasm.Bootstrap/MetadataKeys.cs
new file mode 100644
index 000000000..d51f84f06
--- /dev/null
+++ b/src/Uno.Wasm.Bootstrap/MetadataKeys.cs
@@ -0,0 +1,142 @@
+// Extracted from https://github.com/dotnet/sdk/blob/10803eca35eef6e685924886ba74caf0bd9439ad/src/Tasks/Common/MetadataKeys.cs#L6
+
+namespace Uno.Wasm.Bootstrap
+{
+ internal static class MetadataKeys
+ {
+ // General Metadata
+ public const string Name = "Name";
+ public const string Type = "Type";
+ public const string Version = "Version";
+ public const string FileGroup = "FileGroup";
+ public const string Path = "Path";
+ public const string ResolvedPath = "ResolvedPath";
+ public const string IsImplicitlyDefined = "IsImplicitlyDefined";
+ public const string IsTopLevelDependency = "IsTopLevelDependency";
+ public const string AllowExplicitVersion = "AllowExplicitVersion";
+ public const string RelativePath = "RelativePath";
+ public const string DiagnosticLevel = "DiagnosticLevel";
+ public const string Implementation = "Implementation"; // Metadata on WinMD references
+
+ // Target Metadata
+ public const string RuntimeIdentifier = "RuntimeIdentifier";
+ public const string TargetFrameworkMoniker = "TargetFrameworkMoniker";
+ public const string TargetFramework = "TargetFramework";
+ public const string FrameworkName = "FrameworkName";
+ public const string FrameworkVersion = "FrameworkVersion";
+ public const string IsTrimmable = "IsTrimmable";
+ public const string RuntimeFrameworkName = "RuntimeFrameworkName";
+
+ // SDK Metadata
+ public const string SDKPackageItemSpec = "SDKPackageItemSpec";
+ public const string OriginalItemSpec = "OriginalItemSpec";
+ public const string SDKRootFolder = "SDKRootFolder";
+ public const string ShimRuntimeIdentifier = "ShimRuntimeIdentifier";
+ public const string RuntimePackAlwaysCopyLocal = "RuntimePackAlwaysCopyLocal";
+
+ // Foreign Keys
+ public const string ParentTarget = "ParentTarget";
+ public const string ParentTargetLibrary = "ParentTargetLibrary";
+ public const string ParentPackage = "ParentPackage";
+
+ // Tags
+ public const string Analyzer = "Analyzer";
+ public const string AnalyzerLanguage = "AnalyzerLanguage";
+ public const string TransitiveProjectReference = "TransitiveProjectReference";
+
+ // Diagnostics
+ public const string DiagnosticCode = "DiagnosticCode";
+ public const string Message = "Message";
+ public const string FilePath = "FilePath";
+ public const string Severity = "Severity";
+ public const string StartLine = "StartLine";
+ public const string StartColumn = "StartColumn";
+ public const string EndLine = "EndLine";
+ public const string EndColumn = "EndColumn";
+
+ // Publish Target Manifest
+ public const string RuntimeStoreManifestNames = "RuntimeStoreManifestNames";
+
+ // Conflict Resolution
+ public const string OverriddenPackages = "OverriddenPackages";
+
+ // Package assets
+ public const string NuGetIsFrameworkReference = "NuGetIsFrameworkReference";
+ public const string NuGetPackageId = "NuGetPackageId";
+ public const string NuGetPackageVersion = "NuGetPackageVersion";
+ public const string NuGetSourceType = "NuGetSourceType";
+ public const string PathInPackage = "PathInPackage";
+ public const string PackageDirectory = "PackageDirectory";
+ public const string Publish = "Publish";
+
+ // References
+ public const string ExternallyResolved = "ExternallyResolved";
+ public const string HintPath = "HintPath";
+ public const string MSBuildSourceProjectFile = "MSBuildSourceProjectFile";
+ public const string Private = "Private";
+ public const string Pack = "Pack";
+ public const string ReferenceSourceTarget = "ReferenceSourceTarget";
+ public const string TargetPath = "TargetPath";
+ public const string CopyLocal = "CopyLocal";
+
+ // Targeting packs
+ public const string PackageConflictPreferredPackages = "PackageConflictPreferredPackages";
+ public const string RuntimePackRuntimeIdentifiers = "RuntimePackRuntimeIdentifiers";
+ public const string RuntimePackExcludedRuntimeIdentifiers = "RuntimePackExcludedRuntimeIdentifiers";
+
+ // Runtime packs
+ public const string DropFromSingleFile = "DropFromSingleFile";
+ public const string RuntimePackLabels = "RuntimePackLabels";
+ public const string AdditionalFrameworkReferences = "AdditionalFrameworkReferences";
+
+ // Apphost packs
+ public const string ExcludedRuntimeIdentifiers = "ExcludedRuntimeIdentifiers";
+
+ // Content files
+ public const string PPOutputPath = "PPOutputPath";
+ public const string CodeLanguage = "CodeLanguage";
+ public const string CopyToOutput = "CopyToOutput";
+ public const string BuildAction = "BuildAction";
+ public const string OutputPath = "OutputPath";
+ public const string CopyToPublishDirectory = "CopyToPublishDirectory";
+ public const string ExcludeFromSingleFile = "ExcludeFromSingleFile";
+
+ // Resource assemblies
+ public const string Culture = "Culture";
+ // The DestinationSubDirectory is the directory containing the asset, relative to the destination folder.
+ public const string DestinationSubDirectory = "DestinationSubDirectory";
+
+ // Copy local assets
+ // The DestinationSubPath is the path to the asset, relative to the destination folder.
+ public const string DestinationSubPath = "DestinationSubPath";
+ public const string AssetType = "AssetType";
+
+ public const string ReferenceOnly = "ReferenceOnly";
+
+ public const string Aliases = "Aliases";
+
+ // ReadyToRun
+ public const string DotNetHostPath = "DotNetHostPath";
+ public const string JitPath = "JitPath";
+ public const string TargetOS = "TargetOS";
+ public const string TargetArch = "TargetArch";
+ public const string DiaSymReader = "DiaSymReader";
+ public const string CreatePDBCommand = "CreatePDBCommand";
+ public const string OutputR2RImage = "OutputR2RImage";
+ public const string OutputPDBImage = "OutputPDBImage";
+ public const string EmitSymbols = "EmitSymbols";
+ public const string IsVersion5 = "IsVersion5";
+ public const string CreateCompositeImage = "CreateCompositeImage";
+ public const string PerfmapFormatVersion = "PerfmapFormatVersion";
+
+ // Debug symbols
+ public const string RelatedProperty = "related";
+ public const string XmlExtension = ".xml";
+ public const string XmlFilePath = "XmlFilePath";
+ public const string PdbExtension = ".pdb";
+ public const string PdbFilePath = "PdbFilePath";
+
+ // Dependencies design time
+ public const string Resolved = "Resolved";
+ }
+}
diff --git a/src/Uno.Wasm.Bootstrap/ShellTask.AOTProfile.cs b/src/Uno.Wasm.Bootstrap/ShellTask.AOTProfile.cs
index 67228c8ef..1cf6a311c 100644
--- a/src/Uno.Wasm.Bootstrap/ShellTask.AOTProfile.cs
+++ b/src/Uno.Wasm.Bootstrap/ShellTask.AOTProfile.cs
@@ -47,7 +47,7 @@ public partial class ShellTask_v0
///
private string? TransformAOTProfile()
{
- var profilePath = AotProfile?.FirstOrDefault()?.GetMetadata("FullPath");
+ var profilePath = AotProfile;
if (profilePath != null)
{
@@ -125,7 +125,7 @@ private void TryDumpProfileMethods(Mono.Profiler.Aot.ProfileData profile, string
foreach (var method in profile.Methods)
{
- var genericParameters = string.Join("|", method.GenericInst?.Types.Select(t => t.ToString()) ?? new string[0]);
+ var genericParameters = string.Join("|", method.GenericInst?.Types.Select(t => t.ToString()) ?? []);
sb.AppendLine($"{method.Type.Module.Name};{method.Type.FullName}.{method.Name};{method.GenericInst?.Id};{genericParameters}");
}
diff --git a/src/Uno.Wasm.Bootstrap/ShellTask.cs b/src/Uno.Wasm.Bootstrap/ShellTask.cs
index 6d1b29cfc..ececf6965 100644
--- a/src/Uno.Wasm.Bootstrap/ShellTask.cs
+++ b/src/Uno.Wasm.Bootstrap/ShellTask.cs
@@ -26,13 +26,16 @@
using System.Linq;
using System.Net;
using System.Net.Http.Headers;
+using System.Reflection;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using System.Transactions;
+using System.Xml.Linq;
using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
using Microsoft.Win32.SafeHandles;
using Mono.Cecil;
using Mono.CompilerServices.SymbolWriter;
@@ -42,1712 +45,165 @@
namespace Uno.Wasm.Bootstrap
{
- public partial class ShellTask_v0 : Microsoft.Build.Utilities.Task
+ public partial class ShellTask_v0 : Task
{
private const string WasmScriptsFolder = "WasmScripts";
- private const string ServiceWorkerFileName = "service-worker.js";
private const string DeployMetadataName = "UnoDeploy";
- private static readonly string _wwwwroot = "wwwroot" + Path.DirectorySeparatorChar;
-
- private string _distPath = "";
- private string _workDistPath = "";
- private string _workDistRootPath = "";
- private string _managedPath = "";
- private string _bclPath = "";
- private string[]? _bitcodeFilesCache;
- private List _referencedAssemblies = new List();
- private Dictionary? _bclAssemblies;
- private readonly List _dependencies = new List();
- private string[]? _additionalStyles;
- private List? _resourceSearchList;
- private RuntimeExecutionMode _runtimeExecutionMode;
- private ShellMode _shellMode;
- private CompressionLayoutMode _compressionLayoutMode;
- private string _linkerBinPath = "";
- private string _finalPackagePath = "";
- private string _remoteBasePackagePath = "";
- private string[]? _contentExtensionsToExclude;
-
- private static readonly SHA384Managed _sha384 = new SHA384Managed();
- private UTF8Encoding _utf8Encoding = new UTF8Encoding(false);
- private byte[] _obfuscationKey = Array.Empty();
- private FileNameObfuscationMode _assembliesFileNameObfuscationMode
- = FileNameObfuscationMode.Original;
-
- [Microsoft.Build.Framework.Required]
- public string CurrentProjectPath { get; set; } = "";
-
- [Microsoft.Build.Framework.Required]
- public string BuildTaskBasePath { get; set; } = "";
-
- [Microsoft.Build.Framework.Required]
- public string Assembly { get; set; } = "";
-
- [Microsoft.Build.Framework.Required]
- public string DistPath { get; set; } = "";
-
- [Microsoft.Build.Framework.Required]
- public string IntermediateOutputPath { get; set; } = "";
- [Microsoft.Build.Framework.Required]
- public string ProjectDir { get; set; } = "";
-
- [Microsoft.Build.Framework.Required]
- public string MonoWasmSDKPath { get; set; } = "";
-
- public string? PackagerBinPath { get; set; }
-
- public bool UseFileIntegrity { get; set; } = true;
-
- ///
- /// Disabled until browsers get smarted about fetch vs. prefetch invocations.
- /// e.g. Chrome downloads files twice.
- ///
- public bool GeneratePrefetchHeaders { get; set; } = false;
-
- public Microsoft.Build.Framework.ITaskItem[]? ReferencePath { get; set; }
-
- public Microsoft.Build.Framework.ITaskItem[]? MonoEnvironment { get; set; }
-
- public Microsoft.Build.Framework.ITaskItem[]? RuntimeCopyExclude { get; set; }
-
- [Microsoft.Build.Framework.Required]
- public string TargetFrameworkIdentifier { get; set; } = "";
-
- public string TargetFramework { get; set; } = "";
-
- public string TargetFrameworkVersion { get; set; } = "0.0";
-
- [Microsoft.Build.Framework.Required]
- public string IndexHtmlPath { get; set; } = "";
-
- public string WebAppBasePath { get; set; } = "./";
-
- [Required]
- public string WasmShellMode { get; set; } = "";
-
- [Microsoft.Build.Framework.Required]
- public string MonoRuntimeExecutionMode { get; set; } = "";
-
- [Microsoft.Build.Framework.Required]
- public bool MonoILLinker { get; set; }
-
- public bool InvariantGlobalization { get; set; } = false;
-
- public string CSPConfiguration { get; set; } = "";
-
- public bool EnableJiterpreter { get; set; } = false;
-
- public string RuntimeOptions { get; set; } = "";
-
- public bool EmccLinkOptimization { get; set; }
-
- public string? EmccLinkOptimizationLevel { get; set; }
-
- public bool EnableLogProfiler { get; set; }
-
- public string LogProfilerOptions { get; set; } = "log:alloc,output=output.mlpd";
-
- public string AssembliesFileExtension { get; set; } = ".clr";
-
- public string AssembliesFileNameObfuscationMode { get; set; } = nameof(FileNameObfuscationMode.Original);
-
- public bool ObfuscateAssemblies { get; set; } = false;
-
- public Microsoft.Build.Framework.ITaskItem[]? Assets { get; set; }
-
- public string? ContentExtensionsToExclude { get; set; }
-
- public Microsoft.Build.Framework.ITaskItem[]? AotProfile { get; set; }
-
- public Microsoft.Build.Framework.ITaskItem[]? LinkerDescriptors { get; set; }
-
- public Microsoft.Build.Framework.ITaskItem[]? MixedModeExcludedAssembly { get; set; }
-
- public string AOTProfileExcludedMethods { get; set; } = "";
-
- public bool GenerateAOTProfileDebugList { get; set; } = false;
-
- public bool PrintAOTSkippedMethods { get; set; } = false;
-
- public Microsoft.Build.Framework.ITaskItem[]? CompressedExtensions { get; set; }
-
- public Microsoft.Build.Framework.ITaskItem[]? ExtraEmccFlags { get; set; }
-
- public Microsoft.Build.Framework.ITaskItem[]? RuntimeHostConfigurationOption { get; set; }
-
- public Microsoft.Build.Framework.ITaskItem[]? AdditionalPInvokeLibraries { get; set; }
-
- public Microsoft.Build.Framework.ITaskItem[]? NativeCompile { get; set; }
-
- public Microsoft.Build.Framework.ITaskItem[]? EmccExportedRuntimeMethods { get; set; }
-
- public bool GenerateCompressedFiles { get; set; }
-
- public string? DistCompressionLayoutMode { get; set; }
-
- public bool ForceUseWSL { get; set; }
-
- public bool EnableEmscriptenWindows { get; set; } = true;
-
- public bool ForceDisableWSL { get; set; }
-
- public bool SkipPowershellExecutionPolicyValidation { get; set; } = false;
-
- [Microsoft.Build.Framework.Required]
- public string RuntimeConfiguration { get; set; } = "";
-
- [Microsoft.Build.Framework.Required]
- public bool EnableThreads { get; set; }
-
- public int PThreadsPoolSize { get; set; } = 4;
-
- [Microsoft.Build.Framework.Required]
- public bool EnableSimd { get; set; }
-
- [Microsoft.Build.Framework.Required]
- public bool RuntimeDebuggerEnabled { get; set; }
-
- public int BrotliCompressionQuality { get; set; } = 7;
-
- public string? CustomDebuggerPath { get; set; }
-
- public string? CustomLinkerPath { get; set; }
-
- public string? WasmTunerBinPath { get; set; }
-
- public string? PWAManifestFile { get; set; }
-
- public bool EnableLongPathSupport { get; set; } = true;
-
- public bool EnableEmccProfiling { get; set; } = false;
-
- public bool EnableNetCoreICU { get; set; } = true;
-
- public bool EnableAOTDeduplication { get; set; } = true;
-
- public bool EnableAotGSharedVT { get; set; } = false;
-
- public string? AotCompilerOptions { get; set; }
-
- public bool GenerateAOTProfile { get; set; } = false;
-
- public string? NinjaAdditionalParameters { get; set; }
-
- [Output]
- public string? OutputPackagePath { get; private set; }
-
- [Output]
- public string? OutputDistPath { get; private set; }
-
- private Version ActualTargetFrameworkVersion
- => Version.TryParse(TargetFrameworkVersion.Substring(1), out var v) ? v : new Version("0.0");
-
- public override bool Execute()
- {
- try
- {
- if (string.IsNullOrEmpty(TargetFramework))
- {
- throw new InvalidOperationException($"The TargetFramework task parameter must be defined.");
- }
-
- if(TargetFrameworkIdentifier == ".NETCoreApp" && ActualTargetFrameworkVersion < new Version("5.0"))
- {
- throw new InvalidOperationException($"The TargetFramework version must be above 5.0 (found {TargetFrameworkVersion})");
- }
-
- // Debugger.Launch();
-
- PreloadAssemblies();
- ValidateEmscriptenWindowsAvailability();
- TryGenerateObfuscationKey();
- TryEnableLongPathAware();
- ParseProperties();
- GetBcl();
- CreateDist();
- CopyContent();
- CopyRuntime();
- RunPackager();
- TryDeployDebuggerProxy();
- GenerateServerAppFeaturesInfo();
- ExtractAdditionalJS();
- ExtractAdditionalCSS();
- CleanupDist();
- PrepareFinalDist();
- TouchServiceWorker();
- GenerateConfig();
- MergeConfig();
- GenerateIndexHtml();
- GenerateEmbeddedJs();
- TryCompressDist();
-
- return true;
- }
- catch (Exception ex)
- {
- Log.LogError(ex.ToString(), false, true, null);
- return false;
- }
- }
-
- private void TryGenerateObfuscationKey()
- {
- if (ObfuscateAssemblies)
- {
- _obfuscationKey = Encoding.ASCII.GetBytes(Guid.NewGuid().ToString().Split('-')[0]);
- }
- }
-
- private void PreloadAssemblies()
- {
- // Under some circumstances, the assemblies bundled with the bootstrapper do not
- // get loaded properly by .NET Core. This is method forces the loading of those
- // assemblies in order to let the loading find them automatically.
-
- var path = Path.GetDirectoryName(new Uri(GetType().Assembly.GetName().CodeBase).LocalPath);
-
- foreach (var file in Directory.GetFiles(path, "*.dll"))
- {
- _ = System.Reflection.Assembly.LoadFile(Path.Combine(path, file));
- }
- }
-
- private void TryEnableLongPathAware()
- {
- if (EnableLongPathSupport)
- {
- // In some cases, particularly when using the Azure publish task
- // long paths using the "\\?\" prefix is not supported. Fallback on
- // standard paths in such cases.
-
- try
- {
- var path = TryConvertLongPath(Path.GetFullPath(DistPath));
-
- DirectoryCreateDirectory(path);
- }
- catch (ArgumentException e)
- {
- Log.LogMessage($"Long path format use failed, falling back to standard path (Error: {e.Message})");
- EnableLongPathSupport = false;
- }
- }
-
- IntermediateOutputPath = TryConvertLongPath(IntermediateOutputPath);
-
- if (!Path.IsPathRooted(IntermediateOutputPath))
- {
- IntermediateOutputPath = TryConvertLongPath(Path.Combine(ProjectDir, IntermediateOutputPath));
- }
-
- DistPath = TryConvertLongPath(DistPath);
- CurrentProjectPath = TryConvertLongPath(CurrentProjectPath);
- CustomDebuggerPath = TryConvertLongPath(CustomDebuggerPath!);
- }
-
- private void ValidateEmscriptenWindowsAvailability()
- {
- if (EnableEmscriptenWindows && Environment.OSVersion.Platform != PlatformID.Win32NT)
- {
- EnableEmscriptenWindows = false;
- }
- }
-
-
- private void TouchServiceWorker()
- {
- // The service worker file must change to be reloaded properly, add the dist digest
- // as cache trasher.
- var workerFilePath = Path.Combine(_finalPackagePath, ServiceWorkerFileName);
- var workerBody = File.ReadAllText(workerFilePath);
-
- workerBody = workerBody.Replace("$(CACHE_KEY)", Path.GetFileName(_remoteBasePackagePath));
- workerBody = workerBody.Replace("$(REMOTE_BASE_PATH)", _remoteBasePackagePath);
- workerBody = workerBody.Replace("$(REMOTE_WEBAPP_PATH)", WebAppBasePath);
- workerBody += $"\r\n\r\n// {Path.GetFileName(_managedPath)}";
-
- File.WriteAllText(workerFilePath, workerBody);
-
- // The service worker file must be placed at the root in order to specify the
- // "./" scope to include index.html in the worker. Otherwise, offline mode cannot
- // work if index.html is not cached.
- MoveFileSafe(workerFilePath, Path.Combine(_distPath, ServiceWorkerFileName));
- }
-
- private void FileCopy(string source, string dest, bool overwrite = false)
- {
- var sourceFileName = PathHelper.FixupPath(source);
- var destFileName = PathHelper.FixupPath(dest);
-
- try
- {
- File.Copy(sourceFileName, destFileName, overwrite);
- }
- catch (Exception ex)
- {
- Log.LogError($"Failed to copy {sourceFileName} to {destFileName}: {ex.Message}");
- throw;
- }
- }
-
- private void DirectoryCreateDirectory(string directory)
- {
- var directoryName = PathHelper.FixupPath(directory);
-
- try
- {
- Directory.CreateDirectory(directoryName);
- }
- catch (Exception /*e*/)
- {
- Log.LogError($"Failed to create directory [{directoryName}][{directory}]");
- throw;
- }
- }
-
- private void CleanupDist()
- {
- var unusedFiles = new[] {
- "*.wast",
- "*.bc",
- "*.a",
- "*.rsp",
- "*.c",
- "*.h",
- "package.json",
- };
-
- foreach (var unusedFile in unusedFiles)
- {
- foreach (var file in Directory.EnumerateFiles(_workDistPath, unusedFile))
- {
- Log.LogMessage(MessageImportance.Low, $"Removing unused file {file}");
- File.Delete(file);
- }
- }
- }
-
- private void TryCompressDist()
- {
- var hasCompressedExtensions = (CompressedExtensions?.Any() ?? false);
-
- if (
- !RuntimeDebuggerEnabled
- && GenerateCompressedFiles
- && hasCompressedExtensions
- )
- {
- TryParseDistCompressionLayoutMode();
-
- var compressibleExtensions = CompressedExtensions
- .Select(e => e.ItemSpec);
-
- Log.LogMessage(MessageImportance.Low, $"Compressing {string.Join(", ", compressibleExtensions)}");
-
- var filesToCompress = compressibleExtensions
- .Select(e => {
- if (_assembliesFileNameObfuscationMode == FileNameObfuscationMode.NoDots)
- {
- e = e.Replace(".", "_");
- }
- return e;
- })
- .SelectMany(e => Directory.GetFiles(_finalPackagePath, "*" + e, SearchOption.AllDirectories))
- .Where(f => !Path.GetDirectoryName(f).Contains("_compressed_"))
- .Distinct()
- .ToArray();
-
- if (_compressionLayoutMode == CompressionLayoutMode.Legacy)
- {
- CompressFiles(filesToCompress, "gz", GzipCompress);
- }
-
- CompressFiles(filesToCompress, "br", BrotliCompress);
- }
- else
- {
- Log.LogMessage(MessageImportance.Low,
- $"Compression is disabled (RuntimeDebuggerEnabled:{RuntimeDebuggerEnabled}, " +
- $"GenerateCompressedFiles:{GenerateCompressedFiles}, " +
- $"hasCompressedExtensions:{hasCompressedExtensions})");
- }
- }
-
- private void TryParseDistCompressionLayoutMode()
- {
- if (string.IsNullOrEmpty(DistCompressionLayoutMode))
- {
- var webConfigPath = Directory.GetFiles(_distPath, "web.config").FirstOrDefault();
-
- if (!string.IsNullOrEmpty(webConfigPath)
- && File.ReadAllText(webConfigPath).Contains("_compressed_br"))
- {
- _compressionLayoutMode = CompressionLayoutMode.Legacy;
- }
- else
- {
- _compressionLayoutMode = CompressionLayoutMode.InPlace;
- }
- }
- else
- {
- ParseEnumProperty(nameof(CompressionLayoutMode), DistCompressionLayoutMode!, out _compressionLayoutMode);
- }
- }
-
- private void CompressFiles(string[] filesToCompress, string method, Action compressHandler)
- => filesToCompress
- .AsParallel()
- .Select(fileName =>
- {
- var compressedPathBase = _compressionLayoutMode switch
- {
- CompressionLayoutMode.InPlace => _distPath,
- CompressionLayoutMode.Legacy => Path.Combine(_distPath, "_compressed_" + method),
- _ => throw new NotSupportedException($"CompressionLayoutMode {_compressionLayoutMode} is not supported")
- };
-
- var compressedFileName = fileName;
- compressedFileName = compressedFileName.Replace(_distPath, compressedPathBase);
-
- if (_compressionLayoutMode == CompressionLayoutMode.InPlace)
- {
- compressedFileName += "." + method;
- }
-
- DirectoryCreateDirectory(Path.GetDirectoryName(compressedFileName));
-
- if (File.Exists(compressedFileName))
- {
- if (File.GetCreationTime(compressedFileName) < File.GetCreationTime(fileName))
- {
- Log.LogMessage(MessageImportance.Low, $"Deleting {compressedFileName} as the source has changed");
- File.Delete(compressedFileName);
- }
- }
-
- Log.LogMessage($"Compressing {fileName}->{compressedFileName}");
-
- compressHandler(fileName, compressedFileName);
-
- return true;
- })
- .ToArray();
-
- private void GzipCompress(string source, string destination)
- {
- using var inStream = File.Open(source, FileMode.Open, FileAccess.Read, FileShare.Read);
- using var compressedFileStream = File.Create(destination);
- using var compressionStream = new GZipStream(compressedFileStream, CompressionLevel.Optimal);
-
- inStream.CopyTo(compressionStream);
- }
-
- private void BrotliCompress(string source, string destination)
- {
- using var input = File.Open(source, FileMode.Open, FileAccess.Read, FileShare.Read);
- using var output = File.Create(destination);
- using var bs = new BrotliSharpLib.BrotliStream(output, CompressionMode.Compress);
-
- // By default, BrotliSharpLib uses a quality value of 1 and window size of 22 if the methods are not called.
- bs.SetQuality(BrotliCompressionQuality);
- /** bs.SetWindow(windowSize); **/
- /** bs.SetCustomDictionary(customDict); **/
- input.CopyTo(bs);
-
- /* IMPORTANT: Only use the destination stream after closing/disposing the BrotliStream
- as the BrotliStream must be closed in order to signal that no more blocks are being written
- for the final block to be flushed out
- */
- bs.Dispose();
- }
-
- private bool IsWSLRequired =>
- Environment.OSVersion.Platform == PlatformID.Win32NT
- && !EnableEmscriptenWindows
- && (GetBitcodeFilesParams().Any() || _runtimeExecutionMode != RuntimeExecutionMode.Interpreter || ForceUseWSL || GenerateAOTProfile || UseAotProfile);
-
- private bool UseAotProfile => (AotProfile?.Any() ?? false) && _runtimeExecutionMode == RuntimeExecutionMode.InterpreterAndAOT;
-
- public Version CurrentEmscriptenVersion => Constants.DotnetRuntimeEmscriptenVersion;
-
- public bool HasAdditionalPInvokeLibraries => AdditionalPInvokeLibraries is { } libs && libs.Length != 0;
-
- public bool HasNativeCompile => NativeCompile is { } nativeCompile && nativeCompile.Length != 0;
-
- private (int exitCode, string output, string error) RunProcess(
- string executable,
- string parameters,
- string? workingDirectory = null,
- (string variable, string value)[]? environmentVariables = null)
- {
- if (IsWSLRequired
- && !ForceDisableWSL
- && !EnableEmscriptenWindows
- && !executable.EndsWith("bash.exe", StringComparison.OrdinalIgnoreCase))
- {
- var unixPath = AlignPath(executable, escape: true);
- var dotnetRuntimePath = Path.GetExtension(executable).ToLowerInvariant()
- switch
- {
- ".exe" => "mono",
- ".dll" => "dotnet",
- _ => ""
- };
-
- var cwd = workingDirectory != null ? $"cd \\\"{AlignPath(workingDirectory, escape: true)}\\\" && " : "";
-
- parameters = $"-c \" {cwd} {dotnetRuntimePath} {unixPath} " + parameters.Replace("\\", "\\\\").Replace("\"", "\\\"") + "\"";
-
- executable = GetWSLBashExecutable();
- }
- else if (RuntimeHelpers.IsNetCore
- && (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)
- || RuntimeInformation.IsOSPlatform(OSPlatform.Linux)
- )
- )
- {
- if (executable.EndsWith(".exe", StringComparison.OrdinalIgnoreCase))
- {
- parameters = $"\"{executable}\" {parameters}";
- executable = "mono";
- }
-
- if (executable.EndsWith(".dll", StringComparison.OrdinalIgnoreCase))
- {
- parameters = $"\"{executable}\" {parameters}";
- executable = "dotnet";
- }
- }
- else
- {
- if (executable.EndsWith(".dll", StringComparison.OrdinalIgnoreCase))
- {
- parameters = $"\"{executable}\" {parameters}";
- executable = "dotnet";
- }
- }
-
- var p = new Process
- {
- StartInfo =
- {
- UseShellExecute = false,
- RedirectStandardOutput = true,
- RedirectStandardError = true,
- FileName = executable,
- Arguments = parameters
- }
- };
-
- if(environmentVariables is not null)
- {
- foreach (var envVar in environmentVariables)
- {
- p.StartInfo.Environment.Add(envVar.variable, envVar.value);
- }
- }
-
- if (workingDirectory != null)
- {
- p.StartInfo.WorkingDirectory = workingDirectory;
- }
-
- Log.LogMessage($"Running [{p.StartInfo.WorkingDirectory}]: {p.StartInfo.FileName} {p.StartInfo.Arguments}");
-
- var output = new StringBuilder();
- var error = new StringBuilder();
- var elapsed = Stopwatch.StartNew();
- p.OutputDataReceived += (s, e) => { if (e.Data != null) { Log.LogMessage($"[{elapsed.Elapsed}] {e.Data}"); output.Append(e.Data); } };
- p.ErrorDataReceived += (s, e) => { if (e.Data != null) { Log.LogError($"[{elapsed.Elapsed}] {e.Data}"); error.Append(e.Data); } };
-
- if (p.Start())
- {
- p.BeginOutputReadLine();
- p.BeginErrorReadLine();
- p.WaitForExit();
- var exitCore = p.ExitCode;
- p.Close();
-
- return (exitCore, output.ToString(), error.ToString());
- }
- else
- {
- throw new Exception($"Failed to start [{executable}]");
- }
- }
-
- private static string GetWSLBashExecutable()
- {
- string executable;
- var basePaths = new[] {
- Path.Combine(Environment.GetEnvironmentVariable("WINDIR"), "sysnative"), // 32 bits process
- Path.Combine(Environment.GetEnvironmentVariable("WINDIR"), "System32"), // 64 bits process
- };
-
- var fullPaths = basePaths.Select(p => Path.Combine(p, "bash.exe"));
-
- executable = fullPaths.FirstOrDefault(f => File.Exists(f));
-
- if (string.IsNullOrEmpty(executable))
- {
- var allPaths = string.Join(";", fullPaths);
-
- throw new InvalidOperationException(
- $"WSL is required for this build but could not be found (Searched for [{allPaths}]). " +
- $"WSL use may be explicitly disabled for CI Windows builds, see more details here: https://github.com/unoplatform/Uno.Wasm.Bootstrap#special-considerations-for-ci-servers-github-actions-azure-devops");
- }
-
- return executable;
- }
-
- private string AlignPath(string path, bool escape = false)
- {
- var trimmedPath = path.Replace("\\\\?\\", "");
-
- string convertPath()
- {
- if(IsWSLRequired && !ForceDisableWSL && Path.IsPathRooted(path))
- {
-
- var drive = trimmedPath.Substring(0, 1).ToLowerInvariant();
- var remainder = trimmedPath.Substring(3).Replace("\\", "/");
-
- var r = $"/mnt/{drive}/{remainder}";
-
- Log.LogMessage(MessageImportance.High, $"{path} -> {r}");
- return r;
- }
- else
- {
- return trimmedPath;
- }
- }
-
- var output = convertPath();
-
- if (escape)
- {
- output = output.Replace("\"", "\\\"");
- }
-
- return output;
- }
-
- private void TryDeployDebuggerProxy()
- {
- var sdkName = Path.GetFileName(MonoWasmSDKPath);
-
- if (!string.IsNullOrEmpty(CustomDebuggerPath))
- {
- CustomDebuggerPath = PathHelper.FixupPath(CustomDebuggerPath!);
- }
-
- var wasmDebuggerRootPath = Path.Combine(IntermediateOutputPath, "wasm-debugger");
- DirectoryCreateDirectory(wasmDebuggerRootPath);
-
- var debuggerBinBasePaths = new[] {
- Path.Combine(MonoWasmSDKPath, "dbg-proxy", TargetFramework.ToLower()), // Compatibility with previous runtime packages
- Path.Combine(MonoWasmSDKPath, "dbg-proxy", "net5", "Release"), // Compatibility with previous runtime packages
- Path.Combine(MonoWasmSDKPath, "dbg-proxy", "net5"),
- Path.Combine(MonoWasmSDKPath, "dbg-proxy", "net7.0")
- };
-
- var proxyBasePath = debuggerBinBasePaths.First(Directory.Exists);
-
- // Write down the debugger file path so the static file server can find it
- File.WriteAllText(Path.Combine(wasmDebuggerRootPath, ".debuggerinfo"), proxyBasePath);
- }
-
- private void GenerateServerAppFeaturesInfo()
- // Write down an info file so the static file server can find it
- => File.WriteAllText(Path.Combine(IntermediateOutputPath, ".unoappfeatures"), BuildRuntimeFeatures());
-
- private void RunPackager()
- {
- BuildReferencedAssembliesList();
-
- var workAotPath = Path.Combine(IntermediateOutputPath, "workAot");
-
- if (Directory.Exists(workAotPath))
- {
- DirectoryDelete(workAotPath);
- }
-
- DirectoryCreateDirectory(workAotPath);
-
- var referencePathsParameter = string.Join(
- " "
- , _referencedAssemblies.Select(Path.GetDirectoryName).Distinct().Select(r => $"--search-path=\"{AlignPath(r)}\""));
-
- var referenceAssembliesParameter = string.Join(
- " "
- , _referencedAssemblies.Distinct().Select(r => $"--asm-ref=\"{AlignPath(r)}\""));
-
- var metadataUpdaterPath = Path.Combine(BuildTaskBasePath, "..", "tools", "support", "Uno.Wasm.MetadataUpdater.dll");
-
- if (RuntimeDebuggerEnabled)
- {
- referencePathsParameter += $" \"{AlignPath(metadataUpdaterPath)}\"";
- }
-
- var debugOption = RuntimeDebuggerEnabled ? "--debug" : "";
- string packagerBinPath = string.IsNullOrWhiteSpace(PackagerBinPath) ? Path.Combine(MonoWasmSDKPath, "packager.exe") : PackagerBinPath!;
- var appDirParm = $"--appdir=\"{AlignPath(_workDistPath)}\" ";
-
- // Determines if the packager needs to be used.
- var useFullPackager =
- !ForceDisableWSL
- && (IsRuntimeAOT()
- || GetBitcodeFilesParams().Any()
- || IsWSLRequired
- || HasAdditionalPInvokeLibraries
- || HasNativeCompile
- || GenerateAOTProfile
- || EnableLogProfiler);
-
- var emsdkPath = useFullPackager ? ValidateEmscripten() : "";
-
- ValidateDotnet();
- LinkerSetup();
-
- var runtimeConfigurationParam = $"--runtime-config={RuntimeConfiguration.ToLowerInvariant()}"
- + (EnableThreads ? "-threads" : "") + " "
- + (EnableSimd ? "-simd" : "") + " "
- + (EnableJiterpreter ? "-jiterpreter" : "") + " "
- + (PrintAOTSkippedMethods ? "-print-skipped-aot-methods" : "") + " "
- + (string.IsNullOrWhiteSpace(RuntimeOptions) ? "" : $"--runtime-options \"{RuntimeOptions}\" ")
-
- // Disable icalls generation on macOS, as it's using the cross-compiler that is not available
- + (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? "--no-link-icalls" : "");
-
- if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) && IsRuntimeAOT())
- {
- throw new Exception("Building with AOT is not supported on macOS");
- }
-
- var pthreadPoolSizeParam = $"--pthread-pool-size={PThreadsPoolSize}";
-
- var enableICUParam = EnableNetCoreICU ? "--icu" : "";
- var monovmparams = $"--framework=net5 --runtimepack-dir=\"{AlignPath(MonoWasmSDKPath)}\" {enableICUParam} {pthreadPoolSizeParam} --illinker-path=\"{_linkerBinPath}\"";
- var pass1ResponseContent = $"{runtimeConfigurationParam} {appDirParm} {monovmparams} --zlib {debugOption} {referenceAssembliesParameter} {referencePathsParameter} \"{AlignPath(TryConvertLongPath(Path.GetFullPath(Assembly)))}\"";
-
- var packagerPass1ResponseFile = Path.Combine(workAotPath, "packager-pass1.rsp");
- File.WriteAllText(packagerPass1ResponseFile, pass1ResponseContent);
-
- Log.LogMessage(MessageImportance.Low, $"Response file: {pass1ResponseContent}");
-
- //
- // Run the packager to create the original layout. The AOT will optionally run over this pass.
- //
- var packagerResults = RunProcess(packagerBinPath, $"\"@{AlignPath(packagerPass1ResponseFile)}\"", _workDistPath);
-
- if (packagerResults.exitCode != 0)
- {
- throw new Exception("Failed to generate wasm layout (More details are available in diagnostics mode or using the MSBuild /bl switch)");
- }
-
- if (useFullPackager)
- {
- var extraEmccFlags = (ExtraEmccFlags?.Select(f => f.ItemSpec) ?? new string[0]).ToList();
- var extraLinkerFlags = GetLinkerFeatureConfiguration();
-
- var packagerParams = new List();
-
- var mixedModeExcluded = MixedModeExcludedAssembly
- ?.Select(a => a.ItemSpec)
- .ToArray() ?? Array.Empty();
-
- var useAotProfile = !GenerateAOTProfile && UseAotProfile;
- var aotProfileFilePath = TransformAOTProfile();
-
- var mixedModeAotAssembliesParam = mixedModeExcluded.Any() && !useAotProfile ? "--skip-aot-assemblies=" + string.Join(",", mixedModeExcluded) : "";
- var aotProfile = useAotProfile ? $"\"--aot-profile={AlignPath(aotProfileFilePath!)}\"" : "";
-
- var dynamicLibraries = GetDynamicLibrariesParams();
- var dynamicLibraryParams = dynamicLibraries.Any() ? "--pinvoke-libs=" + string.Join(",", dynamicLibraries) : "";
-
- var bitcodeFiles = GetBitcodeFilesParams();
- var bitcodeFilesParams = dynamicLibraries.Any() ? string.Join(" ", bitcodeFiles.Select(f => $"\"--native-lib={AlignPath(f)}\"")) : "";
-
- var additionalNativeCompile = HasNativeCompile
- ? string.Join(" ", NativeCompile.Select(f => $"\"--native-compile={AlignPath(GetFilePaths(f).fullPath)}\""))
- : "";
-
- var emccExportedRuntimeMethodsParams =
- string.Join(" ", GetEmccExportedRuntimeMethods().Select(f => $"\"--emcc-exported-runtime-method={f}\""));
-
- if (_runtimeExecutionMode != RuntimeExecutionMode.Interpreter && GenerateAOTProfile)
- {
- Log.LogMessage($"Forcing Interpreter mode because GenerateAOTProfile is set");
- _runtimeExecutionMode = RuntimeExecutionMode.Interpreter;
- }
-
- var aotMode = _runtimeExecutionMode switch
- {
- RuntimeExecutionMode.FullAOT => throw new NotSupportedException("FullAOT mode is not supported by this version of the .NET Runtime"), // "--aot",
- RuntimeExecutionMode.InterpreterAndAOT => $"--aot-interp {mixedModeAotAssembliesParam}",
- RuntimeExecutionMode.Interpreter => "",
- _ => throw new NotSupportedException($"Mode {_runtimeExecutionMode} is not supported"),
- };
-
- var dedupOption = !EnableAOTDeduplication ? "--no-dedup" : "";
-
- var aotOptions = $"{aotMode} {dedupOption} {dynamicLibraryParams} {bitcodeFilesParams} {additionalNativeCompile} {emccExportedRuntimeMethodsParams} --emscripten-sdkdir=\"{emsdkPath}\" --builddir=\"{AlignPath(workAotPath)}\"";
-
- if (EnableEmccProfiling)
- {
- extraEmccFlags.Add("--profiling");
- }
-
- packagerParams.Add("--wasm-exceptions");
-
- if (GenerateAOTProfile)
- {
- var aotProfilerSupport = Path.Combine(BuildTaskBasePath, "..", "tools", "support", "Uno.Wasm.AotProfiler.dll");
- referencePathsParameter += $" \"{AlignPath(aotProfilerSupport)}\"";
- }
-
- if(string.IsNullOrEmpty(AotCompilerOptions) && EnableAotGSharedVT)
- {
- AotCompilerOptions = $"-O=gsharedvt";
- }
-
- if (EnableLogProfiler)
- {
- var logProfilerSupport = Path.Combine(BuildTaskBasePath, "..", "tools", "support", "Uno.Wasm.LogProfiler.dll");
- referencePathsParameter += $" \"{AlignPath(logProfilerSupport)}\"";
- }
-
- var extraEmccFlagsPararm = string.Join(" ", extraEmccFlags).Replace("\\", "\\\\");
-
- // Handle the `net8.0-browserwasm` case. The target framework is only
- // used to generate the temporary aot classes, so the base TF is enough.
- var baseTargetFramework = GetBaseTargetFramework();
-
- packagerParams.Add(appDirParm);
- packagerParams.Add(debugOption);
- packagerParams.Add(monovmparams);
- packagerParams.Add("--zlib");
- packagerParams.Add($"--illinker-path=\"{_linkerBinPath}\"");
- packagerParams.Add($"--target-framework=\"{baseTargetFramework}\"");
- packagerParams.Add("--enable-fs ");
- packagerParams.Add($"--extra-emccflags=\"{extraEmccFlagsPararm} -l idbfs.js\" ");
- packagerParams.Add($"--extra-linkerflags=\"{extraLinkerFlags}\"");
- packagerParams.Add(runtimeConfigurationParam);
- packagerParams.Add(aotOptions);
- packagerParams.Add(aotProfile);
- packagerParams.Add($"--aot-compiler-opts=\"{AotCompilerOptions}\"");
- packagerParams.Add(EmccLinkOptimization ? "--emcc-link-optimization" : "");
- packagerParams.Add(MonoILLinker ? "--linker --link-mode=all" : "");
- packagerParams.Add(referencePathsParameter);
- packagerParams.Add(referenceAssembliesParameter);
- packagerParams.Add(GenerateAOTProfile ? "--profile=aot" : "");
- packagerParams.Add(EnableLogProfiler ? "--profile=log" : "");
- packagerParams.Add(!string.IsNullOrEmpty(WasmTunerBinPath) ? $"\"--wasm-tuner-path={AlignPath(Path.GetFullPath(WasmTunerBinPath))}\"" : "");
- packagerParams.Add($"\"--linker-optimization-level={GetEmccLinkerOptimizationLevel()}\"");
- packagerParams.Add($"\"{AlignPath(Path.GetFullPath(Assembly))}\"");
-
- if (InvariantGlobalization)
- {
- packagerParams.Add("--invariant-globalization");
- }
-
- var packagerResponseFile = Path.Combine(workAotPath, "packager.rsp");
- File.WriteAllLines(packagerResponseFile, packagerParams.Select(p => p.Replace("\\", "/")));
-
- Log.LogMessage(MessageImportance.Low, $"Response file: {File.ReadAllText(packagerResponseFile)}");
-
- var aotPackagerResult = RunProcess(packagerBinPath, $"@\"{AlignPath(packagerResponseFile)}\"", _workDistPath);
-
- if (aotPackagerResult.exitCode != 0)
- {
- throw new Exception("Failed to generate wasm layout (More details are available in diagnostics mode or using the MSBuild /bl switch)");
- }
-
- var ninjaPath = Path.Combine(MonoWasmSDKPath, "tools", "ninja.exe");
-
- var environmentVariables = default((string, string)[]);
- if (GenerateAOTProfile)
- {
- // https://github.com/dotnet/runtime/blob/21f07e17b0874a898c660afc07261c70a2cb867d/src/mono/wasm/build/WasmApp.Native.targets#L278
- environmentVariables = new[] { ("ENABLE_AOT_PROFILER", "1"), ("ENABLE_BROWSER_PROFILER", "1") };
- }
-
- var ninjaResult = EnableEmscriptenWindows
- ? RunProcess("cmd", $"/c call \"{emsdkPath}\\emsdk_env.bat\" 2>&1 && {ninjaPath} {NinjaAdditionalParameters} -v", workAotPath, environmentVariables)
- : RunProcess("ninja", $"{NinjaAdditionalParameters} -v", workAotPath, environmentVariables);
-
- if (ninjaResult.exitCode != 0)
- {
- throw new Exception("Failed to run emscripten. More details are available in diagnostics logging mode or using the MSBuild /bl switch, see https://aka.platform.uno/msbuild-troubleshoot.");
- }
-
- CleanupLinkerRemovedFiles(workAotPath);
- }
- else
- {
- if (ForceDisableWSL)
- {
- Log.LogWarning(
- "WARNING: WebAssembly emscripten packaging has been explicitly disabled through" +
- " WasmShellForceDisableWSL, the resulting compilation may not run properly.");
- }
-
- //
- // Run the IL Linker on the interpreter based output, as the packager does not yet do it.
- //
- if (
- MonoILLinker
- )
- {
- var linkerInput = Path.Combine(IntermediateOutputPath, "linker-in");
- var linkerResponse = Path.Combine(linkerInput, "linker.rsp");
- var linkerParams = new List();
-
- if (Directory.Exists(linkerInput))
- {
- DirectoryDelete(linkerInput);
- }
-
- Directory.Move(_managedPath, linkerInput);
- DirectoryCreateDirectory(_managedPath);
-
- var assemblyPath = Path.Combine(linkerInput, Path.GetFileName(Assembly));
-
- // Use explicit assemby references first
- var referenceAssemblyPaths = _referencedAssemblies.Distinct().Select(p => $"-reference \"{p}\" ");
- linkerParams.AddRange(referenceAssemblyPaths);
-
- // Then search for other known paths
- var linkerSearchPaths = _referencedAssemblies.Select(Path.GetDirectoryName).Distinct().Select(p => $"-d \"{p}\" ");
- linkerParams.AddRange(linkerSearchPaths);
- linkerParams.Add($"-d \"{_bclPath}\"");
-
- var frameworkBindings = new List
- {
- };
-
- var bindingsPath = frameworkBindings.Select(a => $"-a \"{Path.Combine(linkerInput, a)}\"");
- linkerParams.AddRange(bindingsPath);
-
- if (RuntimeDebuggerEnabled)
- {
- linkerParams.Add($" -a \"{metadataUpdaterPath}\"");
- }
-
- // Opts should be aligned with the monolinker call in packager.cs, validate for linker_args as well
- linkerParams.Add($"--deterministic --disable-opt unreachablebodies ");
-
- // disabled to align with the .NET SDK default behavior (https://github.com/dotnet/runtime/issues/90745)
- // linkerParams.Add($"--used-attrs-only true ");
-
- // Metadata linking https://github.com/mono/linker/commit/fafb6cf6a385a8c753faa174b9ab7c3600a9d494
- linkerParams.Add("--keep-metadata all ");
-
- linkerParams.Add(GetLinkerFeatureConfiguration());
- linkerParams.Add($"--verbose -b true -a \"{assemblyPath}\" entrypoint -d \"{_managedPath}\"");
- linkerParams.Add($"-out \"{_managedPath}\"");
-
- File.WriteAllLines(linkerResponse, linkerParams);
-
- Log.LogMessage(MessageImportance.Low, $"Response file: {File.ReadAllText(linkerResponse)}");
-
- var linkerResults = RunProcess(
- Path.Combine(_linkerBinPath, "illink.dll"),
- $"\"@{linkerResponse}\"",
- _managedPath
- );
-
- if (linkerResults.exitCode != 0)
- {
- throw new Exception("Failed to execute the linker");
- }
-
- //
- // The linker removes files after the mono-config.json file has been
- // generated by the packager. Synchronize the list with the actual list.
- //
- var deletedFiles = Directory
- .GetFiles(linkerInput, "*.*", SearchOption.AllDirectories)
- .Select(Path.GetFileName)
- .Except(Directory
- .GetFiles(_managedPath, "*.*", SearchOption.AllDirectories)
- .Select(Path.GetFileName)
- );
-
- AdjustMonoConfigJson(deletedFiles);
- }
- }
- }
-
- private string GetBaseTargetFramework()
- {
- var platformIndex = TargetFramework.IndexOf("-");
- var baseTargetFramework = platformIndex > -1
- ? TargetFramework.Substring(0, platformIndex)
- : TargetFramework;
-
- return baseTargetFramework;
- }
-
- private void CleanupLinkerRemovedFiles(string workAotPath)
- {
- // Debugger.Launch();
-
- var linkerOut = Path.Combine(workAotPath, "linker-out");
-
- if (MonoILLinker)
- {
- //
- // Additional assemblies are created as part of the packager processing
- // remove those files so they're not part of the final payload.
- //
- var temporaryFilesToDelete = Directory
- .GetFiles(linkerOut, "*.aot-only")
- .SelectMany(f => new[] {
- Path.ChangeExtension(Path.GetFileName(f), ".dll"),
- Path.ChangeExtension(Path.GetFileName(f), ".pdb")
- })
- .ToList();
-
- AdjustMonoConfigJson(temporaryFilesToDelete);
-
- temporaryFilesToDelete.ForEach(f => File.Delete(Path.Combine(_workDistPath, "managed", f)));
- }
- }
-
- private void AdjustMonoConfigJson(IEnumerable deletedFiles)
- {
- var monoConfigFilePath = Path.Combine(_workDistPath, "mono-config.json");
-
- if (JsonConvert.DeserializeObject(File.ReadAllText(monoConfigFilePath)) is JObject monoConfig)
- {
- if (monoConfig["assets"] is JArray assetsArray)
- {
- // Cleanup the assets list for deleted files
- var assetsDoDelete = assetsArray
- .Where(asset => deletedFiles.Contains(asset["virtualPath"]?.Value()))
- .ToList();
-
- assetsDoDelete.ForEach(a => assetsArray.Remove(a));
-
- foreach (var asset in assetsArray)
- {
- var originalUrl = asset["name"]?.Value();
-
- if (originalUrl is not null)
- {
- if (originalUrl.EndsWith(".dll", StringComparison.OrdinalIgnoreCase))
- {
- var newUrl = originalUrl.Substring(0, originalUrl.Length - "dll".Length - 1) + AssembliesFileExtension;
-
- if (_assembliesFileNameObfuscationMode == FileNameObfuscationMode.NoDots)
- {
- var lastSlashIndex = newUrl.LastIndexOf('/');
- newUrl = newUrl.Substring(0, lastSlashIndex + 1) + newUrl.Substring(lastSlashIndex + 1).Replace(".", "_");
- }
-
- asset["name"] = newUrl;
- }
- }
- }
- }
-
- File.WriteAllText(monoConfigFilePath, JsonConvert.SerializeObject(monoConfig, Formatting.Indented));
- }
- }
-
- private string GetLinkerFeatureConfiguration()
- {
- if (RuntimeHostConfigurationOption != null)
- {
- var builder = new StringBuilder();
-
- foreach (var featureSetting in RuntimeHostConfigurationOption)
- {
- var feature = featureSetting.ItemSpec;
- var featureValue = featureSetting.GetMetadata("Value");
- if (String.IsNullOrEmpty(featureValue))
- {
- throw new ArgumentException("feature settings require \"Value\" metadata");
- }
-
- builder.Append($"--feature {feature} {featureValue} ");
- }
-
- if (
- ActualTargetFrameworkVersion < new Version("6.0")
- && !RuntimeHostConfigurationOption.Any(c => c.ItemSpec == "System.Globalization.Invariant")
- )
- {
- // When using .NET 5, the System.Globalization.Invariant feature is not
- // defined, so we assume that it's enabled.
-
- builder.Append($"--feature System.Globalization.Invariant false ");
- }
-
- return builder.ToString();
- }
- else
- {
- return "";
- }
- }
-
- private string GetEmccLinkerOptimizationLevel()
- {
- if (Enum.TryParse(EmccLinkOptimizationLevel, out var level))
- {
- return level switch
- {
- LinkOptimizationLevel.None => "-O0",
- LinkOptimizationLevel.Level1 => "-O1",
- LinkOptimizationLevel.Level2 => "-O2",
- LinkOptimizationLevel.Level3 => "-O3",
- LinkOptimizationLevel.Maximum => "-Oz",
- _ => throw new ArgumentException("Unknown LinkOptimizationLevel")
- };
- }
- else
- {
- return EmccLinkOptimizationLevel ?? "-O3";
- }
- }
- private void LinkerSetup()
- {
- var embeddedLinker = Path.Combine(MonoWasmSDKPath, "tools");
-
- // Use the embedded linker always when running with WSL, as the local windows binary
- // is not compatible with Linux.
- var linkerPath = (IsWSLRequired || CustomLinkerPath is null)
- ? embeddedLinker
- : CustomLinkerPath;
-
- _linkerBinPath = AlignPath(linkerPath);
- }
-
- private bool IsRuntimeAOT()
- => _runtimeExecutionMode == RuntimeExecutionMode.FullAOT || _runtimeExecutionMode == RuntimeExecutionMode.InterpreterAndAOT;
-
- private string TryConvertLongPath (string path)
- => Environment.OSVersion.Platform == PlatformID.Win32NT
- && !string.IsNullOrEmpty(path)
- && !path.StartsWith(@"\\?\")
- && Path.IsPathRooted(path)
- && EnableLongPathSupport
- && !EnableEmscriptenWindows // ninja does not support "\\?\" normalized paths
- && FileInfoExtensions.PlatformRequiresLongPathNormalization
- ? @"\\?\" + path
- : path;
-
- private void ValidateDotnet()
- {
- int GetDotnetMajorVersion()
- {
- var (exitCode, output, error) = RunProcess("dotnet", "--version");
- if (exitCode != 0)
- {
- throw new InvalidOperationException($"Unable to read the .NET SDK version");
- }
- else
- {
- if (Regex.Match(output, @"(\d+)\.\d+") is { Success: true, Groups.Count: > 0 } match
- && int.TryParse(match.Groups[1].Value, out var majorVersion))
- {
- return majorVersion;
- }
- else
- {
- throw new InvalidOperationException($"Unable to parse the .NET SDK version (Got {output})");
- }
- }
- }
-
- var majorVersion = GetDotnetMajorVersion();
-
- if (majorVersion < 6)
- {
- throw new InvalidOperationException($".NET SDK Version must be 6.0 or greater");
- }
-
- Log.LogMessage($"Found .NET SDK {majorVersion}");
- }
-
- private string ValidateEmscripten()
- {
- if (Environment.OSVersion.Platform == PlatformID.Win32NT)
- {
- if (EnableEmscriptenWindows)
- {
- ValidatPowershellExecutionPolicy();
-
- var emsdkHostFolder = Environment.GetEnvironmentVariable("WASMSHELL_WSLEMSDK")
- ?? Path.Combine(Environment.GetEnvironmentVariable("USERPROFILE"), ".uno", "emsdk");
-
- var emsdkBaseFolder = Path.Combine(emsdkHostFolder, $"emsdk-{CurrentEmscriptenVersion}");
-
- var emscriptenSetupScript = Path.Combine(BuildTaskBasePath, "scripts", "emscripten-setup.cmd");
-
- var result = RunProcess(
- emscriptenSetupScript,
- $"\"{emsdkHostFolder.Replace("\\\\?\\", "").TrimEnd('\\')}\" {CurrentEmscriptenVersion}");
-
- if (result.exitCode == 0)
- {
- return Path.Combine(emsdkBaseFolder, "emsdk");
- }
-
- throw new InvalidOperationException($"Failed to setup emscripten environment.");
- }
- else
- {
- var homePath = GetWSLHomePath();
+ private static readonly string _wwwroot = "wwwroot" + Path.DirectorySeparatorChar;
- var emsdkHostFolder = Environment.GetEnvironmentVariable("WASMSHELL_WSLEMSDK") ?? $"{homePath}/.uno/emsdk";
- var emsdkBaseFolder = emsdkHostFolder + $"/emsdk-{CurrentEmscriptenVersion}";
-
- var emscriptenSetupScript = Path.Combine(BuildTaskBasePath, "scripts", "emscripten-setup.sh");
-
- // Adjust line endings
- AdjustFileLineEndings(emscriptenSetupScript);
-
- var result = RunProcess(
- emscriptenSetupScript,
- $"\"{emsdkHostFolder.Replace("\\\\?\\", "").TrimEnd('\\')}\" {CurrentEmscriptenVersion}");
-
- if (result.exitCode == 0)
- {
- return emsdkBaseFolder + $"/emsdk";
- }
-
- var dotnetSetupScript = Path.Combine(BuildTaskBasePath, "scripts", "dotnet-setup.sh");
- AdjustFileLineEndings(dotnetSetupScript);
-
- Log.LogError(
- $"The Windows Subsystem for Linux dotnet environment may not be properly setup, and you may need to run " +
- $"the environment setup script. Open an Ubuntu WSL shell and run:\n\nbash -c `wslpath \"{dotnetSetupScript}\"`\n\n");
-
- throw new InvalidOperationException($"Failed to setup WSL environment.");
- }
- }
- else if (Environment.OSVersion.Platform == PlatformID.Unix)
- {
- var home = Environment.GetEnvironmentVariable("HOME");
- var emsdkHostFolder = Environment.GetEnvironmentVariable("WASMSHELL_WSLEMSDK") ?? $"{home}/.uno/emsdk";
- var emscriptenSetupScript = Path.Combine(BuildTaskBasePath, "scripts", "emscripten-setup.sh");
- var emsdkBaseFolder = emsdkHostFolder + $"/emsdk-{CurrentEmscriptenVersion}";
+ private ShellMode _shellMode;
+ private UTF8Encoding _utf8Encoding = new UTF8Encoding(false);
+ private readonly List _dependencies = new List();
+ private List? _resourceSearchList;
+ private List _referencedAssemblies = new List();
+ private string[]? _additionalStyles;
+ private string _intermediateAssetsPath = "";
+ private string[]? _contentExtensionsToExclude;
+ private RuntimeExecutionMode _runtimeExecutionMode;
- // Adjust line endings
- AdjustFileLineEndings(emscriptenSetupScript);
+ [Required]
+ public string AssemblyName { get; private set; } = "";
- var result = RunProcess(
- "bash",
- $"-c \"chmod +x \"{emscriptenSetupScript}\"; \"{emscriptenSetupScript}\" \\\"{emsdkHostFolder}\\\" {CurrentEmscriptenVersion}\"");
+ [Required]
+ public string IndexHtmlPath { get; set; } = "";
- if (result.exitCode == 0)
- {
- return emsdkBaseFolder + $"/emsdk";
- }
+ [Required]
+ public string Assembly { get; set; } = "";
- throw new NotSupportedException($"Failed to install emscripten");
- }
- else
- {
- throw new NotSupportedException($"Unsupported platform");
- }
- }
+ [Required]
+ public string CurrentProjectPath { get; set; } = "";
- private (int exitCode, string output, string error) ValidatPowershellExecutionPolicy()
- {
- var result = RunProcess(
- "powershell",
- "Get-ExecutionPolicy",
- environmentVariables: new[] {
- // Workaround for https://github.com/PowerShell/PowerShell/issues/18530#issuecomment-1325691850
- ("PSModulePath", "")
- });
+ public ITaskItem[]? Assets { get; set; }
- if (result.exitCode != 0)
- {
- throw new Exception($"Failed to determine the powershell execution policy.");
- }
+ [Required]
+ public string WasmShellMode { get; set; } = "";
- // https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.2
- if (!result.output.Equals("unrestricted", StringComparison.OrdinalIgnoreCase)
- && !result.output.Equals("remotesigned", StringComparison.OrdinalIgnoreCase)
- && !result.output.Equals("bypass", StringComparison.OrdinalIgnoreCase)
- && !SkipPowershellExecutionPolicyValidation)
- {
- throw new InvalidOperationException($"The current PowerShell Execution policy is [{result.output}]. For more information see https://aka.platform.uno/bootstrapper-powershell");
- }
- return result;
- }
+ public ITaskItem[] EmbeddedResources { get; set; } = [];
- private object GetWSLHomePath()
- {
- var p = RunProcess(GetWSLBashExecutable(), "-c \"echo $HOME\"");
+ [Required]
+ public string IntermediateOutputPath { get; set; } = "";
+ public ITaskItem[]? MonoEnvironment { get; set; }
- if(p.exitCode != 0)
- {
- throw new InvalidOperationException($"Failed to read WSL $HOME path");
- }
+ public string? PWAManifestFile { get; set; }
- return p.output;
- }
+ public string EmscriptenVersion { get; set; } = "";
- private static void AdjustFileLineEndings(string emscriptenSetupScript)
- => File.WriteAllText(emscriptenSetupScript, File.ReadAllText(emscriptenSetupScript).Replace("\r\n", "\n"));
+ public ITaskItem[]? EmccFlags { get; set; }
- private IEnumerable GetDynamicLibrariesParams()
- {
- foreach(var file in GetBitcodeFilesParams().Select(Path.GetFileNameWithoutExtension))
- {
- yield return file;
- }
+ public ITaskItem[]? EmccExportedRuntimeMethod { get; set; }
- // For now, use this until __Internal is properly supported:
- // https://github.com/dotnet/runtime/blob/dbe6447aa29b14150b7c6dd43072cc75f0cdf013/src/mono/mono/metadata/native-library.c#L781
- yield return "__Native";
+ public string? ContentExtensionsToExclude { get; set; }
- if (AdditionalPInvokeLibraries != null)
- {
- foreach (var pInvokeLibrary in AdditionalPInvokeLibraries)
- {
- yield return pInvokeLibrary.ItemSpec;
- }
+ public string CSPConfiguration { get; set; } = "";
- // In the case of libc, the resolution differs when running
- // with or without AOT being enabled, so we add both entries.
- // https://github.dev/dotnet/runtime/blob/58f5c95085b2eb56800b87f466183b1448d33b3d/src/mono/mono/utils/mono-dl.c#L158
- var containsLibc = AdditionalPInvokeLibraries.Any(i => i.ItemSpec == "libc");
- var containsLibcSo = AdditionalPInvokeLibraries.Any(i => i.ItemSpec == "libc.so");
+ public bool Optimize { get; set; }
- if (containsLibc && !containsLibcSo)
- {
- yield return "libc.so";
- }
+ public bool EnableTracing { get; set; }
- if(containsLibcSo && !containsLibc)
- {
- yield return "libc";
- }
- }
- }
+ public bool LoadAllSatelliteResources { get; set; }
- private IEnumerable GetEmccExportedRuntimeMethods()
- => (EmccExportedRuntimeMethods ?? Array.Empty()).Select(m => m.ItemSpec);
+ public string AotProfile { get; set; } = "";
- private IEnumerable GetBitcodeFilesParams()
- {
- if (_bitcodeFilesCache == null)
- {
- _bitcodeFilesCache = Assets
- ?.Where(a => a.ItemSpec.EndsWith(".bc") || a.ItemSpec.EndsWith(".a"))
- .Where(a => !bool.TryParse(a.GetMetadata("UnoAotCompile"), out var compile) || compile)
- .Select(a => GetFilePaths(a).fullPath)
- .ToArray()
- ?? new string[0];
-
- List features = new()
- {
- EnableThreads ? "mt" : "st"
- };
+ public bool RunAOTCompilation { get; set; }
- if (EnableSimd)
- {
- features.Add("simd");
- }
+ public string? RuntimeOptions { get; set; }
- Log.LogMessage(MessageImportance.Low, $"Bitcode files features lookup filter: {string.Join(",", features)}");
+ public string AOTProfileExcludedMethods { get; set; } = "";
- _bitcodeFilesCache = BitcodeFilesSelector.Filter(CurrentEmscriptenVersion, features.ToArray(), _bitcodeFilesCache);
- }
+ public bool GenerateAOTProfileDebugList { get; set; } = false;
- return _bitcodeFilesCache;
- }
+ public Microsoft.Build.Framework.ITaskItem[]? MixedModeExcludedAssembly { get; set; }
- private void ParseProperties()
- {
- ParseEnumProperty(nameof(WasmShellMode), WasmShellMode, out _shellMode);
- ParseEnumProperty(nameof(MonoRuntimeExecutionMode), MonoRuntimeExecutionMode, out _runtimeExecutionMode);
- ParseEnumProperty(nameof(AssembliesFileNameObfuscationMode), AssembliesFileNameObfuscationMode, out _assembliesFileNameObfuscationMode);
- AotProfile ??= new ITaskItem[0];
- _contentExtensionsToExclude =
- ContentExtensionsToExclude
- ?.Split(new[] {';'}, StringSplitOptions.RemoveEmptyEntries)
- ?? new string[0];
+ public bool WasmBuildNative { get; set; }
- Log.LogMessage($"Ignoring content files with following extensions:\n\t{string.Join("\n\t", _contentExtensionsToExclude)}");
+ public bool PublishTrimmed { get; set; }
- if (!WebAppBasePath.EndsWith("/"))
- {
- throw new InvalidOperationException($"The WasmShellWebAppBasePath property must end with a trailing \"/\" (got [{WebAppBasePath}] instead)");
- }
+ public bool RunILLink { get; set; }
- if (!AssembliesFileExtension.StartsWith("."))
- {
- throw new InvalidOperationException($"The WasmShellAssembliesFileExtension property must start with a '.'");
- }
+ public bool EnableLogProfiler { get; set; }
- if(GenerateAOTProfile && MonoILLinker)
- {
- // Unknown failure based on the use of the AOT profiler and the linker.
- // See https://github.com/unoplatform/Uno.Wasm.Bootstrap/issues/724
- //
- // EXCEPTION handling: System.InvalidProgramException:
- // "" tid=0x1 this=0xa690420 , thread handle : 0x1c032f8, state : not waiting
- // at <0xffffffff>
- // at Interop/Sys..cctor () [0x00000] in :0
- // at (wrapper runtime-invoke) object.runtime_invoke_direct_void (object,intptr,intptr,intptr) [0x0002d] in :0
- // at <0x00000>
- // at <0xffffffff>
- // at System.Threading.Thread.GetCurrentProcessorNumber () [0x00000] in :0
- // at System.Threading.ProcessorIdCache.ProcessorNumberSpeedCheck () [0x0001a] in :0
- // at System.Threading.Thread..cctor () [0x00000] in :0
- // at (wrapper runtime-invoke) object.runtime_invoke_direct_void (object,intptr,intptr,intptr) [0x0002d] in :
- // at <0x00000>
- // at <0xffffffff>
- // at System.Threading.ObjectHeader.TryEnterFast (object) [0x00023] in :0
- // at System.Threading.Monitor.ReliableEnterTimeout (object,int,bool&) [0x00021] in :0
- //
- throw new InvalidOperationException($"Generating an AOT profile is not supported when the linker is enabled");
- }
- }
+ public string LogProfilerOptions { get; set; } = "log:alloc,output=output.mlpd";
- private void BuildReferencedAssembliesList()
- {
- if (ReferencePath != null)
- {
- _bclAssemblies = _bclAssemblies ?? throw new Exception("_bclAssemblies is not yet defined");
+ public string WebAppBasePath { get; set; } = "./";
- var runtimeCopyExclusions = RuntimeCopyExclude
- ?.Select(e => e.ItemSpec.ToLowerInvariant())
- .ToArray()
- ?? Array.Empty();
+ public bool GenerateAOTProfile { get; set; }
- foreach (var referencePath in ReferencePath)
- {
- var isReferenceAssembly = referencePath.GetMetadata("PathInPackage")?.StartsWith("ref/", StringComparison.OrdinalIgnoreCase) ?? false;
- var hasConcreteAssembly = isReferenceAssembly && ReferencePath.Any(innerReference => HasConcreteAssemblyForReferenceAssembly(innerReference, referencePath));
+ public bool EnableThreads { get; set; }
- if (isReferenceAssembly && hasConcreteAssembly)
- {
- // Reference assemblies may be present along with the actual assemblies.
- // Filter out those assemblies as they cannot be used at runtime.
- continue;
- }
+ public ITaskItem[]? ReferencePath { get; set; }
- var name = Path.GetFileName(referencePath.ItemSpec);
- if (
- _bclAssemblies.ContainsKey(name)
+ [Output]
+ public ITaskItem[]? StaticWebContent { get; set; } = [];
- // Potential manual exclusions for packages provided explicitly
- // by the user (e.g. System.Text.Json) which is also included in the runtime.
- && !runtimeCopyExclusions.Contains(name)
- )
- {
- _referencedAssemblies.Add(_bclAssemblies[name]);
- }
- else
- {
- _referencedAssemblies.Add(referencePath.ItemSpec);
- }
- }
- }
- }
+ [Output]
+ public ITaskItem[]? NativeFileReference { get; set; } = [];
- private static bool HasConcreteAssemblyForReferenceAssembly(ITaskItem other, ITaskItem referenceAssembly)
- => Path.GetFileName(other.ItemSpec) == Path.GetFileName(referenceAssembly.ItemSpec) && (other.GetMetadata("PathInPackage")?.StartsWith("lib/", StringComparison.OrdinalIgnoreCase) ?? false);
+ [Output]
+ public string? FilteredAotProfile { get; set; } = "";
- private void PrepareFinalDist()
+ public override bool Execute()
{
- IEnumerable ComputeHash(string file)
- {
- using var hashFunction = SHA1.Create();
- using var s = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read);
- return hashFunction.ComputeHash(s);
- }
-
- var allBytes = Directory.GetFiles(_workDistPath, "*.*", SearchOption.AllDirectories)
- .AsParallel()
- .OrderBy(s => s)
- .Select(ComputeHash)
- .SelectMany(h => h)
- .ToArray();
-
- using var hashFunction = SHA1.Create();
- var hash = string.Join("", hashFunction.ComputeHash(allBytes).Select(b => b.ToString("x2")));
-
- OutputDistPath = _distPath;
-
- if (_shellMode == ShellMode.Node)
- {
- _remoteBasePackagePath = "app";
- _finalPackagePath = _distPath;
- OutputPackagePath = _distPath;
- }
- else
- {
- _remoteBasePackagePath = $"package_{hash}";
- _finalPackagePath = TryConvertLongPath(Path.Combine(_distPath, _remoteBasePackagePath));
- OutputPackagePath = _finalPackagePath.Replace(@"\\?\", "");
- }
-
- // Move ICU files to the managed folder to avoid multiple lookups in start_asset_download_sources
- // implied by having multiple sources (https://github.com/dotnet/runtime/blob/ae0f0d8fec21eb69088c970ad58af75cca429651/src/mono/wasm/runtime/loader/assets.ts#L513)
- // move all *.icu files from ditFolder to _managedPath
- var icuFiles = Directory.GetFiles(_workDistPath, "icudt*.dat");
- foreach (var icuFile in icuFiles)
- {
- var icuFileName = Path.GetFileName(icuFile);
- var icuFileDestination = Path.Combine(_managedPath, icuFileName);
- File.Move(icuFile, icuFileDestination);
- }
-
- // Create the path if it does not exist (particularly if the path is
- // not in a set of folder that exists)
- Directory.CreateDirectory(_finalPackagePath);
-
- if (Directory.Exists(_distPath))
- {
- DirectoryDelete(_distPath);
- }
-
- try
- {
- Directory.Move(_workDistRootPath, _distPath);
- }
- catch (Exception ex)
- {
- throw new ApplicationException($"Unable to move ROOT DIST {_workDistRootPath} to {_distPath}: {ex}", ex);
- }
+ IntermediateOutputPath = TryConvertLongPath(IntermediateOutputPath);
+ _intermediateAssetsPath = Path.Combine(IntermediateOutputPath, "unowwwrootassets");
+ Directory.CreateDirectory(_intermediateAssetsPath);
try
{
- if (!_workDistRootPath.Equals(_workDistPath))
- {
- Directory.Move(_workDistPath, _finalPackagePath);
- }
- }
- catch (Exception ex)
- {
- throw new ApplicationException($"Unable to move PACKAGE DIST {_workDistPath} to {_finalPackagePath}: {ex}", ex);
+ ParseProperties();
+ BuildReferencedAssembliesList();
+ CopyContent();
+ GenerateBitcodeFiles();
+ ExtractAdditionalJS();
+ ExtractAdditionalCSS();
+ GeneratedAOTProfile();
+ GenerateIndexHtml();
+ GenerateEmbeddedJs();
+ GenerateConfig();
}
-
- TryObfuscateAssemblies(Path.Combine(_finalPackagePath, Path.GetFileName(_managedPath)));
- }
-
- private void DirectoryDelete(string path)
- => PathHelper.DeleteDirectory(path);
-
- private static void MoveFileSafe(string source, string target)
- {
- if (File.Exists(source) && source != target)
+ finally
{
- if (File.Exists(target))
- {
- File.Delete(target);
- }
-
- File.Move(source, target);
+ Cleanup();
}
- }
-
- ///
- /// Renames the files to avoid quarantine by antivirus software such as Symantec,
- /// which are quite present in the enterprise space.
- ///
- /// The extension to rename
- private void TryObfuscateAssemblies(string path)
- {
- foreach (var dllFile in Directory.GetFiles(path, "*.dll", SearchOption.AllDirectories))
- {
- var destFileName = Path.GetFileNameWithoutExtension(dllFile) + AssembliesFileExtension;
-
- if(_assembliesFileNameObfuscationMode == FileNameObfuscationMode.NoDots)
- {
- destFileName = destFileName.Replace(".", "_");
- }
- var destDirName = Path.Combine(Path.GetDirectoryName(dllFile), destFileName);
-
- Log.LogMessage($"Renaming {dllFile} to {destDirName}");
- Directory.Move(dllFile, destDirName);
-
- if (ObfuscateAssemblies)
- {
- Log.LogMessage($"Obfuscating {destDirName}");
- ObfuscateAssembly(destDirName);
- }
- }
+ return true;
}
- private void ObfuscateAssembly(string file)
+ private void GeneratedAOTProfile()
{
- var data = File.ReadAllBytes(file);
+ var useAotProfile = !GenerateAOTProfile && UseAotProfile;
- for (var i = 0; i < data.Length; i++)
+ if (useAotProfile)
{
- data[i] ^= _obfuscationKey[i % _obfuscationKey.Length];
+ // If the profile was transformed, we need to use the transformed profile
+ FilteredAotProfile = TransformAOTProfile();
}
-
- File.WriteAllBytes(file, data);
}
- private void GetBcl()
+ private void ParseProperties()
{
- _bclPath = Path.Combine(MonoWasmSDKPath, "runtimes", "browser-wasm", "lib");
-
- var subDirectories = Directory.GetDirectories(_bclPath);
- if(subDirectories.Length != 1)
- {
- throw new InvalidDataException("The lib directory structure must have exactly one target framework");
- }
-
- _bclPath = Path.Combine(_bclPath, subDirectories.First());
-
- var reals = Directory.GetFiles(_bclPath, "*.dll", SearchOption.AllDirectories);
- _bclAssemblies = reals.ToDictionary(x => Path.GetFileName(x));
- }
+ ParseEnumProperty(nameof(WasmShellMode), WasmShellMode, out _shellMode);
- private void CreateDist()
- {
- _distPath = TryConvertLongPath(Path.GetFullPath(DistPath));
- _workDistPath = TryConvertLongPath(Path.Combine(IntermediateOutputPath, "dist_work"));
- _workDistRootPath =
- _shellMode == ShellMode.Node
- ? _workDistPath
- : TryConvertLongPath(Path.Combine(IntermediateOutputPath, "dist_root_work"));
- _managedPath = Path.Combine(_workDistPath, "managed");
-
- if (Directory.Exists(_workDistPath))
- {
- DirectoryDelete(_workDistPath);
- }
+ _runtimeExecutionMode
+ = WasmBuildNative && RunAOTCompilation ? RuntimeExecutionMode.InterpreterAndAOT : RuntimeExecutionMode.Interpreter;
- if (Directory.Exists(_workDistRootPath))
- {
- DirectoryDelete(_workDistRootPath);
- }
+ _contentExtensionsToExclude =
+ ContentExtensionsToExclude
+ ?.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)
+ ?? [];
- Log.LogMessage($"Creating managed path {_managedPath}");
- DirectoryCreateDirectory(_managedPath);
+ Log.LogMessage($"Ignoring content files with following extensions:\n\t{string.Join("\n\t", _contentExtensionsToExclude)}");
}
- private void CopyRuntime()
+ private void Cleanup()
{
- DirectoryCreateDirectory(_workDistRootPath);
-
- var runtimePath = Path.Combine(MonoWasmSDKPath, "runtimes", "browser-wasm", "native");
-
- foreach (var sourceFile in Directory.EnumerateFiles(runtimePath))
+ if (_resourceSearchList is not null)
{
- var dest = Path.Combine(_workDistPath, Path.GetFileName(sourceFile));
- Log.LogMessage($"Runtime: {sourceFile} -> {dest}");
- FileCopy(sourceFile, dest, true);
+ foreach (var res in _resourceSearchList)
+ {
+ res.Dispose();
+ }
}
}
@@ -1756,7 +212,14 @@ private void CopyRuntime()
// This is for project-local defined content
var baseSourceFile = item.GetMetadata("DefiningProjectDirectory");
- if (item.GetMetadata("Link") is { } link && !string.IsNullOrEmpty(link))
+ if (item.GetMetadata("TargetPath") is { } targetPath && !string.IsNullOrEmpty(targetPath))
+ {
+ var fullPath = Path.IsPathRooted(item.ItemSpec) ? item.ItemSpec : Path.Combine(baseSourceFile, item.ItemSpec);
+
+ // This is used for item remapping
+ return (fullPath, targetPath);
+ }
+ else if (item.GetMetadata("Link") is { } link && !string.IsNullOrEmpty(link))
{
var fullPath = Path.IsPathRooted(item.ItemSpec) ? item.ItemSpec : Path.Combine(baseSourceFile, item.ItemSpec);
@@ -1791,11 +254,10 @@ private void CopyContent()
{
foreach (var sourceFile in Assets)
{
-
var (fullSourcePath, relativePath) = GetFilePaths(sourceFile);
// Files in "wwwroot" folder will get deployed to root by default
- var defaultDeployMode = relativePath.Contains(_wwwwroot) ? DeployMode.Root : DeployMode.Package;
+ var defaultDeployMode = relativePath.Contains(_wwwroot) ? DeployMode.None : DeployMode.Package;
var deployModeSource = "Default";
var matchedExtension = _contentExtensionsToExclude
@@ -1806,7 +268,7 @@ private void CopyContent()
deployModeSource = "Excluded extension";
}
- relativePath = PathHelper.FixupPath(relativePath).Replace(_wwwwroot, "");
+ relativePath = PathHelper.FixupPath(relativePath).Replace(_wwwroot, "");
if (relativePath.StartsWith(WasmScriptsFolder))
{
@@ -1827,74 +289,129 @@ private void CopyContent()
deployMode = defaultDeployMode;
}
- if (deployMode == DeployMode.Package)
+ var dest = Path.Combine(_intermediateAssetsPath, relativePath);
+
+ if (deployMode != DeployMode.None)
{
// Add the file to the package assets manifest
assets.Add(relativePath.Replace(Path.DirectorySeparatorChar, '/'));
+
+ AddStaticAsset(relativePath, fullSourcePath);
}
- var dest = deployMode
- switch
- {
- DeployMode.Package => Path.Combine(_workDistPath, relativePath),
- DeployMode.Root => Path.Combine(_workDistRootPath, relativePath),
- _ => default // None or unknown mode
- };
+ Log.LogMessage($"ContentFile {fullSourcePath} -> {dest ?? ""} [Mode={deployMode} / by {deployModeSource}, ]");
+ }
+ }
+ var assetsFilePath = Path.Combine(_intermediateAssetsPath, "uno-assets.txt");
+ File.WriteAllLines(assetsFilePath, assets);
+ AddStaticAsset(Path.GetFileName(assetsFilePath), assetsFilePath);
+ }
- Log.LogMessage($"ContentFile {fullSourcePath} -> {dest ?? ""} [Mode={deployMode} / by {deployModeSource}]");
+ private void ExtractAdditionalJS()
+ {
+ BuildResourceSearchList();
- if (dest != null)
- {
- DirectoryCreateDirectory(Path.GetDirectoryName(dest));
+ var q = EnumerateResources("js", "WasmDist")
+ .Concat(EnumerateResources("js", WasmScriptsFolder));
- FileCopy(fullSourcePath, dest, true);
- }
+ foreach (var (name, source, resource) in q)
+ {
+ if (source.Name.Name != Path.GetFileNameWithoutExtension(Assembly))
+ {
+ _dependencies.Add(name);
+
+ CopyResourceToOutput(name, resource);
+
+ Log.LogMessage($"Additional JS {name}");
+ }
+ }
+
+ foreach (var projectResource in EmbeddedResources)
+ {
+ var (fullSourcePath, relativePath) = GetFilePaths(projectResource);
+
+ if (relativePath.Contains("WasmScripts"))
+ {
+ var scriptName = Path.GetFileName(relativePath);
+
+ Log.LogMessage($"Embedded resources JS {scriptName}");
+
+ _dependencies.Add(scriptName);
+ AddStaticAsset(scriptName, fullSourcePath);
}
}
-
- File.WriteAllLines(Path.Combine(_workDistPath, "uno-assets.txt"), assets);
}
- private void ExtractAdditionalJS()
+ private void ExtractAdditionalCSS()
{
BuildResourceSearchList();
- var q = EnumerateResources("js", "WasmDist")
- .Concat(EnumerateResources("js", WasmScriptsFolder));
+ var additionalStyles = new List();
- foreach (var (name, source, resource) in q)
+ foreach (var (name, source, resource) in EnumerateResources("css", "WasmCSS"))
{
- if (source.Name.Name != GetType().Assembly.GetName().Name)
+ if (source.Name.Name != Path.GetFileNameWithoutExtension(Assembly))
{
- _dependencies.Add(name);
+ using (var srcs = resource.GetResourceStream())
+ {
+ additionalStyles.Add(name);
+
+ CopyResourceToOutput(name, resource);
+
+ Log.LogMessage($"Additional CSS {name}");
+ }
}
+ }
+
+ foreach (var projectResource in EmbeddedResources)
+ {
+ var (fullSourcePath, relativePath) = GetFilePaths(projectResource);
+
+ if (relativePath.Contains("WasmCSS"))
+ {
+ var cssName = Path.GetFileName(relativePath);
- CopyResourceToOutput(name, resource);
+ Log.LogMessage($"Embedded CSS {cssName}");
- Log.LogMessage($"Additional JS {name}");
+ additionalStyles.Add(cssName);
+ AddStaticAsset(cssName, fullSourcePath);
+ }
}
+
+ _additionalStyles = additionalStyles.ToArray();
}
- private void ExtractAdditionalCSS()
+ private void CopyResourceToOutput(string name, EmbeddedResource resource)
{
- BuildResourceSearchList();
-
- var q = EnumerateResources("css", "WasmCSS");
+ var dest = Path.Combine(_intermediateAssetsPath, name);
- foreach (var (name, source, resource) in q)
+ using (var srcs = resource.GetResourceStream())
{
- using (var srcs = resource.GetResourceStream())
+ using (var dests = new FileStream(dest, FileMode.Create, FileAccess.Write))
{
- CopyResourceToOutput(name, resource);
-
- Log.LogMessage($"Additional CSS {name}");
+ srcs.CopyTo(dests);
}
}
- _additionalStyles = q
- .Select(res => res.name)
- .ToArray();
+ AddStaticAsset(name, dest);
+ }
+
+ private void AddStaticAsset(string targetPath, string filePath)
+ {
+ var contentRoot = targetPath.StartsWith(_intermediateAssetsPath)
+ ? _intermediateAssetsPath
+ : Path.GetDirectoryName(filePath);
+
+ TaskItem indexMetadata = new(
+ filePath, new Dictionary
+ {
+ ["CopyToOutputDirectory"] = "PreserveNewest",
+ ["ContentRoot"] = contentRoot,
+ ["Link"] = "wwwroot/" + targetPath,
+ });
+
+ StaticWebContent = StaticWebContent.Concat([indexMetadata]).ToArray();
}
private void BuildResourceSearchList()
@@ -1933,19 +450,6 @@ select asm
}
}
- private void CopyResourceToOutput(string name, EmbeddedResource resource)
- {
- var dest = Path.Combine(_workDistPath, name);
-
- using (var srcs = resource.GetResourceStream())
- {
- using (var dests = new FileStream(dest, FileMode.Create, FileAccess.Write))
- {
- srcs.CopyTo(dests);
- }
- }
- }
-
private IEnumerable<(string name, AssemblyDefinition source, EmbeddedResource resource)> EnumerateResources(string extension, string folder)
{
var fullExtension = "." + extension;
@@ -1962,67 +466,71 @@ where res.Name.Contains(fullFolder)
);
}
- private MethodDefinition DiscoverEntryPoint()
+ private void BuildReferencedAssembliesList()
{
- var asm = AssemblyDefinition.ReadAssembly(Assembly);
-
- if (asm?.EntryPoint is MethodDefinition def)
+ if (ReferencePath != null)
{
- return def;
+ foreach (var referencePath in ReferencePath)
+ {
+ _referencedAssemblies.Add(referencePath.ItemSpec);
+ }
}
-
- throw new Exception($"{Path.GetFileName(Assembly)} is missing an entry point. Add Exe in the project file and a static main.");
}
+ static string BuildDependencyPath(string dep, string baseLookup)
+ => baseLookup.StartsWith("/")
+ ? $"\"{baseLookup}{Path.GetFileName(dep)}\""
+ : $"\"{baseLookup}{Path.GetFileNameWithoutExtension(dep)}\"";
+
private void GenerateConfig()
{
- var unoConfigJsPath = Path.Combine(_finalPackagePath, "uno-config.js");
+ var unoConfigJsPath = Path.Combine(_intermediateAssetsPath, "uno-config.js");
using (var w = new StreamWriter(unoConfigJsPath, false, _utf8Encoding))
{
- var baseLookup = _shellMode == ShellMode.Node ? "" : $"{WebAppBasePath}{_remoteBasePackagePath}/";
- var dependencies = string.Join(", ", _dependencies.Select(dep => BuildDependencyPath(dep, baseLookup)));
- var entryPoint = DiscoverEntryPoint();
+ var baseLookup = _shellMode == ShellMode.Node ? "" : $"{WebAppBasePath}";
+ var dependencies = string.Join(", ", _dependencies
+ .Where(d =>
+ !d.EndsWith("require.js")
+ && !d.EndsWith("uno-bootstrap.js")
+ && !d.EndsWith("service-worker.js"))
+ .Select(dep => BuildDependencyPath(dep, baseLookup)));
var config = new StringBuilder();
- var (monoWasmFileName, monoWasmSize, totalAssembliesSize, assemblyFiles, filesIntegrity) = GetFilesDetails();
- var assembliesSize = string.Join(
- ",",
- assemblyFiles.Select(ass => $"\"{ass.fileName}\":{ass.length}"));
- var filesIntegrityStr = string.Join(
- ",",
- filesIntegrity.Select(f => $"\"{f.fileName}\":\"{f.integrity}\""));
-
var enablePWA = !string.IsNullOrEmpty(PWAManifestFile);
- var offlineFiles = enablePWA ? string.Join(", ", GetPWACacheableFiles().Select(f => $"\".{f}\"")) : "";
+ //var offlineFiles = enablePWA ? string.Join(", ", GetPWACacheableFiles().Select(f => $"\".{f}\"")) : "";
var emccExportedRuntimeMethodsParams = string.Join(
",",
GetEmccExportedRuntimeMethods().Select(f => $"\'{f}\'"));
+ var runtimeOptionsSet = string.Join(",", (RuntimeOptions?.Split(' ') ?? []).Select(f => $"\'{f}\'"));
+
config.AppendLine($"let config = {{}};");
- config.AppendLine($"config.uno_remote_managedpath = \"{ Path.GetFileName(_managedPath) }\";");
- config.AppendLine($"config.uno_app_base = \"{WebAppBasePath}{_remoteBasePackagePath}\";");
+ config.AppendLine($"config.uno_remote_managedpath = \"_framework\";");
+
+ // unoAppBase must not finish with a `/` to be backward
+ // compatible.
+ var unoAppBase = WebAppBasePath switch
+ {
+ "" => ".",
+ "./" => ".",
+ "/" => "/.",
+ _ => WebAppBasePath.TrimEnd('/') + "/."
+ };
+
+ config.AppendLine($"config.uno_app_base = \"{unoAppBase}\";");
config.AppendLine($"config.uno_dependencies = [{dependencies}];");
- config.AppendLine($"config.uno_main = \"{entryPoint.DeclaringType.Module.Assembly.Name.Name}\";");
- config.AppendLine($"config.assemblyFileExtension = \"{AssembliesFileExtension}\";");
- config.AppendLine($"config.assemblyFileNameObfuscationMode = \"{_assembliesFileNameObfuscationMode}\";");
- config.AppendLine($"config.mono_wasm_runtime = \"{monoWasmFileName}\";");
- config.AppendLine($"config.mono_wasm_runtime_size = {monoWasmSize};");
- config.AppendLine($"config.assemblies_with_size = {{{assembliesSize}}};");
- config.AppendLine($"config.files_integrity = {{{filesIntegrityStr}}};");
- config.AppendLine($"config.total_assemblies_size = {totalAssembliesSize};");
+ config.AppendLine($"config.uno_runtime_options = [{runtimeOptionsSet}];");
config.AppendLine($"config.enable_pwa = {enablePWA.ToString().ToLowerInvariant()};");
- config.AppendLine($"config.offline_files = ['{WebAppBasePath}', {offlineFiles}];");
+ //config.AppendLine($"config.offline_files = ['{WebAppBasePath}', {offlineFiles}];");
config.AppendLine($"config.uno_shell_mode = \"{_shellMode}\";");
+ config.AppendLine($"config.uno_debugging_enabled = {(!Optimize).ToString().ToLowerInvariant()};");
+ config.AppendLine($"config.uno_enable_tracing = {EnableTracing.ToString().ToLowerInvariant()};");
+ config.AppendLine($"config.uno_load_all_satellite_resources = {LoadAllSatelliteResources.ToString().ToLowerInvariant()};");
config.AppendLine($"config.emcc_exported_runtime_methods = [{emccExportedRuntimeMethodsParams}];");
- if (ObfuscateAssemblies)
- {
- config.AppendLine($"config.assemblyObfuscationKey = \"{Encoding.ASCII.GetString(_obfuscationKey)}\";");
- }
-
if (GenerateAOTProfile)
{
config.AppendLine($"config.generate_aot_profile = true;");
@@ -2044,19 +552,14 @@ private void GenerateConfig()
AddEnvironmentVariable("UNO_BOOTSTRAP_MONO_RUNTIME_MODE", _runtimeExecutionMode.ToString());
AddEnvironmentVariable("UNO_BOOTSTRAP_MONO_PROFILED_AOT", isProfiledAOT.ToString());
- AddEnvironmentVariable("UNO_BOOTSTRAP_LINKER_ENABLED", MonoILLinker.ToString());
- AddEnvironmentVariable("UNO_BOOTSTRAP_DEBUGGER_ENABLED", RuntimeDebuggerEnabled.ToString());
- AddEnvironmentVariable("UNO_BOOTSTRAP_MONO_RUNTIME_CONFIGURATION", RuntimeConfiguration);
+ AddEnvironmentVariable("UNO_BOOTSTRAP_LINKER_ENABLED", (PublishTrimmed && RunILLink).ToString());
+ AddEnvironmentVariable("UNO_BOOTSTRAP_DEBUGGER_ENABLED", (!Optimize).ToString());
+ AddEnvironmentVariable("UNO_BOOTSTRAP_MONO_RUNTIME_CONFIGURATION", "Release");
AddEnvironmentVariable("UNO_BOOTSTRAP_MONO_RUNTIME_FEATURES", BuildRuntimeFeatures());
- AddEnvironmentVariable("UNO_BOOTSTRAP_APP_BASE", _remoteBasePackagePath);
+ AddEnvironmentVariable("UNO_BOOTSTRAP_APP_BASE", "./");
AddEnvironmentVariable("UNO_BOOTSTRAP_WEBAPP_BASE_PATH", WebAppBasePath);
- if (EnableThreads)
- {
- AddEnvironmentVariable("UNO_BOOTSTRAP_MAX_THREADS", PThreadsPoolSize.ToString());
- }
-
- if (ExtraEmccFlags?.Any(f => f.ItemSpec?.Contains("MAXIMUM_MEMORY=4GB") ?? false) ?? false)
+ if (EmccFlags?.Any(f => f.ItemSpec?.Contains("MAXIMUM_MEMORY=4GB") ?? false) ?? false)
{
// Detects the use of the 4GB flag: https://v8.dev/blog/4gb-wasm-memory
AddEnvironmentVariable("UNO_BOOTSTRAP_EMSCRIPTEN_MAXIMUM_MEMORY", "4GB");
@@ -2070,121 +573,17 @@ private void GenerateConfig()
config.AppendLine("export { config };");
w.Write(config.ToString());
- }
- }
-
- private string BuildRuntimeFeatures()
- => EnableThreads ? "threads" : "";
-
- private void GenerateAppInfo()
- {
- var unoAppInfoPath = Path.Combine(_distPath, "uno-appinfo.json");
- using var w = new StreamWriter(unoAppInfoPath, append: false, encoding: _utf8Encoding);
-
- var appInfo = new AppInfo(WebAppBasePath, _remoteBasePackagePath);
- }
-
- static string BuildDependencyPath(string dep, string baseLookup)
- => baseLookup.StartsWith("/")
- ? $"\"{baseLookup}{Path.GetFileName(dep)}\""
- : $"\"{baseLookup}{Path.GetFileNameWithoutExtension(dep)}\"";
-
- private void MergeConfig()
- {
- if(_shellMode == ShellMode.Node)
- {
- var tempFile = Path.GetTempFileName();
- try
- {
- var monoJsPath = Path.Combine(_finalPackagePath, "dotnet.native.js");
-
- using (var fs = new StreamWriter(tempFile))
- {
- fs.Write(File.ReadAllText(Path.Combine(_finalPackagePath, "mono-config.json")));
- fs.Write(File.ReadAllText(Path.Combine(_finalPackagePath, "uno-config.js")));
- fs.Write(File.ReadAllText(Path.Combine(_finalPackagePath, "uno-bootstrap.js")));
- fs.Write(File.ReadAllText(monoJsPath));
- }
-
- File.Delete(monoJsPath);
- File.Move(tempFile, monoJsPath);
- Log.LogMessage($"Merged config files with dotnet.native.js");
- }
- finally
- {
- try
- {
- if (File.Exists(tempFile))
- {
- File.Delete(tempFile);
- }
- }
- catch(Exception e)
+ TaskItem indexMetadata = new(
+ unoConfigJsPath, new Dictionary
{
- Console.WriteLine($"Failed to delete temporary file: {e}");
- }
- }
- }
- }
-
- private IEnumerable GetPWACacheableFiles()
- => from file in Directory.EnumerateFiles(_finalPackagePath, "*.*", SearchOption.AllDirectories)
- where !file.EndsWith("web.config", StringComparison.OrdinalIgnoreCase)
- select file.Replace(_distPath, "").Replace("\\", "/");
-
- private (string monoWasmFileName, long monoWasmSize, long totalAssembliesSize, (string fileName, long length)[] assemblyFiles, (string fileName, string integrity)[] filesIntegrity) GetFilesDetails()
- {
- const string monoWasmFileName = "dotnet.native.wasm";
-
- var monoWasmFilePathAndName = Path.Combine(_finalPackagePath, monoWasmFileName);
- var monoWasmSize = new FileInfo(monoWasmFilePathAndName).Length;
-
- var assemblyPathAndFiles = Directory
- .EnumerateFiles(Path.Combine(_finalPackagePath, "managed"), "*", SearchOption.TopDirectoryOnly)
- .ToArray();
-
- var assemblyFiles = assemblyPathAndFiles
- .Select(f =>
- {
- var fi = new FileInfo(f);
- return (fileName: fi.Name, length: fi.Length);
- })
- .ToArray();
+ ["CopyToOutputDirectory"] = "PreserveNewest",
+ ["ContentRoot"] = _intermediateAssetsPath,
+ ["Link"] = "wwwroot/" + Path.GetFileName(unoConfigJsPath),
+ });
- var totalAssembliesSize = assemblyFiles.Sum(fi => fi.length);
-
- (string fileName, string integrity)[] filesIntegrity;
- if (UseFileIntegrity)
- {
- var integrities = new List<(string fileName, string integrity)>();
-
- void AddFileIntegrity(string filePath)
- {
- var bytes = File.ReadAllBytes(filePath);
- var hash = _sha384.ComputeHash(bytes);
- var integrity = Convert.ToBase64String(hash);
- var path = filePath.Replace(_distPath, "").Replace("\\", "/");
-
- integrities.Add(($".{path}", $"sha384-{integrity}"));
- }
-
- AddFileIntegrity(monoWasmFilePathAndName);
-
- foreach (var f in assemblyPathAndFiles)
- {
- AddFileIntegrity(f);
- }
-
-
- filesIntegrity = integrities.ToArray();
+ StaticWebContent = StaticWebContent.Concat([indexMetadata]).ToArray();
}
- else
- {
- filesIntegrity = Array.Empty<(string fileName, string integrity)>();
- }
-
- return ($"{WebAppBasePath}{_remoteBasePackagePath}/" + monoWasmFileName, monoWasmSize, totalAssembliesSize, assemblyFiles, filesIntegrity);
}
private void GenerateIndexHtml()
@@ -2194,9 +593,9 @@ private void GenerateIndexHtml()
return;
}
- var htmlPath = Path.Combine(_distPath, "index.html");
+ var indexHtmlOutputPath = Path.Combine(_intermediateAssetsPath, "index.html");
- using var w = new StreamWriter(htmlPath, false, _utf8Encoding);
+ using var w = new StreamWriter(indexHtmlOutputPath, false, _utf8Encoding);
using var reader = new StreamReader(IndexHtmlPath);
var html = reader.ReadToEnd();
@@ -2205,7 +604,6 @@ private void GenerateIndexHtml()
var extraBuilder = new StringBuilder();
GeneratePWAContent(extraBuilder);
- GeneratePrefetchHeaderContent(extraBuilder);
GenerateCSPMeta(extraBuilder);
html = html.Replace("$(ADDITIONAL_HEAD)", extraBuilder.ToString());
@@ -2214,15 +612,76 @@ private void GenerateIndexHtml()
html = html.Replace("mono.js\"", "dotnet.js\"");
if (WebAppBasePath != "./")
{
- html = html.Replace($"\"{WebAppBasePath}", $"\"{WebAppBasePath}{_remoteBasePackagePath}/");
+ html = html.Replace($"\"{WebAppBasePath}", $"\"{WebAppBasePath}");
}
- html = html.Replace($"\"./", $"\"{WebAppBasePath}{_remoteBasePackagePath}/");
+ html = html.Replace($"\"./", $"\"{WebAppBasePath}");
html = html.Replace("$(WEB_MANIFEST)", $"{WebAppBasePath}{Path.GetFileName(PWAManifestFile)}");
w.Write(html);
- Log.LogMessage($"HTML {htmlPath}");
+ TaskItem indexMetadata = new(
+ indexHtmlOutputPath, new Dictionary
+ {
+ ["CopyToOutputDirectory"] = "PreserveNewest",
+ ["ContentRoot"] = _intermediateAssetsPath,
+ ["Link"] = "wwwroot/index.html",
+ });
+
+ StaticWebContent = StaticWebContent.Concat([indexMetadata]).ToArray();
+
+ Log.LogMessage($"HTML {indexHtmlOutputPath}");
+ }
+
+ private void GeneratePWAContent(StringBuilder extraBuilder)
+ {
+ if (_shellMode != ShellMode.Browser)
+ {
+ return;
+ }
+
+ if (!string.IsNullOrWhiteSpace(PWAManifestFile))
+ {
+ var manifestDocument = JObject.Parse(File.ReadAllText(PWAManifestFile));
+
+ extraBuilder.AppendLine($" ");
+
+ // See https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html
+ extraBuilder.AppendLine($" ");
+
+ if (manifestDocument["icons"] is JArray array
+ && array.Where(v => v["sizes"]?.Value() == "1024x1024").FirstOrDefault() is JToken img)
+ {
+ extraBuilder.AppendLine($" ");
+ }
+
+ if (manifestDocument["theme_color"]?.Value() is string color)
+ {
+ extraBuilder.AppendLine($" ");
+ }
+ else
+ {
+ extraBuilder.AppendLine($" ");
+ }
+
+ // Transform the PWA assets
+ if (manifestDocument["icons"] is JArray icons)
+ {
+ foreach (var icon in icons)
+ {
+ var originalSource = icon["src"]?.Value();
+
+ icon["src"] = originalSource switch
+ {
+ string s when s.StartsWith("./") => $"{WebAppBasePath}/" + s.Substring(2),
+ string s => $"./" + s,
+ _ => originalSource
+ };
+ }
+ }
+
+ AddStaticAsset(Path.GetFileName(PWAManifestFile), PWAManifestFile!);
+ }
}
private void GenerateCSPMeta(StringBuilder extraBuilder)
@@ -2234,6 +693,41 @@ private void GenerateCSPMeta(StringBuilder extraBuilder)
}
}
+ private void GenerateBitcodeFiles()
+ {
+ var bitcodeFiles = Assets
+ ?.Where(a => a.ItemSpec.EndsWith(".bc") || a.ItemSpec.EndsWith(".a"))
+ .Where(a => !bool.TryParse(a.GetMetadata("UnoAotCompile"), out var compile) || compile)
+ .Select(a => GetFilePaths(a).fullPath)
+ .ToArray()
+ ?? [];
+
+ List features = new()
+ {
+ EnableThreads ? "mt" : "st",
+ "simd"
+ };
+
+ Log.LogMessage(MessageImportance.Low, $"Bitcode files features lookup filter: {string.Join(",", features)}");
+
+ if (Version.TryParse(EmscriptenVersion, out var emsdkVersion))
+ {
+ var list = BitcodeFilesSelector.Filter(emsdkVersion, features.ToArray(), bitcodeFiles);
+
+ NativeFileReference = list.Select(i => new TaskItem(i)).ToArray();
+ }
+ else
+ {
+ Log.LogMessage(MessageImportance.Low, $"EmscriptenVersion is not set, skipping native assets");
+ }
+ }
+
+ private IEnumerable GetEmccExportedRuntimeMethods()
+ => (EmccExportedRuntimeMethod ?? Array.Empty()).Select(m => m.ItemSpec);
+
+ private bool UseAotProfile
+ => !string.IsNullOrEmpty(AotProfile) && _runtimeExecutionMode == RuntimeExecutionMode.InterpreterAndAOT;
+
private void GenerateEmbeddedJs()
{
if (_shellMode != ShellMode.BrowserEmbedded)
@@ -2241,161 +735,106 @@ private void GenerateEmbeddedJs()
return;
}
- var scriptPath = Path.Combine(_distPath, "embedded.js");
+ var scriptPath = Path.Combine(IntermediateOutputPath, "shell-embedded.js");
using var w = new StreamWriter(scriptPath, append: false, _utf8Encoding);
- const string javascriptTemplate = @"
-(async function () {
+ const string javascriptTemplate =
+ """
+ (async function () {
+
+ const executingScript = document.currentScript;
+ if(!executingScript) {
+ console.err("embedded.js MUST be run using a \n";
w2.Write(html);
w2.Flush();
- }
- private void GeneratePrefetchHeaderContent(StringBuilder extraBuilder)
- {
- if (_shellMode == ShellMode.Browser && GeneratePrefetchHeaders)
- {
- extraBuilder.AppendLine($" ");
- extraBuilder.AppendLine($" ");
- extraBuilder.AppendLine($" ");
- extraBuilder.AppendLine($" ");
- extraBuilder.AppendLine($" ");
- extraBuilder.AppendLine($" ");
-
- var distName = Path.GetFileName(_managedPath);
- foreach (var file in Directory.GetFiles(_managedPath, "*.clr", SearchOption.AllDirectories))
- {
- extraBuilder.AppendLine($" ");
- }
- }
+ AddStaticAsset("embedded.js", scriptPath);
+ AddStaticAsset("index.html", htmlPath);
}
- private void GeneratePWAContent(StringBuilder extraBuilder)
- {
- if (_shellMode != ShellMode.Browser)
- {
- return;
- }
-
- if (!string.IsNullOrWhiteSpace(PWAManifestFile))
- {
- var manifestDocument = JObject.Parse(File.ReadAllText(PWAManifestFile));
-
- extraBuilder.AppendLine($" ");
-
- // See https://stackoverflow.com/a/27951414
- extraBuilder.AppendLine($" ");
-
- if (manifestDocument["icons"] is JArray array
- && array.Where(v => v["sizes"]?.Value() == "1024x1024").FirstOrDefault() is JToken img)
- {
- extraBuilder.AppendLine($" ");
- }
-
- if (manifestDocument["theme_color"]?.Value() is string color)
- {
- extraBuilder.AppendLine($" ");
- }
- else
- {
- extraBuilder.AppendLine($" ");
- }
-
- // Transform the PWA assets
- if(manifestDocument["icons"] is JArray icons && !string.IsNullOrWhiteSpace(_remoteBasePackagePath))
- {
- foreach(var icon in icons)
- {
- var originalSource = icon["src"]?.Value();
-
- icon["src"] = originalSource switch
- {
- string s when s.StartsWith("./") => $"{WebAppBasePath}{_remoteBasePackagePath}/" + s.Substring(2),
- string s => $"{_remoteBasePackagePath}/" + s,
- _ => originalSource
- };
- }
- }
+ private string TryConvertLongPath(string path)
+ => Environment.OSVersion.Platform == PlatformID.Win32NT
+ && !string.IsNullOrEmpty(path)
+ && !path.StartsWith(@"\\?\")
+ && Path.IsPathRooted(path)
+ && FileInfoExtensions.PlatformRequiresLongPathNormalization
+ ? @"\\?\" + path
+ : path;
- File.WriteAllText(Path.Combine(_distPath, Path.GetFileName(PWAManifestFile)), manifestDocument.ToString());
- }
- }
+ private string BuildRuntimeFeatures()
+ => EnableThreads ? "threads" : "";
private void ParseEnumProperty(string name, string stringValue, out TEnum value) where TEnum : struct
{
- if (Enum.TryParse(stringValue, true, out value))
+ if (Enum.TryParse(stringValue, true, out value))
{
Log.LogMessage(MessageImportance.Low, $"{name}={value}");
}
@@ -2404,7 +843,5 @@ private void ParseEnumProperty(string name, string stringValue, out TEnum
throw new NotSupportedException($"The {name} {stringValue} is not supported");
}
}
-
- internal record AppInfo(string BasePath, string PackagePath);
}
}
diff --git a/src/Uno.Wasm.Bootstrap/StaticWebAssetsResolverTask.cs b/src/Uno.Wasm.Bootstrap/StaticWebAssetsResolverTask.cs
index 724ac49e0..0f8e9d318 100644
--- a/src/Uno.Wasm.Bootstrap/StaticWebAssetsResolverTask.cs
+++ b/src/Uno.Wasm.Bootstrap/StaticWebAssetsResolverTask.cs
@@ -24,6 +24,7 @@
using System.IO;
using System.Linq;
using System.Numerics;
+using System.Runtime.InteropServices;
using System.Security.Cryptography;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
@@ -31,110 +32,36 @@
namespace Uno.Wasm.Bootstrap;
-public class StaticWebAssetsResolverTask_v0 : Microsoft.Build.Utilities.Task
+public class ValidateStaticAssets_v0 : Microsoft.Build.Utilities.Task
{
- public string? WebAppBasePath { get; set; }
-
[Required]
- public string AssemblyName { get; private set; } = "";
+ public ITaskItem[] CandidateAssets { get; set; } = [];
[Required]
- public string DistPath { get; private set; } = "";
+ public ITaskItem[] ExistingEndpoints { get; set; } = [];
[Required]
- public string ProjectDirectory { get; private set; } = "";
-
- [Output]
- public ITaskItem[]? StaticWebAsset { get; private set; }
+ public ITaskItem[] ContentTypeMappings { get; set; } = [];
public override bool Execute()
{
- var fixedDistPath = PathHelper.FixupPath(DistPath);
- var projectDirectory = PathHelper.FixupPath(ProjectDirectory);
-
- if (Directory.Exists(fixedDistPath))
- {
- var wwwRootBasePath = Path.Combine(projectDirectory, "wwwroot");
-
- var distFiles = Directory.EnumerateFiles(fixedDistPath, "*.*", SearchOption.AllDirectories).ToArray();
- var wwwRootAssets = Directory.Exists(wwwRootBasePath)
- ? Directory.EnumerateFiles(wwwRootBasePath, "*.*", SearchOption.AllDirectories)
- : Enumerable.Empty();
-
- Log.LogMessage(MessageImportance.Low, $"Found {distFiles.Length} assets");
-
- var filteredAssets = distFiles
- .Where(a => !wwwRootAssets
- .Select(wa => wa.Replace(wwwRootBasePath, ""))
- .Any(wa => a.Replace(fixedDistPath, "") == wa))
- .ToArray()
- ;
-
- Log.LogMessage(MessageImportance.Low, $"Found {filteredAssets.Length} filtered assets");
-
- StaticWebAsset =
- filteredAssets.Select(asset => new TaskItem(asset, GetMetadata(asset, fixedDistPath)))
- .ToArray();
- }
- else
- {
- Log.LogMessage(MessageImportance.Low, $"The folder {fixedDistPath} does not exist, skipping StaticAssets generation");
- }
-
+ var staticWebAssets = CandidateAssets.ToDictionary(a => a.GetMetadata("FullPath"));
+ var existingEndpoints = ExistingEndpoints;
+ var existingEndpointsByAssetFile = existingEndpoints
+ .GroupBy(e => e.GetMetadata("AssetFile"), OSPath.PathComparer)
+ .ToDictionary(g => g.Key);
+
return true;
}
- private Dictionary GetMetadata(string asset, string fixedDistPath)
+ internal static class OSPath
{
- var dict = new Dictionary
- {
- ["SourceType"] = "Discovered",
- ["SourceId"] = AssemblyName,
- ["ContentRoot"] = fixedDistPath,
- ["RelativePath"] = asset.Replace(fixedDistPath, ""),
- ["BasePath"] = WebAppBasePath is { Length: > 0 } ? WebAppBasePath : "/",
- ["AssetKind"] = "All",
- ["AssetMode"] = "All",
- ["AssetRole"] = "Primary",
- ["OriginalItemSpec"] = asset,
- };
-
- var (fingerprint, integrity) = ComputeFingerprintAndIntegrity(asset, asset);
- dict.Add("Fingerprint", fingerprint);
- dict.Add("Integrity", integrity);
- return dict;
- }
-
- // https://github.com/dotnet/sdk/blob/cc17704acfbee4b2ef49a82aa6f65aaa9cafffef/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAsset.cs#L233-L248
- private static (string fingerprint, string integrity) ComputeFingerprintAndIntegrity(string identity, string originalItemSpec)
- {
- using var file = File.Exists(identity) ?
- File.OpenRead(identity) :
- (File.Exists(originalItemSpec) ?
- File.OpenRead(originalItemSpec) :
- throw new InvalidOperationException($"No file exists for the asset at either location '{identity}' or '{originalItemSpec}'."));
-
-#if NET6_0_OR_GREATER
- var hash = SHA256.HashData(file);
-#else
- using var sha = SHA256.Create();
- var hash = sha.ComputeHash(file);
-#endif
- return (ToBase36(hash), Convert.ToBase64String(hash));
- }
-
- private static string ToBase36(byte[] hash)
- {
- const string chars = "0123456789abcdefghijklmnopqrstuvwxyz";
-
- var result = new char[10];
- var dividend = BigInteger.Abs(new BigInteger(hash.AsSpan().Slice(0, 9).ToArray()));
- for (var i = 0; i < 10; i++)
- {
- dividend = BigInteger.DivRem(dividend, 36, out var remainder);
- result[i] = chars[(int)remainder];
- }
+ public static StringComparer PathComparer { get; } = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
+ ? StringComparer.OrdinalIgnoreCase :
+ StringComparer.Ordinal;
- return new string(result);
+ public static StringComparison PathComparison { get; } = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
+ ? StringComparison.OrdinalIgnoreCase :
+ StringComparison.Ordinal;
}
}
diff --git a/src/Uno.Wasm.Bootstrap/Uno.Wasm.Bootstrap.csproj b/src/Uno.Wasm.Bootstrap/Uno.Wasm.Bootstrap.csproj
index 00d0c26fc..9b9feeb00 100644
--- a/src/Uno.Wasm.Bootstrap/Uno.Wasm.Bootstrap.csproj
+++ b/src/Uno.Wasm.Bootstrap/Uno.Wasm.Bootstrap.csproj
@@ -3,18 +3,18 @@
netstandard2.0
NET_CORE
- 1701;1702;1705;649;NU5128
+ 1701;1702;1705;649;NU5128;NU1903
Uno.Wasm.Bootstrap.v0
Uno.Wasm.Bootstrap.v0
Uno.Wasm.Bootstrap
true
2.0.1-test.8
true
- 10.0
enable
- true
+ true
+ false
-
+
Uno.Wasm.Bootstrap.v$(GitVersion_Sha)
Uno.Wasm.Bootstrap.v$(GitVersion_Sha)
@@ -41,76 +41,46 @@
-
+
true
build
-
-
+
+
true
build
-
-
- true
- build/CustomDebuggerProxy
-
-
- true
- build/linker
-
-
- true
- build/cilstrip
-
-
+
+
true
build/scripts
-
-
+
+
true
tools/templates
-
-
- true
- tools
- PreserveNewest
- false
-
-
- true
- tools
- PreserveNewest
- false
-
-
- true
- tools
- false
- PreserveNewest
- false
-
-
- true
- tools
- false
- PreserveNewest
- false
-
-
- true
- tools
- false
- PreserveNewest
- false
-
-
+
+
+
true
tools
false
- PreserveNewest
false
-
+
+
+
+
+
+ <_UnoTaskDependencies Include="$(NuGetPackageRoot)/mono.cecil/0.11.4/lib/netstandard2.0/*.dll" />
+
+
+
+
@@ -122,19 +92,14 @@
-
+
-
+
-
- false
- true
- TargetFramework
-
false
true
@@ -150,44 +115,8 @@
true
TargetFramework
-
- false
- true
- TargetFramework
-
-
- false
- true
- TargetFramework
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -204,31 +133,36 @@
+
+
+
-
+
- <_PackagerNet5Files Include="../Uno.Wasm.Packager/bin/$(Configuration)/net5.0/packager.*" />
- <_TunerNet5Files Include="../Uno.Wasm.Tuner/bin/$(Configuration)/net5.0/wasm-tuner.*" />
- <_TunerNet5Files Include="../Uno.Wasm.Tuner/bin/$(Configuration)/net5.0/Mono.Cecil.*" />
- <_TunerNet5Files Include="../Uno.Wasm.Tuner/bin/$(Configuration)/net5.0/System.Json.dll" />
- <_TunerNet5Files Include="../Uno.Wasm.Tuner/bin/$(Configuration)/net5.0/System.Reflection.MetadataLoadContext.dll" />
+
-
-
+
+
+
+
+
-
+
-
-
- true
- build/packager
-
-
- true
- build/wasm-tuner
-
+ <_IntermediateGeneratedJavascript Include="@(GeneratedJavascript->'$(IntermediateOutputPath)%(FileName)%(Extension)')" />
+
+
+
+
+
+
+
+
+
+
+
@@ -241,6 +175,7 @@
<_Sha1Replace Include="ShellTask*.cs" />
<_Sha1Replace Include="*Task.cs" />
+ <_Sha1Replace Include="build\Uno.Wasm.Bootstrap.props" />
<_Sha1Replace Include="build\Uno.Wasm.Bootstrap.targets" />
@@ -261,8 +196,9 @@
if(!output.Contains(SHAVersion))
{
- Log.LogMessage("Updating : " + FilePath);
+ Log.LogMessage("Updating " + FilePath + " with " + SHAVersion);
File.WriteAllText(FilePath, output.Replace("v0", SHAVersion));
+ Log.LogMessage(File.ReadAllText(FilePath));
}
else
{
@@ -272,4 +208,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Uno.Wasm.Bootstrap/UnoInstallSDKTask.cs b/src/Uno.Wasm.Bootstrap/UnoInstallSDKTask.cs
deleted file mode 100644
index 092d13dbf..000000000
--- a/src/Uno.Wasm.Bootstrap/UnoInstallSDKTask.cs
+++ /dev/null
@@ -1,408 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Globalization;
-using System.IO;
-using System.IO.Compression;
-using System.Linq;
-using System.Net;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.Build.Framework;
-using Uno.Wasm.Bootstrap.Extensions;
-
-namespace Uno.Wasm.Bootstrap
-{
- public class UnoInstallSDKTask_v0 : Microsoft.Build.Utilities.Task, ICancelableTask
- {
- private readonly CancellationTokenSource _cts = new();
-
- private static readonly TimeSpan _SDKFolderLockTimeout = TimeSpan.FromMinutes(2);
- private static readonly TimeSpan _SDKLockRetryDelay = TimeSpan.FromSeconds(10);
-
- public string? NetCoreWasmSDKUri { get; set; }
-
- public string? MonoTempFolder { get; set; }
-
- [Microsoft.Build.Framework.Required]
- public string TargetFrameworkIdentifier { get; set; } = "";
-
- public string TargetFramework { get; set; } = "";
-
- public string TargetFrameworkVersion { get; set; } = "0.0";
-
- [Required]
- public string RuntimeConfiguration { get; set; } = "";
-
- [Required]
- public string PackagerOverrideFolderPath { get; set; } = "";
-
- [Required]
- public string CilStripOverrideFolderPath { get; set; } = "";
-
- [Required]
- public bool IsOSUnixLike { get; set; }
-
- [Microsoft.Build.Framework.Required]
- public bool EnableThreads { get; set; }
-
- [Microsoft.Build.Framework.Required]
- public bool EnableSimd { get; set; }
-
- public bool EnableEmscriptenWindows { get; set; } = true;
-
- [Microsoft.Build.Framework.Required]
- public string MonoRuntimeExecutionMode { get; set; } = "";
-
- [Microsoft.Build.Framework.Required]
- public Microsoft.Build.Framework.ITaskItem[]? Assets { get; set; }
-
- public bool GenerateAOTProfile { get; set; } = false;
-
- public bool DisableSDKCheckSumValidation { get; set; } = false;
-
- public bool DebugSDKChecksum { get; set; } = false;
-
- [Output]
- public string? SdkPath { get; set; }
-
- [Output]
- public string? PackagerBinPath { get; set; }
-
- [Output]
- public string? PackagerProjectFile { get; private set; }
-
- public override bool Execute()
- => ExecuteAsync(_cts.Token).Result;
-
- private async Task ExecuteAsync(CancellationToken ct)
- {
- if(TargetFramework == "netstandard2.0")
- {
- Log.LogError($"netstandard2.0 is not supported by this version of the bootstrapper. Update to net5.0 or later.");
- return false;
- }
-
- if (EnableEmscriptenWindows && Environment.OSVersion.Platform != PlatformID.Win32NT)
- {
- EnableEmscriptenWindows = false;
- }
-
- await InstallNetCoreWasmSdk(ct);
-
- return true;
- }
-
- private Version ActualTargetFrameworkVersion => Version.TryParse(TargetFrameworkVersion.Substring(1), out var v) ? v : new Version("0.0");
-
- private async Task InstallNetCoreWasmSdk(CancellationToken ct)
- {
- var sdkUri = string.IsNullOrWhiteSpace(NetCoreWasmSDKUri) ? Constants.DefaultDotnetRuntimeSdkUrl : NetCoreWasmSDKUri!;
-
- if (EnableEmscriptenWindows)
- {
- sdkUri = sdkUri.Replace("linux", "windows");
- }
-
- if (EnableThreads)
- {
- sdkUri = sdkUri.Replace(".zip", "-threads.zip");
- }
-
- if (EnableSimd)
- {
- sdkUri = sdkUri.Replace(".zip", "-simd.zip");
- }
-
- var sdkName = Path.GetFileNameWithoutExtension(new Uri(sdkUri).AbsolutePath.Replace('/', Path.DirectorySeparatorChar));
- Log.LogMessage("NetCore-Wasm SDK: " + sdkName);
- SdkPath = Path.Combine(GetMonoTempPath(), sdkName);
- Log.LogMessage("NetCore-Wasm SDK Path: " + SdkPath);
-
- SetupPackagerOutput();
-
- var writeChecksum = false;
-
- try
- {
- void WriteTools()
- {
- WriteCilStrip();
- }
-
- if (!await ValidateSDKCheckSum(ct, "NetCore-Wasm", SdkPath))
- {
- var zipPath = SdkPath + ".zip";
- Log.LogMessage($"Using NetCore-Wasm SDK {sdkUri}");
-
- zipPath = await RetreiveSDKFile(ct, sdkName, sdkUri, zipPath);
-
- ZipFile.ExtractToDirectory(zipPath, SdkPath);
- Log.LogMessage($"Extracted {sdkName} to {SdkPath}");
-
- MarkSDKExecutable();
-
- WriteTools();
-
- writeChecksum = true;
- }
-
- if (DisableSDKCheckSumValidation)
- {
- // If the validation is disabled, it's generally for troubleshooting of tooling
- // Overwrite the tools when checksum validation is disabled.
- WriteTools();
- }
-
-
- if (writeChecksum)
- {
- WriteChecksum(SdkPath);
- Log.LogMessage($"Wrote checksum to {SdkPath}");
- }
- }
- finally
- {
- UnlockSDKPath(SdkPath);
- }
- }
-
- private void SetupPackagerOutput()
- {
- var packagerName = "packager.dll";
- PackagerBinPath = Path.Combine(PackagerOverrideFolderPath, packagerName);
- }
-
- private void UnlockSDKPath(string sdkPath)
- {
- try
- {
- File.Delete(Path.Combine(sdkPath, ".lock"));
- }
- catch (Exception ex)
- {
- Log.LogMessage($"Failed to delete SDK lock file ({ex.Message})");
- }
- finally
- {
- Log.LogMessage(MessageImportance.Low, "Released SDK Folder lock");
- }
- }
-
- private static void LockSDKPath(string sdkPath)
- {
- var lockFilePath = Path.Combine(sdkPath, ".lock");
- Directory.CreateDirectory(sdkPath);
- File.WriteAllText(path: lockFilePath, Process.GetCurrentProcess().Id.ToString(CultureInfo.InvariantCulture));
- }
-
- private async Task ValidateSDKCheckSum(CancellationToken ct, string sdkName, string sdkPath)
- {
- var result = Directory.Exists(sdkPath);
-
- await WaitForLockFile(sdkPath, ct);
-
- if (!DisableSDKCheckSumValidation && Directory.Exists(sdkPath) && !VerifyChecksum(sdkPath))
- {
- // SDK folder was tampered with (e.g. StorageSense, User, etc.)
- Log.LogMessage($"Removing invalid {sdkName} SDK: {sdkPath}");
-
- var destination = $"{sdkPath}.{Guid.NewGuid():N}";
-
- Directory.Move(sdkPath, destination);
- Directory.Delete(destination, true);
-
- result = false;
- }
-
- LockSDKPath(sdkPath);
-
- return result;
- }
-
- private async Task WaitForLockFile(string sdkPath, CancellationToken ct)
- {
- var lockFilePath = Path.Combine(sdkPath, ".lock");
- var sw = Stopwatch.StartNew();
-
- while (sw.Elapsed < _SDKFolderLockTimeout)
- {
- if (File.Exists(lockFilePath))
- {
- if (int.TryParse(File.ReadAllText(lockFilePath), NumberStyles.Integer, CultureInfo.CurrentCulture, out var pid) && Process.GetCurrentProcess().Id == pid)
- {
- break;
- }
- else
- {
- Log.LogMessage(/*MessageImportance.Low, */"SDK Folder is locked, waiting...");
-
- await Task.Delay(_SDKLockRetryDelay, ct);
- }
- }
- else
- {
- break;
- }
- }
-
- Log.LogMessage(/*MessageImportance.Low, */"Got SDK Folder lock");
- }
-
- private void MarkSDKExecutable()
- {
- if (IsOSUnixLike)
- {
- Process.Start("chmod", $"-R +x \"{SdkPath}\"");
- }
- }
-
- private void WriteCilStrip()
- {
- if (!string.IsNullOrEmpty(CilStripOverrideFolderPath))
- {
- var basePath = Path.Combine(SdkPath, "tools");
- Directory.CreateDirectory(basePath);
-
- foreach (var file in Directory.EnumerateFiles(CilStripOverrideFolderPath))
- {
- var destFileName = Path.Combine(basePath, Path.GetFileName(file));
- Log.LogMessage($"Copy cil-strip {file} to {destFileName}");
- File.Copy(file, destFileName, true);
- }
- }
- }
- static readonly string[] BitCodeExtensions = new string[] { ".bc", ".a" };
-
- private bool HasBitcodeAssets()
- => Assets.Any(asset => BitCodeExtensions.Any(ext => asset.ItemSpec.EndsWith(ext, StringComparison.OrdinalIgnoreCase)));
-
- private async Task RetreiveSDKFile(CancellationToken ct, string sdkName, string sdkUri, string zipPath)
- {
- var tries = 3;
-
- while (--tries > 0)
- {
- try
- {
- var uri = new Uri(sdkUri);
-
- if (!uri.IsFile)
- {
- var client = new WebClient();
- var wp = WebRequest.DefaultWebProxy;
- wp.Credentials = CredentialCache.DefaultCredentials;
- client.Proxy = wp;
-
- Log.LogMessage(Microsoft.Build.Framework.MessageImportance.High, $"Downloading {sdkName} to {zipPath}");
-
- using (ct.Register(() => client.CancelAsync()))
- {
- await client.DownloadFileTaskAsync(sdkUri, zipPath);
- }
-
- return zipPath;
- }
- else
- {
- return uri.LocalPath;
- }
- }
- catch(Exception e)
- {
- Log.LogWarning($"Failed to download Downloading {sdkName} to {zipPath}. Retrying... ({e.Message})");
- }
- }
-
- throw new Exception($"Failed to download {sdkName} to {zipPath}");
- }
-
- private const string ChecksumFilename = "UNO_WASM_SDK.CHECKSUM";
-
- private int ComputeChecksum(string path)
- {
- var exclusions = new[]
- {
- Path.Combine(path, ".lock"),
- Path.Combine(path, ChecksumFilename),
- Path.Combine(path, Path.Combine("wasm-bcl", "wasm_tools", "monolinker.exe.config"))
- };
-
- var files = Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories)
- .Where(f => !exclusions.Contains(f));
-
- if (DebugSDKChecksum)
- {
- var raw = string.Join("\r\n", files.Select(f => $"{f}: {new FileInfo(f).Length}"));
- Log.LogMessage($"SDK Files Checksum: {raw}");
- }
-
- return files
- .Sum(f => f.Length);
- }
-
- private bool VerifyChecksum(string path)
- {
- try
- {
- var checksum = int.Parse(File.ReadAllText(Path.Combine(path, ChecksumFilename)));
-
- return ComputeChecksum(path) == checksum;
- }
- catch
- {
- return false;
- }
- }
-
- private void WriteChecksum(string path)
- {
- var file = Path.Combine(path, ChecksumFilename);
-
- File.WriteAllText(file, $"{ComputeChecksum(path)}");
- }
-
- private string GetMonoTempPath()
- {
- var path = string.IsNullOrWhiteSpace(MonoTempFolder) ? Path.GetTempPath() : MonoTempFolder!;
-
- // Workaround for https://github.com/unoplatform/Uno.Wasm.Bootstrap/issues/418
- if(path.Trim().Contains(" "))
- {
- if (EnableEmscriptenWindows)
- {
- path = Path.Combine(Environment.GetEnvironmentVariable("ProgramData"), "UnoPlatform");
- }
- else
- {
- throw new InvalidOperationException("The MSBuild property WasmShellMonoTempFolder (MonoTempFolder task parameter) must not contain spaces");
- }
- }
-
- Directory.CreateDirectory(path);
-
- return path;
- }
-
- private RuntimeExecutionMode ParseRuntimeExecutionMode()
- {
- if (Enum.TryParse(MonoRuntimeExecutionMode, out var runtimeExecutionMode))
- {
- Log.LogMessage(MessageImportance.Low, $"MonoRuntimeExecutionMode={MonoRuntimeExecutionMode}");
- }
- else
- {
- throw new NotSupportedException($"The MonoRuntimeExecutionMode {MonoRuntimeExecutionMode} is not supported");
- }
-
- return runtimeExecutionMode;
- }
-
- public void Cancel()
- => _cts.Cancel();
- }
-}
diff --git a/src/Uno.Wasm.Bootstrap/build/CustomDebuggerProxy/Mono.Cecil.Mdb.dll b/src/Uno.Wasm.Bootstrap/build/CustomDebuggerProxy/Mono.Cecil.Mdb.dll
deleted file mode 100644
index 4fcaa4131..000000000
Binary files a/src/Uno.Wasm.Bootstrap/build/CustomDebuggerProxy/Mono.Cecil.Mdb.dll and /dev/null differ
diff --git a/src/Uno.Wasm.Bootstrap/build/CustomDebuggerProxy/Mono.Cecil.Pdb.dll b/src/Uno.Wasm.Bootstrap/build/CustomDebuggerProxy/Mono.Cecil.Pdb.dll
deleted file mode 100644
index 9b68872c8..000000000
Binary files a/src/Uno.Wasm.Bootstrap/build/CustomDebuggerProxy/Mono.Cecil.Pdb.dll and /dev/null differ
diff --git a/src/Uno.Wasm.Bootstrap/build/CustomDebuggerProxy/Mono.Cecil.Rocks.dll b/src/Uno.Wasm.Bootstrap/build/CustomDebuggerProxy/Mono.Cecil.Rocks.dll
deleted file mode 100644
index becd68533..000000000
Binary files a/src/Uno.Wasm.Bootstrap/build/CustomDebuggerProxy/Mono.Cecil.Rocks.dll and /dev/null differ
diff --git a/src/Uno.Wasm.Bootstrap/build/CustomDebuggerProxy/Mono.Cecil.dll b/src/Uno.Wasm.Bootstrap/build/CustomDebuggerProxy/Mono.Cecil.dll
deleted file mode 100644
index 58dddaa32..000000000
Binary files a/src/Uno.Wasm.Bootstrap/build/CustomDebuggerProxy/Mono.Cecil.dll and /dev/null differ
diff --git a/src/Uno.Wasm.Bootstrap/build/CustomDebuggerProxy/Mono.WebAssembly.DebuggerProxy.dll b/src/Uno.Wasm.Bootstrap/build/CustomDebuggerProxy/Mono.WebAssembly.DebuggerProxy.dll
deleted file mode 100644
index 2ec873716..000000000
Binary files a/src/Uno.Wasm.Bootstrap/build/CustomDebuggerProxy/Mono.WebAssembly.DebuggerProxy.dll and /dev/null differ
diff --git a/src/Uno.Wasm.Bootstrap/build/Uno.Wasm.Bootstrap.Publish.targets b/src/Uno.Wasm.Bootstrap/build/Uno.Wasm.Bootstrap.Publish.targets
index 5455eeabf..a05b12bfe 100644
--- a/src/Uno.Wasm.Bootstrap/build/Uno.Wasm.Bootstrap.Publish.targets
+++ b/src/Uno.Wasm.Bootstrap/build/Uno.Wasm.Bootstrap.Publish.targets
@@ -1,33 +1,5 @@
-
-
-
-
- <_ResolvedCopyLocalPublishAssets Remove="@(_ResolvedCopyLocalPublishAssets)" />
-
-
-
-
-
-
-
-
-
-
- <_UnoWasmDistFiles Include="$(OutputPath)dist/**"/>
- <_UnoWasmDist Include="@(_UnoWasmDistFiles)">
- $([System.String]::Copy('%(Identity)').Replace('$(OutputPath)dist$([System.IO.Path]::DirectorySeparatorChar)', 'wwwroot/'))
-
-
-
- %(TargetPath)
- PreserveNewest
-
-
-
diff --git a/src/Uno.Wasm.Bootstrap/build/Uno.Wasm.Bootstrap.props b/src/Uno.Wasm.Bootstrap/build/Uno.Wasm.Bootstrap.props
index 6748b30cf..eb2f351ab 100644
--- a/src/Uno.Wasm.Bootstrap/build/Uno.Wasm.Bootstrap.props
+++ b/src/Uno.Wasm.Bootstrap/build/Uno.Wasm.Bootstrap.props
@@ -1,19 +1,4 @@
-
- true
-
-
- browser-wasm
-
-
- false
-
-
- false
-
@@ -23,8 +8,4 @@
-
-
-
-
diff --git a/src/Uno.Wasm.Bootstrap/build/Uno.Wasm.Bootstrap.targets b/src/Uno.Wasm.Bootstrap/build/Uno.Wasm.Bootstrap.targets
index eb328cdbb..c9b9772e3 100644
--- a/src/Uno.Wasm.Bootstrap/build/Uno.Wasm.Bootstrap.targets
+++ b/src/Uno.Wasm.Bootstrap/build/Uno.Wasm.Bootstrap.targets
@@ -1,196 +1,244 @@
-
- <_packageBinaryPath>$(MSBuildThisFileDirectory)../tools/Uno.Wasm.Bootstrap.v0.dll
+ <_UnoBootstrapTaskBinary>$(MSBuildThisFileDirectory)../tools/Uno.Wasm.Bootstrap.v0.dll
<_WasmShellTasksPathIsDevMode>false
- <_WasmShellTasksPathIsDevMode Condition="!Exists('$(_packageBinaryPath)')">true
+ <_WasmShellTasksPathIsDevMode Condition="!Exists('$(_UnoBootstrapTaskBinary)')">true
$(MSBuildThisFileDirectory)../bin/$(Configuration)/netstandard2.0
../tools
- $(MSBuildThisFileDirectory)../Templates/index.html
- $(MSBuildThisFileDirectory)../tools/templates/index.html
+ $(MSBuildThisFileDirectory)../Templates/index.html
+ $(MSBuildThisFileDirectory)../tools/templates/index.html
.a;.bc;.o
- .clr
+ true
browser
- Release
- false
- true
- false
- true
- 7
- true
- false
- true
- false
-
-
- true
-
-
- true
-
-
- false
- false
- false
- false
- false
- true
-
-
-
- <_RequiresILLinkPack Condition="'$(TargetFrameworkVersion)'!='' and '$(TargetFrameworkVersion.Substring(1))'>='8.0'">true
-
- $(AssemblyName)/dist/
-
-
- Interpreter
-
-
- FullAOT
-
-
- false
- false
- true
- false
- false
- $(MonoRuntimeDebuggerEnabled)
-
-
- <_WasmBootstrapOriginalPublishDir>$(PublishDir)
+
+ false
-
+
+
+
+ $(WasmProfilers);aot;
+
+
+ true
+
+
+ false
+
+
+ true
+
+
+ false
-
- false
+
+
+
+
+ $(WasmProfilers);log;
-
-
-
-
-
-
- $([System.IO.Path]::GetDirectoryName($(ILLinkTasksAssembly)))\..\net$(TargetFrameworkVersion.Substring(1))
-
-
-
-
- $([System.IO.Path]::GetDirectoryName($(ILLinkTasksAssembly)))\..\net7.0
-
-
-
-
-
-
-
-
-
- <_WasmShellIsNetCore Condition="'$(TargetFrameworkIdentifier)'=='.NETCoreApp' and '$(TargetFrameworkVersion.Substring(1))'>='5.0'">true
- true
-
+
+ true
+
+
+ false
+
+
+ true
-
-
-
-
+
+ false
+
+
+
+ true
+ true
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+ <_emsdkOriginalPackagePath>$([System.IO.Path]::GetFullPath('$(EmscriptenSdkToolsPath)..'))
+ <_targetEMSDKPath>$(USERPROFILE)\.uno\emsdk\$([System.IO.Path]::GetFileName('$(_emsdkOriginalPackagePath)'))
+
+
+
+
+
+
+
+ $(_targetEMSDKPath)\
+ $(EmscriptenSdkToolsPath)bin\
+ $(EmscriptenSdkToolsPath)emscripten\
+
-
+
+
+
-
+
+
+
-
- $(AssemblyName).xml
- false
-
+
+ <_WasmPInvokeModules Include="__Native" />
+ <_WasmPInvokeModules Include="__Internal" />
+ <_WasmPInvokeModules Include="@(WasmShellAdditionalPInvokeLibrary)" />
+
+
+
+
+
+
+
+ <_NativeAssetsFiltered Include="@(Assets)" Condition=" '%(Extension)'=='.a' OR '%(Extension)'=='.o' OR '%(Extension)'=='.bc' " />
+
+
+
+ <_AOT_InternalForceInterpretAssemblies Include="@(MonoRuntimeMixedModeExcludedAssembly->'%(Filename).dll')" />
-
+
+
+ $(WasmShellEnableSimd)
+
+
+ $(WasmShellEnableAOTDeduplication)
+
+
+ -O0
+ -O1
+ -O2
+ -O3
+ -Oz
+
+ -O0
+
+
+ $(WasmShellEnableJiterpreter)
+
+
+ $(EmccFlags);@(WasmShellExtraEmccFlags)
+
+ $(EmccFlags);--profiling
+
+
+ true
+
+
+ <_WasmPThreadPoolInitialSize Condition=" '$(WasmShellPThreadsPoolSize)' == 'true' ">true
+
+
+ true
+
+
+ true
+
+
+
+
+
+ $([System.IO.Path]::GetFullPath('$(IntermediateOutputPath)emsdk-cache'))
+
+
+ $(TMP)\emsdk-cache
+
+
+
+
+
+
+ <_NativeAssetsFiltered Remove="@(_NativeAssetsFiltered)" />
+
-
-
- BuildDist;
- $(StaticWebAssetsPrepareForRunDependsOn)
-
-
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
@@ -199,172 +247,56 @@
Condition="'%(Extension)' == '.dll'" />
-
-
-
-
- $([System.IO.Path]::Combine('$(OutputPath)', 'dist'))
- <_WasmShellIsNetCore Condition="'$(TargetFrameworkIdentifier)'=='.NETCoreApp' and '$(TargetFrameworkVersion.Substring(1))'>='5.0'">true
-
- <_WasmShellToolSuffix Condition="'$(_WasmShellIsNetCore)'!='true'">net462
- <_WasmShellToolSuffix Condition="'$(_WasmShellIsNetCore)'=='true'">net5.0
-
+
+ <_UnoWasmCopyToOutputAssets
+ Include="@(_AllChildProjectItemsWithTargetPath)"
+ Condition=" '%(_AllChildProjectItemsWithTargetPath.CopyToOutputDirectory)' == 'PreserveNewest' OR '%(_AllChildProjectItemsWithTargetPath.CopyToOutputDirectory)' == 'Always' " />
-
-
-
-
-
+
+
-
-
+ >
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $(OutputPath)/dist
-
-
-
-
-
-
-
- <_CliToolRefs>@(DotNetCliToolReference)
+
+
+ $(_FilteredAotProfile)
-
-
-
-
-
-
-
-
-
-
+
-
diff --git a/src/Uno.Wasm.Bootstrap/build/cilstrip/mono-cil-strip.exe b/src/Uno.Wasm.Bootstrap/build/cilstrip/mono-cil-strip.exe
deleted file mode 100644
index badf776c9..000000000
Binary files a/src/Uno.Wasm.Bootstrap/build/cilstrip/mono-cil-strip.exe and /dev/null differ
diff --git a/src/Uno.Wasm.Bootstrap/build/cilstrip/mono-cil-strip.pdb b/src/Uno.Wasm.Bootstrap/build/cilstrip/mono-cil-strip.pdb
deleted file mode 100644
index d894dbf5b..000000000
Binary files a/src/Uno.Wasm.Bootstrap/build/cilstrip/mono-cil-strip.pdb and /dev/null differ
diff --git a/src/Uno.Wasm.Bootstrap/build/linker/Mono.Cecil.dll b/src/Uno.Wasm.Bootstrap/build/linker/Mono.Cecil.dll
deleted file mode 100644
index 9b78a39f1..000000000
Binary files a/src/Uno.Wasm.Bootstrap/build/linker/Mono.Cecil.dll and /dev/null differ
diff --git a/src/Uno.Wasm.Bootstrap/build/linker/monolinker.exe b/src/Uno.Wasm.Bootstrap/build/linker/monolinker.exe
deleted file mode 100644
index 4e4f7adcd..000000000
Binary files a/src/Uno.Wasm.Bootstrap/build/linker/monolinker.exe and /dev/null differ
diff --git a/src/Uno.Wasm.Bootstrap/tools/support/.gitignore b/src/Uno.Wasm.Bootstrap/tools/support/.gitignore
deleted file mode 100644
index f0daeb894..000000000
--- a/src/Uno.Wasm.Bootstrap/tools/support/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-*.dll
-*.pdb
-*.json
\ No newline at end of file
diff --git a/src/Uno.Wasm.Bootstrap/ts/Uno/WebAssembly/AotProfilerSupport.ts b/src/Uno.Wasm.Bootstrap/ts/Uno/WebAssembly/AotProfilerSupport.ts
index d98c82368..b4386be1b 100644
--- a/src/Uno.Wasm.Bootstrap/ts/Uno/WebAssembly/AotProfilerSupport.ts
+++ b/src/Uno.Wasm.Bootstrap/ts/Uno/WebAssembly/AotProfilerSupport.ts
@@ -3,6 +3,7 @@
export class AotProfilerSupport {
private _context?: DotnetPublicAPI;
+ private _aotProfilerExports?: any;
private _unoConfig: UnoConfig;
@@ -13,16 +14,10 @@
// This will fail when CSP is enabled, but initialization of the profiler
// cannot happen asynchronously. Until this is fixed by the runtime, we'll need
// to keep using bind_static_method.
- var initializeProfile = this._context.BINDING.bind_static_method("[Uno.Wasm.AotProfiler] Uno.AotProfilerSupport:Initialize");
- if (initializeProfile) {
- initializeProfile();
- this.attachProfilerHotKey();
- }
- else {
- throw `Unable to find AOT Profiler initialization method`;
- }
+ this.attachProfilerHotKey();
}
+
public static initialize(context: DotnetPublicAPI, unoConfig: Uno.WebAssembly.Bootstrap.UnoConfig): AotProfilerSupport {
if (Bootstrapper.ENVIRONMENT_IS_WEB && unoConfig.generate_aot_profile) {
return new AotProfilerSupport(context, unoConfig);
@@ -45,13 +40,25 @@
});
}
- public saveAotProfile() {
- var stopProfile = this._context.BINDING.bind_static_method("[Uno.Wasm.AotProfiler] Uno.AotProfilerSupport:StopProfile");
- stopProfile();
+ private async initializeProfile() {
+ let anyContext = this._context;
+
+ if (anyContext.getAssemblyExports !== undefined) {
+ this._aotProfilerExports = await anyContext.getAssemblyExports("Uno.Wasm.AotProfiler");
+ }
+ else {
+ throw `Unable to find getAssemblyExports`;
+ }
+ }
+
+ public async saveAotProfile() {
+ await this.initializeProfile();
+
+ this._aotProfilerExports.Uno.AotProfilerSupport.StopProfile();
// Export the file
var a = window.document.createElement('a');
- var blob = new Blob([(this._context.Module).aot_profile_data]);
+ var blob = new Blob([(this._context.INTERNAL).aotProfileData]);
a.href = window.URL.createObjectURL(blob);
a.download = "aot.profile";
diff --git a/src/Uno.Wasm.Bootstrap/ts/Uno/WebAssembly/Bootstrapper.ts b/src/Uno.Wasm.Bootstrap/ts/Uno/WebAssembly/Bootstrapper.ts
index 502f1f684..ec4bccb50 100644
--- a/src/Uno.Wasm.Bootstrap/ts/Uno/WebAssembly/Bootstrapper.ts
+++ b/src/Uno.Wasm.Bootstrap/ts/Uno/WebAssembly/Bootstrapper.ts
@@ -1,6 +1,5 @@
///
///
-///
///
namespace Uno.WebAssembly.Bootstrap {
@@ -48,15 +47,18 @@ namespace Uno.WebAssembly.Bootstrap {
this._appBase = this._unoConfig.environmentVariables["UNO_BOOTSTRAP_APP_BASE"];
this.disableDotnet6Compatibility = false;
- this.configSrc = `mono-config.json`;
+ this.configSrc = `blazor.boot.json`;
this.onConfigLoaded = config => this.configLoaded(config);
this.onDotnetReady = () => this.RuntimeReady();
- this.onAbort = () => this.runtimeAbort();
// Register this instance of the Uno namespace globally
globalThis.Uno = Uno;
}
+ public static invokeJS(value: string) {
+ return eval(value);
+ }
+
public static async bootstrap(): Promise {
try {
@@ -82,7 +84,7 @@ namespace Uno.WebAssembly.Bootstrap {
//@ts-ignore
var config = await import('./uno-config.js');
- if(document && (document as any).uno_app_base_override) {
+ if (document && (document as any).uno_app_base_override) {
config.config.uno_app_base = (document as any).uno_app_base_override;
}
@@ -93,10 +95,14 @@ namespace Uno.WebAssembly.Bootstrap {
}
//@ts-ignore
- var m = await import(`./dotnet.js`);
+ var m = await import(`./_framework/dotnet.js`);
- // Change the global loadBootResource
- m.dotnet.withResourceLoader(bootstrapper.loadResource.bind(bootstrapper));
+ m.dotnet
+ .withModuleConfig({
+ preRun: () => bootstrapper.wasmRuntimePreRun(),
+ })
+ .withRuntimeOptions(config.config.uno_runtime_options)
+ .withConfig({ loadAllSatelliteResources: config.config.uno_loadAllSatelliteResources });
const dotnetRuntime = await m.default(
(context: DotnetPublicAPI) => {
@@ -105,6 +111,10 @@ namespace Uno.WebAssembly.Bootstrap {
}
);
+ // Capture the module instance and publish to globalThis.
+ bootstrapper._context.Module = dotnetRuntime.Module;
+ (globalThis).Module = bootstrapper._context.Module;
+
bootstrapper._runMain = dotnetRuntime.runMain;
bootstrapper.setupExports(dotnetRuntime);
}
@@ -116,33 +126,26 @@ namespace Uno.WebAssembly.Bootstrap {
private setupExports(dotnetRuntime: any) {
this._getAssemblyExports = dotnetRuntime.getAssemblyExports;
(this._context.Module).getAssemblyExports = dotnetRuntime.getAssemblyExports;
- }
+ (globalThis.Module).getAssemblyExports = dotnetRuntime.getAssemblyExports;
+ }
public asDotnetConfig(): DotnetModuleConfig {
return {
disableDotnet6Compatibility: this.disableDotnet6Compatibility,
configSrc: this.configSrc,
- baseUrl: this._unoConfig.uno_app_base + "/",
- mainScriptPath: "dotnet.js",
+ baseUrl: this._unoConfig.uno_app_base,
+ mainScriptPath: "_framework/dotnet.js",
onConfigLoaded: this.onConfigLoaded,
onDotnetReady: this.onDotnetReady,
onAbort: this.onAbort,
exports: ["IDBFS", "FS"].concat(this._unoConfig.emcc_exported_runtime_methods),
+ onDownloadResourceProgress: (resourcesLoaded: number, totalResources: number) => this.reportDownloadResourceProgress(resourcesLoaded, totalResources),
};
}
public configure(context: DotnetPublicAPI) {
this._context = context;
- // Module may not be initialized yet (.NET 8 and later)
- (this._context).Module = this._context.Module || {};
-
- this.setupRequire();
- this.setupEmscriptenPreRun();
-
- // Module is not exposed in the context in net8+
- (globalThis).Module = this._context.Module;
-
// Required for hot reload (browser-link provided javascript file)
(globalThis).BINDING = this._context.BINDING;
}
@@ -155,16 +158,6 @@ namespace Uno.WebAssembly.Bootstrap {
}
}
- private setupEmscriptenPreRun() {
- if (!this._context.preRun) {
- this._context.preRun = [];
- }
- else if (typeof this._context.preRun === "function") {
- this._context.preRun = [];
- }
- (this._context.preRun).push(() => this.wasmRuntimePreRun());
- }
-
/**
* Setup the global require.js library
*
@@ -178,67 +171,65 @@ namespace Uno.WebAssembly.Bootstrap {
}
private wasmRuntimePreRun() {
-
- if (this._unoConfig.environmentVariables) {
- for (let key in this._unoConfig.environmentVariables) {
- if (this._unoConfig.environmentVariables.hasOwnProperty(key)) {
- if (this._monoConfig.debugLevel) console.log(`Setting ${key}=${this._unoConfig.environmentVariables[key]}`);
- this._monoConfig.environmentVariables[key] = this._unoConfig.environmentVariables[key];
- }
- }
- }
-
- this.timezonePreSetup();
-
if (LogProfilerSupport.initializeLogProfiler(this._unoConfig)) {
this._logProfiler = new LogProfilerSupport(this._context, this._unoConfig);
}
}
- private timezonePreSetup() {
- let timeZone = 'UTC';
- try {
- timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
- // eslint-disable-next-line no-empty
- } catch { }
- this._monoConfig.environmentVariables['TZ'] = timeZone || 'UTC';
- }
-
private RuntimeReady() {
- MonoRuntimeCompatibility.initialize();
-
this.configureGlobal();
+ this.setupRequire();
this.initializeRequire();
this._aotProfiler = AotProfilerSupport.initialize(this._context, this._unoConfig);
- this._logProfiler?.postInitializeLogProfiler();
}
private configureGlobal() {
var thatGlobal = (globalThis);
thatGlobal.config = this._unoConfig;
- thatGlobal.MonoRuntime = MonoRuntimeCompatibility;
+
+ // The module instance is modified by the runtime, merge the changes
+ thatGlobal.Module = this._context.Module;
// global exports from emscripten that are not exposed
// as .NET is initialized in a module
// List of possible exports: https://github.com/emscripten-core/emscripten/blob/c834ef7d69ccb4100239eeba0b0f6573fed063bc/src/modules.js#L391
// Needs to be aligned with exports in https://github.com/unoplatform/Uno.DotnetRuntime.WebAssembly/blob/f7294fe410705bc220e63fc51d44bdffe4093a5d/patches/fix-additional-emscripten-exports.patch#L19
// And in the packager's list of exports.
- thatGlobal.lengthBytesUTF8 = (this._context.Module).lengthBytesUTF8;
- thatGlobal.stringToUTF8 = (this._context.Module).stringToUTF8;
- thatGlobal.UTF8ToString = (this._context.Module).UTF8ToString;
- thatGlobal.UTF8ArrayToString = (this._context.Module).UTF8ArrayToString;
+ let anyModule = this._context.Module;
+ thatGlobal.lengthBytesUTF8 = anyModule.lengthBytesUTF8;
+ thatGlobal.UTF8ToString = anyModule.UTF8ToString;
+ thatGlobal.UTF8ArrayToString = anyModule.UTF8ArrayToString;
+
+ thatGlobal.IDBFS = anyModule.IDBFS;
+ thatGlobal.FS = anyModule.FS;
+
+ // copy properties from this._unoConfig.emcc_exported_runtime_methods into globalThis
+ if (this._unoConfig.emcc_exported_runtime_methods) {
+ this._unoConfig.emcc_exported_runtime_methods.forEach((name: string) => {
+ thatGlobal[name] = anyModule[name];
+ });
+ }
}
// This is called during emscripten `preInit` event, after we fetched config.
private configLoaded(config: MonoConfig) {
this._monoConfig = config;
+ if (this._unoConfig.environmentVariables) {
+ for (let key in this._unoConfig.environmentVariables) {
+ if (this._unoConfig.environmentVariables.hasOwnProperty(key)) {
+ if (this._monoConfig.debugLevel) console.log(`Setting ${key}=${this._unoConfig.environmentVariables[key]}`);
+ this._monoConfig.environmentVariables[key] = this._unoConfig.environmentVariables[key];
+ }
+ }
+ }
+
if (this._unoConfig.generate_aot_profile) {
this._monoConfig.aotProfilerOptions = {
writeAt: "Uno.AotProfilerSupport::StopProfile",
- sendTo: "Uno.AotProfilerSupport::DumpAotProfileData"
+ sendTo: "System.Runtime.InteropServices.JavaScript.JavaScriptExports::DumpAotProfileData"
};
}
@@ -250,10 +241,6 @@ namespace Uno.WebAssembly.Bootstrap {
}
}
- private runtimeAbort() {
- // set_exit_code(1, error);
- }
-
public preInit() {
this.body = document.getElementById("uno-body");
@@ -263,6 +250,7 @@ namespace Uno.WebAssembly.Bootstrap {
private async mainInit(): Promise {
try {
this.attachDebuggerHotkey();
+
await this.setupHotReload();
if (this._hotReloadSupport) {
@@ -290,14 +278,18 @@ namespace Uno.WebAssembly.Bootstrap {
}
}
+ private reportDownloadResourceProgress(resourcesLoaded: number, totalResources: number) {
+
+ this.progress.max = totalResources;
+ (this.progress).value = resourcesLoaded;
+ }
+
private initProgress() {
this.loader = this.body.querySelector(".uno-loader");
if (this.loader) {
this.loader.id = "loading";
- const totalBytesToDownload = this._unoConfig.mono_wasm_runtime_size + this._unoConfig.total_assemblies_size;
const progress = this.loader.querySelector("progress");
- progress.max = totalBytesToDownload;
(progress).value = ""; // indeterminate
this.progress = progress;
@@ -371,206 +363,6 @@ namespace Uno.WebAssembly.Bootstrap {
}
}
- private reportProgressWasmLoading(loaded: number) {
- if (this.progress) {
- this.progress.value = loaded;
- }
- }
-
- private reportAssemblyLoading(adding: number) {
- if (this.progress) {
- this.progress.value += adding;
- }
- }
-
- private raiseLoadingError(err: any) {
- this.loader.setAttribute("loading-alert", "error");
-
- const alert = this.loader.querySelector(".alert");
-
- let title = alert.getAttribute("title");
- if (title) {
- title += `\n${err}`;
- } else {
- title = `${err}`;
- }
- alert.setAttribute("title", title);
- }
-
- private raiseLoadingWarning(msg: string) {
- if (this.loader.getAttribute("loading-alert") !== "error") {
- this.loader.setAttribute("loading-alert", "warning");
- }
-
- const alert = this.loader.querySelector(".alert");
-
- let title = alert.getAttribute("title");
- if (title) {
- title += `\n${msg}`;
- } else {
- title = `${msg}`;
- }
- alert.setAttribute("title", title);
- }
-
- private getFetchInit(url: string): RequestInit {
- const fileName = url.substring(url.lastIndexOf("/") + 1);
-
- const init: RequestInit = { credentials: "same-origin" };
-
- if (this._unoConfig.files_integrity.hasOwnProperty(fileName)) {
- init.integrity = this._unoConfig.files_integrity[fileName];
- }
-
- return init;
- }
-
- private loadResource(type: WebAssemblyBootResourceType, name: string, defaultUri: string, integrity: string, behavior: AssetBehaviors):
- string | Promise | null | undefined {
-
- if (type == "dotnetjs") {
- return defaultUri;
- }
-
- return this.deobfuscateFile(name, this.fetchFile(defaultUri));
- }
-
- private async deobfuscateFile(asset: string, response: Promise): Promise {
- const assemblyFileSuffix = this._unoConfig.assemblyFileNameObfuscationMode !== "NoDots" ?
- this._unoConfig.assemblyFileExtension :
- this._unoConfig.assemblyFileExtension.replace(".", "_");
-
- if (this._unoConfig.assemblyObfuscationKey && asset.endsWith(assemblyFileSuffix)) {
- const responseValue = await response;
-
- if (responseValue) {
- var data = new Uint8Array(await responseValue.arrayBuffer());
- var key = this._unoConfig.assemblyObfuscationKey;
-
- for (var i = 0; i < data.length; i++) {
- data[i] ^= key.charCodeAt(i % key.length);
- }
-
- return new Response(data, { "status": 200, headers: responseValue.headers });
- }
- }
-
- return response;
- }
-
- private fetchWithProgress(url: string, progressCallback: Function) : Promise {
-
- if (!this.loader) {
- // No active loader, simply use the fetch API directly...
- return fetch(url, this.getFetchInit(url));
- }
-
- return fetch(url, this.getFetchInit(url))
- .then(response => {
- if (!response.ok) {
- throw Error(`${response.status} ${response.statusText}`);
- }
-
- try {
- let loaded = 0;
-
- // Wrap original stream with another one, while reporting progress.
- const stream = new ReadableStream({
- start(ctl) {
- const reader = response.body.getReader();
-
- read();
-
- function read() {
- reader.read()
- .then(
- ({ done, value }) => {
- if (done) {
- ctl.close();
- return;
- }
- loaded += value.byteLength;
- progressCallback(loaded, value.byteLength);
- ctl.enqueue(value);
- read();
- })
- .catch(error => {
- console.error(error);
- ctl.error(error);
- });
- }
- }
- });
-
- // We copy the previous response to keep original headers.
- // Not only the WebAssembly will require the right content-type,
- // but we also need it for streaming optimizations:
- // https://bugs.chromium.org/p/chromium/issues/detail?id=719172#c28
- return new Response(stream, response);
- }
- catch (ex) {
- // ReadableStream may not be supported (Edge as of 42.17134.1.0)
- return response;
- }
- })
- .catch(err => this.raiseLoadingError(err));
- }
-
- private fetchFile(asset: string) : Promise {
-
- if (asset.lastIndexOf(".dll") !== -1) {
- asset = asset.replace(".dll", this._unoConfig.assemblyFileExtension);
-
- if (this._unoConfig.assemblyFileNameObfuscationMode == "NoDots") {
- asset = asset.replace(/\/([^\/]*)$/, function (match, p1) {
- return "/" + p1.replace(/\./g, "_");
- });
- }
- }
-
- if (asset.startsWith("icudt") && asset.endsWith(".dat")) {
- asset = `${this._unoConfig.uno_app_base}/${asset}`;
- }
-
- asset = asset.replace("/managed/", `/${this._unoConfig.uno_remote_managedpath}/`);
-
- if (Bootstrapper.ENVIRONMENT_IS_NODE) {
- var fs = require('fs');
-
- console.log('Loading... ' + asset);
- var binary = fs.readFileSync(asset);
- var resolve_func2 = function (resolve: any, reject: any) {
- resolve(new Uint8Array(binary));
- };
- var resolve_func1 = function (resolve: any, reject: any) {
- var response = {
- ok: true,
- url: asset,
- arrayBuffer: function () {
- return new Promise(resolve_func2);
- }
- };
- resolve(response);
- };
- return new Promise(resolve_func1);
- } else {
- if (!this._unoConfig.enable_debugging) {
- // Assembly fetch streaming is disabled during debug, it seems to
- // interfere with the ability for mono or the chrome debugger to
- // initialize the debugging session properly. Streaming in debug is
- // not particularly interesting, so we can skip it.
-
- const assemblyName = asset.substring(asset.lastIndexOf("/") + 1);
- if (this._unoConfig.assemblies_with_size.hasOwnProperty(assemblyName)) {
- return this
- .fetchWithProgress(asset, (loaded: any, adding: any) => this.reportAssemblyLoading(adding));
- }
- }
-
- return fetch(asset, {credentials: "same-origin"});
- }
- }
-
private isElectron() {
return navigator.userAgent.indexOf('Electron') !== -1;
}
@@ -581,21 +373,21 @@ namespace Uno.WebAssembly.Bootstrap {
// But when run with NodeJS or Electron, it's using CommonJS instead of AMD
this._isUsingCommonJS = this._unoConfig.uno_shell_mode !== "BrowserEmbedded" && (Bootstrapper.ENVIRONMENT_IS_NODE || this.isElectron());
- if (this._unoConfig.enable_debugging) console.log("Done loading the BCL");
+ if (this._unoConfig.uno_enable_tracing) console.log("Done loading the BCL");
if (this._unoConfig.uno_dependencies && this._unoConfig.uno_dependencies.length !== 0) {
let pending = this._unoConfig.uno_dependencies.length;
const checkDone = (dependency: string) => {
--pending;
- if (this._unoConfig.enable_debugging) console.log(`Loaded dependency (${dependency}) - remains ${pending} other(s).`);
+ if (this._unoConfig.uno_enable_tracing) console.log(`Loaded dependency (${dependency}) - remains ${pending} other(s).`);
if (pending === 0) {
this.mainInit();
}
};
this._unoConfig.uno_dependencies.forEach((dependency) => {
- if (this._unoConfig.enable_debugging) console.log(`Loading dependency (${dependency})`);
+ if (this._unoConfig.uno_enable_tracing) console.log(`Loading dependency (${dependency})`);
let processDependency = (instance: any) => {
@@ -604,7 +396,7 @@ namespace Uno.WebAssembly.Bootstrap {
const existingInitializer = instance.onRuntimeInitialized;
- if (this._unoConfig.enable_debugging) console.log(`Waiting for dependency (${dependency}) initialization`);
+ if (this._unoConfig.uno_enable_tracing) console.log(`Waiting for dependency (${dependency}) initialization`);
instance.onRuntimeInitialized = () => {
checkDone(dependency);
@@ -649,7 +441,7 @@ namespace Uno.WebAssembly.Bootstrap {
}
private hasDebuggingEnabled() {
- return this._hasReferencedPdbs && this._currentBrowserIsChrome;
+ return this._unoConfig.uno_debugging_enabled && this._currentBrowserIsChrome;
}
private attachDebuggerHotkey() {
diff --git a/src/Uno.Wasm.Bootstrap/ts/Uno/WebAssembly/MonoRuntimeCompatibility.ts b/src/Uno.Wasm.Bootstrap/ts/Uno/WebAssembly/MonoRuntimeCompatibility.ts
deleted file mode 100644
index 3c2e37046..000000000
--- a/src/Uno.Wasm.Bootstrap/ts/Uno/WebAssembly/MonoRuntimeCompatibility.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-///
-///
-///
-///
-
-namespace Uno.WebAssembly.Bootstrap {
-
- /**
- * This block is present for backward compatibility when "MonoRuntime" was provided by mono-wasm.
- * */
- export class MonoRuntimeCompatibility {
- static load_runtime: any;
- static assembly_load: any;
- static find_class: any;
- static find_method: any;
- static invoke_method: any;
- static mono_string_get_utf8: any;
- static mono_wasm_obj_array_new: any;
- static mono_string: any;
- static mono_wasm_obj_array_set: any;
-
- public static initialize() {
- MonoRuntimeCompatibility.load_runtime = Module.cwrap("mono_wasm_load_runtime", null, ["string", "number"]);
- MonoRuntimeCompatibility.assembly_load = Module.cwrap("mono_wasm_assembly_load", "number", ["string"]);
- MonoRuntimeCompatibility.find_class = Module.cwrap("mono_wasm_assembly_find_class", "number", ["number", "string", "string"]);
- MonoRuntimeCompatibility.find_method = Module.cwrap("mono_wasm_assembly_find_method", "number", ["number", "string", "number"]);
- MonoRuntimeCompatibility.invoke_method = Module.cwrap("mono_wasm_invoke_method", "number", ["number", "number", "number"]);
- MonoRuntimeCompatibility.mono_string_get_utf8 = Module.cwrap("mono_wasm_string_get_utf8", "number", ["number"]);
- MonoRuntimeCompatibility.mono_string = Module.cwrap("mono_wasm_string_from_js", "number", ["string"]);
- MonoRuntimeCompatibility.mono_wasm_obj_array_new = Module.cwrap("mono_wasm_obj_array_new", "number", ["number"]);
- MonoRuntimeCompatibility.mono_wasm_obj_array_set = Module.cwrap("mono_wasm_obj_array_set", null, ["number", "number", "number"]);
- }
-
- public static conv_string(mono_obj: any) {
- if (mono_obj === 0)
- return null;
-
- return BINDING.conv_string(mono_obj);
- }
-
- public static call_method(method: any, this_arg: any, args: any) {
- const args_mem = Module._malloc(args.length * 4);
- const eh_throw = Module._malloc(4);
- for (let i = 0; i < args.length; ++i)
- Module.setValue(args_mem + i * 4, args[i], "i32");
- Module.setValue(eh_throw, 0, "i32");
-
- const res = MonoRuntimeCompatibility.invoke_method(method, this_arg, args_mem, eh_throw);
-
- const eh_res = Module.getValue(eh_throw, "i32");
-
- Module._free(args_mem);
- Module._free(eh_throw);
-
- if (eh_res !== 0) {
- const msg = MonoRuntimeCompatibility.conv_string(res);
- throw new Error(msg);
- }
-
- return res;
- }
- }
-}
diff --git a/src/Uno.Wasm.Bootstrap/ts/Uno/WebAssembly/UnoConfig.ts b/src/Uno.Wasm.Bootstrap/ts/Uno/WebAssembly/UnoConfig.ts
index b430198f0..786b0cb9d 100644
--- a/src/Uno.Wasm.Bootstrap/ts/Uno/WebAssembly/UnoConfig.ts
+++ b/src/Uno.Wasm.Bootstrap/ts/Uno/WebAssembly/UnoConfig.ts
@@ -13,20 +13,6 @@
assemblyFileNameObfuscationMode: string;
- mono_wasm_runtime: string;
-
- mono_wasm_runtime_size?: number;
-
- assemblies_with_size?: {
- [i: string]: number;
- };
-
- files_integrity?: {
- [i: string]: string;
- };
-
- total_assemblies_size?: number;
-
enable_pwa: boolean;
offline_files: string[];
@@ -40,8 +26,13 @@
};
generate_aot_profile?: boolean;
- enable_debugging?: boolean;
-
- assemblyObfuscationKey?: string;
+
+ uno_enable_tracing?: boolean;
+
+ uno_debugging_enabled?: boolean;
+
+ uno_runtime_options?: string[];
+
+ uno_load_all_satellite_resources?: string[];
}
}
diff --git a/src/Uno.Wasm.Embedded.App/Uno.Wasm.Embedded.App.csproj b/src/Uno.Wasm.Embedded.App/Uno.Wasm.Embedded.App.csproj
index ba233ed31..c82dd4910 100644
--- a/src/Uno.Wasm.Embedded.App/Uno.Wasm.Embedded.App.csproj
+++ b/src/Uno.Wasm.Embedded.App/Uno.Wasm.Embedded.App.csproj
@@ -1,7 +1,7 @@
-
+
- net6.0
+ net9.0
Exe
false
Uno.Wasm.Sample.Program
@@ -13,7 +13,6 @@
-
diff --git a/src/Uno.Wasm.HttpRequestMessageExtensions/Uno.Wasm.HttpRequestMessageExtensions.csproj b/src/Uno.Wasm.HttpRequestMessageExtensions/Uno.Wasm.HttpRequestMessageExtensions.csproj
index 44335e4d7..c41bdd168 100644
--- a/src/Uno.Wasm.HttpRequestMessageExtensions/Uno.Wasm.HttpRequestMessageExtensions.csproj
+++ b/src/Uno.Wasm.HttpRequestMessageExtensions/Uno.Wasm.HttpRequestMessageExtensions.csproj
@@ -5,7 +5,6 @@
1701;1702;1705;649
Uno.Wasm.HttpRequestMessageExtensions
true
- 11.0
diff --git a/src/Uno.Wasm.MetadataUpdater/Runtime.cs b/src/Uno.Wasm.MetadataUpdater/Runtime.cs
index 4ef0a2268..245943fa0 100644
--- a/src/Uno.Wasm.MetadataUpdater/Runtime.cs
+++ b/src/Uno.Wasm.MetadataUpdater/Runtime.cs
@@ -1,50 +1,23 @@
using System;
using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Runtime.InteropServices.ComTypes;
+using System.Runtime.InteropServices.JavaScript;
namespace WebAssembly
{
internal sealed class Runtime
{
- ///
- /// Mono specific internal call.
- ///
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern string InvokeJS(string str, out int exceptional_result);
-
- // Disable inlining to avoid the interpreter to evaluate an internal call that may not be available
- [MethodImpl(MethodImplOptions.NoInlining)]
- private static string MonoInvokeJS(string str, out int exceptionResult) => InvokeJS(str, out exceptionResult);
-
- // Disable inlining to avoid the interpreter to evaluate an internal call that may not be available
- [MethodImpl(MethodImplOptions.NoInlining)]
- private static string NetCoreInvokeJS(string str, out int exceptionResult)
- => Interop.Runtime.InvokeJS(str, out exceptionResult);
-
///
/// Invokes Javascript code in the hosting environment
///
internal static string InvokeJS(string str)
- {
- var r = IsNetCore
- ? NetCoreInvokeJS(str, out var exceptionResult)
- : MonoInvokeJS(str, out exceptionResult);
-
- if (exceptionResult != 0)
- {
- Console.Error.WriteLine($"Error #{exceptionResult} \"{r}\" executing javascript: \"{str}\"");
- }
- return r;
- }
-
- internal static bool IsNetCore { get; } = Type.GetType("System.Runtime.Loader.AssemblyLoadContext") != null;
+ => Interop.InvokeJS(str);
}
-}
-internal sealed class Interop
-{
- internal sealed class Runtime
+ internal static partial class Interop
{
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- public static extern string InvokeJS(string str, out int exceptional_result);
+ [JSImport("globalThis.Uno.WebAssembly.Bootstrap.Bootstrapper.invokeJS")]
+ public static partial string InvokeJS(string value);
}
}
diff --git a/src/Uno.Wasm.MixedModeRoslynSample/Uno.Wasm.MixedModeRoslynSample.csproj b/src/Uno.Wasm.MixedModeRoslynSample/Uno.Wasm.MixedModeRoslynSample.csproj
index 34b8ac7fc..db3be73d1 100644
--- a/src/Uno.Wasm.MixedModeRoslynSample/Uno.Wasm.MixedModeRoslynSample.csproj
+++ b/src/Uno.Wasm.MixedModeRoslynSample/Uno.Wasm.MixedModeRoslynSample.csproj
@@ -1,7 +1,7 @@
-
+
- net5.0
+ net9.0
Exe
false
Uno.Wasm.Sample.Program
@@ -23,8 +23,8 @@
+
-
diff --git a/src/Uno.Wasm.MixedModeSample/Uno.Wasm.MixedModeSample.csproj b/src/Uno.Wasm.MixedModeSample/Uno.Wasm.MixedModeSample.csproj
index 1251e1073..5331fcf43 100644
--- a/src/Uno.Wasm.MixedModeSample/Uno.Wasm.MixedModeSample.csproj
+++ b/src/Uno.Wasm.MixedModeSample/Uno.Wasm.MixedModeSample.csproj
@@ -1,7 +1,7 @@
-
+
- net5.0
+ net9.0
Exe
false
Uno.Wasm.Sample.Program
@@ -19,8 +19,8 @@
+
-
diff --git a/src/Uno.Wasm.Node.Sample/Uno.Wasm.Node.Sample.csproj b/src/Uno.Wasm.Node.Sample/Uno.Wasm.Node.Sample.csproj
index 84d18b8cb..7490f2c17 100644
--- a/src/Uno.Wasm.Node.Sample/Uno.Wasm.Node.Sample.csproj
+++ b/src/Uno.Wasm.Node.Sample/Uno.Wasm.Node.Sample.csproj
@@ -1,7 +1,7 @@
-
+
- net5.0
+ net9.0
Exe
false
true
@@ -14,8 +14,8 @@
+
-
@@ -43,15 +43,5 @@
true
TargetFramework
-
- false
- true
- TargetFramework
-
-
- false
- true
- TargetFramework
-
diff --git a/src/Uno.Wasm.Packager/CapturingAssemblyResolver.cs b/src/Uno.Wasm.Packager/CapturingAssemblyResolver.cs
deleted file mode 100644
index 5d45f9776..000000000
--- a/src/Uno.Wasm.Packager/CapturingAssemblyResolver.cs
+++ /dev/null
@@ -1,97 +0,0 @@
-using System;
-using System.Linq;
-using System.IO;
-using System.Collections.Generic;
-using Mono.Cecil;
-
-///
-/// An IAssemblyResolver which assumes the files list will not change, to perform faster lookups.
-///
-class CapturingAssemblyResolver : DefaultAssemblyResolver
-{
- private List> _files;
- private List _assembly_references;
-
- public CapturingAssemblyResolver(List assembly_references)
- {
- _assembly_references = assembly_references;
- }
-
- protected override AssemblyDefinition SearchDirectory(AssemblyNameReference name, IEnumerable directories, ReaderParameters parameters)
- {
- if (_files == null)
- {
- // Create a cache of the files found in search directories to avoid
- // paying the cost of File.Exists
-
- _files = new List>();
-
- // Fill all the known references first, so they get resolved
- // using compilation paths.
- var explicitAssembliesPaths = new Dictionary();
- foreach (var asmReferencePath in _assembly_references)
- {
- if (Path.GetFileNameWithoutExtension(asmReferencePath) is { } asmName)
- {
- if (!explicitAssembliesPaths.ContainsKey(asmName))
- {
- explicitAssembliesPaths.Add(asmName, asmReferencePath);
- }
- }
- }
-
- _files.Add(explicitAssembliesPaths);
-
- // Use all other search paths
- string[] extensions = new[] { ".winmd", ".dll", ".exe", ".dll" };
-
- foreach (var directory in directories.Where(Directory.Exists))
- {
- var map = new Dictionary();
-
- foreach (var file in Directory.GetFiles(directory))
- {
- if (extensions.Any(e => file.EndsWith(e, StringComparison.OrdinalIgnoreCase)))
- {
- if (Path.GetFileNameWithoutExtension(file) is { } asmName)
- {
- if (!map.ContainsKey(asmName))
- {
- map.Add(asmName, file);
- }
- }
- }
- }
-
- _files.Add(map);
- }
- }
-
- foreach (var directory in _files)
- {
- if (directory.TryGetValue(name.Name, out var filePath))
- {
- try
- {
- return GetAssembly(filePath, parameters);
- }
- catch (System.BadImageFormatException)
- {
- continue;
- }
- }
- }
-
- return null;
- }
-
- AssemblyDefinition GetAssembly(string file, ReaderParameters parameters)
- {
- if (parameters.AssemblyResolver == null)
- {
- parameters.AssemblyResolver = this;
- }
-
- return ModuleDefinition.ReadModule(file, parameters).Assembly;
- }
-}
diff --git a/src/Uno.Wasm.Packager/Mono.Cecil.dll b/src/Uno.Wasm.Packager/Mono.Cecil.dll
deleted file mode 100644
index 1a0b93a20..000000000
Binary files a/src/Uno.Wasm.Packager/Mono.Cecil.dll and /dev/null differ
diff --git a/src/Uno.Wasm.Packager/Options.cs b/src/Uno.Wasm.Packager/Options.cs
deleted file mode 100644
index 4c8f670ab..000000000
--- a/src/Uno.Wasm.Packager/Options.cs
+++ /dev/null
@@ -1,2006 +0,0 @@
-//
-// Options.cs
-//
-// Authors:
-// Jonathan Pryor ,
-// Federico Di Gregorio
-// Rolf Bjarne Kvinge
-//
-// Copyright (C) 2008 Novell (http://www.novell.com)
-// Copyright (C) 2009 Federico Di Gregorio.
-// Copyright (C) 2012 Xamarin Inc (http://www.xamarin.com)
-// Copyright (C) 2017 Microsoft Corporation (http://www.microsoft.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-// Compile With:
-// mcs -debug+ -r:System.Core Options.cs -o:Mono.Options.dll -t:library
-// mcs -debug+ -d:LINQ -r:System.Core Options.cs -o:Mono.Options.dll -t:library
-//
-// The LINQ version just changes the implementation of
-// OptionSet.Parse(IEnumerable), and confers no semantic changes.
-
-//
-// A Getopt::Long-inspired option parsing library for C#.
-//
-// Mono.Options.OptionSet is built upon a key/value table, where the
-// key is a option format string and the value is a delegate that is
-// invoked when the format string is matched.
-//
-// Option format strings:
-// Regex-like BNF Grammar:
-// name: .+
-// type: [=:]
-// sep: ( [^{}]+ | '{' .+ '}' )?
-// aliases: ( name type sep ) ( '|' name type sep )*
-//
-// Each '|'-delimited name is an alias for the associated action. If the
-// format string ends in a '=', it has a required value. If the format
-// string ends in a ':', it has an optional value. If neither '=' or ':'
-// is present, no value is supported. `=' or `:' need only be defined on one
-// alias, but if they are provided on more than one they must be consistent.
-//
-// Each alias portion may also end with a "key/value separator", which is used
-// to split option values if the option accepts > 1 value. If not specified,
-// it defaults to '=' and ':'. If specified, it can be any character except
-// '{' and '}' OR the *string* between '{' and '}'. If no separator should be
-// used (i.e. the separate values should be distinct arguments), then "{}"
-// should be used as the separator.
-//
-// Options are extracted either from the current option by looking for
-// the option name followed by an '=' or ':', or is taken from the
-// following option IFF:
-// - The current option does not contain a '=' or a ':'
-// - The current option requires a value (i.e. not a Option type of ':')
-//
-// The `name' used in the option format string does NOT include any leading
-// option indicator, such as '-', '--', or '/'. All three of these are
-// permitted/required on any named option.
-//
-// Option bundling is permitted so long as:
-// - '-' is used to start the option group
-// - all of the bundled options are a single character
-// - at most one of the bundled options accepts a value, and the value
-// provided starts from the next character to the end of the string.
-//
-// This allows specifying '-a -b -c' as '-abc', and specifying '-D name=value'
-// as '-Dname=value'.
-//
-// Option processing is disabled by specifying "--". All options after "--"
-// are returned by OptionSet.Parse() unchanged and unprocessed.
-//
-// Unprocessed options are returned from OptionSet.Parse().
-//
-// Examples:
-// int verbose = 0;
-// OptionSet p = new OptionSet ()
-// .Add ("v", v => ++verbose)
-// .Add ("name=|value=", v => Console.WriteLine (v));
-// p.Parse (new string[]{"-v", "--v", "/v", "-name=A", "/name", "B", "extra"});
-//
-// The above would parse the argument string array, and would invoke the
-// lambda expression three times, setting `verbose' to 3 when complete.
-// It would also print out "A" and "B" to standard output.
-// The returned array would contain the string "extra".
-//
-// C# 3.0 collection initializers are supported and encouraged:
-// var p = new OptionSet () {
-// { "h|?|help", v => ShowHelp () },
-// };
-//
-// System.ComponentModel.TypeConverter is also supported, allowing the use of
-// custom data types in the callback type; TypeConverter.ConvertFromString()
-// is used to convert the value option to an instance of the specified
-// type:
-//
-// var p = new OptionSet () {
-// { "foo=", (Foo f) => Console.WriteLine (f.ToString ()) },
-// };
-//
-// Random other tidbits:
-// - Boolean options (those w/o '=' or ':' in the option format string)
-// are explicitly enabled if they are followed with '+', and explicitly
-// disabled if they are followed with '-':
-// string a = null;
-// var p = new OptionSet () {
-// { "a", s => a = s },
-// };
-// p.Parse (new string[]{"-a"}); // sets v != null
-// p.Parse (new string[]{"-a+"}); // sets v != null
-// p.Parse (new string[]{"-a-"}); // sets v == null
-//
-
-//
-// Mono.Options.CommandSet allows easily having separate commands and
-// associated command options, allowing creation of a *suite* along the
-// lines of **git**(1), **svn**(1), etc.
-//
-// CommandSet allows intermixing plain text strings for `--help` output,
-// Option values -- as supported by OptionSet -- and Command instances,
-// which have a name, optional help text, and an optional OptionSet.
-//
-// var suite = new CommandSet ("suite-name") {
-// // Use strings and option values, as with OptionSet
-// "usage: suite-name COMMAND [OPTIONS]+",
-// { "v:", "verbosity", (int? v) => Verbosity = v.HasValue ? v.Value : Verbosity+1 },
-// // Commands may also be specified
-// new Command ("command-name", "command help") {
-// Options = new OptionSet {/*...*/},
-// Run = args => { /*...*/},
-// },
-// new MyCommandSubclass (),
-// };
-// return suite.Run (new string[]{...});
-//
-// CommandSet provides a `help` command, and forwards `help COMMAND`
-// to the registered Command instance by invoking Command.Invoke()
-// with `--help` as an option.
-//
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.ComponentModel;
-using System.Globalization;
-using System.IO;
-#if PCL
-using System.Reflection;
-#else
-using System.Runtime.Serialization;
-using System.Security.Permissions;
-#endif
-using System.Text;
-using System.Text.RegularExpressions;
-
-#if LINQ
-using System.Linq;
-#endif
-
-#if TEST
-using NDesk.Options;
-#endif
-
-#if PCL
-using MessageLocalizerConverter = System.Func;
-#else
-using MessageLocalizerConverter = System.Converter;
-#endif
-
-#if NDESK_OPTIONS
-namespace NDesk.Options
-#else
-namespace Mono.Options
-#endif
-{
- static class StringCoda {
-
- public static IEnumerable WrappedLines (string self, params int[] widths)
- {
- IEnumerable w = widths;
- return WrappedLines (self, w);
- }
-
- public static IEnumerable WrappedLines (string self, IEnumerable widths)
- {
- if (widths == null)
- throw new ArgumentNullException ("widths");
- return CreateWrappedLinesIterator (self, widths);
- }
-
- private static IEnumerable CreateWrappedLinesIterator (string self, IEnumerable widths)
- {
- if (string.IsNullOrEmpty (self)) {
- yield return string.Empty;
- yield break;
- }
- using (IEnumerator ewidths = widths.GetEnumerator ()) {
- bool? hw = null;
- int width = GetNextWidth (ewidths, int.MaxValue, ref hw);
- int start = 0, end;
- do {
- end = GetLineEnd (start, width, self);
- // endCorrection is 1 if the line end is '\n', and might be 2 if the line end is '\r\n'.
- int endCorrection = 1;
- if (end >= 2 && self.Substring (end - 2, 2).Equals ("\r\n"))
- endCorrection = 2;
- char c = self [end - endCorrection];
- if (char.IsWhiteSpace (c))
- end -= endCorrection;
- bool needContinuation = end != self.Length && !IsEolChar (c);
- string continuation = "";
- if (needContinuation) {
- --end;
- continuation = "-";
- }
- string line = self.Substring (start, end - start) + continuation;
- yield return line;
- start = end;
- if (char.IsWhiteSpace (c))
- start += endCorrection;
- width = GetNextWidth (ewidths, width, ref hw);
- } while (start < self.Length);
- }
- }
-
- private static int GetNextWidth (IEnumerator ewidths, int curWidth, ref bool? eValid)
- {
- if (!eValid.HasValue || (eValid.HasValue && eValid.Value)) {
- curWidth = (eValid = ewidths.MoveNext ()).Value ? ewidths.Current : curWidth;
- // '.' is any character, - is for a continuation
- const string minWidth = ".-";
- if (curWidth < minWidth.Length)
- throw new ArgumentOutOfRangeException ("widths",
- string.Format ("Element must be >= {0}, was {1}.", minWidth.Length, curWidth));
- return curWidth;
- }
- // no more elements, use the last element.
- return curWidth;
- }
-
- private static bool IsEolChar (char c)
- {
- return !char.IsLetterOrDigit (c);
- }
-
- private static int GetLineEnd (int start, int length, string description)
- {
- int end = System.Math.Min (start + length, description.Length);
- int sep = -1;
- for (int i = start; i < end; ++i) {
- if (i + 2 <= description.Length && description.Substring (i, 2).Equals ("\r\n"))
- return i+2;
- if (description [i] == '\n')
- return i+1;
- if (IsEolChar (description [i]))
- sep = i+1;
- }
- if (sep == -1 || end == description.Length)
- return end;
- return sep;
- }
- }
-
- public class OptionValueCollection : IList, IList {
-
- List values = new List ();
- OptionContext c;
-
- internal OptionValueCollection (OptionContext c)
- {
- this.c = c;
- }
-
- #region ICollection
- void ICollection.CopyTo (Array array, int index) {(values as ICollection).CopyTo (array, index);}
- bool ICollection.IsSynchronized {get {return (values as ICollection).IsSynchronized;}}
- object ICollection.SyncRoot {get {return (values as ICollection).SyncRoot;}}
- #endregion
-
- #region ICollection
- public void Add (string item) {values.Add (item);}
- public void Clear () {values.Clear ();}
- public bool Contains (string item) {return values.Contains (item);}
- public void CopyTo (string[] array, int arrayIndex) {values.CopyTo (array, arrayIndex);}
- public bool Remove (string item) {return values.Remove (item);}
- public int Count {get {return values.Count;}}
- public bool IsReadOnly {get {return false;}}
- #endregion
-
- #region IEnumerable
- IEnumerator IEnumerable.GetEnumerator () {return values.GetEnumerator ();}
- #endregion
-
- #region IEnumerable
- public IEnumerator GetEnumerator () {return values.GetEnumerator ();}
- #endregion
-
- #region IList
- int IList.Add (object value) {return (values as IList).Add (value);}
- bool IList.Contains (object value) {return (values as IList).Contains (value);}
- int IList.IndexOf (object value) {return (values as IList).IndexOf (value);}
- void IList.Insert (int index, object value) {(values as IList).Insert (index, value);}
- void IList.Remove (object value) {(values as IList).Remove (value);}
- void IList.RemoveAt (int index) {(values as IList).RemoveAt (index);}
- bool IList.IsFixedSize {get {return false;}}
- object IList.this [int index] {get {return this [index];} set {(values as IList)[index] = value;}}
- #endregion
-
- #region IList
- public int IndexOf (string item) {return values.IndexOf (item);}
- public void Insert (int index, string item) {values.Insert (index, item);}
- public void RemoveAt (int index) {values.RemoveAt (index);}
-
- private void AssertValid (int index)
- {
- if (c.Option == null)
- throw new InvalidOperationException ("OptionContext.Option is null.");
- if (index >= c.Option.MaxValueCount)
- throw new ArgumentOutOfRangeException ("index");
- if (c.Option.OptionValueType == OptionValueType.Required &&
- index >= values.Count)
- throw new OptionException (string.Format (
- c.OptionSet.MessageLocalizer ("Missing required value for option '{0}'."), c.OptionName),
- c.OptionName);
- }
-
- public string this [int index] {
- get {
- AssertValid (index);
- return index >= values.Count ? null : values [index];
- }
- set {
- values [index] = value;
- }
- }
- #endregion
-
- public List ToList ()
- {
- return new List (values);
- }
-
- public string[] ToArray ()
- {
- return values.ToArray ();
- }
-
- public override string ToString ()
- {
- return string.Join (", ", values.ToArray ());
- }
- }
-
- public class OptionContext {
- private Option option;
- private string name;
- private int index;
- private OptionSet set;
- private OptionValueCollection c;
-
- public OptionContext (OptionSet set)
- {
- this.set = set;
- this.c = new OptionValueCollection (this);
- }
-
- public Option Option {
- get {return option;}
- set {option = value;}
- }
-
- public string OptionName {
- get {return name;}
- set {name = value;}
- }
-
- public int OptionIndex {
- get {return index;}
- set {index = value;}
- }
-
- public OptionSet OptionSet {
- get {return set;}
- }
-
- public OptionValueCollection OptionValues {
- get {return c;}
- }
- }
-
- public enum OptionValueType {
- None,
- Optional,
- Required,
- }
-
- public abstract class Option {
- string prototype, description;
- string[] names;
- OptionValueType type;
- int count;
- string[] separators;
- bool hidden;
-
- protected Option (string prototype, string description)
- : this (prototype, description, 1, false)
- {
- }
-
- protected Option (string prototype, string description, int maxValueCount)
- : this (prototype, description, maxValueCount, false)
- {
- }
-
- protected Option (string prototype, string description, int maxValueCount, bool hidden)
- {
- if (prototype == null)
- throw new ArgumentNullException ("prototype");
- if (prototype.Length == 0)
- throw new ArgumentException ("Cannot be the empty string.", "prototype");
- if (maxValueCount < 0)
- throw new ArgumentOutOfRangeException ("maxValueCount");
-
- this.prototype = prototype;
- this.description = description;
- this.count = maxValueCount;
- this.names = (this is OptionSet.Category)
- // append GetHashCode() so that "duplicate" categories have distinct
- // names, e.g. adding multiple "" categories should be valid.
- ? new[]{prototype + this.GetHashCode ()}
- : prototype.Split ('|');
-
- if (this is OptionSet.Category || this is CommandOption)
- return;
-
- this.type = ParsePrototype ();
- this.hidden = hidden;
-
- if (this.count == 0 && type != OptionValueType.None)
- throw new ArgumentException (
- "Cannot provide maxValueCount of 0 for OptionValueType.Required or " +
- "OptionValueType.Optional.",
- "maxValueCount");
- if (this.type == OptionValueType.None && maxValueCount > 1)
- throw new ArgumentException (
- string.Format ("Cannot provide maxValueCount of {0} for OptionValueType.None.", maxValueCount),
- "maxValueCount");
- if (Array.IndexOf (names, "<>") >= 0 &&
- ((names.Length == 1 && this.type != OptionValueType.None) ||
- (names.Length > 1 && this.MaxValueCount > 1)))
- throw new ArgumentException (
- "The default option handler '<>' cannot require values.",
- "prototype");
- }
-
- public string Prototype {get {return prototype;}}
- public string Description {get {return description;}}
- public OptionValueType OptionValueType {get {return type;}}
- public int MaxValueCount {get {return count;}}
- public bool Hidden {get {return hidden;}}
-
- public string[] GetNames ()
- {
- return (string[]) names.Clone ();
- }
-
- public string[] GetValueSeparators ()
- {
- if (separators == null)
- return new string [0];
- return (string[]) separators.Clone ();
- }
-
- protected static T Parse (string value, OptionContext c)
- {
- Type tt = typeof (T);
-#if PCL
- TypeInfo ti = tt.GetTypeInfo ();
-#else
- Type ti = tt;
-#endif
- bool nullable =
- ti.IsValueType &&
- ti.IsGenericType &&
- !ti.IsGenericTypeDefinition &&
- ti.GetGenericTypeDefinition () == typeof (Nullable<>);
-#if PCL
- Type targetType = nullable ? tt.GenericTypeArguments [0] : tt;
-#else
- Type targetType = nullable ? tt.GetGenericArguments () [0] : tt;
-#endif
- T t = default (T);
- try {
- if (value != null) {
-#if PCL
- if (targetType.GetTypeInfo ().IsEnum)
- t = (T) Enum.Parse (targetType, value, true);
- else
- t = (T) Convert.ChangeType (value, targetType);
-#else
- TypeConverter conv = TypeDescriptor.GetConverter (targetType);
- t = (T) conv.ConvertFromString (value);
-#endif
- }
- }
- catch (Exception e) {
- throw new OptionException (
- string.Format (
- c.OptionSet.MessageLocalizer ("Could not convert string `{0}' to type {1} for option `{2}'."),
- value, targetType.Name, c.OptionName),
- c.OptionName, e);
- }
- return t;
- }
-
- internal string[] Names {get {return names;}}
- internal string[] ValueSeparators {get {return separators;}}
-
- static readonly char[] NameTerminator = new char[]{'=', ':'};
-
- private OptionValueType ParsePrototype ()
- {
- char type = '\0';
- List seps = new List ();
- for (int i = 0; i < names.Length; ++i) {
- string name = names [i];
- if (name.Length == 0)
- throw new ArgumentException ("Empty option names are not supported.", "prototype");
-
- int end = name.IndexOfAny (NameTerminator);
- if (end == -1)
- continue;
- names [i] = name.Substring (0, end);
- if (type == '\0' || type == name [end])
- type = name [end];
- else
- throw new ArgumentException (
- string.Format ("Conflicting option types: '{0}' vs. '{1}'.", type, name [end]),
- "prototype");
- AddSeparators (name, end, seps);
- }
-
- if (type == '\0')
- return OptionValueType.None;
-
- if (count <= 1 && seps.Count != 0)
- throw new ArgumentException (
- string.Format ("Cannot provide key/value separators for Options taking {0} value(s).", count),
- "prototype");
- if (count > 1) {
- if (seps.Count == 0)
- this.separators = new string[]{":", "="};
- else if (seps.Count == 1 && seps [0].Length == 0)
- this.separators = null;
- else
- this.separators = seps.ToArray ();
- }
-
- return type == '=' ? OptionValueType.Required : OptionValueType.Optional;
- }
-
- private static void AddSeparators (string name, int end, ICollection seps)
- {
- int start = -1;
- for (int i = end+1; i < name.Length; ++i) {
- switch (name [i]) {
- case '{':
- if (start != -1)
- throw new ArgumentException (
- string.Format ("Ill-formed name/value separator found in \"{0}\".", name),
- "prototype");
- start = i+1;
- break;
- case '}':
- if (start == -1)
- throw new ArgumentException (
- string.Format ("Ill-formed name/value separator found in \"{0}\".", name),
- "prototype");
- seps.Add (name.Substring (start, i-start));
- start = -1;
- break;
- default:
- if (start == -1)
- seps.Add (name [i].ToString ());
- break;
- }
- }
- if (start != -1)
- throw new ArgumentException (
- string.Format ("Ill-formed name/value separator found in \"{0}\".", name),
- "prototype");
- }
-
- public void Invoke (OptionContext c)
- {
- OnParseComplete (c);
- c.OptionName = null;
- c.Option = null;
- c.OptionValues.Clear ();
- }
-
- protected abstract void OnParseComplete (OptionContext c);
-
- internal void InvokeOnParseComplete (OptionContext c)
- {
- OnParseComplete (c);
- }
-
- public override string ToString ()
- {
- return Prototype;
- }
- }
-
- public abstract class ArgumentSource {
-
- protected ArgumentSource ()
- {
- }
-
- public abstract string[] GetNames ();
- public abstract string Description { get; }
- public abstract bool GetArguments (string value, out IEnumerable replacement);
-
-#if !PCL || NETSTANDARD1_3
- public static IEnumerable GetArgumentsFromFile (string file)
- {
- return GetArguments (File.OpenText (file), true);
- }
-#endif
-
- public static IEnumerable GetArguments (TextReader reader)
- {
- return GetArguments (reader, false);
- }
-
- // Cribbed from mcs/driver.cs:LoadArgs(string)
- static IEnumerable GetArguments (TextReader reader, bool close)
- {
- try {
- StringBuilder arg = new StringBuilder ();
-
- string line;
- while ((line = reader.ReadLine ()) != null) {
- int t = line.Length;
-
- for (int i = 0; i < t; i++) {
- char c = line [i];
-
- if (c == '"' || c == '\'') {
- char end = c;
-
- for (i++; i < t; i++){
- c = line [i];
-
- if (c == end)
- break;
- arg.Append (c);
- }
- } else if (c == ' ') {
- if (arg.Length > 0) {
- yield return arg.ToString ();
- arg.Length = 0;
- }
- } else
- arg.Append (c);
- }
- if (arg.Length > 0) {
- yield return arg.ToString ();
- arg.Length = 0;
- }
- }
- }
- finally {
- if (close)
- reader.Dispose ();
- }
- }
- }
-
-#if !PCL || NETSTANDARD1_3
- public class ResponseFileSource : ArgumentSource {
-
- public override string[] GetNames ()
- {
- return new string[]{"@file"};
- }
-
- public override string Description {
- get {return "Read response file for more options.";}
- }
-
- public override bool GetArguments (string value, out IEnumerable replacement)
- {
- if (string.IsNullOrEmpty (value) || !value.StartsWith ("@")) {
- replacement = null;
- return false;
- }
- replacement = ArgumentSource.GetArgumentsFromFile (value.Substring (1));
- return true;
- }
- }
-#endif
-
-#if !PCL
- [Serializable]
-#endif
- public class OptionException : Exception {
- private string option;
-
- public OptionException ()
- {
- }
-
- public OptionException (string message, string optionName)
- : base (message)
- {
- this.option = optionName;
- }
-
- public OptionException (string message, string optionName, Exception innerException)
- : base (message, innerException)
- {
- this.option = optionName;
- }
-
-#if !PCL
- protected OptionException (SerializationInfo info, StreamingContext context)
- : base (info, context)
- {
- this.option = info.GetString ("OptionName");
- }
-#endif
-
- public string OptionName {
- get {return this.option;}
- }
-
-#if !PCL
-#pragma warning disable SYSLIB0003 // Type or member is obsolete
- [SecurityPermission (SecurityAction.LinkDemand, SerializationFormatter = true)]
-#pragma warning restore SYSLIB0003 // Type or member is obsolete
- public override void GetObjectData (SerializationInfo info, StreamingContext context)
- {
- base.GetObjectData (info, context);
- info.AddValue ("OptionName", option);
- }
-#endif
- }
-
- public delegate void OptionAction (TKey key, TValue value);
-
- public class OptionSet : KeyedCollection
- {
- public OptionSet ()
- : this (null)
- {
- }
-
- public OptionSet (MessageLocalizerConverter localizer)
- {
- this.roSources = new ReadOnlyCollection (sources);
- this.localizer = localizer;
- if (this.localizer == null) {
- this.localizer = delegate (string f) {
- return f;
- };
- }
- }
-
- MessageLocalizerConverter localizer;
-
- public MessageLocalizerConverter MessageLocalizer {
- get {return localizer;}
- internal set {localizer = value;}
- }
-
- List sources = new List ();
- ReadOnlyCollection roSources;
-
- public ReadOnlyCollection ArgumentSources {
- get {return roSources;}
- }
-
-
- protected override string GetKeyForItem (Option item)
- {
- if (item == null)
- throw new ArgumentNullException ("option");
- if (item.Names != null && item.Names.Length > 0)
- return item.Names [0];
- // This should never happen, as it's invalid for Option to be
- // constructed w/o any names.
- throw new InvalidOperationException ("Option has no names!");
- }
-
- [Obsolete ("Use KeyedCollection.this[string]")]
- protected Option GetOptionForName (string option)
- {
- if (option == null)
- throw new ArgumentNullException ("option");
- try {
- return base [option];
- }
- catch (KeyNotFoundException) {
- return null;
- }
- }
-
- protected override void InsertItem (int index, Option item)
- {
- base.InsertItem (index, item);
- AddImpl (item);
- }
-
- protected override void RemoveItem (int index)
- {
- Option p = Items [index];
- base.RemoveItem (index);
- // KeyedCollection.RemoveItem() handles the 0th item
- for (int i = 1; i < p.Names.Length; ++i) {
- Dictionary.Remove (p.Names [i]);
- }
- }
-
- protected override void SetItem (int index, Option item)
- {
- base.SetItem (index, item);
- AddImpl (item);
- }
-
- private void AddImpl (Option option)
- {
- if (option == null)
- throw new ArgumentNullException ("option");
- List added = new List (option.Names.Length);
- try {
- // KeyedCollection.InsertItem/SetItem handle the 0th name.
- for (int i = 1; i < option.Names.Length; ++i) {
- Dictionary.Add (option.Names [i], option);
- added.Add (option.Names [i]);
- }
- }
- catch (Exception) {
- foreach (string name in added)
- Dictionary.Remove (name);
- throw;
- }
- }
-
- public OptionSet Add (string header)
- {
- if (header == null)
- throw new ArgumentNullException ("header");
- Add (new Category (header));
- return this;
- }
-
- internal sealed class Category : Option {
-
- // Prototype starts with '=' because this is an invalid prototype
- // (see Option.ParsePrototype(), and thus it'll prevent Category
- // instances from being accidentally used as normal options.
- public Category (string description)
- : base ("=:Category:= " + description, description)
- {
- }
-
- protected override void OnParseComplete (OptionContext c)
- {
- throw new NotSupportedException ("Category.OnParseComplete should not be invoked.");
- }
- }
-
-
- public new OptionSet Add (Option option)
- {
- base.Add (option);
- return this;
- }
-
- sealed class ActionOption : Option {
- Action action;
-
- public ActionOption (string prototype, string description, int count, Action action)
- : this (prototype, description, count, action, false)
- {
- }
-
- public ActionOption (string prototype, string description, int count, Action action, bool hidden)
- : base (prototype, description, count, hidden)
- {
- if (action == null)
- throw new ArgumentNullException ("action");
- this.action = action;
- }
-
- protected override void OnParseComplete (OptionContext c)
- {
- action (c.OptionValues);
- }
- }
-
- public OptionSet Add (string prototype, Action action)
- {
- return Add (prototype, null, action);
- }
-
- public OptionSet Add (string prototype, string description, Action action)
- {
- return Add (prototype, description, action, false);
- }
-
- public OptionSet Add (string prototype, string description, Action action, bool hidden)
- {
- if (action == null)
- throw new ArgumentNullException ("action");
- Option p = new ActionOption (prototype, description, 1,
- delegate (OptionValueCollection v) { action (v [0]); }, hidden);
- base.Add (p);
- return this;
- }
-
- public OptionSet Add (string prototype, OptionAction action)
- {
- return Add (prototype, null, action);
- }
-
- public OptionSet Add (string prototype, string description, OptionAction action)
- {
- return Add (prototype, description, action, false);
- }
-
- public OptionSet Add (string prototype, string description, OptionAction action, bool hidden) {
- if (action == null)
- throw new ArgumentNullException ("action");
- Option p = new ActionOption (prototype, description, 2,
- delegate (OptionValueCollection v) {action (v [0], v [1]);}, hidden);
- base.Add (p);
- return this;
- }
-
- sealed class ActionOption : Option {
- Action action;
-
- public ActionOption (string prototype, string description, Action action)
- : base (prototype, description, 1)
- {
- if (action == null)
- throw new ArgumentNullException ("action");
- this.action = action;
- }
-
- protected override void OnParseComplete (OptionContext c)
- {
- action (Parse (c.OptionValues [0], c));
- }
- }
-
- sealed class ActionOption : Option {
- OptionAction action;
-
- public ActionOption (string prototype, string description, OptionAction action)
- : base (prototype, description, 2)
- {
- if (action == null)
- throw new ArgumentNullException ("action");
- this.action = action;
- }
-
- protected override void OnParseComplete (OptionContext c)
- {
- action (
- Parse (c.OptionValues [0], c),
- Parse (c.OptionValues [1], c));
- }
- }
-
- public OptionSet Add (string prototype, Action action)
- {
- return Add (prototype, null, action);
- }
-
- public OptionSet Add (string prototype, string description, Action action)
- {
- return Add (new ActionOption (prototype, description, action));
- }
-
- public OptionSet Add (string prototype, OptionAction action)
- {
- return Add (prototype, null, action);
- }
-
- public OptionSet Add (string prototype, string description, OptionAction action)
- {
- return Add (new ActionOption (prototype, description, action));
- }
-
- public OptionSet Add (ArgumentSource source)
- {
- if (source == null)
- throw new ArgumentNullException ("source");
- sources.Add (source);
- return this;
- }
-
- protected virtual OptionContext CreateOptionContext ()
- {
- return new OptionContext (this);
- }
-
- public List Parse (IEnumerable arguments)
- {
- if (arguments == null)
- throw new ArgumentNullException ("arguments");
- OptionContext c = CreateOptionContext ();
- c.OptionIndex = -1;
- bool process = true;
- List unprocessed = new List ();
- Option def = Contains ("<>") ? this ["<>"] : null;
- ArgumentEnumerator ae = new ArgumentEnumerator (arguments);
- foreach (string argument in ae) {
- ++c.OptionIndex;
- if (argument == "--") {
- process = false;
- continue;
- }
- if (!process) {
- Unprocessed (unprocessed, def, c, argument);
- continue;
- }
- if (AddSource (ae, argument))
- continue;
- if (!Parse (argument, c))
- Unprocessed (unprocessed, def, c, argument);
- }
- if (c.Option != null)
- c.Option.Invoke (c);
- return unprocessed;
- }
-
- class ArgumentEnumerator : IEnumerable {
- List> sources = new List> ();
-
- public ArgumentEnumerator (IEnumerable arguments)
- {
- sources.Add (arguments.GetEnumerator ());
- }
-
- public void Add (IEnumerable arguments)
- {
- sources.Add (arguments.GetEnumerator ());
- }
-
- public IEnumerator GetEnumerator ()
- {
- do {
- IEnumerator c = sources [sources.Count-1];
- if (c.MoveNext ())
- yield return c.Current;
- else {
- c.Dispose ();
- sources.RemoveAt (sources.Count-1);
- }
- } while (sources.Count > 0);
- }
-
- IEnumerator IEnumerable.GetEnumerator ()
- {
- return GetEnumerator ();
- }
- }
-
- bool AddSource (ArgumentEnumerator ae, string argument)
- {
- foreach (ArgumentSource source in sources) {
- IEnumerable replacement;
- if (!source.GetArguments (argument, out replacement))
- continue;
- ae.Add (replacement);
- return true;
- }
- return false;
- }
-
- private static bool Unprocessed (ICollection extra, Option def, OptionContext c, string argument)
- {
- if (def == null) {
- extra.Add (argument);
- return false;
- }
- c.OptionValues.Add (argument);
- c.Option = def;
- c.Option.Invoke (c);
- return false;
- }
-
- private readonly Regex ValueOption = new Regex (
- @"^(?--|-|/)(?[^:=]+)((?[:=])(?.*))?$");
-
- protected bool GetOptionParts (string argument, out string flag, out string name, out string sep, out string value)
- {
- if (argument == null)
- throw new ArgumentNullException ("argument");
-
- flag = name = sep = value = null;
- Match m = ValueOption.Match (argument);
- if (!m.Success) {
- return false;
- }
- flag = m.Groups ["flag"].Value;
- name = m.Groups ["name"].Value;
- if (m.Groups ["sep"].Success && m.Groups ["value"].Success) {
- sep = m.Groups ["sep"].Value;
- value = m.Groups ["value"].Value;
- }
- return true;
- }
-
- protected virtual bool Parse (string argument, OptionContext c)
- {
- if (c.Option != null) {
- ParseValue (argument, c);
- return true;
- }
-
- string f, n, s, v;
- if (!GetOptionParts (argument, out f, out n, out s, out v))
- return false;
-
- Option p;
- if (Contains (n)) {
- p = this [n];
- c.OptionName = f + n;
- c.Option = p;
- switch (p.OptionValueType) {
- case OptionValueType.None:
- c.OptionValues.Add (n);
- c.Option.Invoke (c);
- break;
- case OptionValueType.Optional:
- case OptionValueType.Required:
- ParseValue (v, c);
- break;
- }
- return true;
- }
- // no match; is it a bool option?
- if (ParseBool (argument, n, c))
- return true;
- // is it a bundled option?
- if (ParseBundledValue (f, string.Concat (n + s + v), c))
- return true;
-
- return false;
- }
-
- private void ParseValue (string option, OptionContext c)
- {
- if (option != null)
- foreach (string o in c.Option.ValueSeparators != null
- ? option.Split (c.Option.ValueSeparators, c.Option.MaxValueCount - c.OptionValues.Count, StringSplitOptions.None)
- : new string[]{option}) {
- c.OptionValues.Add (o);
- }
- if (c.OptionValues.Count == c.Option.MaxValueCount ||
- c.Option.OptionValueType == OptionValueType.Optional)
- c.Option.Invoke (c);
- else if (c.OptionValues.Count > c.Option.MaxValueCount) {
- throw new OptionException (localizer (string.Format (
- "Error: Found {0} option values when expecting {1}.",
- c.OptionValues.Count, c.Option.MaxValueCount)),
- c.OptionName);
- }
- }
-
- private bool ParseBool (string option, string n, OptionContext c)
- {
- Option p;
- string rn;
- if (n.Length >= 1 && (n [n.Length-1] == '+' || n [n.Length-1] == '-') &&
- Contains ((rn = n.Substring (0, n.Length-1)))) {
- p = this [rn];
- string v = n [n.Length-1] == '+' ? option : null;
- c.OptionName = option;
- c.Option = p;
- c.OptionValues.Add (v);
- p.Invoke (c);
- return true;
- }
- return false;
- }
-
- private bool ParseBundledValue (string f, string n, OptionContext c)
- {
- if (f != "-")
- return false;
- for (int i = 0; i < n.Length; ++i) {
- Option p;
- string opt = f + n [i].ToString ();
- string rn = n [i].ToString ();
- if (!Contains (rn)) {
- if (i == 0)
- return false;
- throw new OptionException (string.Format (localizer (
- "Cannot use unregistered option '{0}' in bundle '{1}'."), rn, f + n), null);
- }
- p = this [rn];
- switch (p.OptionValueType) {
- case OptionValueType.None:
- Invoke (c, opt, n, p);
- break;
- case OptionValueType.Optional:
- case OptionValueType.Required: {
- string v = n.Substring (i+1);
- c.Option = p;
- c.OptionName = opt;
- ParseValue (v.Length != 0 ? v : null, c);
- return true;
- }
- default:
- throw new InvalidOperationException ("Unknown OptionValueType: " + p.OptionValueType);
- }
- }
- return true;
- }
-
- private static void Invoke (OptionContext c, string name, string value, Option option)
- {
- c.OptionName = name;
- c.Option = option;
- c.OptionValues.Add (value);
- option.Invoke (c);
- }
-
- private const int OptionWidth = 29;
- private const int Description_FirstWidth = 80 - OptionWidth;
- private const int Description_RemWidth = 80 - OptionWidth - 2;
-
- static readonly string CommandHelpIndentStart = new string (' ', OptionWidth);
- static readonly string CommandHelpIndentRemaining = new string (' ', OptionWidth + 2);
-
- public void WriteOptionDescriptions (TextWriter o)
- {
- foreach (Option p in this) {
- int written = 0;
-
- if (p.Hidden)
- continue;
-
- Category c = p as Category;
- if (c != null) {
- WriteDescription (o, p.Description, "", 80, 80);
- continue;
- }
- CommandOption co = p as CommandOption;
- if (co != null) {
- WriteCommandDescription (o, co.Command, co.CommandName);
- continue;
- }
-
- if (!WriteOptionPrototype (o, p, ref written))
- continue;
-
- if (written < OptionWidth)
- o.Write (new string (' ', OptionWidth - written));
- else {
- o.WriteLine ();
- o.Write (new string (' ', OptionWidth));
- }
-
- WriteDescription (o, p.Description, new string (' ', OptionWidth+2),
- Description_FirstWidth, Description_RemWidth);
- }
-
- foreach (ArgumentSource s in sources) {
- string[] names = s.GetNames ();
- if (names == null || names.Length == 0)
- continue;
-
- int written = 0;
-
- Write (o, ref written, " ");
- Write (o, ref written, names [0]);
- for (int i = 1; i < names.Length; ++i) {
- Write (o, ref written, ", ");
- Write (o, ref written, names [i]);
- }
-
- if (written < OptionWidth)
- o.Write (new string (' ', OptionWidth - written));
- else {
- o.WriteLine ();
- o.Write (new string (' ', OptionWidth));
- }
-
- WriteDescription (o, s.Description, new string (' ', OptionWidth+2),
- Description_FirstWidth, Description_RemWidth);
- }
- }
-
- internal void WriteCommandDescription (TextWriter o, Command c, string commandName)
- {
- var name = new string (' ', 8) + (commandName ?? c.Name);
- if (name.Length < OptionWidth - 1) {
- WriteDescription (o, name + new string (' ', OptionWidth - name.Length) + c.Help, CommandHelpIndentRemaining, 80, Description_RemWidth);
- } else {
- WriteDescription (o, name, "", 80, 80);
- WriteDescription (o, CommandHelpIndentStart + c.Help, CommandHelpIndentRemaining, 80, Description_RemWidth);
- }
- }
-
- void WriteDescription (TextWriter o, string value, string prefix, int firstWidth, int remWidth)
- {
- bool indent = false;
- foreach (string line in GetLines (localizer (GetDescription (value)), firstWidth, remWidth)) {
- if (indent)
- o.Write (prefix);
- o.WriteLine (line);
- indent = true;
- }
- }
-
- bool WriteOptionPrototype (TextWriter o, Option p, ref int written)
- {
- string[] names = p.Names;
-
- int i = GetNextOptionIndex (names, 0);
- if (i == names.Length)
- return false;
-
- if (names [i].Length == 1) {
- Write (o, ref written, " -");
- Write (o, ref written, names [0]);
- }
- else {
- Write (o, ref written, " --");
- Write (o, ref written, names [0]);
- }
-
- for ( i = GetNextOptionIndex (names, i+1);
- i < names.Length; i = GetNextOptionIndex (names, i+1)) {
- Write (o, ref written, ", ");
- Write (o, ref written, names [i].Length == 1 ? "-" : "--");
- Write (o, ref written, names [i]);
- }
-
- if (p.OptionValueType == OptionValueType.Optional ||
- p.OptionValueType == OptionValueType.Required) {
- if (p.OptionValueType == OptionValueType.Optional) {
- Write (o, ref written, localizer ("["));
- }
- Write (o, ref written, localizer ("=" + GetArgumentName (0, p.MaxValueCount, p.Description)));
- string sep = p.ValueSeparators != null && p.ValueSeparators.Length > 0
- ? p.ValueSeparators [0]
- : " ";
- for (int c = 1; c < p.MaxValueCount; ++c) {
- Write (o, ref written, localizer (sep + GetArgumentName (c, p.MaxValueCount, p.Description)));
- }
- if (p.OptionValueType == OptionValueType.Optional) {
- Write (o, ref written, localizer ("]"));
- }
- }
- return true;
- }
-
- static int GetNextOptionIndex (string[] names, int i)
- {
- while (i < names.Length && names [i] == "<>") {
- ++i;
- }
- return i;
- }
-
- static void Write (TextWriter o, ref int n, string s)
- {
- n += s.Length;
- o.Write (s);
- }
-
- static string GetArgumentName (int index, int maxIndex, string description)
- {
- var matches = Regex.Matches (description ?? "", @"(?<=(? 1
- if (maxIndex > 1 && parts.Length == 2 &&
- parts[0] == index.ToString (CultureInfo.InvariantCulture)) {
- argName = parts[1];
- }
- }
-
- if (string.IsNullOrEmpty (argName)) {
- argName = maxIndex == 1 ? "VALUE" : "VALUE" + (index + 1);
- }
- return argName;
- }
-
- private static string GetDescription (string description)
- {
- if (description == null)
- return string.Empty;
- StringBuilder sb = new StringBuilder (description.Length);
- int start = -1;
- for (int i = 0; i < description.Length; ++i) {
- switch (description [i]) {
- case '{':
- if (i == start) {
- sb.Append ('{');
- start = -1;
- }
- else if (start < 0)
- start = i + 1;
- break;
- case '}':
- if (start < 0) {
- if ((i+1) == description.Length || description [i+1] != '}')
- throw new InvalidOperationException ("Invalid option description: " + description);
- ++i;
- sb.Append ("}");
- }
- else {
- sb.Append (description.Substring (start, i - start));
- start = -1;
- }
- break;
- case ':':
- if (start < 0)
- goto default;
- start = i + 1;
- break;
- default:
- if (start < 0)
- sb.Append (description [i]);
- break;
- }
- }
- return sb.ToString ();
- }
-
- private static IEnumerable GetLines (string description, int firstWidth, int remWidth)
- {
- return StringCoda.WrappedLines (description, firstWidth, remWidth);
- }
- }
-
- public class Command
- {
- public string Name {get;}
- public string Help {get;}
-
- public OptionSet Options {get; set;}
- public Action> Run {get; set;}
-
- public CommandSet CommandSet {get; internal set;}
-
- public Command (string name, string help = null)
- {
- if (string.IsNullOrEmpty (name))
- throw new ArgumentNullException (nameof (name));
-
- Name = NormalizeCommandName (name);
- Help = help;
- }
-
- static string NormalizeCommandName (string name)
- {
- var value = new StringBuilder (name.Length);
- var space = false;
- for (int i = 0; i < name.Length; ++i) {
- if (!char.IsWhiteSpace (name, i)) {
- space = false;
- value.Append (name [i]);
- }
- else if (!space) {
- space = true;
- value.Append (' ');
- }
- }
- return value.ToString ();
- }
-
- public virtual int Invoke (IEnumerable arguments)
- {
- var rest = Options?.Parse (arguments) ?? arguments;
- Run?.Invoke (rest);
- return 0;
- }
- }
-
- class CommandOption : Option
- {
- public Command Command {get;}
- public string CommandName {get;}
-
- // Prototype starts with '=' because this is an invalid prototype
- // (see Option.ParsePrototype(), and thus it'll prevent Category
- // instances from being accidentally used as normal options.
- public CommandOption (Command command, string commandName = null, bool hidden = false)
- : base ("=:Command:= " + (commandName ?? command?.Name), (commandName ?? command?.Name), maxValueCount: 0, hidden: hidden)
- {
- if (command == null)
- throw new ArgumentNullException (nameof (command));
- Command = command;
- CommandName = commandName ?? command.Name;
- }
-
- protected override void OnParseComplete (OptionContext c)
- {
- throw new NotSupportedException ("CommandOption.OnParseComplete should not be invoked.");
- }
- }
-
- class HelpOption : Option
- {
- Option option;
- CommandSet commands;
-
- public HelpOption (CommandSet commands, Option d)
- : base (d.Prototype, d.Description, d.MaxValueCount, d.Hidden)
- {
- this.commands = commands;
- this.option = d;
- }
-
- protected override void OnParseComplete (OptionContext c)
- {
- commands.showHelp = true;
-
- option?.InvokeOnParseComplete (c);
- }
- }
-
- class CommandOptionSet : OptionSet
- {
- CommandSet commands;
-
- public CommandOptionSet (CommandSet commands, MessageLocalizerConverter localizer)
- : base (localizer)
- {
- this.commands = commands;
- }
-
- protected override void SetItem (int index, Option item)
- {
- if (ShouldWrapOption (item)) {
- base.SetItem (index, new HelpOption (commands, item));
- return;
- }
- base.SetItem (index, item);
- }
-
- bool ShouldWrapOption (Option item)
- {
- if (item == null)
- return false;
- var help = item as HelpOption;
- if (help != null)
- return false;
- foreach (var n in item.Names) {
- if (n == "help")
- return true;
- }
- return false;
- }
-
- protected override void InsertItem (int index, Option item)
- {
- if (ShouldWrapOption (item)) {
- base.InsertItem (index, new HelpOption (commands, item));
- return;
- }
- base.InsertItem (index, item);
- }
- }
-
- public class CommandSet : KeyedCollection
- {
- readonly string suite;
-
- OptionSet options;
- TextWriter outWriter;
- TextWriter errorWriter;
-
- internal List NestedCommandSets;
-
- internal HelpCommand help;
-
- internal bool showHelp;
-
- internal OptionSet Options => options;
-
-#if !PCL || NETSTANDARD1_3
- public CommandSet(string suite, MessageLocalizerConverter localizer = null)
- : this(suite, Console.Out, Console.Error, localizer)
- {
- }
-#endif
-
- public CommandSet (string suite, TextWriter output, TextWriter error, MessageLocalizerConverter localizer = null)
- {
- if (suite == null)
- throw new ArgumentNullException (nameof (suite));
- if (output == null)
- throw new ArgumentNullException (nameof (output));
- if (error == null)
- throw new ArgumentNullException (nameof (error));
-
- this.suite = suite;
- options = new CommandOptionSet (this, localizer);
- outWriter = output;
- errorWriter = error;
- }
-
- public string Suite => suite;
- public TextWriter Out => outWriter;
- public TextWriter Error => errorWriter;
- public MessageLocalizerConverter MessageLocalizer => options.MessageLocalizer;
-
- protected override string GetKeyForItem (Command item)
- {
- return item?.Name;
- }
-
- public new CommandSet Add (Command value)
- {
- if (value == null)
- throw new ArgumentNullException (nameof (value));
- AddCommand (value);
- options.Add (new CommandOption (value));
- return this;
- }
-
- void AddCommand (Command value)
- {
- if (value.CommandSet != null && value.CommandSet != this) {
- throw new ArgumentException ("Command instances can only be added to a single CommandSet.", nameof (value));
- }
- value.CommandSet = this;
- if (value.Options != null) {
- value.Options.MessageLocalizer = options.MessageLocalizer;
- }
-
- base.Add (value);
-
- help = help ?? value as HelpCommand;
- }
-
- public CommandSet Add (string header)
- {
- options.Add (header);
- return this;
- }
-
- public CommandSet Add (Option option)
- {
- options.Add (option);
- return this;
- }
-
- public CommandSet Add (string prototype, Action action)
- {
- options.Add (prototype, action);
- return this;
- }
-
- public CommandSet Add (string prototype, string description, Action action)
- {
- options.Add (prototype, description, action);
- return this;
- }
-
- public CommandSet Add (string prototype, string description, Action action, bool hidden)
- {
- options.Add (prototype, description, action, hidden);
- return this;
- }
-
- public CommandSet Add (string prototype, OptionAction action)
- {
- options.Add (prototype, action);
- return this;
- }
-
- public CommandSet Add (string prototype, string description, OptionAction action)
- {
- options.Add (prototype, description, action);
- return this;
- }
-
- public CommandSet Add (string prototype, string description, OptionAction action, bool hidden)
- {
- options.Add (prototype, description, action, hidden);
- return this;
- }
-
- public CommandSet Add (string prototype, Action action)
- {
- options.Add (prototype, null, action);
- return this;
- }
-
- public CommandSet Add (string prototype, string description, Action action)
- {
- options.Add (prototype, description, action);
- return this;
- }
-
- public CommandSet Add (string prototype, OptionAction action)
- {
- options.Add (prototype, action);
- return this;
- }
-
- public CommandSet Add (string prototype, string description, OptionAction action)
- {
- options.Add (prototype, description, action);
- return this;
- }
-
- public CommandSet Add (ArgumentSource source)
- {
- options.Add (source);
- return this;
- }
-
- public CommandSet Add (CommandSet nestedCommands)
- {
- if (nestedCommands == null)
- throw new ArgumentNullException (nameof (nestedCommands));
-
- if (NestedCommandSets == null) {
- NestedCommandSets = new List ();
- }
-
- if (!AlreadyAdded (nestedCommands)) {
- NestedCommandSets.Add (nestedCommands);
- foreach (var o in nestedCommands.options) {
- if (o is CommandOption c) {
- options.Add (new CommandOption (c.Command, $"{nestedCommands.Suite} {c.CommandName}"));
- }
- else {
- options.Add (o);
- }
- }
- }
-
- nestedCommands.options = this.options;
- nestedCommands.outWriter = this.outWriter;
- nestedCommands.errorWriter = this.errorWriter;
-
- return this;
- }
-
- bool AlreadyAdded (CommandSet value)
- {
- if (value == this)
- return true;
- if (NestedCommandSets == null)
- return false;
- foreach (var nc in NestedCommandSets) {
- if (nc.AlreadyAdded (value))
- return true;
- }
- return false;
- }
-
- public IEnumerable GetCompletions (string prefix = null)
- {
- string rest;
- ExtractToken (ref prefix, out rest);
-
- foreach (var command in this) {
- if (command.Name.StartsWith (prefix, StringComparison.OrdinalIgnoreCase)) {
- yield return command.Name;
- }
- }
-
- if (NestedCommandSets == null)
- yield break;
-
- foreach (var subset in NestedCommandSets) {
- if (subset.Suite.StartsWith (prefix, StringComparison.OrdinalIgnoreCase)) {
- foreach (var c in subset.GetCompletions (rest)) {
- yield return $"{subset.Suite} {c}";
- }
- }
- }
- }
-
- static void ExtractToken (ref string input, out string rest)
- {
- rest = "";
- input = input ?? "";
-
- int top = input.Length;
- for (int i = 0; i < top; i++) {
- if (char.IsWhiteSpace (input [i]))
- continue;
-
- for (int j = i; j < top; j++) {
- if (char.IsWhiteSpace (input [j])) {
- rest = input.Substring (j).Trim ();
- input = input.Substring (i, j).Trim ();
- return;
- }
- }
- rest = "";
- if (i != 0)
- input = input.Substring (i).Trim ();
- return;
- }
- }
-
- public int Run (IEnumerable arguments)
- {
- if (arguments == null)
- throw new ArgumentNullException (nameof (arguments));
-
- this.showHelp = false;
- if (help == null) {
- help = new HelpCommand ();
- AddCommand (help);
- }
- Action setHelp = v => showHelp = v != null;
- if (!options.Contains ("help")) {
- options.Add ("help", "", setHelp, hidden: true);
- }
- if (!options.Contains ("?")) {
- options.Add ("?", "", setHelp, hidden: true);
- }
- var extra = options.Parse (arguments);
- if (extra.Count == 0) {
- if (showHelp) {
- return help.Invoke (extra);
- }
- Out.WriteLine (options.MessageLocalizer ($"Use `{Suite} help` for usage."));
- return 1;
- }
- var command = GetCommand (extra);
- if (command == null) {
- help.WriteUnknownCommand (extra [0]);
- return 1;
- }
- if (showHelp) {
- if (command.Options?.Contains ("help") ?? true) {
- extra.Add ("--help");
- return command.Invoke (extra);
- }
- command.Options.WriteOptionDescriptions (Out);
- return 0;
- }
- return command.Invoke (extra);
- }
-
- internal Command GetCommand (List extra)
- {
- return TryGetLocalCommand (extra) ?? TryGetNestedCommand (extra);
- }
-
- Command TryGetLocalCommand (List extra)
- {
- var name = extra [0];
- if (Contains (name)) {
- extra.RemoveAt (0);
- return this [name];
- }
- for (int i = 1; i < extra.Count; ++i) {
- name = name + " " + extra [i];
- if (!Contains (name))
- continue;
- extra.RemoveRange (0, i+1);
- return this [name];
- }
- return null;
- }
-
- Command TryGetNestedCommand (List extra)
- {
- if (NestedCommandSets == null)
- return null;
-
- var nestedCommands = NestedCommandSets.Find (c => c.Suite == extra [0]);
- if (nestedCommands == null)
- return null;
-
- var extraCopy = new List (extra);
- extraCopy.RemoveAt (0);
- if (extraCopy.Count == 0)
- return null;
-
- var command = nestedCommands.GetCommand (extraCopy);
- if (command != null) {
- extra.Clear ();
- extra.AddRange (extraCopy);
- return command;
- }
- return null;
- }
- }
-
- public class HelpCommand : Command
- {
- public HelpCommand ()
- : base ("help", help: "Show this message and exit")
- {
- }
-
- public override int Invoke (IEnumerable arguments)
- {
- var extra = new List (arguments ?? new string [0]);
- var _ = CommandSet.Options.MessageLocalizer;
- if (extra.Count == 0) {
- CommandSet.Options.WriteOptionDescriptions (CommandSet.Out);
- return 0;
- }
- var command = CommandSet.GetCommand (extra);
- if (command == this || extra.Contains ("--help")) {
- CommandSet.Out.WriteLine (_ ($"Usage: {CommandSet.Suite} COMMAND [OPTIONS]"));
- CommandSet.Out.WriteLine (_ ($"Use `{CommandSet.Suite} help COMMAND` for help on a specific command."));
- CommandSet.Out.WriteLine ();
- CommandSet.Out.WriteLine (_ ($"Available commands:"));
- CommandSet.Out.WriteLine ();
- var commands = GetCommands ();
- commands.Sort ((x, y) => string.Compare (x.Key, y.Key, StringComparison.OrdinalIgnoreCase));
- foreach (var c in commands) {
- if (c.Key == "help") {
- continue;
- }
- CommandSet.Options.WriteCommandDescription (CommandSet.Out, c.Value, c.Key);
- }
- CommandSet.Options.WriteCommandDescription (CommandSet.Out, CommandSet.help, "help");
- return 0;
- }
- if (command == null) {
- WriteUnknownCommand (extra [0]);
- return 1;
- }
- if (command.Options != null) {
- command.Options.WriteOptionDescriptions (CommandSet.Out);
- return 0;
- }
- return command.Invoke (new [] { "--help" });
- }
-
- List> GetCommands ()
- {
- var commands = new List> ();
-
- foreach (var c in CommandSet) {
- commands.Add (new KeyValuePair(c.Name, c));
- }
-
- if (CommandSet.NestedCommandSets == null)
- return commands;
-
- foreach (var nc in CommandSet.NestedCommandSets) {
- AddNestedCommands (commands, "", nc);
- }
-
- return commands;
- }
-
- void AddNestedCommands (List> commands, string outer, CommandSet value)
- {
- foreach (var v in value) {
- commands.Add (new KeyValuePair($"{outer}{value.Suite} {v.Name}", v));
- }
- if (value.NestedCommandSets == null)
- return;
- foreach (var nc in value.NestedCommandSets) {
- AddNestedCommands (commands, $"{outer}{value.Suite} ", nc);
- }
- }
-
- internal void WriteUnknownCommand (string unknownCommand)
- {
- CommandSet.Error.WriteLine (CommandSet.Options.MessageLocalizer ($"{CommandSet.Suite}: Unknown command: {unknownCommand}"));
- CommandSet.Error.WriteLine (CommandSet.Options.MessageLocalizer ($"{CommandSet.Suite}: Use `{CommandSet.Suite} help` for usage."));
- }
- }
-}
-
diff --git a/src/Uno.Wasm.Packager/Uno.Wasm.Packager.csproj b/src/Uno.Wasm.Packager/Uno.Wasm.Packager.csproj
deleted file mode 100644
index e0eb35f6a..000000000
--- a/src/Uno.Wasm.Packager/Uno.Wasm.Packager.csproj
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
- net5.0
- Exe
- packager
-
-
- Major
-
-
-
-
-
-
-
-
-
diff --git a/src/Uno.Wasm.Packager/packager.cs b/src/Uno.Wasm.Packager/packager.cs
deleted file mode 100644
index 0c364d8ed..000000000
--- a/src/Uno.Wasm.Packager/packager.cs
+++ /dev/null
@@ -1,2047 +0,0 @@
-using System;
-using System.Linq;
-using System.IO;
-using System.Collections.Generic;
-using Mono.Cecil;
-using Mono.Options;
-using Mono.Cecil.Cil;
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-
-//
-// Google V8 style options:
-// - bool: --foo/--no-foo
-//
-
-enum FlagType {
- BoolFlag,
-}
-
-// 'Option' is already used by Mono.Options
-class Flag {
- public Flag (string name, string desc, FlagType type) {
- Name = name;
- FlagType = type;
- Description = desc;
- }
-
- public string Name {
- get; set;
- }
-
- public FlagType FlagType {
- get; set;
- }
-
- public string Description {
- get; set;
- }
-}
-
-class BoolFlag : Flag {
- public BoolFlag (string name, string description, bool def_value, Action action) : base (name, description, FlagType.BoolFlag) {
- Setter = action;
- DefaultValue = def_value;
- }
-
- public Action Setter {
- get; set;
- }
-
- public bool DefaultValue {
- get; set;
- }
-}
-
-class Driver {
- static bool enable_debug, enable_linker, invariant_globalization;
- static string app_prefix, framework_prefix, bcl_tools_prefix, bcl_facades_prefix, out_prefix;
- static List bcl_prefixes;
- static HashSet asm_map = new HashSet ();
- static List file_list = new List ();
- static HashSet assemblies_with_dbg_info = new HashSet ();
- static List root_search_paths = new List();
- static List assembly_references = new List();
- static CapturingAssemblyResolver resolver;
-
- const string BINDINGS_ASM_NAME_MONO = "WebAssembly.Bindings";
- const string BINDINGS_RUNTIME_CLASS_NAME = "WebAssembly.Runtime";
- const string HTTP_ASM_NAME = "System.Net.Http.WebAssemblyHttpHandler";
- const string WEBSOCKETS_ASM_NAME = "WebAssembly.Net.WebSockets";
- const string BINDINGS_MODULE = "corebindings.o";
- const string BINDINGS_MODULE_SUPPORT = "$tool_prefix/src/binding_support.js";
- private static readonly string[] jiterpreterOptions = new[] { "jiterpreter-traces-enabled", "jiterpreter-interp-entry-enabled", "jiterpreter-jit-call-enabled" };
-
- class AssemblyData {
- // Assembly name
- public string name;
- // Base filename
- public string filename;
- // Path outside build tree
- public string src_path;
- // Path of .bc file
- public string bc_path;
- // Path of the wasm object file
- public string o_path;
- // Path in appdir
- public string app_path;
- // Path of the AOT depfile
- public string aot_depfile_path;
- // Linker input path
- public string linkin_path;
- // Linker pdb input path
- public string linkin_pdb_path;
- // Linker pdb output path
- public string linkout_pdb_path;
- // Linker output path
- public string linkout_path;
- // AOT input path
- public string aotin_path;
- // Final output path after IL strip
- public string final_path;
- // Whenever to AOT this assembly
- public bool aot;
-
- // If not null, this is a satellite assembly
- public string culture;
- }
-
- static List assemblies = new List ();
-
- enum AssemblyKind {
- User,
- Framework,
- Bcl,
- None,
- }
-
- void AddFlag (OptionSet options, Flag flag) {
- if (flag is BoolFlag) {
- options.Add (flag.Name, s => (flag as BoolFlag).Setter (true));
- options.Add ("no-" + flag.Name, s => (flag as BoolFlag).Setter (false));
- }
- option_list.Add (flag);
- }
-
- static List option_list = new List ();
-
- static void Usage () {
- Console.WriteLine ("Usage: packager.exe ");
- Console.WriteLine ("Valid options:");
- Console.WriteLine ("\t--help Show this help message");
- Console.WriteLine ("\t--debugrt Use the debug runtime (default release) - this has nothing to do with C# debugging");
- Console.WriteLine ("\t--aot Enable AOT mode");
- Console.WriteLine ("\t--aot-interp Enable AOT+INTERP mode");
- Console.WriteLine ("\t--prefix=x Set the input assembly prefix to 'x' (default to the current directory)");
- Console.WriteLine ("\t--out=x Set the output directory to 'x' (default to the current directory)");
- Console.WriteLine ("\t--mono-sdkdir=x Set the mono sdk directory to 'x'");
- Console.WriteLine ("\t--deploy=x Set the deploy prefix to 'x' (default to 'managed')");
- Console.WriteLine ("\t--vfs=x Set the VFS prefix to 'x' (default to 'managed')");
- Console.WriteLine ("\t--target-framework=x Set app target framework");
- Console.WriteLine ("\t--template=x Set the template name to 'x' (default to 'runtime.js')");
- Console.WriteLine ("\t--asset=x Add specified asset 'x' to list of assets to be copied");
- Console.WriteLine ("\t--search-path=x Add specified path 'x' to list of paths used to resolve assemblies");
- Console.WriteLine ("\t--copy=always|ifnewer Set the type of copy to perform.");
- Console.WriteLine ("\t\t 'always' overwrites the file if it exists.");
- Console.WriteLine ("\t\t 'ifnewer' copies or overwrites the file if modified or size is different.");
- Console.WriteLine ("\t--profile=x Enable the 'x' mono profiler.");
- Console.WriteLine ("\t--runtime-config=x sets the mono runtime to use (defaults to release).");
- Console.WriteLine ("\t--pthread-pool-size=x sets the number of available pthreads the runtime can use (defaults to 4).");
- Console.WriteLine ("\t--aot-assemblies=x List of assemblies to AOT in AOT+INTERP mode.");
- Console.WriteLine ("\t--skip-aot-assemblies=x List of assemblies to skip AOT in AOT+INTERP mode.");
- Console.WriteLine ("\t--aot-compiler-opts=x Adjust aot compiler options.");
- Console.WriteLine ("\t--aot-profile=x Use 'x' as the AOT profile.");
- Console.WriteLine ("\t--link-mode=sdkonly|all Set the link type used for AOT. (EXPERIMENTAL)");
- Console.WriteLine ("\t--pinvoke-libs=x DllImport libraries used.");
- Console.WriteLine ("\t\t 'sdkonly' only link the Core libraries.");
- Console.WriteLine ("\t\t 'all' link Core and User assemblies. (default)");
- Console.WriteLine ("\t--pinvoke-libs=x DllImport libraries used.");
- Console.WriteLine ("\t--native-lib=x Link the native library 'x' into the final executable.");
- Console.WriteLine ("\t--native-compile=x Provide the file to emcc.");
- Console.WriteLine ("\t--preload-file=x Preloads the file or directory 'x' into the virtual filesystem.");
- Console.WriteLine ("\t--embed-file=x Embeds the file or directory 'x' into the virtual filesystem.");
- Console.WriteLine ("\t--extra-emccflags=\"x\" Additional emscripten arguments (e.g. -s USE_LIBPNG=1).");
- Console.WriteLine ("\t--extra-linkerflags=\"x\" Additional linker arguments.");
-
- Console.WriteLine ("foo.dll Include foo.dll as one of the root assemblies");
- Console.WriteLine ();
-
- Console.WriteLine ("Additional options (--option/--no-option):");
- foreach (var flag in option_list) {
- if (flag is BoolFlag) {
- Console.WriteLine (" --" + flag.Name + " (" + flag.Description + ")");
- Console.WriteLine (" type: bool default: " + ((flag as BoolFlag).DefaultValue ? "true" : "false"));
- }
- }
- }
-
- static void Debug (string s) {
- Console.WriteLine (s);
- }
-
- static string FindFrameworkAssembly (string asm) {
- return asm;
- }
-
- static bool Try (string prefix, string name, out string out_res) {
- out_res = null;
-
- string res = (Path.Combine (prefix, name));
- if (File.Exists (res)) {
- out_res = Path.GetFullPath (res);
- return true;
- }
- return false;
- }
-
- static string ResolveWithExtension (string prefix, string name) {
- string res = null;
-
- if (Try (prefix, name, out res))
- return res;
- if (Try (prefix, name + ".dll", out res))
- return res;
- if (Try (prefix, name + ".exe", out res))
- return res;
- return null;
- }
-
- static string ResolveUser (string asm_name) {
- return ResolveWithExtension (app_prefix, asm_name);
- }
-
- static string ResolveFramework (string asm_name) {
- return ResolveWithExtension (framework_prefix, asm_name);
- }
-
- static string ResolveBcl (string asm_name) {
- foreach (var prefix in bcl_prefixes) {
- string res = ResolveWithExtension (prefix, asm_name);
- if (res != null)
- return res;
- }
- return null;
- }
-
- static string ResolveBclFacade (string asm_name) {
- return ResolveWithExtension (bcl_facades_prefix, asm_name);
- }
-
- static string Resolve (string asm_name, out AssemblyKind kind) {
- kind = AssemblyKind.User;
- var asm = ResolveUser (asm_name);
- if (asm != null)
- return asm;
-
- kind = AssemblyKind.Framework;
- asm = ResolveFramework (asm_name);
- if (asm != null)
- return asm;
-
- kind = AssemblyKind.Bcl;
- asm = ResolveBcl (asm_name);
- if (asm == null)
- asm = ResolveBclFacade (asm_name);
- if (asm != null)
- return asm;
-
- kind = AssemblyKind.None;
- throw new Exception ($"Could not resolve {asm_name}");
- }
-
- static bool is_sdk_assembly (string filename) {
- foreach (var prefix in bcl_prefixes)
- if (filename.StartsWith (prefix))
- return true;
- return false;
- }
-
- static void Import (string ra, AssemblyKind kind) {
- if(ra == null)
- {
- return;
- }
-
- var assemblyFullPath = Path.GetFullPath(ra);
- var assemblyDirectory = Path.GetDirectoryName(assemblyFullPath);
-
- if (!asm_map.Add (assemblyFullPath))
- return;
- Console.WriteLine($"Resolving {ra}");
- ReaderParameters rp = new ReaderParameters();
- bool add_pdb = enable_debug && File.Exists (Path.ChangeExtension (ra, "pdb"));
- if (add_pdb) {
- rp.ReadSymbols = true;
- // Facades do not have symbols
- rp.ThrowIfSymbolsAreNotMatching = false;
- rp.SymbolReaderProvider = new DefaultSymbolReaderProvider(false);
- }
-
- if (resolver == null)
- {
- resolver = new CapturingAssemblyResolver(assembly_references);
- root_search_paths.ForEach(resolver.AddSearchDirectory);
- foreach (var prefix in bcl_prefixes)
- resolver.AddSearchDirectory(prefix);
- resolver.AddSearchDirectory(bcl_facades_prefix);
- resolver.AddSearchDirectory(framework_prefix);
- }
-
- rp.AssemblyResolver = resolver;
-
- rp.InMemory = true;
- var image = ModuleDefinition.ReadModule (ra, rp);
- file_list.Add (ra);
- //Debug ($"Processing {ra} debug {add_pdb}");
-
- var data = new AssemblyData () { name = image.Assembly.Name.Name, src_path = ra };
- assemblies.Add (data);
-
- if (add_pdb && (kind == AssemblyKind.User || kind == AssemblyKind.Framework)) {
- var pdb_path = Path.ChangeExtension (Path.GetFullPath (ra), "pdb");
- file_list.Add (pdb_path);
- assemblies_with_dbg_info.Add (pdb_path);
- }
-
- var parent_kind = kind;
-
- foreach (var ar in image.AssemblyReferences) {
- // Resolve using root search paths first
- AssemblyDefinition resolved = null;
- try {
- resolved = image.AssemblyResolver.Resolve(ar, rp);
- } catch {
- }
-
- if (resolved == null && is_sdk_assembly (ra))
- // FIXME: netcore assemblies have missing references
- continue;
-
- if (resolved != null) {
- Import (resolved.MainModule.FileName, parent_kind);
- } else {
- var resolve = Resolve (ar.Name, out kind);
- if (resolve != null)
- {
- Import(resolve, kind);
- }
- else
- {
- Console.WriteLine($"Could not resolve {ar.Name}");
- }
- }
- }
-
- // Resolving satellite assemblies
- if(!invariant_globalization && kind == AssemblyKind.User)
- {
- string resourceFile = GetAssemblyResourceFileName(assemblyFullPath);
-
- foreach (var subDirectory in Directory.EnumerateDirectories(assemblyDirectory))
- {
- var satelliteAssembly = Path.Combine(subDirectory, resourceFile);
- if (!File.Exists(satelliteAssembly))
- {
- continue;
- }
-
- string cultureName = subDirectory.Substring(subDirectory.LastIndexOf(Path.DirectorySeparatorChar) + 1);
- string culturePath = Path.Combine(assemblyDirectory, cultureName);
-
- var satelliteData = new AssemblyData() {
- name = resourceFile.Replace(".dll", ""),
- src_path = satelliteAssembly.Replace("\\", "/"),
- culture = cultureName,
- aot = false
- };
-
- assemblies.Add(satelliteData);
-
- file_list.Add(satelliteAssembly);
-
- Console.WriteLine($"Added satellite assembly {cultureName}/{resourceFile}");
- }
- }
-
- Console.WriteLine($"Resolved {ra}");
- }
-
- static string GetAssemblyResourceFileName(string assembly)
- => Path.GetFileNameWithoutExtension(assembly) + ".resources.dll";
-
- void GenDriver (string builddir, List profilers, ExecMode ee_mode, bool link_icalls) {
- var symbols = new List ();
- foreach (var adata in assemblies) {
- if (adata.aot)
- symbols.Add (String.Format ("mono_aot_module_{0}_info", adata.name.Replace ('.', '_').Replace ('-', '_')));
- }
-
- var w = File.CreateText (Path.Combine (builddir, "driver-gen.c.in"));
-
- foreach (var symbol in symbols) {
- w.WriteLine ($"extern void *{symbol};");
- }
-
- w.WriteLine ("static void register_aot_modules ()");
- w.WriteLine ("{");
- foreach (var symbol in symbols)
- w.WriteLine ($"\tmono_aot_register_module ({symbol});");
- w.WriteLine ("}");
-
- foreach (var profiler in profilers) {
- w.WriteLine ($"void mono_profiler_init_{profiler} (const char *desc);");
- w.WriteLine ("EMSCRIPTEN_KEEPALIVE void mono_wasm_load_profiler_" + profiler + " (const char *desc) { mono_profiler_init_" + profiler + " (desc); }");
- }
-
- switch (ee_mode) {
- case ExecMode.AotInterp:
- w.WriteLine ("#define EE_MODE_LLVMONLY_INTERP 1");
- break;
- case ExecMode.Aot:
- w.WriteLine ("#define EE_MODE_LLVMONLY 1");
- break;
- default:
- break;
- }
-
- if (link_icalls)
- w.WriteLine ("#define LINK_ICALLS 1");
-
- w.Close ();
- }
-
- public static int Main (string[] args) {
- return new Driver ().Run (args);
- }
-
- enum CopyType
- {
- Default,
- Always,
- IfNewer
- }
-
- enum ExecMode {
- Interp = 1,
- Aot = 2,
- AotInterp = 3
- }
-
- enum LinkMode
- {
- SdkOnly,
- All
- }
-
- class WasmOptions {
- public bool Debug;
- public bool DebugRuntime;
- public bool AddBinding;
- public bool Linker;
- public bool LinkIcalls;
- public bool ILStrip;
- public bool LinkerVerbose;
- public bool EnableZLib;
- public bool EnableFS;
- public bool EnableThreads;
- public bool EnableJiterpreter;
- public bool Simd;
- public bool PrintSkippedAOTMethods;
- public bool EnableDynamicRuntime;
- public bool LinkerExcludeDeserialization;
- public bool EnableCollation;
- public bool EnableICU;
- public bool EnableDedup = true;
- public bool EmccLinkOptimizations = false;
- public bool EnableWasmExceptions = false;
- public bool InvariantGlobalization = false;
- }
-
- int Run (string[] args) {
- var add_binding = true;
- var root_assemblies = new List ();
- enable_debug = false;
- string builddir = null;
- string sdkdir = null;
- string emscripten_sdkdir = null;
- var aot_assemblies = "";
- var skip_aot_assemblies = "";
- app_prefix = Environment.CurrentDirectory;
- var assembly_root = "managed";
- var vfs_prefix = "managed";
- var target_framework = "net5.0";
- var use_release_runtime = true;
- var enable_aot = false;
- var enable_dedup = true;
- var print_usage = false;
- var emit_ninja = false;
- bool build_wasm = false;
- bool enable_lto = false;
- bool link_icalls = false;
- bool gen_pinvoke = false;
- bool enable_zlib = false;
- bool enable_fs = false;
- bool enable_threads = false;
- bool enable_dynamic_runtime = false;
- bool is_netcore = false;
- bool is_windows = Environment.OSVersion.Platform == PlatformID.Win32NT;
- bool enable_simd = false;
- bool print_skipped_aot_methods = false;
- var il_strip = false;
- var linker_verbose = false;
- var runtimeTemplate = "runtime.js";
- var assets = new List ();
- var profilers = new List ();
- var native_libs = new List ();
- var preload_files = new List ();
- var embed_files = new List ();
- var emcc_exported_runtime_methods = new List ();
- var native_compile = new List ();
- var pinvoke_libs = "";
- var copyTypeParm = "default";
- var copyType = CopyType.Default;
- var ee_mode = ExecMode.Interp;
- var linkModeParm = "all";
- var linkMode = LinkMode.All;
- var linkDescriptor = "";
- var framework = "";
- var runtimepack_dir = "";
- string usermode;
- string runtimeOptions = null;
- string aot_profile = null;
- string aot_compiler_options = "";
- string wasm_runtime_path = null;
- var runtime_config = "release";
- int pthread_pool_size = 4;
- string wasmStackSize = "5MB";
- string illinker_path = "";
- string extra_emccflags = "";
- string extra_linkerflags = "";
- string linker_optimization_level = "";
- string wasm_tuner_path = "";
- var linker_args = new List();
-
- var opts = new WasmOptions () {
- AddBinding = true,
- Debug = false,
- DebugRuntime = false,
- Linker = false,
- ILStrip = false, // disabled because of https://github.com/dotnet/runtime/issues/50609
- LinkerVerbose = false,
- EnableZLib = false,
- EnableFS = false,
- Simd = false,
- EnableDynamicRuntime = false,
- LinkerExcludeDeserialization = true,
- EnableCollation = false,
- EnableICU = false
- };
-
- var p = new OptionSet () {
- { "nobinding", s => opts.AddBinding = false },
- { "out=", s => out_prefix = s },
- { "appdir=", s => out_prefix = s },
- { "builddir=", s => builddir = s },
- { "mono-sdkdir=", s => sdkdir = s },
- { "emscripten-sdkdir=", s => emscripten_sdkdir = s },
- { "runtimepack-dir=", s => runtimepack_dir = s },
- { "prefix=", s => app_prefix = s },
- { "wasm-runtime-path=", s => wasm_runtime_path = s },
- { "deploy=", s => assembly_root = s },
- { "vfs=", s => vfs_prefix = s },
- { "target-framework=", s => target_framework = s },
- { "aot", s => ee_mode = ExecMode.Aot },
- { "aot-interp", s => ee_mode = ExecMode.AotInterp },
- { "template=", s => runtimeTemplate = s },
- { "asset=", s => assets.Add(s) },
- { "search-path=", s => root_search_paths.Add(s) },
- { "asm-ref=", s => assembly_references.Add(s) },
- { "profile=", s => profilers.Add (s) },
- { "copy=", s => copyTypeParm = s },
- { "aot-assemblies=", s => aot_assemblies = s },
- { "aot-profile=", s => aot_profile = s },
- { "runtime-config=", s => runtime_config = s },
- { "pthread-pool-size=", s => int.TryParse(s, out pthread_pool_size) },
- { "wasm-stack-size=", s => wasmStackSize = s },
- { "skip-aot-assemblies=", s => skip_aot_assemblies = s },
- { "aot-compiler-opts=", s => aot_compiler_options = s },
- { "link-mode=", s => linkModeParm = s },
- { "link-descriptor=", s => linkDescriptor = s },
- { "pinvoke-libs=", s => pinvoke_libs = s },
- { "native-compile=", s => native_compile.Add(s) },
- { "native-lib=", s => native_libs.Add (s) },
- { "preload-file=", s => preload_files.Add (s) },
- { "embed-file=", s => embed_files.Add (s) },
- { "emcc-exported-runtime-method=", s => emcc_exported_runtime_methods.Add (s) },
- { "framework=", s => framework = s },
- { "extra-emccflags=", s => extra_emccflags = s },
- { "illinker-path=", s => illinker_path = s },
- { "extra-linkerflags=", s => extra_linkerflags = s },
- { "runtime-options=", s => runtimeOptions = s },
- { "linker-optimization-level=", s => linker_optimization_level = s },
- { "wasm-tuner-path=", s => wasm_tuner_path = s },
- { "help", s => print_usage = true },
- };
-
- AddFlag (p, new BoolFlag ("debug", "enable c# debugging", opts.Debug, b => opts.Debug = b));
- AddFlag (p, new BoolFlag ("debugrt", "enable debug runtime", opts.DebugRuntime, b => opts.DebugRuntime = b));
- AddFlag (p, new BoolFlag ("linker", "enable the linker", opts.Linker, b => opts.Linker = b));
- AddFlag (p, new BoolFlag ("binding", "enable the binding engine", opts.AddBinding, b => opts.AddBinding = b));
- AddFlag (p, new BoolFlag ("link-icalls", "link away unused icalls", opts.LinkIcalls, b => opts.LinkIcalls = b));
- AddFlag (p, new BoolFlag ("il-strip", "strip IL code from assemblies in AOT mode", opts.ILStrip, b => opts.ILStrip = b));
- AddFlag (p, new BoolFlag ("linker-verbose", "set verbose option on linker", opts.LinkerVerbose, b => opts.LinkerVerbose = b));
- AddFlag (p, new BoolFlag ("zlib", "enable the use of zlib for System.IO.Compression support", opts.EnableZLib, b => opts.EnableZLib = b));
- AddFlag (p, new BoolFlag ("enable-fs", "enable filesystem support (through Emscripten's file_packager.py in a later phase)", opts.EnableFS, b => opts.EnableFS = b));
- AddFlag (p, new BoolFlag ("threads", "enable threads", opts.EnableThreads, b => opts.EnableThreads = b));
- AddFlag (p, new BoolFlag ("jiterpreter", "enable jiterpreter", opts.EnableJiterpreter, b => opts.EnableJiterpreter = b));
- AddFlag (p, new BoolFlag ("print-skipped-aot-methods", "enable jiterpreter", opts.PrintSkippedAOTMethods, b => opts.PrintSkippedAOTMethods = b));
- AddFlag (p, new BoolFlag ("dedup", "enable dedup pass", opts.EnableDedup, b => opts.EnableDedup = b));
- AddFlag (p, new BoolFlag ("dynamic-runtime", "enable dynamic runtime (support for Emscripten's dlopen)", opts.EnableDynamicRuntime, b => opts.EnableDynamicRuntime = b));
- AddFlag (p, new BoolFlag ("simd", "enable SIMD support", opts.Simd, b => opts.Simd = b));
- AddFlag (p, new BoolFlag ("wasm-exceptions", "enable exceptions", opts.EnableWasmExceptions, b => opts.EnableWasmExceptions = b));
- AddFlag (p, new BoolFlag ("linker-exclude-deserialization", "Link out .NET deserialization support", opts.LinkerExcludeDeserialization, b => opts.LinkerExcludeDeserialization = b));
- AddFlag (p, new BoolFlag ("collation", "enable unicode collation support", opts.EnableCollation, b => opts.EnableCollation = b));
- AddFlag (p, new BoolFlag ("icu", "enable .NET 5+ ICU", opts.EnableICU, b => opts.EnableICU = b));
- AddFlag (p, new BoolFlag ("emcc-link-optimization", "enable emcc link-time optimizations", opts.EmccLinkOptimizations, b => opts.EmccLinkOptimizations = b));
- AddFlag (p, new BoolFlag ("invariant-globalization", "enables invariant globalization", opts.InvariantGlobalization, b => opts.InvariantGlobalization = b));
- p.Add(new ResponseFileSource());
-
- var new_args = p.Parse (args).ToArray ();
- foreach (var a in new_args) {
- root_assemblies.Add (a);
- }
-
- if (print_usage) {
- Usage ();
- return 0;
- }
-
- if (!Enum.TryParse(copyTypeParm, true, out copyType)) {
- Console.WriteLine("Invalid copy value");
- Usage ();
- return 1;
- }
-
- if (!Enum.TryParse(linkModeParm, true, out linkMode)) {
- Console.WriteLine("Invalid link-mode value");
- Usage ();
- return 1;
- }
-
- if (out_prefix == null) {
- Console.Error.WriteLine ("The --appdir= argument is required.");
- return 1;
- }
-
- enable_debug = opts.Debug;
- enable_linker = opts.Linker;
- add_binding = opts.AddBinding;
- il_strip = opts.ILStrip;
- linker_verbose = opts.LinkerVerbose;
- gen_pinvoke = pinvoke_libs != "";
- enable_zlib = opts.EnableZLib;
- enable_fs = opts.EnableFS;
- enable_threads = opts.EnableThreads;
- enable_dynamic_runtime = opts.EnableDynamicRuntime;
- enable_simd = opts.Simd;
- print_skipped_aot_methods = opts.PrintSkippedAOTMethods;
- invariant_globalization = opts.InvariantGlobalization;
-
- // Dedup is disabled by default https://github.com/dotnet/runtime/issues/48814
- enable_dedup = opts.EnableDedup;
-
- if (opts.DebugRuntime) {
- runtime_config = "release";
- } else {
- switch (runtime_config) {
- case "debug":
- enable_debug = true;
- break;
-
- case "release":
- break;
-
- case "release-threads":
- enable_threads = true;
- break;
-
- case "debug-threads":
- enable_threads = true;
- enable_debug = true;
- break;
-
- case "dynamic-release":
- enable_dynamic_runtime = true;
- break;
-
- case "dynamic-debug":
- enable_dynamic_runtime = true;
- enable_debug = true;
- break;
-
- default:
- Console.WriteLine ("Invalid --runtime-config value. Must be either debug, release, dynamic-release, dynamic-debug.");
- Usage ();
- return 1;
- }
- }
-
- if (ee_mode == ExecMode.Aot || ee_mode == ExecMode.AotInterp)
- enable_aot = true;
-
- if (enable_aot || opts.Linker)
- enable_linker = true;
- if (opts.LinkIcalls)
- link_icalls = true;
- if (!enable_linker || !enable_aot)
- enable_dedup = false;
- if (enable_aot || link_icalls || gen_pinvoke || profilers.Count > 0 || native_libs.Count > 0 || native_compile.Count > 0 || preload_files.Count > 0 || embed_files.Count > 0) {
- build_wasm = true;
- emit_ninja = true;
- }
- if (!enable_aot && link_icalls)
- enable_lto = true;
- if (ee_mode != ExecMode.Aot)
- // Can't strip out IL code in mixed mode, since the interpreter might execute some methods even if they have AOTed code available
- il_strip = false;
-
- if (aot_assemblies != "") {
- if (ee_mode != ExecMode.AotInterp) {
- Console.Error.WriteLine ("The --aot-assemblies= argument requires --aot-interp.");
- return 1;
- }
- }
- if (skip_aot_assemblies != "") {
- if (ee_mode != ExecMode.AotInterp) {
- Console.Error.WriteLine ("The --skip-aot-assemblies= argument requires --aot-interp.");
- return 1;
- }
- }
- if (link_icalls && !enable_linker) {
- Console.Error.WriteLine ("The --link-icalls option requires the --linker option.");
- return 1;
- }
-
- var tool_prefix = runtimepack_dir;
-
- if (framework != "") {
- if (framework.StartsWith ("net5")) {
- is_netcore = true;
- if (runtimepack_dir == "") {
- Console.Error.WriteLine ("The --runtimepack-dir= argument is required.");
- return 1;
- }
- if (!Directory.Exists (runtimepack_dir)) {
- Console.Error.WriteLine ($"The directory '{runtimepack_dir}' doesn't exist.");
- return 1;
- }
- if (!Directory.Exists (Path.Combine (runtimepack_dir, "runtimes", "browser-wasm"))) {
- Console.Error.WriteLine ($"The directory '{runtimepack_dir}' doesn't contain a 'runtimes/browser-wasm' subdirectory.");
- return 1;
- }
- runtimepack_dir = Path.Combine (runtimepack_dir, "runtimes", "browser-wasm").Replace("\\", "/");
- } else {
- Console.Error.WriteLine ("The only valid value for --framework is 'net5...'");
- return 1;
- }
- }
-
- if (aot_profile != null && !File.Exists (aot_profile)) {
- Console.Error.WriteLine ($"AOT profile file '{aot_profile}' not found.");
- return 1;
- }
-
- if (enable_simd && !is_netcore) {
- Console.Error.WriteLine ("--simd is only supported with netcore.");
- return 1;
- }
-
- //are we working from the tree?
- if (sdkdir != null) {
- framework_prefix = Path.Combine (tool_prefix, "framework"); //all framework assemblies are currently side built to packager.exe
- } else if (Directory.Exists (Path.Combine (tool_prefix, "../out/wasm-bcl/wasm"))) {
- framework_prefix = Path.Combine (tool_prefix, "framework"); //all framework assemblies are currently side built to packager.exe
- sdkdir = Path.Combine (tool_prefix, "../out");
- } else {
- framework_prefix = Path.Combine (tool_prefix, "framework");
- sdkdir = tool_prefix;
- }
- string bcl_root = Path.Combine (sdkdir, "wasm-bcl");
- var bcl_prefix = Path.Combine (bcl_root, "wasm");
- bcl_facades_prefix = Path.Combine (bcl_prefix, "Facades");
- bcl_prefixes = new List ();
- if (is_netcore) {
- bcl_tools_prefix = Path.Combine (sdkdir, "tools");
- /* corelib */
- bcl_prefixes.Add (Path.Combine (runtimepack_dir, "native"));
- /* .net runtime */
- bcl_prefixes.Add (Path.Combine (runtimepack_dir, "lib", "net8.0"));
- } else {
- bcl_tools_prefix = Path.Combine (bcl_root, "wasm_tools");
- bcl_prefixes.Add (bcl_prefix);
- }
-
- Console.WriteLine("Resolving assemblies");
- foreach (var ra in root_assemblies) {
- AssemblyKind kind;
- var resolved = Resolve (ra, out kind);
- Import (resolved, kind);
- }
- Console.WriteLine("Done resolving assemblies");
-
- if (enable_aot) {
- var to_aot = new Dictionary (StringComparer.OrdinalIgnoreCase);
- if (is_netcore)
- to_aot ["System.Private.CoreLib"] = true;
- else
- to_aot ["mscorlib"] = true;
- if (aot_assemblies != "") {
- foreach (var s in aot_assemblies.Split (','))
- to_aot [s] = true;
- }
- foreach (var ass in assemblies) {
- if (aot_assemblies == "" || to_aot.ContainsKey (ass.name)) {
- ass.aot = true;
-
- if(ass.culture is not null)
- {
- // Satellite assemblies cannot be AOTed as they're
- // implicitly duplicates.
- ass.aot = false;
- }
-
- to_aot.Remove (ass.name);
- }
- }
-
- if (to_aot.Count > 0) {
- Console.WriteLine ("Skipping AOT for unknown assembly names '" + string.Join(",", to_aot.Keys) + "' in --aot-assemblies option.");
- }
-
- if(skip_aot_assemblies != "") {
- var skipList = skip_aot_assemblies.Split(',');
-
- foreach(var asm in assemblies) {
- if (skipList.Any(s => asm.name.Equals(s, StringComparison.OrdinalIgnoreCase))) {
- Console.WriteLine ($"Disabling AOT for {asm.name}");
- asm.aot = false;
- }
- }
- }
- }
-
- if (builddir != null) {
- emit_ninja = true;
- if (!Directory.Exists (builddir))
- Directory.CreateDirectory (builddir);
- }
-
- if (!emit_ninja)
- {
- if (!Directory.Exists(out_prefix))
- Directory.CreateDirectory(out_prefix);
- var bcl_dir = Path.Combine(out_prefix, assembly_root);
- if (Directory.Exists(bcl_dir))
- Directory.Delete(bcl_dir, true);
- Directory.CreateDirectory(bcl_dir);
-
- file_list.AsParallel().ForAll(f =>
- {
- var fileName = Path.GetFileName(f);
-
- if (IsResourceAssembly(f, out var culture))
- {
- fileName = Path.Combine(culture, fileName);
- }
-
- CopyFile(f, Path.Combine(bcl_dir, fileName), copyType);
- });
- }
-
- if (assembly_root.EndsWith ("/"))
- assembly_root = assembly_root.Substring (0, assembly_root.Length - 1);
- if (vfs_prefix.EndsWith ("/"))
- vfs_prefix = vfs_prefix.Substring (0, vfs_prefix.Length - 1);
-
- string src_prefix = is_netcore ? Path.Combine(runtimepack_dir, "native") : Path.Combine(tool_prefix, "src");
-
- // wasm core bindings module
- var wasm_core_bindings = string.Empty;
- if (add_binding) {
- wasm_core_bindings = BINDINGS_MODULE;
- }
- // wasm core bindings support file
- var wasm_core_support = string.Empty;
- var wasm_core_support_library = string.Empty;
- if (add_binding) {
-
- if (is_netcore)
- {
- wasm_core_support_library += $"--js-library " + Path.Combine(src_prefix, "pal_random.lib.js") + " ";
- }
- }
- var runtime_js = Path.Combine (emit_ninja ? builddir : out_prefix, "runtime.js");
- if (emit_ninja) {
- File.Delete (runtime_js);
- File.Copy (runtimeTemplate, runtime_js);
- } else {
- if (File.Exists(runtime_js) && (File.Exists(runtimeTemplate))) {
- CopyFile (runtimeTemplate, runtime_js, CopyType.IfNewer, $"runtime template <{runtimeTemplate}> ");
- } else {
- if (File.Exists(runtimeTemplate))
- CopyFile (runtimeTemplate, runtime_js, CopyType.IfNewer, $"runtime template <{runtimeTemplate}> ");
- else {
- var runtime_gen = "\nvar Module = {\n\tonRuntimeInitialized: function () {\n\t\tMONO.mono_load_runtime_and_bcl (\n\t\tconfig.vfs_prefix,\n\t\tconfig.deploy_prefix,\n\t\tconfig.enable_debugging,\n\t\tconfig.file_list,\n\t\tfunction () {\n\t\t\tApp.init ();\n\t\t}\n\t)\n\t},\n};";
- File.Delete (runtime_js);
- File.WriteAllText (runtime_js, runtime_gen);
- }
- }
- }
-
- AssemblyData dedup_asm = null;
-
- if (enable_dedup) {
- dedup_asm = new AssemblyData () { name = "aot-instances",
- filename = "aot-instances.dll",
- bc_path = Path.Combine("$builddir", "aot-instances.dll.bc"),
- o_path = Path.Combine("$builddir", "aot-instances.dll.o"),
- app_path = Path.Combine("$appdir", "$deploy_prefix", "aot-instances.dll"),
- linkout_path = Path.Combine("$builddir", "linker-out", "aot-instances.dll"),
- aot = true
- };
- assemblies.Add (dedup_asm);
- file_list.Add ("aot-instances.dll");
- }
-
- file_list.Add ("dotnet.native.wasm");
- file_list.Add ("dotnet.native.js");
- file_list.Add ("dotnet.runtime.js");
-
- if (enable_threads) {
- file_list.Add("dotnet.native.worker.js");
- }
-
- string wasm_runtime_dir;
- if (is_netcore) {
- wasm_runtime_dir = Path.Combine (runtimepack_dir, "native");
- } else {
- if (wasm_runtime_path == null)
- wasm_runtime_path = Path.Combine (tool_prefix, "builds");
-
- if (enable_threads)
- wasm_runtime_dir = Path.Combine (wasm_runtime_path, use_release_runtime ? "threads-release" : "threads-debug");
- else if (enable_dynamic_runtime)
- wasm_runtime_dir = Path.Combine (wasm_runtime_path, use_release_runtime ? "dynamic-release" : "dynamic-debug");
- else
- wasm_runtime_dir = Path.Combine (wasm_runtime_path, use_release_runtime ? "release" : "debug");
- }
-
- if (is_netcore)
- {
- if (opts.EnableICU)
- {
- foreach (var icudat in Directory.EnumerateFiles(wasm_runtime_dir))
- {
- if (Path.GetFileName(icudat).StartsWith("icudt.dat"))
- {
- file_list.Add(icudat);
- }
- }
- }
- else
- {
- // ICU fails when running with AOT, reason yet unknown
- Console.WriteLine("WARNING: ICU Disabled when using AOT");
- }
- }
-
- var file_list_str = string.Join(",\n", file_list.Distinct().Select(f =>
- {
- var fileName = Path.GetFileName(f).ToLower(); ;
-
- var assetType = Path.GetExtension(f).ToLowerInvariant() switch
- {
- ".dll" => "assembly",
- ".pdb" => "assembly", // PDBs are loaded through https://github.com/dotnet/runtime/blob/55d35231b48ec0a66835a2bd71a968baf8ad9a12/src/mono/wasm/runtime/assets.ts#L411-L412
- ".wasm" => "dotnetwasm",
- ".js" when fileName is "dotnet.native.worker.js" => "js-module-threads",
- ".js" when fileName is "dotnet.native.js" => "js-module-native",
- ".js" when fileName is "dotnet.runtime.js" => "js-module-runtime",
- ".js" when fileName is "dotnet.js" => "js-module-dotnet",
- ".dat" => "icu",
- _ => throw new Exception($"Unsupported asset type")
- };
-
- string cultureField = null;
- string culturePathPrefix = null;
-
- if (assetType is "assembly")
- {
- if(IsResourceAssembly(f, out var culture))
- {
- assetType = "resource";
- cultureField = $", \"culture\":\"{Path.GetFileName(Path.GetDirectoryName(f))}\"";
- culturePathPrefix = $"{culture}/";
- }
- }
-
- return $" {{ \"name\": \"{culturePathPrefix}{Path.GetFileName(f)}\",\"virtualPath\": \"{Path.GetFileName(f)}\", \"loadRemote\": true, \"behavior\":\"{assetType}\" {cultureField} }}";
- }));
- var debugLevel = enable_debug ? " -1" : "0";
-
- // Follow https://github.com/dotnet/runtime/blob/e57438026c25707bf6dd52cd332db657e919bbd4/src/mono/wasm/runtime/dotnet.d.ts#L80
-
- var configOptions = new Dictionary()
- {
- ["assemblyRootFolder"] = $"\"{assembly_root}\"",
- ["debugLevel"] = debugLevel.ToString(),
- };
-
- if (enable_threads)
- {
- configOptions["pthreadPoolSize"] = pthread_pool_size.ToString();
- }
-
- var runtimeOptionsSet = runtimeOptions?.Split(" ")?.ToHashSet() ?? new HashSet(3);
- foreach (var jiterpreterOption in jiterpreterOptions)
- {
- if (opts.EnableJiterpreter)
- {
- if (!runtimeOptionsSet.Contains($"--no-{jiterpreterOption}"))
- {
- runtimeOptionsSet.Add($"--{jiterpreterOption}");
- }
- }
- else
- {
- if (!runtimeOptionsSet.Contains($"--{jiterpreterOption}"))
- {
- runtimeOptionsSet.Add($"--no-{jiterpreterOption}");
- }
- }
- }
-
- configOptions["runtimeOptions"] = $"[{string.Join(",", runtimeOptionsSet.Select(o => $"\"{o}\""))}]";
- configOptions["remoteSources"] = $"[\"{assembly_root}/\"]";
- configOptions["globalizationMode"] = "\"all\"";
-
- var config = $"{{" +
- string.Join(",", configOptions.Select(o => $"\n \t\"{o.Key}\": {o.Value}")) + "," +
- $"\n \t\"assets\": [ " + file_list_str + "]\n" +
- $"}}";
-
- var config_json = Path.Combine(emit_ninja ? builddir : out_prefix, "mono-config.json");
- File.Delete(config_json);
- File.WriteAllText(config_json, config);
-
- if (!emit_ninja) {
- var interp_files = new List { "dotnet.js", "dotnet.native.wasm", "dotnet.runtime.js", "dotnet.native.js" };
-
- if (enable_threads) {
- interp_files.Add ("dotnet.native.worker.js");
- }
- foreach (var fname in interp_files) {
- File.Delete (Path.Combine (out_prefix, fname));
- File.Copy (
- Path.Combine (wasm_runtime_dir, fname),
- Path.Combine (out_prefix, fname));
- }
-
- assets.AsParallel().ForAll(asset =>
- {
- CopyFile(asset,
- Path.Combine(out_prefix, Path.GetFileName(asset)), copyType, "Asset: ");
- });
- }
-
- if (!emit_ninja)
- return 0;
-
- if (builddir == null) {
- Console.Error.WriteLine ("The --builddir argument is required.");
- return 1;
- }
-
- var filenames = new Dictionary ();
- foreach (var a in assemblies) {
- var assembly = a.src_path;
- if (assembly == null)
- continue;
- string filename = Path.GetFileName (assembly);
- if (filenames.ContainsKey (filename) && !filename.EndsWith(".resources.dll", StringComparison.OrdinalIgnoreCase)) {
- Console.WriteLine ("Duplicate input assembly: " + assembly + " " + filenames [filename]);
- return 1;
- }
- filenames [filename] = assembly;
- }
-
- if (build_wasm) {
- if (sdkdir == null) {
- Console.WriteLine ("The --mono-sdkdir argument is required.");
- return 1;
- }
- if (emscripten_sdkdir == null) {
- Console.WriteLine ("The --emscripten-sdkdir argument is required.");
- return 1;
- }
- GenDriver (builddir, profilers, ee_mode, link_icalls);
- }
-
- string runtime_dir;
- string runtime_libdir;
- if (is_netcore) {
- runtime_dir = "$runtimepack_dir/native";
- runtime_libdir = "$runtimepack_dir/native";
- } else {
- runtime_dir = "$mono_sdkdir/wasm-runtime-release";
- runtime_libdir = $"{runtime_dir}/lib";
- }
- string runtime_libs = "";
- if (ee_mode == ExecMode.Interp || ee_mode == ExecMode.AotInterp || link_icalls) {
- runtime_libs += $"$runtime_libdir/libmono-ee-interp.a ";
- // We need to link the icall table because the interpreter uses it to lookup icalls even if the aot-ed icall wrappers are available
- if (!link_icalls)
- runtime_libs += $"$runtime_libdir/libmono-icall-table.a ";
- }
- runtime_libs += $"$runtime_libdir/libmonosgen-2.0.a ";
- if (is_netcore)
- {
- runtime_libs += $"$runtime_libdir/wasm-bundled-timezones.a ";
-
- if (enable_simd)
- {
- runtime_libs += $"$runtime_libdir/libmono-wasm-simd.a ";
- }
- else
- {
- runtime_libs += $"$runtime_libdir/libmono-wasm-nosimd.a ";
- }
-
- runtime_libs += $"$runtime_libdir/libSystem.Native.a ";
- runtime_libs += $"$runtime_libdir/libSystem.IO.Compression.Native.a ";
- runtime_libs += $"$runtime_libdir/libSystem.Globalization.Native.a ";
- runtime_libs += $"$runtime_libdir/libicuuc.a ";
- runtime_libs += $"$runtime_libdir/libicui18n.a ";
- runtime_libs += $"$runtime_libdir/libicudata.a ";
-
- runtime_libs += opts.EnableWasmExceptions
- ? $"$runtime_libdir/libmono-wasm-eh-wasm.a "
- : $"$runtime_libdir/libmono-wasm-eh-js.a ";
-
- if (enable_debug)
- {
- runtime_libs += $"$runtime_libdir/libmono-component-marshal-ilgen-static.a ";
- runtime_libs += $"$runtime_libdir/libmono-component-diagnostics_tracing-static.a ";
- runtime_libs += $"$runtime_libdir/libmono-component-hot_reload-static.a ";
- runtime_libs += $"$runtime_libdir/libmono-component-debugger-static.a ";
- }
- else
- {
- // ilgen is required most of the time and we'll need to include it conditionally
- // when incompatible assemblies are detected: https://github.com/dotnet/runtime/blob/8b25fd382260e8eafbfd77f64b0fe28dc7301c2e/src/tasks/MonoTargetsTasks/MarshalingPInvokeScanner/MarshalingPInvokeScanner.cs#L21
- // runtime_libs += $"$runtime_libdir/libmono-component-marshal-ilgen-stub-static.a ";
-
- // For now, we include the component always, as even basic tests require the component
- // to be linked in.
- runtime_libs += $"$runtime_libdir/libmono-component-marshal-ilgen-static.a ";
-
- runtime_libs += $"$runtime_libdir/libmono-component-diagnostics_tracing-stub-static.a ";
- runtime_libs += $"$runtime_libdir/libmono-component-hot_reload-stub-static.a ";
- runtime_libs += $"$runtime_libdir/libmono-component-debugger-stub-static.a ";
- }
- }
- else
- runtime_libs += $"$runtime_libdir/libmono-native.a ";
-
- string emcc_flags = "";
-
- string aot_args = "llvm-path=\"$emscripten_sdkdir/upstream/bin\",";
- string profiler_libs = "";
- string profiler_aot_args = "";
- foreach (var profiler in profilers) {
- if (is_netcore)
- {
- profiler_libs += $"$runtime_libdir/libmono-profiler-{profiler}.a ";
- }
- else
- {
- profiler_libs += $"$runtime_libdir/libmono-profiler-{profiler}-static.a ";
- }
- if (profiler_aot_args != "")
- profiler_aot_args += " ";
- profiler_aot_args += $"--profile={profiler}";
-
- if (profiler == "aot")
- {
- // related to driver.c conditionals
- emcc_flags += " -DENABLE_AOT_PROFILER=1 ";
- }
- }
- string extra_link_libs = "";
- foreach (var lib in native_libs)
- extra_link_libs += $"{EscapePath(lib)} ";
- if (aot_profile != null) {
- CopyFile (aot_profile, Path.Combine (builddir, Path.GetFileName (aot_profile)), CopyType.IfNewer, "");
- aot_args += $"profile=\"{aot_profile}\",profile-only,";
- }
- if (ee_mode == ExecMode.AotInterp)
- aot_args += "interp,";
- if (build_wasm)
- enable_zlib = true;
- if (is_netcore)
- enable_zlib = false;
-
- wasm_runtime_dir = Path.GetFullPath (wasm_runtime_dir);
- sdkdir = Path.GetFullPath (sdkdir);
- out_prefix = Path.GetFullPath (out_prefix);
-
- string driver_deps = "";
- if (link_icalls)
- driver_deps += " $builddir/icall-table.h";
- if (gen_pinvoke)
- driver_deps += " $builddir/pinvoke-table.h";
- if (enable_lto)
- emcc_flags += "--llvm-lto 1 ";
- if (enable_zlib || is_netcore)
- emcc_flags += "-s USE_ZLIB=1 ";
- if (enable_fs)
- emcc_flags += "-s FORCE_FILESYSTEM=1 ";
- foreach (var pf in preload_files)
- emcc_flags += "--preload-file " + pf + " ";
- foreach (var f in embed_files)
- emcc_flags += "--embed-file " + f + " ";
-
- var emcc_link_flags = new List();
- if (enable_debug || !opts.EmccLinkOptimizations)
- {
- emcc_link_flags.Add("-O0 ");
- }
- else
- {
- emcc_link_flags.Add(linker_optimization_level);
- }
-
- if (enable_threads)
- {
- emcc_link_flags.Add("-s USE_PTHREADS=1");
- emcc_link_flags.Add("-Wno-pthreads-mem-growth");
-
- emcc_flags += "-s USE_PTHREADS=1 ";
- emcc_flags += "-Wno-pthreads-mem-growth ";
-
- aot_compiler_options += " --wasm-gc-safepoints ";
- }
-
- if (opts.EnableWasmExceptions)
- {
- emcc_link_flags.Add("-fwasm-exceptions");
- emcc_flags += " -fwasm-exceptions ";
- aot_compiler_options += " --wasm-exceptions ";
- }
- else
- {
- emcc_flags += " -s DISABLE_EXCEPTION_CATCHING=0 ";
- }
-
- emcc_flags += " -s EXPORT_ES6=1 ";
-
- // https://github.com/dotnet/runtime/blob/0a57a9b20905b1e14993dc4604bad3bdf0b57fa2/src/mono/wasm/wasm.proj#L187
- emcc_exported_runtime_methods.Add("FS");
- emcc_exported_runtime_methods.Add("out");
- emcc_exported_runtime_methods.Add("err");
- emcc_exported_runtime_methods.Add("ccall");
- emcc_exported_runtime_methods.Add("cwrap");
- emcc_exported_runtime_methods.Add("setValue");
- emcc_exported_runtime_methods.Add("getValue");
- emcc_exported_runtime_methods.Add("UTF8ToString");
- emcc_exported_runtime_methods.Add("UTF8ArrayToString");
- emcc_exported_runtime_methods.Add("stringToUTF8Array");
- emcc_exported_runtime_methods.Add("FS_createPath");
- emcc_exported_runtime_methods.Add("FS_createDataFile");
- emcc_exported_runtime_methods.Add("removeRunDependency");
- emcc_exported_runtime_methods.Add("addRunDependency");
- emcc_exported_runtime_methods.Add("addFunction");
- emcc_exported_runtime_methods.Add("safeSetTimeout");
- emcc_exported_runtime_methods.Add("runtimeKeepalivePush");
- emcc_exported_runtime_methods.Add("runtimeKeepalivePop");
- emcc_exported_runtime_methods.Add("maybeExit");
-
- // Additional uno-only exports
- emcc_exported_runtime_methods.Add("FS_readFile");
- emcc_exported_runtime_methods.Add("lengthBytesUTF8");
- emcc_exported_runtime_methods.Add("stringToUTF8");
- emcc_exported_runtime_methods.Add("removeFunction");
- emcc_exported_runtime_methods.Add("IDBFS");
- emcc_exported_runtime_methods.Add("print");
-
- var exports = string.Join(",", emcc_exported_runtime_methods.Distinct().Select(m => $"\'{m}\'"));
-
- emcc_link_flags.Add("-s EXPORTED_RUNTIME_METHODS=\"[" + exports + "]\"");
-
- // https://github.com/dotnet/runtime/blob/0a57a9b20905b1e14993dc4604bad3bdf0b57fa2/src/mono/wasm/wasm.proj#L202
- List exportedFunctions = new()
- {
- "_fmod" ,
- "_atan2" ,
- "_fma" ,
- "_pow" ,
- "_fmodf" ,
- "_atan2f" ,
- "_fmaf" ,
- "_powf" ,
-
- "_asin" ,
- "_asinh" ,
- "_acos" ,
- "_acosh" ,
- "_atan" ,
- "_atanh" ,
- "_cbrt" ,
- "_cos" ,
- "_cosh" ,
- "_exp" ,
- "_log" ,
- "_log2" ,
- "_log10" ,
- "_sin" ,
- "_sinh" ,
- "_tan" ,
- "_tanh" ,
-
- "_asinf" ,
- "_asinhf" ,
- "_acosf" ,
- "_acoshf" ,
- "_atanf" ,
- "_atanhf" ,
- "_cbrtf" ,
- "_cosf" ,
- "_coshf" ,
- "_expf" ,
- "_logf" ,
- "_log2f" ,
- "_log10f" ,
- "_sinf" ,
- "_sinhf" ,
- "_tanf" ,
- "_tanhf" ,
-
- // Uno specific
- "_malloc" ,
- "stackSave",
- "stackRestore",
- "stackAlloc",
- "_memalign",
- "_memset",
- "_htons",
- "_ntohs",
- "_free"
- };
-
- if (enable_threads)
- {
- // https://github.com/dotnet/runtime/blob/6c3a197c4e01bb40c58e7c88370f92acbd53d81c/src/mono/wasm/wasm.proj#L265
- exportedFunctions.Add("_emscripten_main_runtime_thread_id");
- }
-
- var exportedFunctionsValue = string.Join(",", exportedFunctions.Distinct());
- emcc_link_flags.Add($"-s EXPORTED_FUNCTIONS={exportedFunctionsValue}");
-
- // workaround for https://github.com/emscripten-core/emscripten/issues/18034
- emcc_link_flags.Add($"-s TEXTDECODER=0");
-
- // Align with https://github.com/dotnet/runtime/blob/0a57a9b20905b1e14993dc4604bad3bdf0b57fa2/src/mono/wasm/wasm.proj#L279
- emcc_link_flags.Add("-s EXPORT_ES6=1");
- emcc_link_flags.Add("-s ALLOW_MEMORY_GROWTH=1");
- emcc_link_flags.Add("-s NO_EXIT_RUNTIME=1");
- emcc_link_flags.Add("-s FORCE_FILESYSTEM=1");
-
- emcc_link_flags.Add("--source-map-base http://example.com");
- emcc_link_flags.Add("-s EXPORT_NAME=\"'createDotnetRuntime'\"");
- emcc_link_flags.Add("-s MODULARIZE=1");
- emcc_link_flags.Add("-s ENVIRONMENT=\"web,webview,worker,node,shell\"");
-
- emcc_link_flags.Add("-s ALLOW_TABLE_GROWTH=1");
- emcc_link_flags.Add($"-s STACK_SIZE={wasmStackSize}");
-
- emcc_link_flags.Add("-s WASM_BIGINT=1");
- emcc_link_flags.Add("-s ERROR_ON_UNDEFINED_SYMBOLS=1");
- emcc_link_flags.Add("-s \"DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=[\'memset\']\"");
-
- // https://github.com/dotnet/runtime/blob/0a57a9b20905b1e14993dc4604bad3bdf0b57fa2/src/mono/wasm/wasm.proj#L303
- emcc_link_flags.Add("-Wno-limited-postlink-optimizations");
-
- var failOnError = is_windows
- ? "; if ($$LastExitCode -ne 0) { exit 1; }"
- : "";
-
- if (enable_simd) {
- aot_args += "mattr=simd,";
- emcc_flags += "-msimd128 ";
- emcc_flags += "-DCONFIGURATION_COMPILE_OPTIONS=\"-msimd128\" -DCONFIGURATION_INTERPSIMDTABLES_LIB=\"simd\" ";
- }
-
- if (print_skipped_aot_methods)
- {
- aot_args += "print-skipped,";
- }
-
- if (is_netcore) {
- emcc_flags += $"-DGEN_PINVOKE -I{src_prefix} ";
-
- // No need to emit LLVM, we're not using LTO options
- // emcc_flags += $"-emit-llvm ";
- }
- if (!use_release_runtime)
- // -s ASSERTIONS=2 is very slow
- emcc_flags += "-s ASSERTIONS=1 ";
-
- if (!string.IsNullOrEmpty(extra_emccflags)) {
- emcc_flags += " " + extra_emccflags + " ";
- }
-
- var ninja = File.CreateText (Path.Combine (builddir, "build.ninja"));
- var linkerResponse = Path.Combine (builddir, "linker.rsp");
-
- // Defines
- ninja.WriteLine ($"mono_sdkdir = {sdkdir}");
- ninja.WriteLine ($"emscripten_sdkdir = {emscripten_sdkdir}");
- ninja.WriteLine ($"tool_prefix = {tool_prefix}");
- ninja.WriteLine ($"appdir = {out_prefix}");
- ninja.WriteLine ($"builddir = .");
- if (is_netcore)
- ninja.WriteLine ($"runtimepack_dir = {runtimepack_dir}");
- ninja.WriteLine ($"wasm_runtime_dir = {wasm_runtime_dir}");
- ninja.WriteLine ($"runtime_libdir = {runtime_libdir}");
- ninja.WriteLine ($"deploy_prefix = {assembly_root}");
- ninja.WriteLine ($"bcl_dir = {bcl_prefix}");
- ninja.WriteLine ($"bcl_facades_dir = {bcl_facades_prefix}");
- ninja.WriteLine ($"framework_dir = {framework_prefix}");
- ninja.WriteLine ($"tools_dir = {bcl_tools_prefix}");
- ninja.WriteLine ($"linker_dir = {illinker_path}");
-
- if (!is_windows)
- {
- // emsdk is setup from the bootstrapper to avoid concurrency issues
- // in the emsdk environment setup tooling
- ninja.WriteLine($"emsdk_env = $builddir/emsdk_env.sh");
- }
- else
- {
- ninja.WriteLine($"emsdk_env = emsdkenv.cmd");
- }
-
- if (add_binding) {
- ninja.WriteLine ($"wasm_core_bindings = $builddir/{BINDINGS_MODULE}");
- ninja.WriteLine ($"wasm_core_support = {wasm_core_support}");
- ninja.WriteLine ($"wasm_core_support_library = {wasm_core_support_library}");
- } else {
- ninja.WriteLine ("wasm_core_bindings =");
- ninja.WriteLine ("wasm_core_support =");
- ninja.WriteLine ("wasm_core_support_library =");
- }
-
- if (is_netcore)
- {
- var ext = is_windows ? ".exe" : "";
- ninja.WriteLine ($"cross = $runtimepack_dir/native/cross/browser-wasm/mono-aot-cross{ext}");
- }
- else
- {
- ninja.WriteLine ("cross = $mono_sdkdir/wasm-cross-release/bin/wasm32-unknown-none-mono-sgen");
- }
-
- if (Environment.OSVersion.Platform != PlatformID.Win32NT)
- {
- ninja.WriteLine ("emcc = source $emsdk_env && PYTHONUTF8=1 LC_ALL=C.UTF-8 emcc");
- }
- else
- {
- ninja.WriteLine("emcc = $$env:PYTHONUTF8=1; emcc ");
- }
-
- ninja.WriteLine ("wasm_opt = $emscripten_sdkdir/upstream/bin/wasm-opt");
- ninja.WriteLine ($"emcc_flags = -DENABLE_METADATA_UPDATE=1 {emcc_flags} ");
- ninja.WriteLine ($"aot_base_args = llvmonly,asmonly,no-opt,static,direct-icalls,deterministic,nodebug,{aot_args}");
-
- var environment = new List
- {
- "MONO_PATH=$mono_path"
- };
-
- if (enable_threads)
- {
- // environment.Add("MONO_THREADS_SUSPEND=coop");
- }
-
- var response_prefix = is_windows
- ? "`@"
- : "@";
-
- var aot_cross_prefix = is_windows
- ? $"cmd /c set \"MONO_PATH=$mono_path\" &&" + string.Join(" ", environment.Select(e => $"set \"{e}\" &&"))
- : string.Join(" ", environment);
-
- // Rules
- ninja.WriteLine ("rule aot");
- ninja.WriteLine ($" command = {aot_cross_prefix} $cross --debug {profiler_aot_args} {aot_compiler_options} --aot=$aot_args,$aot_base_args,depfile=$depfile,llvm-outfile=$outfile $src_file");
- ninja.WriteLine (" description = [AOT] $src_file -> $outfile");
-
- ninja.WriteLine ("rule aot-instances");
- ninja.WriteLine ($" command = {aot_cross_prefix} $cross --response=$builddir/aot-instances.rsp");
- ninja.WriteLine ($" rspfile = $builddir/aot-instances.rsp");
- ninja.WriteLine ($" rspfile_content = --debug {profiler_aot_args} {aot_compiler_options} --aot=$aot_base_args,llvm-outfile=$outfile,dedup-include=$dedup_image $src_files");
- ninja.WriteLine (" description = [AOT-INSTANCES] $outfile");
-
- ninja.WriteLine ("rule mkdir");
- if (Environment.OSVersion.Platform != PlatformID.Win32NT)
- {
- ninja.WriteLine(" command = mkdir -p $out");
- }
- else
- {
- ninja.WriteLine(" command = powershell mkdir -Force -p '$out' | Out-Null");
- }
-
- var cpCommand = Environment.OSVersion.Platform == PlatformID.Win32NT ? "copy" : "cp";
- var commandPrefix = Environment.OSVersion.Platform == PlatformID.Win32NT ? "powershell " : "";
-
- if (Environment.OSVersion.Platform != PlatformID.Win32NT)
- {
- ninja.WriteLine ("rule cp");
- ninja.WriteLine ($" command = {commandPrefix} {cpCommand} $in $out");
- ninja.WriteLine ($" description = [CP] $in -> $out");
- ninja.WriteLine("rule cpifdiff");
- // Copy $in to $out only if it changed
- ninja.WriteLine ($" command = /bin/bash -c \"if cmp -s $in $out ; then : ; else {cpCommand} $in $out ; fi\"");
-
- ninja.WriteLine ("rule cpifdiffex");
- ninja.WriteLine ($" command = /bin/bash -c \"if [ -f $in ] && [ `cmp -s $in $out` ] ; then : ; else {cpCommand} $in $out ; fi\"");
-
- ninja.WriteLine (" restat = true");
- ninja.WriteLine (" description = [CPIFDIFFEX] $in -> $out");
- }
- else
- {
- ninja.WriteLine ("rule cp");
- ninja.WriteLine ($" command = cmd /V:ON /c set \"in1=$in\" & set \"in2=!in1:/=\\!\" & set \"out1=$out\" & set \"out2=!out1:/=\\!\" & copy /y !in2! !out2! 1> NUL");
- ninja.WriteLine ($" description = [CP] $in -> $out");
-
- ninja.WriteLine ("rule cpifdiff");
- ninja.WriteLine ($" command = cmd /V:ON /c set \"in1=$in\" & set \"in2=!in1:/=\\!\" & set \"out1=$out\" & set \"out2=!out1:/=\\!\" & copy /y !in2! !out2! 1> NUL");
- ninja.WriteLine ($" description = [CPIFDIFF] $in -> $out");
-
- ninja.WriteLine ("rule cpifdiffex");
- ninja.WriteLine ($" command = cmd /V:ON /c set \"in1=$in\" & set \"in2=!in1:/=\\!\" & set \"out1=$out\" & set \"out2=!out1:/=\\!\" & if exist !in2! copy /y !in2! !out2! 1> NUL");
- ninja.WriteLine ( " restat = true");
- ninja.WriteLine ( " description = [CPIFDIFFEX] $in -> $out");
- }
-
- var emcc_shell_prefix = is_windows
- ? "powershell"
- : "bash -c";
-
- var tools_shell_prefix = is_windows
- ? "powershell"
- : "";
-
- ninja.WriteLine("rule create-emsdk-env");
-
- if (is_windows)
- {
- ninja.WriteLine($" command = cmd /c \"$emscripten_sdkdir/emsdk.bat\" construct_env > $out");
- }
- else
- {
- ninja.WriteLine($" command = {tools_shell_prefix} \"$emscripten_sdkdir/emsdk\" construct_env > $out");
- }
-
- ninja.WriteLine ("rule emcc");
- ninja.WriteLine ($" command = {emcc_shell_prefix} \"$emcc $emcc_flags $flags -Oz -c -o $out $in\"");
- ninja.WriteLine (" description = [EMCC] $in -> $out");
-
- var src_prefix_es6 = Path.Combine(src_prefix, "es6") + Path.DirectorySeparatorChar;
-
- // Additional parameters are not supported in the same way between linux and windows.
- var jsAdditionals =
- $"--pre-js {src_prefix_es6}dotnet.es6.pre.js " +
- $"--js-library {src_prefix_es6}dotnet.es6.lib.js " +
- $"--extern-post-js {src_prefix_es6}dotnet.es6.extpost.js " +
- wasm_core_support_library;
-
- var emcc_link_additionals_command = is_windows ? jsAdditionals : "";
- var emcc_link_additionals_response = is_windows ? "" : jsAdditionals;
-
- // Prevents https://github.com/emscripten-core/emscripten/blob/347262aec9c4450e34b6af617d1420dbda2f6662/src/preamble.js#L945 to remove
- // the `env` member: https://github.com/emscripten-core/emscripten/blob/347262aec9c4450e34b6af617d1420dbda2f6662/emcc.py#L2534
- // which is being used here: https://github.com/dotnet/runtime/blob/e131899322693dff60b835a83bbf02f7916e3991/src/mono/wasm/runtime/startup.ts#LL446C1-L446C10
- emcc_link_flags.Add("-s ASSERTIONS=1");
-
- ninja.WriteLine("rule emcc-link");
- ninja.WriteLine($" command = {emcc_shell_prefix} \"$emcc {response_prefix}$builddir/emcc_link.rsp {emcc_link_additionals_command} {failOnError} \"");
- ninja.WriteLine($" rspfile = $builddir/emcc_link.rsp");
- ninja.WriteLine($" rspfile_content = $emcc_flags {string.Join(" ", emcc_link_flags)} -v -o \"$out_js\" -s MODULARIZE=1 {emcc_link_additionals_response} $in");
- ninja.WriteLine($" description = [EMCC-LINK] $in -> $out");
-
- ninja.WriteLine ("rule linker");
- var linkerBin = "dotnet \'$linker_dir/illink.dll\'";
-
- var assemblyRefPaths = assembly_references.Distinct().Select(p => $"-reference \"{p}\" ");
- var linkerSearchPaths = root_search_paths.Concat(bcl_prefixes).Distinct().Select(p => $"-d \"{p}\" ");
-
- var tunerBinary = string.IsNullOrEmpty(wasm_tuner_path)
- ? $"$tools_dir{Path.DirectorySeparatorChar}wasm-tuner.dll"
- : wasm_tuner_path;
-
- var tunerCommand = $"dotnet '{tunerBinary}'";
-
- var exitCommand = is_windows ? failOnError : "|| exit 1";
-
- linker_args.Add($"-out ./linker-out --deterministic --disable-opt unreachablebodies");
- linker_args.Add($"--strip-link-attributes");
- linker_args.Add(extra_linkerflags);
- linker_args.AddRange(assemblyRefPaths);
- linker_args.AddRange(linkerSearchPaths);
-
- ninja.WriteLine ($" command = {tools_shell_prefix} {linkerBin} \'@{linkerResponse}\' {exitCommand}; {tunerCommand} --gen-empty-assemblies \'@$builddir/tuner.rsp\'");
- ninja.WriteLine (" rspfile = $builddir/tuner.rsp");
- ninja.WriteLine (" rspfile_content = $out");
- ninja.WriteLine (" description = [IL-LINK]");
- ninja.WriteLine ("rule aot-instances-dll");
-
- if (is_windows)
- {
- ninja.WriteLine($" command = cmd /c \"dotnet new classlib -o aot-instances && del aot-instances\\*.cs && dotnet build aot-instances\\aot-instances.csproj /r -p:Deterministic=true -p:ImplicitUsings=false -p:TargetFramework={target_framework} -p:UseSharedCompilation=false /p:OutputPath=..\\linker-out\"");
- }
- else
- {
- ninja.WriteLine($" command = dotnet new classlib -o aot-instances; rm aot-instances/*.cs; dotnet build aot-instances/aot-instances.csproj /r -p:Deterministic=true -p:ImplicitUsings=false -p:TargetFramework={target_framework} -p:UseSharedCompilation=false /p:OutputPath=../linker-out/");
- }
-
- ninja.WriteLine ("rule gen-runtime-icall-table");
- ninja.WriteLine ($" command = {aot_cross_prefix} $cross --print-icall-table > $out");
- ninja.WriteLine ("rule gen-icall-table");
- ninja.WriteLine ($" command = {tools_shell_prefix} {tunerCommand} --gen-icall-table $out $runtime_table $in");
- ninja.WriteLine ("rule gen-pinvoke-table");
- ninja.WriteLine ($" command = {tools_shell_prefix} {tunerCommand} --gen-pinvoke-table \'@$builddir/gen-pinvoke.rsp\'");
- ninja.WriteLine ($" rspfile = $builddir/gen-pinvoke.rsp");
- ninja.WriteLine ($" rspfile_content = $out $pinvoke_libs $in");
- ninja.WriteLine ("rule ilstrip");
- ninja.WriteLine ($" command = {commandPrefix} {cpCommand} $in $out; mono $tools_dir/mono-cil-strip.exe -q $out");
- ninja.WriteLine (" description = [IL-STRIP]");
-
- // Targets
- ninja.WriteLine ("build $appdir: mkdir");
- ninja.WriteLine ("build $appdir/$deploy_prefix: mkdir");
- ninja.WriteLine ("build $appdir/runtime.js: cpifdiff $builddir/runtime.js");
- ninja.WriteLine ("build $appdir/mono-config.json: cpifdiff $builddir/mono-config.json");
- if (build_wasm) {
- var source_file = Path.GetFullPath(Path.Combine(src_prefix, "driver.c"));
- ninja.WriteLine($"build $builddir/driver.c: cpifdiff {EscapePath(source_file)}");
- ninja.WriteLine($"build $builddir/driver-gen.c: cpifdiff $builddir/driver-gen.c.in");
- source_file = Path.GetFullPath(Path.Combine(src_prefix, "pinvoke.c"));
- ninja.WriteLine($"build $builddir/pinvoke.c: cpifdiff {EscapePath(source_file)}");
- source_file = Path.GetFullPath(Path.Combine(src_prefix, "pinvoke.h"));
- ninja.WriteLine($"build $builddir/pinvoke.h: cpifdiff {EscapePath(source_file)}");
-
- if (!is_netcore)
- {
- var pinvoke_file_name = is_netcore ? "pinvoke-table.h" : "pinvoke-tables-default.h";
- var pinvoke_file = Path.GetFullPath(Path.Combine(src_prefix, pinvoke_file_name));
- ninja.WriteLine($"build $builddir/pinvoke-tables-default.h: cpifdiff {EscapePath(pinvoke_file)}");
- driver_deps += $" $builddir/pinvoke-tables-default.h";
- }
-
- var driver_cflags = enable_aot ? "-DENABLE_AOT=1" : "";
-
- if (add_binding) {
- var bindings_source_file = Path.GetFullPath (Path.Combine (src_prefix, "corebindings.c"));
- ninja.WriteLine ($"build $builddir/corebindings.c: cpifdiff {EscapePath(bindings_source_file)}");
-
- ninja.WriteLine ($"build $builddir/corebindings.o: emcc $builddir/corebindings.c | $emsdk_env");
- ninja.WriteLine ($" flags = -I{runtime_dir}/include/mono-2.0");
- driver_cflags += " -DCORE_BINDINGS ";
- }
- if (gen_pinvoke)
- driver_cflags += " -DGEN_PINVOKE ";
- if (is_netcore)
- driver_cflags += " -DENABLE_NETCORE ";
-
- ninja.WriteLine ("build $emsdk_env: create-emsdk-env");
- ninja.WriteLine ($"build $builddir/driver.o: emcc $builddir/driver.c | $emsdk_env $builddir/driver-gen.c {driver_deps}");
- ninja.WriteLine ($" flags = {driver_cflags} -DDRIVER_GEN=1 -I{runtime_dir}/include/mono-2.0");
- ninja.WriteLine ($"build $builddir/pinvoke.o: emcc $builddir/pinvoke.c | $emsdk_env {driver_deps}");
- ninja.WriteLine ($" flags = {driver_cflags} -DDRIVER_GEN=1 -I{runtime_dir}/include/mono-2.0");
-
- foreach (var nativeCompile in native_compile)
- {
- var fileName = Path.GetFileName(nativeCompile);
- var fileNameWithoutExt = Path.GetFileNameWithoutExtension(nativeCompile);
-
- ninja.WriteLine($"build $builddir/{fileName}: cpifdiff {EscapePath(source_file)}");
- ninja.WriteLine($"build $builddir/{fileNameWithoutExt}.o: emcc {EscapePath(nativeCompile)} | $emsdk_env {driver_deps}");
- ninja.WriteLine($" flags = {driver_cflags} -DDRIVER_GEN=1 -I{runtime_dir}/include/mono-2.0");
- }
-
- if (enable_zlib) {
- var zlib_source_file = Path.GetFullPath (Path.Combine (src_prefix, "zlib-helper.c"));
- ninja.WriteLine ($"build $builddir/zlib-helper.c: cpifdiff {EscapePath(zlib_source_file)}");
-
- ninja.WriteLine ($"build $builddir/zlib-helper.o: emcc $builddir/zlib-helper.c | $emsdk_env");
- ninja.WriteLine ($" flags = -s USE_ZLIB=1 -I{runtime_dir}/include/mono-2.0");
- }
- } else {
- ninja.WriteLine ("build $appdir/dotnet.native.js: cpifdiff $wasm_runtime_dir/dotnet.native.js");
- ninja.WriteLine ("build $appdir/dotnet.native.wasm: cpifdiff $wasm_runtime_dir/dotnet.native.wasm");
- if (enable_threads) {
- ninja.WriteLine ("build $appdir/dotnet.native.worker.js: cpifdiff $wasm_runtime_dir/dotnet.native.worker.js");
- }
- }
- if (enable_aot)
- ninja.WriteLine ("build $builddir/aot-in: mkdir");
- {
- var list = new List();
-
- if (!is_netcore)
- {
- list.Add("linker-preserves.xml");
- list.Add("linker-subs.xml");
- list.Add("linker-disable-collation.xml");
- }
-
- foreach (var file in list) {
- var source_file = Path.GetFullPath (Path.Combine (src_prefix, file));
- ninja.WriteLine ($"build $builddir/{file}: cpifdiff {EscapePath(source_file)}");
- }
- }
- var ofiles = "";
- var bc_files = "";
- string linker_infiles = "";
- string linker_ofiles = "";
- string linker_ofiles_dedup = "";
- string dedup_infiles = "";
- if (enable_linker) {
- string path = Path.Combine (builddir, "linker-in");
- if (!Directory.Exists (path))
- Directory.CreateDirectory (path);
- }
- string aot_in_path = enable_linker ? Path.Combine("$builddir","linker-out") : "$builddir";
- foreach (var a in assemblies) {
- var assembly = a.src_path;
- if (assembly == null)
- continue;
- string filename = Path.GetFileName (assembly);
-
- if(a.culture is not null)
- {
- filename = Path.Combine(a.culture, filename);
- }
-
- var filename_noext = Path.GetFileNameWithoutExtension (filename);
- string filename_pdb = Path.ChangeExtension (filename, "pdb");
- var source_file_path = Path.GetFullPath (assembly);
- var source_file_path_pdb = Path.ChangeExtension (source_file_path, "pdb");
- string infile = "";
- string infile_pdb = "";
- bool emit_pdb = assemblies_with_dbg_info.Contains (source_file_path_pdb);
- if (enable_linker) {
- a.linkin_path = Path.Combine("$builddir", "linker-in", filename);
- a.linkin_pdb_path = Path.Combine("$builddir", "linker-in", filename_pdb);
- a.linkout_path = Path.Combine("$builddir", "linker-out", filename);
- a.linkout_pdb_path = Path.Combine("$builddir", "linker-out", filename_pdb);
- linker_infiles += $"{a.linkin_path} ";
- linker_ofiles += $" {a.linkout_path}";
-
- if (a.aot) {
- linker_ofiles_dedup += $" {a.linkout_path}";
- }
- ninja.WriteLine ($"build {a.linkin_path}: cp {EscapePath(source_file_path)}");
- if (File.Exists(source_file_path_pdb)) {
- ninja.WriteLine($"build {a.linkin_pdb_path}: cp {EscapePath(source_file_path_pdb)}");
- linker_ofiles += $" {a.linkout_pdb_path}";
- infile_pdb = a.linkout_pdb_path;
- }
- a.aotin_path = a.linkout_path;
- infile = $"{a.aotin_path}";
- } else {
- infile = Path.Combine("$builddir", filename);
- ninja.WriteLine ($"build $builddir/{filename}: cpifdiff {EscapePath(source_file_path)}");
- a.linkout_path = infile;
- if (emit_pdb) {
- ninja.WriteLine ($"build $builddir/{filename_pdb}: cpifdiffex {EscapePath(source_file_path_pdb)}");
- infile_pdb = $"$builddir/{filename_pdb}";
- }
- }
-
- a.final_path = infile;
- if (il_strip) {
- ninja.WriteLine ($"build $builddir/ilstrip-out/{filename} : ilstrip {infile}");
- a.final_path = $"$builddir/ilstrip-out/{filename}";
- }
-
- ninja.WriteLine ($"build $appdir/$deploy_prefix/{filename}: cpifdiff {EscapePath(a.final_path)}");
- if (emit_pdb && infile_pdb != "")
- ninja.WriteLine ($"build $appdir/$deploy_prefix/{filename_pdb}: cpifdiffex {EscapePath(infile_pdb)}");
- if (a.aot) {
- a.bc_path = $"$builddir/{filename}.bc";
- a.o_path = $"$builddir/{filename}.o";
- a.aot_depfile_path = $"$builddir/linker-out/{filename}.depfile";
-
- if (filename == "mscorlib.dll") {
- // mscorlib has no dependencies so we can skip the aot step if the input didn't change
- // The other assemblies depend on their references
- infile = "$builddir/aot-in/mscorlib.dll";
- a.aotin_path = infile;
- ninja.WriteLine ($"build {a.aotin_path}: cpifdiff {EscapePath(a.linkout_path)}");
- }
- ninja.WriteLine ($"build {a.bc_path}.tmp: aot {infile}");
- ninja.WriteLine ($" src_file={infile}");
- ninja.WriteLine ($" outfile={a.bc_path}.tmp");
- if (is_windows)
- {
- ninja.WriteLine($" mono_path={aot_in_path}");
- }
- else
- {
- ninja.WriteLine($" mono_path=$builddir/aot-in:{aot_in_path}");
- }
- ninja.WriteLine ($" depfile={a.aot_depfile_path}");
- if (enable_dedup)
- ninja.WriteLine ($" aot_args=dedup-skip");
-
- ninja.WriteLine ($"build {a.bc_path}: cpifdiff {EscapePath(a.bc_path)}.tmp");
- ninja.WriteLine ($"build {a.o_path}: emcc {a.bc_path} | $emsdk_env");
-
- ofiles += " " + $"{a.o_path}";
- bc_files += " " + $"{a.bc_path}";
- dedup_infiles += $" {a.aotin_path}";
- }
- }
- if (enable_dedup) {
- /*
- * Run the aot compiler in dedup mode:
- * mono --aot=,dedup-include=aot-instances.dll aot-instances.dll
- * This will process all assemblies and emit all instances into the aot image of aot-instances.dll
- */
- var a = dedup_asm;
- /*
- * The dedup process will read in the .dedup files created when running with dedup-skip, so add all the
- * .bc files as dependencies.
- */
- ninja.WriteLine ($"build {a.bc_path}.tmp: aot-instances | {bc_files} {a.linkout_path}");
- ninja.WriteLine ($" dedup_image={a.filename}");
- ninja.WriteLine ($" src_files={dedup_infiles} {a.linkout_path}");
- ninja.WriteLine ($" outfile={a.bc_path}.tmp");
-
- if (is_windows)
- {
- ninja.WriteLine($" mono_path={aot_in_path}");
- }
- else
- {
- ninja.WriteLine($" mono_path=$builddir/aot-in:{aot_in_path}");
- }
-
- ninja.WriteLine ($"build {a.app_path}: cpifdiff {EscapePath(a.linkout_path)}");
- ninja.WriteLine ($"build {a.linkout_path}: aot-instances-dll");
- // The dedup image might not have changed
- ninja.WriteLine ($"build {a.bc_path}: cpifdiff {EscapePath(a.bc_path)}.tmp");
- ninja.WriteLine ($"build {a.o_path}: emcc {a.bc_path} | $emsdk_env");
- ofiles += $" {a.o_path}";
- }
-
- if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
- {
- ninja.WriteLine("build $builddir/icall-table.json: gen-runtime-icall-table");
- }
-
- if (link_icalls) {
-
- string icall_assemblies = "";
- foreach (var a in assemblies.Where(a => a.culture is null)) {
- if (a.name == "mscorlib" || a.name == "System")
- icall_assemblies += $"{a.linkout_path} ";
- }
- ninja.WriteLine ($"build $builddir/icall-table.h: gen-icall-table {icall_assemblies}");
- ninja.WriteLine ($" runtime_table=$builddir/icall-table.json");
- }
- else
- {
- // Fake a command so that __static_icalls__ gets to the tuner
- ninja.WriteLine ("build __static_icalls__: mkdir");
- }
- if (gen_pinvoke) {
- string pinvoke_assemblies = "";
- foreach (var a in assemblies.Where(a => a.culture is null))
- pinvoke_assemblies += $"{a.linkout_path} ";
-
- ninja.WriteLine ($"build $builddir/pinvoke-table.h: cpifdiff $builddir/pinvoke-table.h.tmp");
-
- var icallTable = RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? "__static_icalls__" : "$builddir/icall-table.json";
- ninja.WriteLine ($"build $builddir/pinvoke-table.h.tmp: gen-pinvoke-table {icallTable} {pinvoke_assemblies}");
-
- if (is_netcore)
- {
- ninja.WriteLine($" pinvoke_libs=libSystem.Native,libSystem.IO.Compression.Native,libSystem.Globalization.Native,QCall,{pinvoke_libs}");
- }
- else
- {
- ninja.WriteLine($" pinvoke_libs=System.Native,{pinvoke_libs}");
- }
- }
- if (build_wasm) {
- string zlibhelper = enable_zlib ? "$builddir/zlib-helper.o" : "";
-
- var native_compile_params = string.Join(" ", native_compile.Select(f => $"$builddir/{Path.GetFileNameWithoutExtension(f)}.o"));
-
- ninja.WriteLine ($"build $appdir/dotnet.native.js $appdir/dotnet.native.wasm: emcc-link $builddir/driver.o $builddir/pinvoke.o {native_compile_params} {zlibhelper} {wasm_core_bindings} {ofiles} {profiler_libs} {extra_link_libs} {runtime_libs} | {EscapePath(src_prefix)}/es6/dotnet.es6.lib.js {wasm_core_support} $emsdk_env");
- ninja.WriteLine ($" out_wasm=$appdir/dotnet.native.wasm");
- ninja.WriteLine ($" out_js=$appdir/dotnet.native.js");
- }
- if (enable_linker) {
- switch (linkMode) {
- case LinkMode.SdkOnly:
- usermode = "copy";
- break;
- case LinkMode.All:
- usermode = "link";
- break;
- default:
- usermode = "link";
- break;
- }
-
- // Removed because of https://github.com/dotnet/runtime/issues/65325
- //if (enable_aot)
- // // Only used by the AOT compiler
- // linker_args.Add("--explicit-reflection ");
-
- // disabled to align with the .NET SDK default behavior (https://github.com/dotnet/runtime/issues/90745)
- // linker_args.Add("--used-attrs-only true ");
-
- if (!is_netcore)
- {
- linker_args.Add("--substitutions linker-subs.xml ");
- linker_infiles += "| linker-subs.xml ";
- linker_args.Add("-x linker-preserves.xml ");
- linker_infiles += "linker-preserves.xml ";
- }
-
- if (opts.LinkerExcludeDeserialization && !is_netcore)
- linker_args.Add("--exclude-feature deserialization ");
-
- if (!opts.EnableCollation && !is_netcore) {
- linker_args.Add("--substitutions linker-disable-collation.xml ");
- linker_infiles += "linker-disable-collation.xml";
- }
- if (opts.Debug) {
- linker_args.Add("-b true ");
- }
- if (!string.IsNullOrEmpty (linkDescriptor)) {
- linker_args.Add($"-x {linkDescriptor} ");
- foreach (var assembly in root_assemblies) {
- string filename = Path.GetFileName (assembly);
- linker_args.Add($"-p {usermode} {filename} -r linker-in/{filename} ");
- }
- } else {
- foreach (var assembly in root_assemblies) {
- string filename = Path.GetFileName (assembly);
- linker_args.Add($"-a linker-in/{filename} {(IsSupportAssembly(filename) ? string.Empty : "entrypoint")} ");
- }
- }
-
- if (linker_verbose) {
- linker_args.Add("--verbose ");
- }
- linker_args.Add($"-d linker-in -d {bcl_prefix} -d {bcl_facades_prefix} -d {bcl_facades_prefix} ");
-
- // Metadata linking https://github.com/mono/linker/commit/fafb6cf6a385a8c753faa174b9ab7c3600a9d494
- linker_args.Add($"--keep-metadata all ");
-
- linker_args.Add($" --verbose ");
-
- ninja.WriteLine ("build $builddir/linker-out: mkdir");
- ninja.WriteLine ($"build {linker_ofiles}: linker {linker_infiles}");
-
- File.WriteAllLines(linkerResponse, linker_args);
- }
- if (il_strip)
- ninja.WriteLine ("build $builddir/ilstrip-out: mkdir");
-
- foreach(var asset in assets) {
- var filename = Path.GetFileName (asset);
- var abs_path = Path.GetFullPath (asset);
- ninja.WriteLine ($"build $appdir/{filename}: cpifdiff {abs_path}");
- }
-
- ninja.Close ();
-
- return 0;
- }
-
- private bool IsResourceAssembly(string f, out string culture)
- {
- if (f.EndsWith(".resources.dll", StringComparison.OrdinalIgnoreCase))
- {
- var originalAssembly = Path.GetFileName(f.Replace(".resources.dll", ".dll", StringComparison.OrdinalIgnoreCase));
-
- var resourceAssemblyDirectory = Path.GetDirectoryName(Path.GetDirectoryName(f));
- if (File.Exists(Path.Combine(resourceAssemblyDirectory, originalAssembly)))
- {
- culture = Path.GetFileName(Path.GetDirectoryName(f));
-
- return true;
- }
- }
-
- culture = null;
- return false;
- }
-
- private static bool IsSupportAssembly(string filename)
- =>
- filename switch
- {
- "Uno.Wasm.AotProfiler.dll" => true,
- "Uno.Wasm.LogProfiler.dll" => true,
- "Uno.Wasm.MetadataUpdater.dll" => true,
- _ => false
- };
-
- static void CopyFile(string sourceFileName, string destFileName, CopyType copyType, string typeFile = "")
- {
- Console.WriteLine($"{typeFile}cp: {copyType} - {sourceFileName} -> {destFileName}");
-
- Directory.CreateDirectory(Path.GetDirectoryName(destFileName));
-
- switch (copyType)
- {
- case CopyType.Always:
- File.Copy(sourceFileName, destFileName, true);
- break;
- case CopyType.IfNewer:
- if (!File.Exists(destFileName))
- {
- File.Copy(sourceFileName, destFileName);
- }
- else
- {
- var srcInfo = new FileInfo (sourceFileName);
- var dstInfo = new FileInfo (destFileName);
-
- if (srcInfo.LastWriteTime.Ticks > dstInfo.LastWriteTime.Ticks || srcInfo.Length > dstInfo.Length)
- File.Copy(sourceFileName, destFileName, true);
- else
- Console.WriteLine($" skipping: {sourceFileName}");
- }
- break;
- default:
- File.Copy(sourceFileName, destFileName);
- break;
- }
-
- }
-
- private string EscapePath(string path)
- => path.Replace(" ", "$ ").Replace(":", "$:");
-}
diff --git a/src/Uno.Wasm.Sample.RayTracer.Shared/Program.cs b/src/Uno.Wasm.Sample.RayTracer.Shared/Program.cs
index fc681cce6..e401b45ff 100644
--- a/src/Uno.Wasm.Sample.RayTracer.Shared/Program.cs
+++ b/src/Uno.Wasm.Sample.RayTracer.Shared/Program.cs
@@ -3,6 +3,7 @@
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
+using System.Threading.Tasks;
using RayTraceBenchmark;
using WebAssembly;
@@ -10,8 +11,12 @@ namespace Uno.Wasm.Test.Empty
{
class Program
{
- static int Main(string[] args)
+ static async Task Main(string[] args)
{
+ await Task.Yield();
+
+ Runtime.InvokeJS($"Interop.appendResult(\"test\")");
+
System.Console.WriteLine($"Mono Runtime Mode: " + Environment.GetEnvironmentVariable("UNO_BOOTSTRAP_MONO_RUNTIME_MODE"));
var w = Stopwatch.StartNew();
diff --git a/src/Uno.Wasm.Sample.RayTracer/Uno.Wasm.Sample.RayTracer.csproj b/src/Uno.Wasm.Sample.RayTracer/Uno.Wasm.Sample.RayTracer.csproj
index 80394b842..ae836d8a5 100644
--- a/src/Uno.Wasm.Sample.RayTracer/Uno.Wasm.Sample.RayTracer.csproj
+++ b/src/Uno.Wasm.Sample.RayTracer/Uno.Wasm.Sample.RayTracer.csproj
@@ -1,7 +1,7 @@
-
+
- net6.0
+ net9.0
Exe
false
true
@@ -10,27 +10,28 @@
$(DefineConstants);__WASM__;UWP
manifest.json
-
true
+ True
+ true
+ true
+
+ $(MSBuildThisFileDirectory)aot.profile
+
+
-
+
-
- false
- true
- TargetFramework
-
false
true
@@ -38,24 +39,25 @@
-
-
-
-
-
+
+
+
+ <_appOutput>$(PublishDir)wwwroot
+
+
<_AdditionalFile1 Include="pwa-images\android\android-launchericon-144-144.png" />
<_AdditionalFile1 Include="pwa-images\windows10\SplashScreen.scale-100.png" />
-
-
+
+
diff --git a/src/Uno.Wasm.Sample.Server.Net7/Uno.Wasm.Sample.Server.Net7.csproj b/src/Uno.Wasm.Sample.Server.Net7/Uno.Wasm.Sample.Server.Net7.csproj
index 2a55999b2..c78e7c4a1 100644
--- a/src/Uno.Wasm.Sample.Server.Net7/Uno.Wasm.Sample.Server.Net7.csproj
+++ b/src/Uno.Wasm.Sample.Server.Net7/Uno.Wasm.Sample.Server.Net7.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net9.0
enable
LatestMajor
diff --git a/src/Uno.Wasm.Sample/Program.cs b/src/Uno.Wasm.Sample/Program.cs
index 0b891a1a3..9224eae43 100644
--- a/src/Uno.Wasm.Sample/Program.cs
+++ b/src/Uno.Wasm.Sample/Program.cs
@@ -19,6 +19,8 @@
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Globalization;
+using System.Runtime.InteropServices.JavaScript;
+using System.Threading.Tasks;
namespace Uno.Wasm.Sample
{
@@ -59,13 +61,20 @@ static void Main(string[] args)
#endif
Console.WriteLine($"requireJSAvailable: {requireAvailable}");
+ Console.WriteLine($"CultureInfo.CurrentCulture: {CultureInfo.CurrentCulture}");
+ Console.WriteLine($"CultureInfo.CurrentUICulture: {CultureInfo.CurrentUICulture}");
+ Console.WriteLine($"Thread.CurrentThread.CurrentCulture: {Thread.CurrentThread.CurrentCulture}");
+ Console.WriteLine($"Thread.CurrentThread.CurrentUICulture: {Thread.CurrentThread.CurrentUICulture}");
+ Console.WriteLine($"CultureInfo.DefaultThreadCurrentCulture: { CultureInfo.DefaultThreadCurrentCulture?.ToString() ?? "" }");
+ Console.WriteLine($"CultureInfo.DefaultThreadCurrentUICulture: { CultureInfo.DefaultThreadCurrentUICulture?.ToString() ?? ""}");
+
Console.WriteLine($"Timezone: {TimeZoneInfo.Local.StandardName}");
Console.WriteLine(typeof(Microsoft.Extensions.Logging.Abstractions.NullLogger));
var r = new System.Resources.ResourceManager("FxResources.System.Web.Services.Description.SR", typeof(System.Web.Services.Description.Binding).Assembly);
Console.WriteLine($"Res(en): {r.GetString("WebDescriptionMissing", new CultureInfo("en-US"))}");
- Console.WriteLine($"Res(fr): {r.GetString("WebDescriptionMissing", new CultureInfo("fr-CA"))}");
+ Console.WriteLine($"Res(fr): {r.GetString("WebDescriptionMissing", new CultureInfo("fr"))}");
_t = new Timer(_ => {
Console.WriteLine("message");
@@ -84,6 +93,9 @@ public static partial class Imports
[System.Runtime.InteropServices.JavaScript.JSImport("globalThis.isRequireAvailable")]
public static partial bool IsRequireAvailable();
+
+ [JSImport("INTERNAL.loadSatelliteAssemblies")]
+ internal static partial Task LoadSatelliteAssemblies(string[] culturesToLoad);
}
#endif
diff --git a/src/Uno.Wasm.Sample/Runtime.cs b/src/Uno.Wasm.Sample/Runtime.cs
index 3b9d34303..fb78b2dec 100644
--- a/src/Uno.Wasm.Sample/Runtime.cs
+++ b/src/Uno.Wasm.Sample/Runtime.cs
@@ -8,3 +8,4 @@ internal sealed class Runtime
public static extern string InvokeJS(string str, out int exceptional_result);
}
}
+
diff --git a/src/Uno.Wasm.Sample/WasmScripts/test.js b/src/Uno.Wasm.Sample/WasmScripts/test.js
index 66bfdab29..f830c08a5 100644
--- a/src/Uno.Wasm.Sample/WasmScripts/test.js
+++ b/src/Uno.Wasm.Sample/WasmScripts/test.js
@@ -8,10 +8,10 @@
async function initializeExports() {
if (Module.getAssemblyExports !== undefined) {
try {
- globalThis.samplesNetExports = await Module.getAssemblyExports("Uno.Wasm.SampleNet");
+ globalThis.samplesNetExports = await Module.getAssemblyExports("Uno.Wasm.SampleNet7");
}
catch (e) {
- log.error(e);
+ console.error(e);
}
}
}
@@ -27,12 +27,13 @@ function isRequireAvailable() {
}
function testCallback() {
+
try {
if (Module.getAssemblyExports !== undefined && samplesNetExports.hasOwnProperty('Uno')) {
return samplesNetExports.Uno.Wasm.Sample.Exports.MyExportedMethod1();
}
else {
- return Module.mono_bind_static_method("[Uno.Wasm.SampleNet] Uno.Wasm.Sample.Exports:MyExportedMethod2")();
+ return Module.mono_bind_static_method("[Uno.Wasm.SampleNet7] Uno.Wasm.Sample.Exports:MyExportedMethod2")();
}
}
catch (e) {
diff --git a/src/Uno.Wasm.Sample/sample.common.props b/src/Uno.Wasm.Sample/sample.common.props
index 0fa29c2a8..8976d6148 100644
--- a/src/Uno.Wasm.Sample/sample.common.props
+++ b/src/Uno.Wasm.Sample/sample.common.props
@@ -2,7 +2,6 @@
-
@@ -20,7 +19,10 @@
- Uno.Wasm.SampleNet
+ Uno.Wasm.SampleNet7
+ true
+
+ true
@@ -29,50 +31,7 @@
-
-
- <_AdditionalFile1 Include="SomeContent01.txt" />
- <_AdditionalFile1 Include="SomeContent02.txt" />
- <_AdditionalFile1 Include=".editorconfig" />
- <_AdditionalFile1 Include="nuget.config" />
-
- <_duplicateValidationItems Include="$(WasmShellOutputPackagePath)\**\System.Private.CoreLib.clr" />
-
-
-
- <_monoConfigJson>$([System.IO.File]::ReadAllText('$(WasmShellOutputPackagePath)\mono-config.json'))
- <_duplicateValidation>@(_duplicateValidationItems)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- false
- true
- TargetFramework
-
false
true
diff --git a/src/Uno.Wasm.SampleNet6.Aot/Uno.Wasm.SampleNet6.Aot.csproj b/src/Uno.Wasm.SampleNet6.Aot/Uno.Wasm.SampleNet6.Aot.csproj
index bfcfee888..92cf605f7 100644
--- a/src/Uno.Wasm.SampleNet6.Aot/Uno.Wasm.SampleNet6.Aot.csproj
+++ b/src/Uno.Wasm.SampleNet6.Aot/Uno.Wasm.SampleNet6.Aot.csproj
@@ -1,16 +1,14 @@
-
+
- net5
- Exe
- false
- Uno.Wasm.Sample.Program
+ net9.0
true
InterpreterAndAOT
true
true
+ true
@@ -26,8 +24,8 @@
+
-
@@ -44,11 +42,6 @@
-
- false
- true
- TargetFramework
-
false
true
diff --git a/src/Uno.Wasm.SampleNet6.LogProfiler/LinkerConfig.xml b/src/Uno.Wasm.SampleNet6.LogProfiler/LinkerConfig.xml
deleted file mode 100644
index 635cbeb02..000000000
--- a/src/Uno.Wasm.SampleNet6.LogProfiler/LinkerConfig.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/src/Uno.Wasm.SampleNet6.LogProfiler/Uno.Wasm.SampleNet6.LogProfiler.csproj b/src/Uno.Wasm.SampleNet6.LogProfiler/Uno.Wasm.SampleNet6.LogProfiler.csproj
deleted file mode 100644
index 4429e5376..000000000
--- a/src/Uno.Wasm.SampleNet6.LogProfiler/Uno.Wasm.SampleNet6.LogProfiler.csproj
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
- net6.0
- Exe
- false
- Uno.Wasm.Sample.Program
- /
-
- true
-
-
- true
-
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Uno.Wasm.SampleNet6.LogProfiler/wwwroot/favicon.ico b/src/Uno.Wasm.SampleNet6.LogProfiler/wwwroot/favicon.ico
deleted file mode 100644
index 131108413..000000000
Binary files a/src/Uno.Wasm.SampleNet6.LogProfiler/wwwroot/favicon.ico and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6.LogProfiler/wwwroot/web.config b/src/Uno.Wasm.SampleNet6.LogProfiler/wwwroot/web.config
deleted file mode 100644
index 9385f43a9..000000000
--- a/src/Uno.Wasm.SampleNet6.LogProfiler/wwwroot/web.config
+++ /dev/null
@@ -1,79 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Uno.Wasm.SampleNet6/LinkerConfig.xml b/src/Uno.Wasm.SampleNet6/LinkerConfig.xml
deleted file mode 100644
index ed78e52b0..000000000
--- a/src/Uno.Wasm.SampleNet6/LinkerConfig.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/src/Uno.Wasm.SampleNet6/Uno.Wasm.SampleNet6.csproj b/src/Uno.Wasm.SampleNet6/Uno.Wasm.SampleNet6.csproj
deleted file mode 100644
index de0e75cba..000000000
--- a/src/Uno.Wasm.SampleNet6/Uno.Wasm.SampleNet6.csproj
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
- net6.0
- Exe
- false
- Uno.Wasm.Sample.Program
- /
-
-
-
-
- true
-
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Uno.Wasm.SampleNet6/favicon.ico b/src/Uno.Wasm.SampleNet6/favicon.ico
deleted file mode 100644
index 131108413..000000000
Binary files a/src/Uno.Wasm.SampleNet6/favicon.ico and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/web.config b/src/Uno.Wasm.SampleNet6/web.config
deleted file mode 100644
index 9385f43a9..000000000
--- a/src/Uno.Wasm.SampleNet6/web.config
+++ /dev/null
@@ -1,79 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/favicon.ico b/src/Uno.Wasm.SampleNet6/wwwroot/favicon.ico
deleted file mode 100644
index 131108413..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/favicon.ico and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/android/android-launchericon-144-144.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/android/android-launchericon-144-144.png
deleted file mode 100644
index e8388115e..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/android/android-launchericon-144-144.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/android/android-launchericon-192-192.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/android/android-launchericon-192-192.png
deleted file mode 100644
index a135ee16d..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/android/android-launchericon-192-192.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/android/android-launchericon-48-48.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/android/android-launchericon-48-48.png
deleted file mode 100644
index cb5e47bf2..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/android/android-launchericon-48-48.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/android/android-launchericon-512-512.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/android/android-launchericon-512-512.png
deleted file mode 100644
index b74932f18..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/android/android-launchericon-512-512.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/android/android-launchericon-72-72.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/android/android-launchericon-72-72.png
deleted file mode 100644
index eb4e32b6c..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/android/android-launchericon-72-72.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/android/android-launchericon-96-96.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/android/android-launchericon-96-96.png
deleted file mode 100644
index d7ff4321a..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/android/android-launchericon-96-96.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/chrome/chrome-extensionmanagementpage-48-48.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/chrome/chrome-extensionmanagementpage-48-48.png
deleted file mode 100644
index cb5e47bf2..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/chrome/chrome-extensionmanagementpage-48-48.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/chrome/chrome-favicon-16-16.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/chrome/chrome-favicon-16-16.png
deleted file mode 100644
index acac95c18..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/chrome/chrome-favicon-16-16.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/chrome/chrome-installprocess-128-128.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/chrome/chrome-installprocess-128-128.png
deleted file mode 100644
index b3329f082..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/chrome/chrome-installprocess-128-128.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/firefox/firefox-general-128-128.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/firefox/firefox-general-128-128.png
deleted file mode 100644
index b3329f082..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/firefox/firefox-general-128-128.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/firefox/firefox-general-16-16.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/firefox/firefox-general-16-16.png
deleted file mode 100644
index acac95c18..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/firefox/firefox-general-16-16.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/firefox/firefox-general-256-256.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/firefox/firefox-general-256-256.png
deleted file mode 100644
index a305069e5..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/firefox/firefox-general-256-256.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/firefox/firefox-general-32-32.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/firefox/firefox-general-32-32.png
deleted file mode 100644
index 16adaf420..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/firefox/firefox-general-32-32.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/firefox/firefox-general-48-48.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/firefox/firefox-general-48-48.png
deleted file mode 100644
index cb5e47bf2..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/firefox/firefox-general-48-48.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/firefox/firefox-general-64-64.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/firefox/firefox-general-64-64.png
deleted file mode 100644
index 43adca5e1..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/firefox/firefox-general-64-64.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/firefox/firefox-general-90-90.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/firefox/firefox-general-90-90.png
deleted file mode 100644
index 1b515a81b..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/firefox/firefox-general-90-90.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/firefox/firefox-marketplace-128-128.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/firefox/firefox-marketplace-128-128.png
deleted file mode 100644
index b3329f082..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/firefox/firefox-marketplace-128-128.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/firefox/firefox-marketplace-512-512.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/firefox/firefox-marketplace-512-512.png
deleted file mode 100644
index b74932f18..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/firefox/firefox-marketplace-512-512.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-appicon-1024-1024.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-appicon-1024-1024.png
deleted file mode 100644
index 92c7a4d56..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-appicon-1024-1024.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-appicon-120-120.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-appicon-120-120.png
deleted file mode 100644
index a9fd2651f..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-appicon-120-120.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-appicon-152-152.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-appicon-152-152.png
deleted file mode 100644
index c48c22fc4..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-appicon-152-152.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-appicon-180-180.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-appicon-180-180.png
deleted file mode 100644
index f0a0ed233..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-appicon-180-180.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-appicon-76-76.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-appicon-76-76.png
deleted file mode 100644
index dd31b6be9..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-appicon-76-76.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-1024-768.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-1024-768.png
deleted file mode 100644
index 1cc966690..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-1024-768.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-1242-2208.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-1242-2208.png
deleted file mode 100644
index fa4c609dc..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-1242-2208.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-1334-750.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-1334-750.png
deleted file mode 100644
index b255efa26..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-1334-750.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-1536-2048.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-1536-2048.png
deleted file mode 100644
index 0cf7a1f88..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-1536-2048.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-2048-1536.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-2048-1536.png
deleted file mode 100644
index ff2a88e72..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-2048-1536.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-2208-1242.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-2208-1242.png
deleted file mode 100644
index e811a2d92..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-2208-1242.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-640-1136.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-640-1136.png
deleted file mode 100644
index 0a9902a74..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-640-1136.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-640-960.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-640-960.png
deleted file mode 100644
index 18e773e7e..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-640-960.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-750-1334.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-750-1334.png
deleted file mode 100644
index 8f22f7ff8..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-750-1334.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-768-1024.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-768-1024.png
deleted file mode 100644
index 951844dab..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/ios/ios-launchimage-768-1024.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-smallsquare-24-24.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-smallsquare-24-24.png
deleted file mode 100644
index eb0398738..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-smallsquare-24-24.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-smallsquare-30-30.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-smallsquare-30-30.png
deleted file mode 100644
index d0f92a363..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-smallsquare-30-30.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-smallsquare-42-42.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-smallsquare-42-42.png
deleted file mode 100644
index 4056ff4ac..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-smallsquare-42-42.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-smallsquare-54-54.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-smallsquare-54-54.png
deleted file mode 100644
index 717da1314..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-smallsquare-54-54.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-splashscreen-1116-540.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-splashscreen-1116-540.png
deleted file mode 100644
index 815b05e4e..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-splashscreen-1116-540.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-splashscreen-620-300.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-splashscreen-620-300.png
deleted file mode 100644
index 6c31a63a7..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-splashscreen-620-300.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-splashscreen-868-420.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-splashscreen-868-420.png
deleted file mode 100644
index accc7a793..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-splashscreen-868-420.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-squarelogo-120-120.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-squarelogo-120-120.png
deleted file mode 100644
index a9fd2651f..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-squarelogo-120-120.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-squarelogo-150-150.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-squarelogo-150-150.png
deleted file mode 100644
index c2260a841..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-squarelogo-150-150.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-squarelogo-210-210.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-squarelogo-210-210.png
deleted file mode 100644
index 6e7d0d1cf..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-squarelogo-210-210.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-squarelogo-270-270.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-squarelogo-270-270.png
deleted file mode 100644
index 36c1d1a4b..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-squarelogo-270-270.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-storelogo-50-50.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-storelogo-50-50.png
deleted file mode 100644
index bc585363f..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-storelogo-50-50.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-storelogo-70-70.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-storelogo-70-70.png
deleted file mode 100644
index 6e1d9bb52..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-storelogo-70-70.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-storelogo-90-90.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-storelogo-90-90.png
deleted file mode 100644
index 1b515a81b..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windows-storelogo-90-90.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-appicon-106-106.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-appicon-106-106.png
deleted file mode 100644
index 142d90969..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-appicon-106-106.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-appicon-44-44.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-appicon-44-44.png
deleted file mode 100644
index 1b47f4790..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-appicon-44-44.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-appicon-62-62.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-appicon-62-62.png
deleted file mode 100644
index 2ef84f401..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-appicon-62-62.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-mediumtile-150-150.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-mediumtile-150-150.png
deleted file mode 100644
index c2260a841..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-mediumtile-150-150.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-mediumtile-210-210.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-mediumtile-210-210.png
deleted file mode 100644
index 6e7d0d1cf..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-mediumtile-210-210.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-mediumtile-360-360.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-mediumtile-360-360.png
deleted file mode 100644
index 8ececfbff..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-mediumtile-360-360.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-smalltile-170-170.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-smalltile-170-170.png
deleted file mode 100644
index 0be719eb0..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-smalltile-170-170.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-smalltile-71-71.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-smalltile-71-71.png
deleted file mode 100644
index 724116ebe..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-smalltile-71-71.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-smalltile-99-99.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-smalltile-99-99.png
deleted file mode 100644
index a4603f20c..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-smalltile-99-99.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-storelogo-120-120.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-storelogo-120-120.png
deleted file mode 100644
index a9fd2651f..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-storelogo-120-120.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-storelogo-50-50.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-storelogo-50-50.png
deleted file mode 100644
index bc585363f..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-storelogo-50-50.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-storelogo-70-70.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-storelogo-70-70.png
deleted file mode 100644
index 6e1d9bb52..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows/windowsphone-storelogo-70-70.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/SplashScreen.scale-100.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/SplashScreen.scale-100.png
deleted file mode 100644
index 6c31a63a7..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/SplashScreen.scale-100.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/SplashScreen.scale-125.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/SplashScreen.scale-125.png
deleted file mode 100644
index b1f07c7b1..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/SplashScreen.scale-125.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/SplashScreen.scale-150.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/SplashScreen.scale-150.png
deleted file mode 100644
index d222e0bb3..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/SplashScreen.scale-150.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/SplashScreen.scale-200.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/SplashScreen.scale-200.png
deleted file mode 100644
index 8c265cf27..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/SplashScreen.scale-200.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/SplashScreen.scale-400.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/SplashScreen.scale-400.png
deleted file mode 100644
index 010c53f6b..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/SplashScreen.scale-400.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square150x150Logo.scale-100.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square150x150Logo.scale-100.png
deleted file mode 100644
index c2260a841..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square150x150Logo.scale-100.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square150x150Logo.scale-125.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square150x150Logo.scale-125.png
deleted file mode 100644
index 88d6b0512..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square150x150Logo.scale-125.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square150x150Logo.scale-150.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square150x150Logo.scale-150.png
deleted file mode 100644
index d16d65a37..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square150x150Logo.scale-150.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square150x150Logo.scale-200.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square150x150Logo.scale-200.png
deleted file mode 100644
index 9ad09e66a..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square150x150Logo.scale-200.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square150x150Logo.scale-400.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square150x150Logo.scale-400.png
deleted file mode 100644
index 62076cb25..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square150x150Logo.scale-400.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square310x310Logo.scale-100.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square310x310Logo.scale-100.png
deleted file mode 100644
index dbf326c2c..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square310x310Logo.scale-100.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square310x310Logo.scale-125.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square310x310Logo.scale-125.png
deleted file mode 100644
index 2f773bc66..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square310x310Logo.scale-125.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square310x310Logo.scale-150.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square310x310Logo.scale-150.png
deleted file mode 100644
index 9d021d777..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square310x310Logo.scale-150.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square310x310Logo.scale-200.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square310x310Logo.scale-200.png
deleted file mode 100644
index 6869ac3b8..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square310x310Logo.scale-200.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square310x310Logo.scale-400.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square310x310Logo.scale-400.png
deleted file mode 100644
index 23f9b56e3..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square310x310Logo.scale-400.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.scale-100.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.scale-100.png
deleted file mode 100644
index 1b47f4790..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.scale-100.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.scale-125.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.scale-125.png
deleted file mode 100644
index 2eacba1ce..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.scale-125.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.scale-150.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.scale-150.png
deleted file mode 100644
index 21ded376c..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.scale-150.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.scale-200.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.scale-200.png
deleted file mode 100644
index 1cf187ef0..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.scale-200.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.scale-400.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.scale-400.png
deleted file mode 100644
index 9f74108f4..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.scale-400.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.targetsize-16.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.targetsize-16.png
deleted file mode 100644
index acac95c18..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.targetsize-16.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.targetsize-16_altform-unplated.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.targetsize-16_altform-unplated.png
deleted file mode 100644
index acac95c18..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.targetsize-16_altform-unplated.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.targetsize-24.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.targetsize-24.png
deleted file mode 100644
index eb0398738..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.targetsize-24.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.targetsize-24_altform-unplated.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.targetsize-24_altform-unplated.png
deleted file mode 100644
index eb0398738..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.targetsize-24_altform-unplated.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.targetsize-256.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.targetsize-256.png
deleted file mode 100644
index a305069e5..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.targetsize-256.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.targetsize-256_altform-unplated.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.targetsize-256_altform-unplated.png
deleted file mode 100644
index a305069e5..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.targetsize-256_altform-unplated.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.targetsize-48.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.targetsize-48.png
deleted file mode 100644
index cb5e47bf2..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.targetsize-48.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.targetsize-48_altform-unplated.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.targetsize-48_altform-unplated.png
deleted file mode 100644
index cb5e47bf2..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square44x44Logo.targetsize-48_altform-unplated.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square71x71Logo.scale-100.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square71x71Logo.scale-100.png
deleted file mode 100644
index 724116ebe..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square71x71Logo.scale-100.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square71x71Logo.scale-125.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square71x71Logo.scale-125.png
deleted file mode 100644
index f46e0ad2b..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square71x71Logo.scale-125.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square71x71Logo.scale-150.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square71x71Logo.scale-150.png
deleted file mode 100644
index 3c9b37bcb..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square71x71Logo.scale-150.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square71x71Logo.scale-200.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square71x71Logo.scale-200.png
deleted file mode 100644
index 785df9c25..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square71x71Logo.scale-200.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square71x71Logo.scale-400.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square71x71Logo.scale-400.png
deleted file mode 100644
index febcb3f3e..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Square71x71Logo.scale-400.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/StoreLogo.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/StoreLogo.png
deleted file mode 100644
index bc585363f..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/StoreLogo.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/StoreLogo.scale-100.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/StoreLogo.scale-100.png
deleted file mode 100644
index bc585363f..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/StoreLogo.scale-100.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/StoreLogo.scale-125.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/StoreLogo.scale-125.png
deleted file mode 100644
index 9def8089a..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/StoreLogo.scale-125.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/StoreLogo.scale-150.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/StoreLogo.scale-150.png
deleted file mode 100644
index 9a2f80134..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/StoreLogo.scale-150.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/StoreLogo.scale-200.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/StoreLogo.scale-200.png
deleted file mode 100644
index d7b20290c..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/StoreLogo.scale-200.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/StoreLogo.scale-400.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/StoreLogo.scale-400.png
deleted file mode 100644
index 0224c8956..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/StoreLogo.scale-400.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Wide310x150Logo.scale-100.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Wide310x150Logo.scale-100.png
deleted file mode 100644
index 01a7ecee3..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Wide310x150Logo.scale-100.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Wide310x150Logo.scale-125.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Wide310x150Logo.scale-125.png
deleted file mode 100644
index 649fbaa18..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Wide310x150Logo.scale-125.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Wide310x150Logo.scale-150.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Wide310x150Logo.scale-150.png
deleted file mode 100644
index 5e8425c81..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Wide310x150Logo.scale-150.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Wide310x150Logo.scale-200.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Wide310x150Logo.scale-200.png
deleted file mode 100644
index 6c31a63a7..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Wide310x150Logo.scale-200.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Wide310x150Logo.scale-400.png b/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Wide310x150Logo.scale-400.png
deleted file mode 100644
index 8c265cf27..000000000
Binary files a/src/Uno.Wasm.SampleNet6/wwwroot/pwa-images/windows10/Wide310x150Logo.scale-400.png and /dev/null differ
diff --git a/src/Uno.Wasm.SampleNet6/wwwroot/web.config b/src/Uno.Wasm.SampleNet6/wwwroot/web.config
deleted file mode 100644
index 9385f43a9..000000000
--- a/src/Uno.Wasm.SampleNet6/wwwroot/web.config
+++ /dev/null
@@ -1,79 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Uno.Wasm.SampleNet7/Uno.Wasm.SampleNet7.csproj b/src/Uno.Wasm.SampleNet7/Uno.Wasm.SampleNet7.csproj
index 6f47f67c9..579424379 100644
--- a/src/Uno.Wasm.SampleNet7/Uno.Wasm.SampleNet7.csproj
+++ b/src/Uno.Wasm.SampleNet7/Uno.Wasm.SampleNet7.csproj
@@ -1,11 +1,14 @@
-
+
- net7.0
+ net9.0
Exe
false
Uno.Wasm.Sample.Program
- /
+
+
+
+
@@ -15,6 +18,8 @@
true
latest
true
+ false
+ --jiterpreter-stats-enabled
diff --git a/src/Uno.Wasm.SampleNet7/wwwroot/web.config b/src/Uno.Wasm.SampleNet7/wwwroot/web.config
deleted file mode 100644
index b4c347b28..000000000
--- a/src/Uno.Wasm.SampleNet7/wwwroot/web.config
+++ /dev/null
@@ -1,82 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Uno.Wasm.Static Linking/Uno.Wasm.StaticLinking.csproj b/src/Uno.Wasm.Static Linking/Uno.Wasm.StaticLinking.csproj
index 5cb2d15c0..03665db50 100644
--- a/src/Uno.Wasm.Static Linking/Uno.Wasm.StaticLinking.csproj
+++ b/src/Uno.Wasm.Static Linking/Uno.Wasm.StaticLinking.csproj
@@ -1,7 +1,7 @@
-
+
- net5.0
+ net9.0
Uno.Wasm.StaticLinking
Exe
false
@@ -15,12 +15,13 @@
-
+
+
+
-
@@ -41,11 +42,6 @@
-
- false
- true
- TargetFramework
-
false
true
@@ -53,4 +49,4 @@
-
\ No newline at end of file
+
diff --git a/src/Uno.Wasm.StaticLinking.Aot.Net6/Uno.Wasm.StaticLinking.Aot.Net6.csproj b/src/Uno.Wasm.StaticLinking.Aot.Net6/Uno.Wasm.StaticLinking.Aot.Net6.csproj
index d1664b980..c722944d2 100644
--- a/src/Uno.Wasm.StaticLinking.Aot.Net6/Uno.Wasm.StaticLinking.Aot.Net6.csproj
+++ b/src/Uno.Wasm.StaticLinking.Aot.Net6/Uno.Wasm.StaticLinking.Aot.Net6.csproj
@@ -1,7 +1,7 @@
-
+
- net6.0
+ net9.0
Uno.Wasm.StaticLinking
Exe
false
@@ -32,12 +32,13 @@
-
+
+
+
-
\ No newline at end of file
+
diff --git a/src/Uno.Wasm.StaticLinking.Embedded/Uno.Wasm.StaticLinking.Embedded.csproj b/src/Uno.Wasm.StaticLinking.Embedded/Uno.Wasm.StaticLinking.Embedded.csproj
index 56add9dd7..0430d8c69 100644
--- a/src/Uno.Wasm.StaticLinking.Embedded/Uno.Wasm.StaticLinking.Embedded.csproj
+++ b/src/Uno.Wasm.StaticLinking.Embedded/Uno.Wasm.StaticLinking.Embedded.csproj
@@ -1,7 +1,7 @@
-
+
- net6.0
+ net9.0
Uno.Wasm.StaticLinking
Exe
false
@@ -27,12 +27,12 @@
+
-
\ No newline at end of file
+
diff --git a/src/Uno.Wasm.StaticLinking.PgAot.Net6/Uno.Wasm.StaticLinking.PgAot.Net6.csproj b/src/Uno.Wasm.StaticLinking.PgAot.Net6/Uno.Wasm.StaticLinking.PgAot.Net6.csproj
index aa6dd5713..c9c27773d 100644
--- a/src/Uno.Wasm.StaticLinking.PgAot.Net6/Uno.Wasm.StaticLinking.PgAot.Net6.csproj
+++ b/src/Uno.Wasm.StaticLinking.PgAot.Net6/Uno.Wasm.StaticLinking.PgAot.Net6.csproj
@@ -1,7 +1,7 @@
-
+
- net6.0
+ net9.0
Uno.Wasm.StaticLinking
Exe
false
@@ -32,12 +32,13 @@
-
+
+
+
-
+
+
+
+
+
+
+
+
diff --git a/src/Uno.Wasm.StaticLinking.Shared/Program.cs b/src/Uno.Wasm.StaticLinking.Shared/Program.cs
index 1046838e5..4b2638ccf 100644
--- a/src/Uno.Wasm.StaticLinking.Shared/Program.cs
+++ b/src/Uno.Wasm.StaticLinking.Shared/Program.cs
@@ -96,7 +96,9 @@ static void Main()
var satelliteValidation =
s1 == "Cannot find definition for {0}. Service Description with namespace {1} is missing."
- && s2 == "Impossible de localiser une définition pour {0}. Description du service manquante avec l'espace de noms {1}.";
+ // TODO JELA
+ // && s2 == "Impossible de localiser une définition pour {0}. Description du service manquante avec l'espace de noms {1}."
+ ;
var res = $"{runtimeMode};" +
$"{SideModule1.test_add(21, 21)};" +
diff --git a/src/Uno.Wasm.StaticLinking.Shared/Uno.Wasm.StaticLinking.Shared.projitems b/src/Uno.Wasm.StaticLinking.Shared/Uno.Wasm.StaticLinking.Shared.projitems
index e673d7a90..9b2c1317b 100644
--- a/src/Uno.Wasm.StaticLinking.Shared/Uno.Wasm.StaticLinking.Shared.projitems
+++ b/src/Uno.Wasm.StaticLinking.Shared/Uno.Wasm.StaticLinking.Shared.projitems
@@ -31,16 +31,6 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Uno.Wasm.StaticLinking.Shared/Validations.props b/src/Uno.Wasm.StaticLinking.Shared/Validations.props
index 9a5e3e4cc..0a90257c0 100644
--- a/src/Uno.Wasm.StaticLinking.Shared/Validations.props
+++ b/src/Uno.Wasm.StaticLinking.Shared/Validations.props
@@ -4,35 +4,11 @@
InPlace
+ true
-
-
- <_duplicateValidationItems Include="$(WasmShellOutputPackagePath)\**\System.Private.CoreLib.clr" />
-
-
-
- <_duplicateValidation>@(_duplicateValidationItems)
-
-
-
-
-
-
-
- <_compressedItems Include="$(WasmShellOutputPackagePath)\**\*.br" />
-
-
-
- <_compressedItemsValidation>@(_compressedItems)
-
-
-
-
-
diff --git a/src/Uno.Wasm.StaticLinking.Shared/WasmScripts/test.js b/src/Uno.Wasm.StaticLinking.Shared/WasmScripts/test.js
index 6287f163e..fc55d7ec6 100644
--- a/src/Uno.Wasm.StaticLinking.Shared/WasmScripts/test.js
+++ b/src/Uno.Wasm.StaticLinking.Shared/WasmScripts/test.js
@@ -46,7 +46,6 @@ function glAvailable() {
function functionsExportsAvailable() {
var available =
typeof globalThis.lengthBytesUTF8 !== 'undefined'
- && typeof globalThis.stringToUTF8 !== 'undefined'
&& typeof globalThis.UTF8ToString !== 'undefined'
&& typeof globalThis.UTF8ArrayToString !== 'undefined'
diff --git a/src/Uno.Wasm.StaticLinking.Shared/native/side.bc/1.2/side.bc b/src/Uno.Wasm.StaticLinking.Shared/native/side.a/1.2/side.a
similarity index 64%
rename from src/Uno.Wasm.StaticLinking.Shared/native/side.bc/1.2/side.bc
rename to src/Uno.Wasm.StaticLinking.Shared/native/side.a/1.2/side.a
index ab7ed5520..ad8fdb488 100644
Binary files a/src/Uno.Wasm.StaticLinking.Shared/native/side.bc/1.2/side.bc and b/src/Uno.Wasm.StaticLinking.Shared/native/side.a/1.2/side.a differ
diff --git a/src/Uno.Wasm.StaticLinking.Shared/native/side.bc/1.2/st,simd/side.bc b/src/Uno.Wasm.StaticLinking.Shared/native/side.a/1.2/st,simd/side.a
similarity index 64%
rename from src/Uno.Wasm.StaticLinking.Shared/native/side.bc/1.2/st,simd/side.bc
rename to src/Uno.Wasm.StaticLinking.Shared/native/side.a/1.2/st,simd/side.a
index ab7ed5520..ad8fdb488 100644
Binary files a/src/Uno.Wasm.StaticLinking.Shared/native/side.bc/1.2/st,simd/side.bc and b/src/Uno.Wasm.StaticLinking.Shared/native/side.a/1.2/st,simd/side.a differ
diff --git a/src/Uno.Wasm.StaticLinking.Shared/native/side2.a/1.2/st,simd/side2.a b/src/Uno.Wasm.StaticLinking.Shared/native/side2.a/1.2/st,simd/side2.a
new file mode 100644
index 000000000..72f49f74d
Binary files /dev/null and b/src/Uno.Wasm.StaticLinking.Shared/native/side2.a/1.2/st,simd/side2.a differ
diff --git a/src/Uno.Wasm.StaticLinking.Shared/native/side2.a/1.3/side2.a b/src/Uno.Wasm.StaticLinking.Shared/native/side2.a/1.3/side2.a
new file mode 100644
index 000000000..d8dffea54
Binary files /dev/null and b/src/Uno.Wasm.StaticLinking.Shared/native/side2.a/1.3/side2.a differ
diff --git a/src/Uno.Wasm.StaticLinking.Shared/native/side2.bc/1.2/st,simd/side2.bc b/src/Uno.Wasm.StaticLinking.Shared/native/side2.bc/1.2/st,simd/side2.bc
deleted file mode 100644
index f156e9180..000000000
Binary files a/src/Uno.Wasm.StaticLinking.Shared/native/side2.bc/1.2/st,simd/side2.bc and /dev/null differ
diff --git a/src/Uno.Wasm.StaticLinking.Shared/native/side2.bc/1.3/side2.bc b/src/Uno.Wasm.StaticLinking.Shared/native/side2.bc/1.3/side2.bc
deleted file mode 100644
index 22d341b2a..000000000
Binary files a/src/Uno.Wasm.StaticLinking.Shared/native/side2.bc/1.3/side2.bc and /dev/null differ
diff --git a/src/Uno.Wasm.StaticLinking.Shared/native/side3.a/1.3/side3.a b/src/Uno.Wasm.StaticLinking.Shared/native/side3.a/1.3/side3.a
new file mode 100644
index 000000000..97f7ea389
Binary files /dev/null and b/src/Uno.Wasm.StaticLinking.Shared/native/side3.a/1.3/side3.a differ
diff --git a/src/Uno.Wasm.StaticLinking.Shared/native/side3.a/1.4/side3.a b/src/Uno.Wasm.StaticLinking.Shared/native/side3.a/1.4/side3.a
new file mode 100644
index 000000000..af7387404
Binary files /dev/null and b/src/Uno.Wasm.StaticLinking.Shared/native/side3.a/1.4/side3.a differ
diff --git a/src/Uno.Wasm.StaticLinking.Shared/native/side3.a/1.4/st,simd/side3.a b/src/Uno.Wasm.StaticLinking.Shared/native/side3.a/1.4/st,simd/side3.a
new file mode 100644
index 000000000..af7387404
Binary files /dev/null and b/src/Uno.Wasm.StaticLinking.Shared/native/side3.a/1.4/st,simd/side3.a differ
diff --git a/src/Uno.Wasm.StaticLinking.Shared/native/side3.bc/1.3/side3.bc b/src/Uno.Wasm.StaticLinking.Shared/native/side3.bc/1.3/side3.bc
deleted file mode 100644
index fda765cb7..000000000
Binary files a/src/Uno.Wasm.StaticLinking.Shared/native/side3.bc/1.3/side3.bc and /dev/null differ
diff --git a/src/Uno.Wasm.StaticLinking.Shared/native/side3.bc/1.4/side3.bc b/src/Uno.Wasm.StaticLinking.Shared/native/side3.bc/1.4/side3.bc
deleted file mode 100644
index d92fbc803..000000000
Binary files a/src/Uno.Wasm.StaticLinking.Shared/native/side3.bc/1.4/side3.bc and /dev/null differ
diff --git a/src/Uno.Wasm.StaticLinking.Shared/native/side3.bc/1.4/st,simd/side3.bc b/src/Uno.Wasm.StaticLinking.Shared/native/side3.bc/1.4/st,simd/side3.bc
deleted file mode 100644
index d92fbc803..000000000
Binary files a/src/Uno.Wasm.StaticLinking.Shared/native/side3.bc/1.4/st,simd/side3.bc and /dev/null differ
diff --git a/src/Uno.Wasm.StaticLinking.Shared/native/side4.a/1.3/side4.a b/src/Uno.Wasm.StaticLinking.Shared/native/side4.a/1.3/side4.a
new file mode 100644
index 000000000..51f1f6175
Binary files /dev/null and b/src/Uno.Wasm.StaticLinking.Shared/native/side4.a/1.3/side4.a differ
diff --git a/src/Uno.Wasm.StaticLinking.Shared/native/side4.a/2.0/side4.a b/src/Uno.Wasm.StaticLinking.Shared/native/side4.a/2.0/side4.a
new file mode 100644
index 000000000..a8df299d9
Binary files /dev/null and b/src/Uno.Wasm.StaticLinking.Shared/native/side4.a/2.0/side4.a differ
diff --git a/src/Uno.Wasm.StaticLinking.Shared/native/side4.a/3.1/side4.a b/src/Uno.Wasm.StaticLinking.Shared/native/side4.a/3.1/side4.a
new file mode 100644
index 000000000..998e50d13
Binary files /dev/null and b/src/Uno.Wasm.StaticLinking.Shared/native/side4.a/3.1/side4.a differ
diff --git a/src/Uno.Wasm.StaticLinking.Shared/native/side4.a/3.1/st,simd/side4.a b/src/Uno.Wasm.StaticLinking.Shared/native/side4.a/3.1/st,simd/side4.a
new file mode 100644
index 000000000..998e50d13
Binary files /dev/null and b/src/Uno.Wasm.StaticLinking.Shared/native/side4.a/3.1/st,simd/side4.a differ
diff --git a/src/Uno.Wasm.StaticLinking.Shared/native/side4.a/5.0/side4.a b/src/Uno.Wasm.StaticLinking.Shared/native/side4.a/5.0/side4.a
new file mode 100644
index 000000000..d55452574
Binary files /dev/null and b/src/Uno.Wasm.StaticLinking.Shared/native/side4.a/5.0/side4.a differ
diff --git a/src/Uno.Wasm.StaticLinking.Shared/native/side4.bc/1.3/side4.bc b/src/Uno.Wasm.StaticLinking.Shared/native/side4.bc/1.3/side4.bc
deleted file mode 100644
index 60a7ca063..000000000
Binary files a/src/Uno.Wasm.StaticLinking.Shared/native/side4.bc/1.3/side4.bc and /dev/null differ
diff --git a/src/Uno.Wasm.StaticLinking.Shared/native/side4.bc/2.0/side4.bc b/src/Uno.Wasm.StaticLinking.Shared/native/side4.bc/2.0/side4.bc
deleted file mode 100644
index cb117dad6..000000000
Binary files a/src/Uno.Wasm.StaticLinking.Shared/native/side4.bc/2.0/side4.bc and /dev/null differ
diff --git a/src/Uno.Wasm.StaticLinking.Shared/native/side4.bc/3.1/side4.bc b/src/Uno.Wasm.StaticLinking.Shared/native/side4.bc/3.1/side4.bc
deleted file mode 100644
index d8d3a9ea3..000000000
Binary files a/src/Uno.Wasm.StaticLinking.Shared/native/side4.bc/3.1/side4.bc and /dev/null differ
diff --git a/src/Uno.Wasm.StaticLinking.Shared/native/side4.bc/3.1/st,simd/side4.bc b/src/Uno.Wasm.StaticLinking.Shared/native/side4.bc/3.1/st,simd/side4.bc
deleted file mode 100644
index d8d3a9ea3..000000000
Binary files a/src/Uno.Wasm.StaticLinking.Shared/native/side4.bc/3.1/st,simd/side4.bc and /dev/null differ
diff --git a/src/Uno.Wasm.StaticLinking.Shared/native/side4.bc/5.0/side4.bc b/src/Uno.Wasm.StaticLinking.Shared/native/side4.bc/5.0/side4.bc
deleted file mode 100644
index 008c9b356..000000000
Binary files a/src/Uno.Wasm.StaticLinking.Shared/native/side4.bc/5.0/side4.bc and /dev/null differ
diff --git a/src/Uno.Wasm.StaticLinking.Shared/side_module/build.sh b/src/Uno.Wasm.StaticLinking.Shared/side_module/build.sh
index 90f6cd325..1a981fa6c 100644
--- a/src/Uno.Wasm.StaticLinking.Shared/side_module/build.sh
+++ b/src/Uno.Wasm.StaticLinking.Shared/side_module/build.sh
@@ -7,18 +7,18 @@ buildSideModule(){
emcc $1 -std=c++17 -s LEGALIZE_JS_FFI=0 -r -o $2 -s WASM=1 -fwasm-exceptions -msimd128 -s USE_LIBPNG=1 -DCUSTOM_VERSION="\"$3\"" $5 -DCUSTOM_FUNCTION_NAME="$4_getCustomVersion"
}
-buildSideModule "mysideModule.cpp" "../native/side.bc/1.2/side.bc" "1.2" "side" ""
-buildSideModule "mysideModule.cpp" "../native/side.bc/1.2/st,simd/side.bc" "1.2" "side" "-msimd128"
+buildSideModule "mysideModule.cpp" "../native/side.a/1.2/side.a" "1.2" "side" ""
+buildSideModule "mysideModule.cpp" "../native/side.a/1.2/st,simd/side.a" "1.2" "side" "-msimd128"
-buildSideModule "version_test.cpp" "../native/side2.bc/1.3/side2.bc" "1.3" "side2" ""
-buildSideModule "version_test.cpp" "../native/side2.bc/1.2/st,simd/side2.bc" "1.2" "side2" "-msimd128"
+buildSideModule "version_test.cpp" "../native/side2.a/1.3/side2.a" "1.3" "side2" ""
+buildSideModule "version_test.cpp" "../native/side2.a/1.2/st,simd/side2.a" "1.2" "side2" "-msimd128"
-buildSideModule "version_test.cpp" "../native/side3.bc/1.3/side3.bc" "1.3" "side3" ""
-buildSideModule "version_test.cpp" "../native/side3.bc/1.4/side3.bc" "1.4" "side3" ""
-buildSideModule "version_test.cpp" "../native/side3.bc/1.4/st,simd/side3.bc" "1.4" "side3" "-msimd128"
+buildSideModule "version_test.cpp" "../native/side3.a/1.3/side3.a" "1.3" "side3" ""
+buildSideModule "version_test.cpp" "../native/side3.a/1.4/side3.a" "1.4" "side3" ""
+buildSideModule "version_test.cpp" "../native/side3.a/1.4/st,simd/side3.a" "1.4" "side3" "-msimd128"
-buildSideModule "version_test.cpp" "../native/side4.bc/1.3/side4.bc" "1.3" "side4" ""
-buildSideModule "version_test.cpp" "../native/side4.bc/2.0/side4.bc" "2.0" "side4" ""
-buildSideModule "version_test.cpp" "../native/side4.bc/3.1/side4.bc" "3.1" "side4" ""
-buildSideModule "version_test.cpp" "../native/side4.bc/3.1/st,simd/side4.bc" "3.1" "side4" "-msimd128"
-buildSideModule "version_test.cpp" "../native/side4.bc/5.0/side4.bc" "5.0" "side4" ""
+buildSideModule "version_test.cpp" "../native/side4.a/1.3/side4.a" "1.3" "side4" ""
+buildSideModule "version_test.cpp" "../native/side4.a/2.0/side4.a" "2.0" "side4" ""
+buildSideModule "version_test.cpp" "../native/side4.a/3.1/side4.a" "3.1" "side4" ""
+buildSideModule "version_test.cpp" "../native/side4.a/3.1/st,simd/side4.a" "3.1" "side4" "-msimd128"
+buildSideModule "version_test.cpp" "../native/side4.a/5.0/side4.a" "5.0" "side4" ""
diff --git a/src/Uno.Wasm.StaticLinking.Shared/side_module/hello.html b/src/Uno.Wasm.StaticLinking.Shared/side_module/hello.html
index 464e351b5..c92e167d6 100644
--- a/src/Uno.Wasm.StaticLinking.Shared/side_module/hello.html
+++ b/src/Uno.Wasm.StaticLinking.Shared/side_module/hello.html
@@ -4,1213 +4,122 @@
Emscripten-Generated Code
-
+
-
- image/svg+xml
-
+
Downloading...
-
- Resize canvas
- Lock/hide mouse pointer
-
-
-
+
+ Resize canvas
+ Lock/hide mouse pointer
+
+
+
-
@@ -1222,13 +131,11 @@
var spinnerElement = document.getElementById('spinner');
var Module = {
- preRun: [],
- postRun: [],
print: (function() {
var element = document.getElementById('output');
if (element) element.value = ''; // clear browser cache
- return function(text) {
- if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
+ return (...args) => {
+ var text = args.join(' ');
// These replacements are necessary if you render to raw HTML
//text = text.replace(/&/g, "&");
//text = text.replace(/ {
var canvas = document.getElementById('canvas');
// As a default initial behavior, pop up an alert when webgl context is lost. To make your
// application robust, you may want to override this behavior before shipping!
// See http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2
- canvas.addEventListener("webglcontextlost", function(e) { alert('WebGL context lost. You will need to reload the page.'); e.preventDefault(); }, false);
+ canvas.addEventListener("webglcontextlost", (e) => { alert('WebGL context lost. You will need to reload the page.'); e.preventDefault(); }, false);
return canvas;
})(),
- setStatus: function(text) {
+ setStatus: (text) => {
if (!Module.setStatus.last) Module.setStatus.last = { time: Date.now(), text: '' };
if (text === Module.setStatus.last.text) return;
var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
@@ -1274,17 +181,17 @@
statusElement.innerHTML = text;
},
totalDependencies: 0,
- monitorRunDependencies: function(left) {
+ monitorRunDependencies: (left) => {
this.totalDependencies = Math.max(this.totalDependencies, left);
Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
}
};
Module.setStatus('Downloading...');
- window.onerror = function(event) {
+ window.onerror = (event) => {
// TODO: do not warn on ok events like simulating an infinite loop or exitStatus
Module.setStatus('Exception thrown, see JavaScript console');
spinnerElement.style.display = 'none';
- Module.setStatus = function(text) {
+ Module.setStatus = (text) => {
if (text) console.error('[post-exception status] ' + text);
};
};
@@ -1292,5 +199,3 @@