Coder Social home page Coder Social logo

unoplatform / uno.xamlmerge.task Goto Github PK

View Code? Open in Web Editor NEW
6.0 9.0 4.0 1.38 MB

Home Page: https://platform.uno/

License: Other

PowerShell 0.95% C# 98.73% JavaScript 0.32%
uno uno-platform webassembly wasm uwp mono xamarin csharp first-timers-friendly

uno.xamlmerge.task's Introduction

Uno.XamlMerge.Task

An msbuild task which enables the merging of WinUI XAML resource dictionaries into a single flat ResourceDictionary.

This code is derived from WinUI's BatchMergeXaml class, to be reused in any WinUI and Uno Platform Controls library.

Why merge ResourceDictionary instances ?

This task is generally used to allow for separate resource dictionary authoring (which makes them easier to load and read) to avoid impacting resources lookup runtime performance. In WinUI, ResourceDictionary resolution is performed through a graph traversal of MergedDictionaries, which generally implies that a worse case resolution can require as many lookups as there are dictionaries.

To limit the impact of the traversal, this task task takes all resource dictionaries found in a specific MSBuild item group, and merges them into a single file. This file is then generally either named Themes\Generic.xaml or referenced as a merged dictionary from another Themes\Generic.xaml file.

Using the task

See our documentation for more details on how to use this task.

uno.xamlmerge.task's People

Contributors

agneszitte avatar ajpinedam avatar dependabot[bot] avatar jeromelaban avatar ramezgerges avatar youssef1313 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

uno.xamlmerge.task's Issues

[Mobile] XamlMergeOutputFile is not generated when building the app

Current behavior

When building the app, the XamlMergeOutputFile is not generated.

Expected behavior

When building the app, the XamlMergeOutputFile should be generated.

How to reproduce it (as minimally and precisely as possible)

I am working on a net6 uno sample app

Environment

Nuget Package: uno.winui 4.6.39

Package Version(s):

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renders for Xamarin.Forms
  • Windows
  • Build tasks

Visual Studio:

  • 2022 (version: 17.4.3)

Relevant plugins:

  • Resharper (version: )

Anything else we need to know?

The only way to generate the file is to rebuild the whole project every time. Simply building does not generate the file. This is causing 2 issues.

  • The generated file is not refreshed when only the styles are modified
  • The generated file is not found when someone opens the project on the first time making the build fail. It also makes the pipeline fail every time unless you add this file to your solution (I would rather ignore those changes).

Theme dictionary keys are not correct when merged

Current behavior

I have a ResourceDictionary with two theme ResourceDictionaries for Light and Dark. When merged, the Dark one's key is now Default.

Original dictionary:
image

Merged:
image

Expected behavior

Dictionary keys remain the same.

How to reproduce it (as minimally and precisely as possible)

Environment

Nuget Package: Uno.XamlMerge.Task

Package Version(s): 0.1.0-dev.50

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renders for Xamarin.Forms
  • Windows
  • Build tasks

Visual Studio:

  • 2017 (version: )
  • 2019 (version: )
  • for Mac (version: )

Relevant plugins:

  • Resharper (version: )

Anything else we need to know?

[Android/iOS] Cannot locate MergedResourcesDictionnary.xaml with latest dev uno.ui on project with pages on UWP head

Current behavior

It doesn't localize MergedResourcesDictionnary.xaml. Which makes the app crash.
image

Expected behavior

It should be able to find the MergedResourcesDictionnary.xaml. It works still when using an older uno.ui package version (e.g 4.4.20).

Screenshot_20221021-170916

How to reproduce it (as minimally and precisely as possible)

Environment

Nuget Package:

Package Version(s):
uno.ui: 4.6.0-dev.888
uno.xamlmerge.ui: 1.1.0-dev.13

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renders for Xamarin.Forms
  • Windows
  • Build tasks

Visual Studio:

  • 2022 (version: 17.3.5)
  • 2019 (version: )
  • for Mac (version: )

Relevant plugins:

  • Resharper (version: )

Anything else we need to know?

  • In the sample, the project is set up so all xaml files goes in the UWP, to keep the UWP hot reload feature on our project.
  • If you first rebuild the UWP project, then it won't crash anymore on Android/iOS.
    • You can then delete the generated MergedResourcesDictionnary file to reproduce the crash again.

dynamically rename xmlns if different urls shares the same xmlns

What would you like to be added:

dynamically rename xmlns if different urls shares the same xmlns:

  • file1.xaml: xmlns:local="using:Something.This"
  • file2.xaml: xmlns:local="using:Something.That"

the rename should cover:

  • node name: <local:MyControl />
  • certain attribute values:
    • mc:Ignorable
    • [Style or ControlTemplate].TargetType
    • Binding.Path: <TextBlock Text="{Binding Path=(ext:MyExtensions.SomeProperty)}" />

with options to omit/override specific xmlns for edge-case scenarios: (like uno-reserved xmlns: win, not_win, ios, etc...)

[UWP] Make it so we you still use live visual tree when debugging on Windows

The XamlMerge make it so we can't access style of component with LiveVisualTree while debugging on windows.

What would you like to be added:

Have XamlMerge disabled on UPW or at the very least disabled when debugging.

Why is this needed:

LiveVisualTree is an important tool when working on front end issues and features.

For which Platform:

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renders for Xamarin.Forms
  • Windows
  • Build tasks

Anything else we need to know?

Support for the ability to disable merging for hot reload in Debug configuration

What would you like to be added:

