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.
This commit is contained in:
Redth 2017-04-04 08:50:14 -04:00
Родитель bbf15c28fd
Коммит 231d1c8bf8
5 изменённых файлов: 18 добавлений и 59 удалений

Просмотреть файл

@ -594,8 +594,6 @@ Task ("buildtasks").Does (() =>
NuGetRestore ("./vector-drawable/buildtask/Vector-Drawable-BuildTasks.csproj");
DotNetBuild ("./vector-drawable/buildtask/Vector-Drawable-BuildTasks.csproj", c => c.Configuration = BUILD_CONFIG);
CopyFile ("./vector-drawable/buildtask/bin/" + BUILD_CONFIG + "/Xamarin.Android.Support.Tasks.VectorDrawable.targets", "./vector-drawable/nuget/merge.targets");
});
SetupXamarinBuildTasks (buildSpec, Tasks, Task);

Просмотреть файл

@ -38,10 +38,11 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="VectorDrawableCheckBuildToolsVersionTask.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<None Include="Xamarin.Android.Support.Tasks.VectorDrawable.targets">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<None Include="..\nuget\merge.targets">
<Link>merge.targets</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>

Просмотреть файл

@ -1,45 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Adds an argument to the call to aapt to support vectors -->
<PropertyGroup>
<AndroidResgenExtraArgs>$(AndroidResgenExtraArgs)--no-version-vectors</AndroidResgenExtraArgs>
</PropertyGroup>
<!--
*
* Xamarin Android Support Vector Drawable MSBuild Tasks
*
-->
<PropertyGroup>
<VectorDrawableCheckBuildToolsVersionTaskFilename Condition=" '$(VectorDrawableCheckBuildToolsVersionTaskFilename)' == '' ">$(MSBuildThisFileDirectory)Xamarin.Android.Support.Tasks.VectorDrawable.dll</VectorDrawableCheckBuildToolsVersionTaskFilename>
</PropertyGroup>
<!-- set some defaults -->
<PropertyGroup>
<VectorDrawableCheckBuildToolsVersionTaskDependsOn>
_ResolveMonoAndroidSdks;$(VectorDrawableCheckBuildToolsVersionTaskDependsOn);
</VectorDrawableCheckBuildToolsVersionTaskDependsOn>
<VectorDrawableCheckBuildToolsVersionTaskBeforeTargets>
_UpdateAndroidResgen;$(VectorDrawableCheckBuildToolsVersionTaskBeforeTargets);
</VectorDrawableCheckBuildToolsVersionTaskBeforeTargets>
</PropertyGroup>
<!-- include the task assembly -->
<UsingTask
AssemblyFile="$(VectorDrawableCheckBuildToolsVersionTaskFilename)"
TaskName="Xamarin.Android.Support.Tasks.VectorDrawableCheckBuildToolsVersionTask" />
<!-- the build tasks -->
<Target
Name="VectorDrawableCheckBuildToolsVersionTask"
Condition=""
BeforeTargets="$(VectorDrawableCheckBuildToolsVersionTaskBeforeTargets)">
<VectorDrawableCheckBuildToolsVersionTask
AndroidSdkBuildToolsPath="$(AndroidSdkBuildToolsPath)">
</VectorDrawableCheckBuildToolsVersionTask>
</Target>
</Project>

Просмотреть файл

@ -22,7 +22,7 @@
</metadata>
<files>
<file src="vector-drawable/buildtask/bin/Release/Xamarin.Android.Support.Tasks.VectorDrawable.dll" target="build/MonoAndroid70" />
<file src="vector-drawable/nuget/Xamarin.Android.Support.Vector.Drawable.targets" target="build/MonoAndroid70" />
<file src="vector-drawable/nuget/merge.targets" target="build/MonoAndroid70/Xamarin.Android.Support.Vector.Drawable.targets" />
<file src="output/Xamarin.Android.Support.Vector.Drawable.dll" target="lib/MonoAndroid70" />
</files>

Просмотреть файл

@ -1,17 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Adds an argument to the call to aapt to support vectors -->
<PropertyGroup>
<AndroidResgenExtraArgs>$(AndroidResgenExtraArgs)--no-version-vectors</AndroidResgenExtraArgs>
</PropertyGroup>
<!--
*
* Xamarin Android Support Vector Drawable MSBuild Tasks
*
-->
<PropertyGroup>
<VectorDrawableCheckBuildToolsVersionTaskFilename Condition=" '$(VectorDrawableCheckBuildToolsVersionTaskFilename)' == '' ">$(MSBuildThisFileDirectory)Xamarin.Android.Support.Tasks.VectorDrawable.dll</VectorDrawableCheckBuildToolsVersionTaskFilename>
</PropertyGroup>
@ -42,4 +35,16 @@
</VectorDrawableCheckBuildToolsVersionTask>
</Target>
</Project>
<Target
Name="_XamarinAndroidSupportVectorDrawableArgs"
BeforeTargets="_UpdateAndroidResgen">
<!-- Adds an argument to the call to aapt to support vectors -->
<PropertyGroup Condition=" '$(AndroidResgenExtraArgs)' != '' AND !$(AndroidResgenExtraArgs.Contains('--no-version-vectors'))">
<AndroidResgenExtraArgs>$(AndroidResgenExtraArgs.TrimEnd(' ')) --no-version-vectors</AndroidResgenExtraArgs>
</PropertyGroup>
<PropertyGroup Condition="'$(AndroidResgenExtraArgs)' == ''">
<AndroidResgenExtraArgs>--no-version-vectors</AndroidResgenExtraArgs>
</PropertyGroup>
</Target>
</Project>