From 347615126bc8327bccaed7b728152ee29f3023e1 Mon Sep 17 00:00:00 2001 From: Jerome Laban Date: Fri, 1 Nov 2024 11:53:48 -0400 Subject: [PATCH 1/3] fix: don't prefix uno-assets path with the package folder for compatibility --- doc/features-additional-files.md | 16 ++++++++++++++-- .../GenerateUnoAssetsManifestTask.cs | 11 ++++++++++- src/Uno.Wasm.Sample/sample.common.props | 18 ++++++++++++++++++ 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/doc/features-additional-files.md b/doc/features-additional-files.md index a64d0e8b3..79262fb06 100644 --- a/doc/features-additional-files.md +++ b/doc/features-additional-files.md @@ -55,7 +55,19 @@ Exclusions: ``` +1. +A few files extensions are excluded (`UnoDeploy="None")`by default such as `*.a`, `*.o`. `.html` files are those named `web.config` will default to `UnoDeploy="Root"`. -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. +### Asset dictionary + +The file `wwwroot/package_XXX/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. + +The files are specified in two parts: +- The files located in the `_framework` folder, which are all the assemblies used to run the app. The path in the `uno-assets.txt` file is relative to the base uri of the site. +- The files contained in `package_XXX` folder, which are the Content files specified at build time. The path in the `uno-assets.txt` file is relative to the `package_XXX` folder of the site. + +> [!IMPORTANT] +> This file only contain files deployed in `UnoDeploy="Package"` mode. -A few files extensions are excluded (`UnoDeploy="None")`by default such as `*.a`, `*.o`. `.html` files are those named `web.config` will default to `UnoDeploy="Root"`. diff --git a/src/Uno.Wasm.Bootstrap/GenerateUnoAssetsManifestTask.cs b/src/Uno.Wasm.Bootstrap/GenerateUnoAssetsManifestTask.cs index 5dc78c40f..7554243c8 100644 --- a/src/Uno.Wasm.Bootstrap/GenerateUnoAssetsManifestTask.cs +++ b/src/Uno.Wasm.Bootstrap/GenerateUnoAssetsManifestTask.cs @@ -58,7 +58,16 @@ public override bool Execute() foreach(var asset in StaticWebAsset) { var assetPath = Path.GetDirectoryName(asset.GetMetadata("RelativePath")) + "/" + Path.GetFileName(asset.GetMetadata("FullPath")); - assets.Add(assetPath.Replace("\\", "/").TrimStart('/')); + var sanitizedAssetPath = assetPath.Replace("\\", "/").TrimStart('/'); + + if (sanitizedAssetPath.StartsWith(OutputPackagePath + "/")) + { + // Remove the original path OutputPackagePath from the path to keep + // net8 compatibility. + sanitizedAssetPath.Substring(OutputPackagePath.Length + 1); + } + + assets.Add(sanitizedAssetPath); } var assetsFilePath = Path.Combine(_intermediateAssetsPath, "uno-assets.txt"); diff --git a/src/Uno.Wasm.Sample/sample.common.props b/src/Uno.Wasm.Sample/sample.common.props index 4d81f331f..33a537c25 100644 --- a/src/Uno.Wasm.Sample/sample.common.props +++ b/src/Uno.Wasm.Sample/sample.common.props @@ -44,5 +44,23 @@ + + + + + <_appOutput>$(PublishDir)wwwroot/$(WasmShellOutputPackagePath) + + + + + + + + + + + + From f14c957f2cb6116c438eb43c8946a1cb0ca668ab Mon Sep 17 00:00:00 2001 From: Jerome Laban Date: Fri, 1 Nov 2024 11:56:23 -0400 Subject: [PATCH 2/3] chore: Adjust linting --- doc/features-additional-files.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/features-additional-files.md b/doc/features-additional-files.md index 79262fb06..077c04694 100644 --- a/doc/features-additional-files.md +++ b/doc/features-additional-files.md @@ -55,8 +55,8 @@ Exclusions: ``` -1. -A few files extensions are excluded (`UnoDeploy="None")`by default such as `*.a`, `*.o`. `.html` files are those named `web.config` will default to `UnoDeploy="Root"`. + +1. A few files extensions are excluded (`UnoDeploy="None")`by default such as `*.a`, `*.o`. `.html` files are those named `web.config` will default to `UnoDeploy="Root"`. ### Asset dictionary @@ -65,9 +65,9 @@ The file `wwwroot/package_XXX/uno-assets.txt` contains the package relative path It can be used to identify which assets are packaged with the application at runtime and avoid costly probing operations. The files are specified in two parts: + - The files located in the `_framework` folder, which are all the assemblies used to run the app. The path in the `uno-assets.txt` file is relative to the base uri of the site. - The files contained in `package_XXX` folder, which are the Content files specified at build time. The path in the `uno-assets.txt` file is relative to the `package_XXX` folder of the site. > [!IMPORTANT] > This file only contain files deployed in `UnoDeploy="Package"` mode. - From fd21e877af3f08af44268a348012f99d09866646 Mon Sep 17 00:00:00 2001 From: Jerome Laban Date: Fri, 1 Nov 2024 11:58:24 -0400 Subject: [PATCH 3/3] chore: Adjust more linting --- doc/features-additional-files.md | 8 ++++---- src/Uno.Wasm.Bootstrap/GenerateUnoAssetsManifestTask.cs | 2 +- src/Uno.Wasm.Sample/sample.common.props | 9 +++++++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/doc/features-additional-files.md b/doc/features-additional-files.md index 077c04694..94cc6661e 100644 --- a/doc/features-additional-files.md +++ b/doc/features-additional-files.md @@ -39,9 +39,9 @@ Exclusions: 1. Files in the `WasmScript` folder will be set as `UnoDeploy="None"` by default (they are not treat as content) -2. Files in the `wwwroot` folder will be set as `UnoDeploy="Root"` by default +1. Files in the `wwwroot` folder will be set as `UnoDeploy="Root"` by default -3. You can manually set the _deploy mode_ in the `.csproj` in the following way: +1. You can manually set the _deploy mode_ in the `.csproj` in the following way: ```xml @@ -58,9 +58,9 @@ Exclusions: 1. A few files extensions are excluded (`UnoDeploy="None")`by default such as `*.a`, `*.o`. `.html` files are those named `web.config` will default to `UnoDeploy="Root"`. -### Asset dictionary +### Asset dictionary -The file `wwwroot/package_XXX/uno-assets.txt` contains the package relative paths of the content files that were copied to the `wwwroot` folder. +The file `wwwroot/package_XXX/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. diff --git a/src/Uno.Wasm.Bootstrap/GenerateUnoAssetsManifestTask.cs b/src/Uno.Wasm.Bootstrap/GenerateUnoAssetsManifestTask.cs index 7554243c8..efebdcf9d 100644 --- a/src/Uno.Wasm.Bootstrap/GenerateUnoAssetsManifestTask.cs +++ b/src/Uno.Wasm.Bootstrap/GenerateUnoAssetsManifestTask.cs @@ -64,7 +64,7 @@ public override bool Execute() { // Remove the original path OutputPackagePath from the path to keep // net8 compatibility. - sanitizedAssetPath.Substring(OutputPackagePath.Length + 1); + sanitizedAssetPath = sanitizedAssetPath.Substring(OutputPackagePath.Length + 1); } assets.Add(sanitizedAssetPath); diff --git a/src/Uno.Wasm.Sample/sample.common.props b/src/Uno.Wasm.Sample/sample.common.props index 33a537c25..24c389355 100644 --- a/src/Uno.Wasm.Sample/sample.common.props +++ b/src/Uno.Wasm.Sample/sample.common.props @@ -56,9 +56,14 @@ + + <_InvalidAssetLines Include="@(_UnoAssetsLines)" + Condition="$([System.String]::Copy('%(Identity)').StartsWith('package_'))" /> + + - +