You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixed#2100
Currently `ConvertResourcesCases` is called twice on ALL
resources referenced by the project. This is terribly inefficient.
However it is required. The first pass is done before a `Compile`,
this fixes up the casing for things like drawables etc ready to
be processed by aapt. The second is done after `GenerateJavaStubs`
which happens AFTER the `Compile` step. This is to replace any
custom view references with the correct `{md5}.View` style references.
This is because we replace the normal readable namespace with an md5 hash.
The problem was that `ConvertResourcesCases` is doing a TON of
work it doesn't really need to do the second time around. For example
checking if it needs to lower case names of items. The second pass
really only needs to worry about custom views. In addition to that
it was also re-scanning ALL the files again.
This commit introduces a new Task `ConvertCustomView`. The sole
purpose of this task is to fix up the layout files which contain
custom views. It does nothing else. To make this even quicker we
modify `ConvertResourcesCases` to emit a mapping file (class-map.txt). This file
contains items like
MonoDroid.Example.MyLayout;/fullpath/to/file.xml
android.support.v7.widget.ActionBarOverlayLayout;/fullpath/to/some/other/file.xml
This allows us to know were the files are which contain ANY layout.
With this information in conjuction with the `acw_map.txt` file will
allow us to do a targeted update. So we go through the `acw_map.txt`
values and fix up those files where we have entires in the `class-map.txt`.
This reduces the amount of time spent processing files quite a bit.
For a Blank Xamarin Forms app from a clean build.
2639 ms ConvertResourcesCases 1 calls
3 ms ConvertCustomView 1 calls
Normally the `ConvertResourcesCases` would be called twice and would
take a total of 5-6 seconds.
StringAssert.Contains("md5d6f7135293df7527c983d45d07471c5e.CustomTextView",output,"md5d6f7135293df7527c983d45d07471c5e.CustomTextView should exist in the main.xml");
46
58
StringAssert.DoesNotContain("ClassLibrary1.CustomView",output,"ClassLibrary1.CustomView should have been replaced.");
@@ -59,6 +71,8 @@ public void CheckClassIsNotReplacedWithMd5 ()
StringAssert.Contains("md5d6f7135293df7527c983d45d07471c5e.CustomTextView",output,"md5d6f7135293df7527c983d45d07471c5e.CustomTextView should exist in the main.xml");
80
104
StringAssert.DoesNotContain("ClassLibrary1.CustomView",output,"ClassLibrary1.CustomView should have been replaced.");
81
105
StringAssert.Contains("classLibrary1.CustomView",output,"classLibrary1.CustomView should have been replaced.");
82
-
Assert.AreEqual(1,errors.Count,"One Error should have been raised.");
106
+
Assert.AreEqual(2,errors.Count,"One Error should have been raised.");
83
107
Assert.AreEqual("XA1002",errors[0].Code,"XA1002 should have been raised.");
108
+
Assert.AreEqual("XA1002",errors[1].Code,"XA1002 should have been raised.");
0 commit comments