The ability for the XamlMerge task to be disabled, so it plays nice with hot-reload tools.

Anything else we need to know?

Implementing this feature requires the generation of the top-level dictionary, but create a mode that will create an set of merged dictionaries inclusions to keep the original files explicitly referenced in order for Hot Reload to work properly.

We will be able to automatically enter that mode if the configuration is Debug.

Error .NET6 Class Library

Current behavior

Xaml Merge is working fine in the UWP & Xamarin Class Library but not in the WinUI & MAUI one and almost using the same project config.

It's generating a good file but is giving me the following error:

CSC : error UXAML0001: Processing failed for file C:\P\Nventive.View\src\View.Uno.WinUI\Themes\MergedResourceDictionaries.xaml (System.InvalidOperationException: The type u:DelayControl could not be found

If I ignore the delay control file, it will pass on the error to the next control in the generated file.

Expected behavior

Xaml Merge should be working in WinUI & MAUI Class Library.

How to reproduce it (as minimally and precisely as possible)

nventive/Nventive.View#56

https://github.com/nventive/Nventive.View/tree/dev/thla/feat-add-samples

Environment

Nuget Package:

Package Version(s):

1.1.0-dev.13

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renders for Xamarin.Forms
  • Windows
  • Build tasks

Visual Studio:

  • 2019 (version: )
  • 2022 (version: )
  • for Mac (version: )

Relevant plugins:

  • Resharper (version: )

Anything else we need to know?

Add support for `UpToDateCheck` item group

What would you like to be added:

UpToDateCheck should be added to merged dictionaries so that changes can trigger a build even those files are removed from the Page items group.

Anything else we need to know?

[NET6] Error with latest version

Current behavior

Getting the following error on the latest version.

1>C:\Users\tommy-lee.pigeon\.nuget\packages\uno.xamlmerge.task\1.26.0-dev.40\build\Uno.XamlMerge.Task.targets(15,3): error MSB4018: The "BatchMergeXaml_f76645703193d279913d46c9181e0642bc79c095" task failed unexpectedly.
1>C:\Users\tommy-lee.pigeon\.nuget\packages\uno.xamlmerge.task\1.26.0-dev.40\build\Uno.XamlMerge.Task.targets(15,3): error MSB4018: System.ArgumentOutOfRangeException: Insertion index was out of range. Must be non-negative and less than or equal to size.
1>C:\Users\tommy-lee.pigeon\.nuget\packages\uno.xamlmerge.task\1.26.0-dev.40\build\Uno.XamlMerge.Task.targets(15,3): error MSB4018: Parameter name: index
1>C:\Users\tommy-lee.pigeon\.nuget\packages\uno.xamlmerge.task\1.26.0-dev.40\build\Uno.XamlMerge.Task.targets(15,3): error MSB4018:    at System.Collections.ArrayList.Insert(Int32 index, Object value)
1>C:\Users\tommy-lee.pigeon\.nuget\packages\uno.xamlmerge.task\1.26.0-dev.40\build\Uno.XamlMerge.Task.targets(15,3): error MSB4018:    at System.Xml.XmlNamedNodeMap.InsertNodeAt(Int32 i, XmlNode node)
1>C:\Users\tommy-lee.pigeon\.nuget\packages\uno.xamlmerge.task\1.26.0-dev.40\build\Uno.XamlMerge.Task.targets(15,3): error MSB4018:    at System.Xml.XmlAttributeCollection.InsertNodeAt(Int32 i, XmlNode node)
1>C:\Users\tommy-lee.pigeon\.nuget\packages\uno.xamlmerge.task\1.26.0-dev.40\build\Uno.XamlMerge.Task.targets(15,3): error MSB4018:    at System.Xml.XmlAttributeCollection.InsertAfter(XmlAttribute newNode, XmlAttribute refNode)
1>C:\Users\tommy-lee.pigeon\.nuget\packages\uno.xamlmerge.task\1.26.0-dev.40\build\Uno.XamlMerge.Task.targets(15,3): error MSB4018:    at Uno.UI.Tasks.BatchMerge.BatchMergeXaml_f76645703193d279913d46c9181e0642bc79c095.BatchMerger.Merge(CustomTask owner, String mergedXamlFile, String projectFullPath, ITaskItem[] pageItems) in /_/src/Uno.XamlMerge.Task/BatchMergeXaml.cs:line 257
1>C:\Users\tommy-lee.pigeon\.nuget\packages\uno.xamlmerge.task\1.26.0-dev.40\build\Uno.XamlMerge.Task.targets(15,3): error MSB4018:    at Uno.UI.Tasks.BatchMerge.BatchMergeXaml_f76645703193d279913d46c9181e0642bc79c095.Execute() in /_/src/Uno.XamlMerge.Task/BatchMergeXaml.cs:line 49
1>C:\Users\tommy-lee.pigeon\.nuget\packages\uno.xamlmerge.task\1.26.0-dev.40\build\Uno.XamlMerge.Task.targets(15,3): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
1>C:\Users\tommy-lee.pigeon\.nuget\packages\uno.xamlmerge.task\1.26.0-dev.40\build\Uno.XamlMerge.Task.targets(15,3): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()

Expected behavior

How to reproduce it (as minimally and precisely as possible)

Environment

Nuget Package:

Package Version(s):

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renders for Xamarin.Forms
  • Windows
  • Build tasks

Visual Studio:

  • 2017 (version: )
  • 2019 (version: )
  • for Mac (version: )

Relevant plugins:

  • Resharper (version: )

Anything else we need to know?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.