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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ https://github.com/dotnet/designs/blob/4703666296f5e59964961464c25807c727282cae/
<Using Include="Android.OS.Bundle" Alias="Bundle" Platform="Android" />
</ItemGroup>

<ItemGroup Condition=" '$(EnableDefaultAndroidItems)' == 'true' and $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '8.0')) ">
<ItemGroup Condition=" '$(MonoAndroidResourcePrefix)' != '' and
'$(EnableDefaultAndroidItems)' == 'true' and
$([MSBuild]::VersionEquals($(TargetFrameworkVersion), '8.0')) ">
<!-- Default Resource file inclusion -->
<!-- https://developer.android.com/guide/topics/resources/providing-resources -->
<AndroidResource Include="$(MonoAndroidResourcePrefix)\*\*.xml" />
jonathanpeppers marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -35,8 +37,17 @@ https://github.com/dotnet/designs/blob/4703666296f5e59964961464c25807c727282cae/
<AndroidResource Include="$(MonoAndroidResourcePrefix)\font\*.otf" />
<AndroidResource Include="$(MonoAndroidResourcePrefix)\font\*.ttc" />
<AndroidResource Include="$(MonoAndroidResourcePrefix)\raw\*" Exclude="$(MonoAndroidResourcePrefix)\raw\.*" />
</ItemGroup>

<ItemGroup Condition=" '$(MonoAndroidAssetsPrefix)' != '' and
'$(EnableDefaultAndroidItems)' == 'true' and
$([MSBuild]::VersionEquals($(TargetFrameworkVersion), '8.0')) ">
<!-- Default Asset file inclusion -->
<AndroidAsset Include="$(MonoAndroidAssetsPrefix)\**\*" Exclude="$(MonoAndroidAssetsPrefix)\**\.*\**" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to above, but…

Why support $(MonoAndroidAssetsPrefix) at all anymore? Consider @(TransformFile), @(AndroidLibrary), @(AndroidJavaSource), etc., below: none of those use $(MonoAndroidAssetsPrefix), and thus aren't susceptible to pulling in C:\**\*.

Alternatively, perhaps we could require/force $(MonoAndroidAssetsPrefix) to end with "directory-separator-char", which would allow us to change these includes to e.g.:

<AndroidResource Include="$(MonoAndroidAssetsPrefix)**\*" />

which would also prevent us from trying to traverse C:\**\*.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After discussion and thinking about AutoImports.props MSBuild ordering, we decided to just format my code better...

Spec if needed: https://github.com/dotnet/designs/blob/main/accepted/2020/workloads/workload-resolvers.md#workload-props-files

</ItemGroup>

<ItemGroup Condition=" '$(EnableDefaultAndroidItems)' == 'true'
and $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '8.0')) ">
<!-- Default XPath transforms for bindings -->
<TransformFile Include="Transforms*.xml" />
<TransformFile Include="Transforms\**\*.xml" />
Expand Down