Skip to content

Commit

Permalink
Fix AOT fixup failure when XAML files are in sub directories
Browse files Browse the repository at this point in the history
  • Loading branch information
driver1998 committed Aug 21, 2024
1 parent 485dbca commit 197350d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions BuildTasks/NativeAotFixup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ private void Pass1Fixes()

private void Pass2Fixes()
{
Log.LogMessage(MessageImportance.High, "Pass2AddPartial");
var pagePass2CsList = Directory.GetFiles(ObjDirectory, "*.g.cs");
var pagePass2CsList = Directory.GetFiles(ObjDirectory, "*.g.cs", SearchOption.AllDirectories);
foreach (var pagePass2Cs in pagePass2CsList)
{
var filename = Path.GetFileName(pagePass2Cs);
Expand All @@ -52,9 +51,7 @@ private void Pass2Fixes()
continue;
}

var path = Path.Combine(ObjDirectory, filename);

var str = File.ReadAllText(path);
var str = File.ReadAllText(pagePass2Cs);
str = Regex.Replace(str,
"private class (.*?_obj\\d*_Bindings) :(\\s+global::Windows.UI.Xaml.(?:IDataTemplateExtension|Markup.IDataTemplateComponent|Markup.IXamlBindScopeDiagnostics|Markup.IComponentConnector),)",
"private partial class $1 :$2");
Expand All @@ -72,7 +69,7 @@ private void Pass2Fixes()
str = Regex.Replace(str,
"(this.dataRoot = )\\((global::.*?)\\)(.*?);",
"$1global::WinRT.CastExtensions.As<$2>($3);");
File.WriteAllText(path, str);
File.WriteAllText(pagePass2Cs, str);
}
}

Expand Down
2 changes: 1 addition & 1 deletion ModernXamlCompiler/ModernXamlCompiler.msbuildproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<PropertyGroup>
<PackageId>DisposableMemory.ModernNetUAP.XamlCompiler</PackageId>
<Version>0.2.2-preview1</Version>
<Version>0.2.2</Version>
<Authors>driver1998</Authors>
<Description>UWP (Windows.UI.Xaml) Xaml Compiler support for Modern .NET</Description>
<PackageProjectUrl>https://github.com/driver1998/ModernNetUAP.XamlCompiler</PackageProjectUrl>
Expand Down

0 comments on commit 197350d

Please sign in to comment.