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

[Xamarin.Android.Build.Tasks] guard AutoImport.props against empty values #7837

Merged
merged 2 commits into from
Mar 2, 2023

Commits on Feb 28, 2023

  1. [Xamarin.Android.Build.Tasks] guard AutoImport.props against empty …

    …values
    
    There is an email thread about ASP.NET projects in VS -- and something
    is potentially slowing down builds when optional workloads are
    installed.
    
    One concern is our `AutoImport.props`, take for instance the following
    `foo.targets` file:
    
        <Project>
          <ItemGroup>
            <AndroidResource Include="$(MonoAndroidResourcePrefix)\*\*.xml" />
            <AndroidResource Include="$(MonoAndroidResourcePrefix)\*\*.axml" />
            <AndroidResource Include="$(MonoAndroidResourcePrefix)\*\*.png" />
            <AndroidResource Include="$(MonoAndroidResourcePrefix)\*\*.jpg" />
            <AndroidResource Include="$(MonoAndroidResourcePrefix)\*\*.gif" />
            <AndroidResource Include="$(MonoAndroidResourcePrefix)\*\*.webp" />
            <AndroidResource Include="$(MonoAndroidResourcePrefix)\font\*.ttf" />
            <AndroidResource Include="$(MonoAndroidResourcePrefix)\font\*.otf" />
            <AndroidResource Include="$(MonoAndroidResourcePrefix)\font\*.ttc" />
            <AndroidResource Include="$(MonoAndroidResourcePrefix)\raw\*" Exclude="$(MonoAndroidResourcePrefix)\raw\.*" />
            <AndroidAsset Include="$(MonoAndroidAssetsPrefix)\**\*" Exclude="$(MonoAndroidAssetsPrefix)\**\.*\**" />
          </ItemGroup>
          <Target Name="Build" />
        </Project>
    
    In this case `$(MonoAndroidResourcePrefix)` and
    `$(MonoAndroidAssetsPrefix)` will be blank, and we get:
    
        msbuild foo.targets -bl
        ...
          MSBUILD : warning MSB5029: The value "\**\.*\**" of the "Exclude" attribute in element <ItemGroup> in file "foo.targets (13,61)" is a wildcard that results in enumerating all files on the drive, which was likely not intended. Check that referenced properties are always defined.
        1 Warning(s)
        0 Error(s)
        Time Elapsed 00:02:45.14
    
    I'm not sure this is causing an actual problem, but I think it's a
    good idea to add some safety here.
    
    I will make a similar change in Xamarin.Legacy.Sdk.
    jonathanpeppers committed Feb 28, 2023
    Configuration menu
    Copy the full SHA
    cc400b6 View commit details
    Browse the repository at this point in the history

Commits on Mar 2, 2023

  1. Indentation

    jonathanpeppers committed Mar 2, 2023
    Configuration menu
    Copy the full SHA
    89880c3 View commit details
    Browse the repository at this point in the history