-
Notifications
You must be signed in to change notification settings - Fork 569
[Trimming] Use resource designer Type in ResourceIdManager #11439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
ff7e772
4430cbf
55ca233
b2fed7e
d026b03
0d4d5b9
a12930a
65be7bc
75e8ee9
c0c8fe1
8ed1be6
cb89b78
6a6b180
d3d74d1
d3b944d
99877b0
c42f89d
a9ecd4c
f761140
3b800f3
6776665
7c62539
0b73eb5
50316cd
d70293f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -384,6 +384,7 @@ GenerateResourceDesigner CreateTask (string path) | |
| task.UseManagedResourceGenerator = true; | ||
| task.DesignTimeBuild = true; | ||
| task.Namespace = "Foo.Foo"; | ||
| task.AssemblyName = "Foo"; | ||
| task.NetResgenOutputFile = Path.Combine (Root, path, "Resource.designer.cs"); | ||
| task.DesignTimeOutputFile = Path.Combine (Root, path, "designtime", "Resource.designer.cs"); | ||
| task.ProjectDir = Path.Combine (Root, path); | ||
|
|
@@ -460,6 +461,34 @@ public void GenerateDesignerFileFromRtxt ([Values] bool withLibraryReference, [V | |
| Directory.Delete (Path.Combine (Root, path), recursive: true); | ||
| } | ||
|
|
||
| [Test] | ||
| public void ResourceDesignerImportGeneratorHandlesAssemblyQualifiedResourceDesignerAttribute () | ||
| { | ||
| var path = Path.Combine ("temp", TestName + " Some Space"); | ||
| CreateResourceDirectory (path); | ||
| var mapTask = CreateCaseMapTask (path); | ||
| Assert.IsTrue (mapTask.Execute (), "Map Task should have executed successfully."); | ||
|
|
||
| var libraryPath = Path.Combine (path, "Library"); | ||
| // BuildLibraryWithResources() generates a library Resource.designer.cs with: | ||
| // [assembly: ResourceDesignerAttribute("Library.Resource, Library", IsApplication=false)] | ||
| BuildLibraryWithResources (libraryPath, AndroidRuntime.MonoVM); | ||
|
|
||
| var task = CreateTask (path); | ||
| task.RTxtFile = Path.Combine (Root, path, "R.txt"); | ||
| File.WriteAllText (task.RTxtFile, Rtxt); | ||
| task.References = new TaskItem [] { | ||
| new TaskItem (Path.Combine (Root, libraryPath, "bin", "Debug", "Library.dll")) | ||
| }; | ||
|
|
||
| Assert.IsTrue (task.Execute (), "Task should have executed successfully."); | ||
| var designer = File.ReadAllText (task.NetResgenOutputFile); | ||
| // The import generator can only emit this assignment if it decoded the | ||
| // assembly-qualified attribute argument back to "Library.Resource". | ||
| StringAssert.Contains ("global::Library.Resource.Animator.slide_in_bottom = global::Foo.Foo.Resource.Animator.slide_in_bottom;", designer); | ||
| Directory.Delete (Path.Combine (Root, path), recursive: true); | ||
| } | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤖 💡 Testing — Good targeted test for the AQN round-trip! Consider also adding a negative/edge-case assertion that a library with the old non-AQN format (e.g., Rule: Test edge cases |
||
| [Test] | ||
| public void GenerateDesignerFileFromEmptyRtxt () | ||
| { | ||
|
|
@@ -489,6 +518,7 @@ public void UpdateLayoutIdIsIncludedInDesigner ([Values(true, false)] bool useRt | |
| task.UseManagedResourceGenerator = true; | ||
| task.DesignTimeBuild = true; | ||
| task.Namespace = "Foo.Foo"; | ||
| task.AssemblyName = "Foo"; | ||
| task.NetResgenOutputFile = Path.Combine (Root, path, "Resource.designer.cs"); | ||
| task.ProjectDir = Path.Combine (Root, path); | ||
| task.ResourceDirectory = Path.Combine (Root, path, "res") + Path.DirectorySeparatorChar; | ||
|
|
@@ -607,6 +637,7 @@ public void CompareAapt2AndManagedParserOutput () | |
| task.UseManagedResourceGenerator = true; | ||
| task.DesignTimeBuild = false; | ||
| task.Namespace = "MonoAndroidApplication4.MonoAndroidApplication4"; | ||
| task.AssemblyName = "MonoAndroidApplication4"; | ||
| task.NetResgenOutputFile = Path.Combine (Root, path, "Resource.designer.aapt2.cs"); | ||
| task.ProjectDir = Path.Combine (Root, path); | ||
| task.CaseMapFile = Path.Combine (Root, path, "case_map.txt"); | ||
|
|
@@ -726,6 +757,7 @@ int styleable ElevenAttributes_attr09 9 | |
| task.UseManagedResourceGenerator = true; | ||
| task.DesignTimeBuild = true; | ||
| task.Namespace = "Foo.Foo"; | ||
| task.AssemblyName = "Foo"; | ||
| task.NetResgenOutputFile = Path.Combine (Root, path, "Resource.designer.cs"); | ||
| task.ProjectDir = Path.Combine (Root, path); | ||
| task.CaseMapFile = Path.Combine (Root, path, "case_map.txt"); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.