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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Currently the <GenerateJavaStubs/> MSBuild task will load and
iterate over NetStandard or PCL assemblies. It simply looks at all
items in @(_ResolvedUserAssemblies) and writes Java stubs if needed.
We could look at the TargetFrameworkIdentifier and only do this
work for MonoAndroid assemblies.
To make this work:
The <ResolveAssemblies/> MSBuild task needs to parse the TargetFrameworkIdentifier and add it to the item metadata for each
assembly.
<GenerateJavaStubs/> should use a subset of @(_ResolvedUserAssemblies) where TargetFrameworkIdentifier is MonoAndroid.
Results:
Before
First: 1200 ms GenerateJavaStubs 1 calls
Incremental: 1047 ms GenerateJavaStubs 1 calls
After
First: 1084 ms GenerateJavaStubs 1 calls
Incremental: 868 ms GenerateJavaStubs 1 calls
This seems to save ~200ms in the Xamarin.Forms integration project in
this repo. Projects using lots of NetStandard/PCL assemblies should
see a bigger benefit.
The reason will be displayed to describe this comment to others. Learn more.
I prefer this original code of using value.StartsWith("MonoAndroid") -- though perhaps it should be extended to value.StartsWith("MonoAndroid,")? -- largely because I'm not sure about what are the requirements and constraints on framework names.
For example, if a "framework name" could contain a comma, the new approach of splitting on all commas may cause a "mismatch". Using StartsWith() against MonoAndroid, would alloy such fears.
The reason will be displayed to describe this comment to others. Learn more.
After using IndexOf + Substring, I think it's still OK to just compare targetFrameworkIdentifier == "MonoAndroid":
//// Summary:// Reports the zero-based index of the first occurrence of the specified string// in the current System.String object. A parameter specifies the type of search// to use for the specified string.//// Returns:// The index position of the value parameter if that string is found, or -1 if it// is not. If value is System.String.Empty, the return value is 0.publicintIndexOf(Stringvalue,StringComparisoncomparisonType);
It should be the first instance of , and targetFrameworkIdentifier will be everything before it.
…id assemblies
Currently the `<GenerateJavaStubs/>` MSBuild task will load and
iterate over NetStandard or PCL assemblies. It simply looks at all
items in `@(_ResolvedUserAssemblies)` and writes Java stubs if needed.
We could look at the `TargetFrameworkIdentifier` and *only* do this
work for `MonoAndroid` assemblies.
To make this work:
- The `<ResolveAssemblies/>` MSBuild task needs to parse the
`TargetFrameworkIdentifier` and add it to the item metadata for each
assembly.
- `<GenerateJavaStubs/>` should use a subset of
`@(_ResolvedUserAssemblies)` where `TargetFrameworkIdentifier` is
`MonoAndroid`.
Results:
Before
First: 1200 ms GenerateJavaStubs 1 calls
Incremental: 1047 ms GenerateJavaStubs 1 calls
After
First: 1084 ms GenerateJavaStubs 1 calls
Incremental: 868 ms GenerateJavaStubs 1 calls
This seems to save ~200ms in the Xamarin.Forms integration project in
this repo. Projects using lots of NetStandard/PCL assemblies should
see a bigger benefit.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
None yet
4 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently the
<GenerateJavaStubs/>
MSBuild task will load anditerate over NetStandard or PCL assemblies. It simply looks at all
items in
@(_ResolvedUserAssemblies)
and writes Java stubs if needed.We could look at the
TargetFrameworkIdentifier
and only do thiswork for
MonoAndroid
assemblies.To make this work:
<ResolveAssemblies/>
MSBuild task needs to parse theTargetFrameworkIdentifier
and add it to the item metadata for eachassembly.
<GenerateJavaStubs/>
should use a subset of@(_ResolvedUserAssemblies)
whereTargetFrameworkIdentifier
isMonoAndroid
.Results:
This seems to save ~200ms in the Xamarin.Forms integration project in
this repo. Projects using lots of NetStandard/PCL assemblies should
see a bigger benefit.