Skip to content
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

Rework Layout CustomView replacement. #2100

Closed
dellis1972 opened this issue Aug 24, 2018 · 0 comments · Fixed by #2129
Closed

Rework Layout CustomView replacement. #2100

dellis1972 opened this issue Aug 24, 2018 · 0 comments · Fixed by #2129
Assignees
Labels

Comments

@dellis1972
Copy link
Contributor

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 is we use ConvertResourcesCases and it does all the processing it did in the first pass again (or tries too).

So here is an idea.

On the first pass, we create a map file which contains a list of ALL the views we find in a layout file and the file it was found in. For Example

MonoDroid.ApiDemo.Spinner1=res/layouts/custom_view.xml
android.support.v7.FancyLayout=lp/11/res/fancylayout.xml

We then write a new Task which will using this map file in conjunction with the act_map.txt (or better the typemap.jm/mj files).

Sample output of act_map.txt

MonoDroid.ApiDemo.LogTextBox;md5c5caeb16a99a36adf764572343f76a16.LogTextBox
MonoDroid.ApiDemo.Spinner1;md5c5caeb16a99a36adf764572343f76a16.Spinner1

This will allow us to speficially target the exact file(s) which contain the views we need to replace. It should save us having to parse every xml layout file and instead use dictionary lookups to quickly find the file we need to process and possibly just do a string replace..

dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Sep 3, 2018
Fixed dotnet#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 `ConvertCustomViews`. 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.
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Sep 3, 2018
Fixed dotnet#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.
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Sep 3, 2018
Fixed dotnet#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.
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Sep 4, 2018
Fixed dotnet#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.
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Sep 4, 2018
Fixed dotnet#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.
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Sep 4, 2018
Fixed dotnet#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.
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Sep 4, 2018
Fixed dotnet#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.
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Sep 5, 2018
Fixed dotnet#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.
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Sep 5, 2018
Fixed dotnet#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.
dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Sep 5, 2018
Fixed dotnet#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.
jonpryor pushed a commit that referenced this issue Sep 5, 2018
Fixes: #2100

Currently the `<ConvertResourcesCases/>` task is called twice on ALL
resources referenced by the project.  This is terribly inefficient,
but unfortunately is required: the first pass is done before the
`Compile` target, and fixes up the casing for things like
drawables/etc. so that they're ready to be processed by `aapt`.
The second pass is done after `<GenerateJavaStubs/>`, which happens
*after* the `Compile` target.  This is to replace any custom view
references with the correct `{md5}.View` style references, as 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 `<ConvertCustomView/>` task.  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,
`customview-map.txt`.  This file contains entries like:

	MonoDroid.Example.MyLayout;/fullpath/to/file.xml
	android.support.v7.widget.ActionBarOverlayLayout;/fullpath/to/some/other/file.xml

This allows us to know which files contain ANY layout.

This information in conjunction with the `acw_map.txt` file will
allow us to do a targeted update: we go through the `acw_map.txt`
values and fix up those files where we have entires in 
`customview-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.
@ghost ghost locked as resolved and limited conversation to collaborators Jun 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants