Skip to content
This repository was archived by the owner on Jun 20, 2023. It is now read-only.

Commit 231d1c8

Browse files
committed
Fix —no-version-vectors agai
There were some initial optimizations done to the adding of —no-version-vectors to AndroidResgenExtraArgs, but they were made to the wrong file. The build script caused the modified file to be overwritten during the build making the changes ineffective. This commit cleans up where the .targets file lives so the build tasks project reads it from one source, and the build script no longer copies the file around.
1 parent bbf15c2 commit 231d1c8

File tree

5 files changed

+18
-59
lines changed

5 files changed

+18
-59
lines changed

build.cake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,8 +594,6 @@ Task ("buildtasks").Does (() =>
594594
NuGetRestore ("./vector-drawable/buildtask/Vector-Drawable-BuildTasks.csproj");
595595

596596
DotNetBuild ("./vector-drawable/buildtask/Vector-Drawable-BuildTasks.csproj", c => c.Configuration = BUILD_CONFIG);
597-
598-
CopyFile ("./vector-drawable/buildtask/bin/" + BUILD_CONFIG + "/Xamarin.Android.Support.Tasks.VectorDrawable.targets", "./vector-drawable/nuget/merge.targets");
599597
});
600598

601599
SetupXamarinBuildTasks (buildSpec, Tasks, Task);

vector-drawable/buildtask/Vector-Drawable-BuildTasks.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,11 @@
3838
<Compile Include="Properties\AssemblyInfo.cs" />
3939
<Compile Include="VectorDrawableCheckBuildToolsVersionTask.cs" />
4040
</ItemGroup>
41-
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
4241
<ItemGroup>
43-
<None Include="Xamarin.Android.Support.Tasks.VectorDrawable.targets">
44-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
42+
<None Include="..\nuget\merge.targets">
43+
<Link>merge.targets</Link>
44+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
4545
</None>
4646
</ItemGroup>
47+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
4748
</Project>

vector-drawable/buildtask/Xamarin.Android.Support.Tasks.VectorDrawable.targets

Lines changed: 0 additions & 45 deletions
This file was deleted.

vector-drawable/nuget/Xamarin.Android.Support.Vector.Drawable.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
</metadata>
2323
<files>
2424
<file src="vector-drawable/buildtask/bin/Release/Xamarin.Android.Support.Tasks.VectorDrawable.dll" target="build/MonoAndroid70" />
25-
<file src="vector-drawable/nuget/Xamarin.Android.Support.Vector.Drawable.targets" target="build/MonoAndroid70" />
25+
<file src="vector-drawable/nuget/merge.targets" target="build/MonoAndroid70/Xamarin.Android.Support.Vector.Drawable.targets" />
2626

2727
<file src="output/Xamarin.Android.Support.Vector.Drawable.dll" target="lib/MonoAndroid70" />
2828
</files>

vector-drawable/nuget/merge.targets

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
4-
<!-- Adds an argument to the call to aapt to support vectors -->
5-
<PropertyGroup>
6-
<AndroidResgenExtraArgs>$(AndroidResgenExtraArgs)--no-version-vectors</AndroidResgenExtraArgs>
7-
</PropertyGroup>
8-
93
<!--
104
*
115
* Xamarin Android Support Vector Drawable MSBuild Tasks
126
*
137
-->
14-
158
<PropertyGroup>
169
<VectorDrawableCheckBuildToolsVersionTaskFilename Condition=" '$(VectorDrawableCheckBuildToolsVersionTaskFilename)' == '' ">$(MSBuildThisFileDirectory)Xamarin.Android.Support.Tasks.VectorDrawable.dll</VectorDrawableCheckBuildToolsVersionTaskFilename>
1710
</PropertyGroup>
@@ -42,4 +35,16 @@
4235
</VectorDrawableCheckBuildToolsVersionTask>
4336
</Target>
4437

45-
</Project>
38+
<Target
39+
Name="_XamarinAndroidSupportVectorDrawableArgs"
40+
BeforeTargets="_UpdateAndroidResgen">
41+
<!-- Adds an argument to the call to aapt to support vectors -->
42+
<PropertyGroup Condition=" '$(AndroidResgenExtraArgs)' != '' AND !$(AndroidResgenExtraArgs.Contains('--no-version-vectors'))">
43+
<AndroidResgenExtraArgs>$(AndroidResgenExtraArgs.TrimEnd(' ')) --no-version-vectors</AndroidResgenExtraArgs>
44+
</PropertyGroup>
45+
<PropertyGroup Condition="'$(AndroidResgenExtraArgs)' == ''">
46+
<AndroidResgenExtraArgs>--no-version-vectors</AndroidResgenExtraArgs>
47+
</PropertyGroup>
48+
</Target>
49+
50+
</Project>

0 commit comments

Comments
 (0)