xamarin-macios/msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.ObjCBinding.CSh...

181 строка
7.8 KiB
XML

<!--
***********************************************************************************************
Xamarin.Mac.ObjcBinding.CSharp.targets
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.
This file imports the version- and platform-specific targets for the project importing
this file. This file also defines targets to produce an error if the specified targets
file does not exist, but the project is built anyway (command-line or IDE build).
Copyright (C) 2014 Xamarin Inc. All rights reserved.
***********************************************************************************************
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="Xamarin.Mac.Tasks.BTouch" AssemblyFile="Xamarin.Mac.Tasks.dll" />
<UsingTask TaskName="Xamarin.Mac.Tasks.CreateBindingResourcePackage" AssemblyFile="Xamarin.Mac.Tasks.dll" />
<UsingTask TaskName="Xamarin.MacDev.Tasks.Zip" AssemblyFile="Xamarin.Mac.Tasks.dll" />
<UsingTask TaskName="Xamarin.Mac.Tasks.PrepareNativeReferences" AssemblyFile="Xamarin.Mac.Tasks.dll" />
<UsingTask TaskName="Microsoft.Build.Tasks.Delete" AssemblyFile="Xamarin.Mac.Tasks.dll"/>
<Import Project="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).Before.targets"
Condition="Exists('$(MSBuildThisFileDirectory)$(MSBuildThisFileName).Before.targets')"/>
<!-- Due to IDE/template bugs, many bindings projects exist in the wild withtout correct TFI/TFV tags.
In addition, System is not supported, so treat System as Modern or Full, depending on TFV being set.
Microsoft.CSharp.targets gives TargetFrameworkVersion / TargetFrameworkIdentifier default values, so we _must_ do this _before_
import Microsoft.CSharp.targets. However, we can't do most of Xamarin.Mac.ObjCBinding.CSharp.props before it. -->
<Choose>
<When Condition=" '$(UseXamMacFullFramework)' == '' And ( '$(TargetFrameworkVersion)' == 'v2.0' Or '$(TargetFrameworkVersion)' == '' )">
<PropertyGroup>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<TargetFrameworkIdentifier>Xamarin.Mac</TargetFrameworkIdentifier>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<UseXamMacFullFramework>true</UseXamMacFullFramework>
<TargetFrameworkIdentifier></TargetFrameworkIdentifier>
</PropertyGroup>
</Otherwise>
</Choose>
<PropertyGroup>
<!-- Enable nuget package conflict resolution -->
<ResolveAssemblyConflicts>true</ResolveAssemblyConflicts>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildThisFileDirectory)Xamarin.Mac.ObjCBinding.CSharp.props"/>
<Import Project="$(MSBuildThisFileDirectory)Xamarin.Mac.ObjCBinding.Common.targets" />
<Import Project="$(MSBuildThisFileDirectory)Xamarin.Shared.targets" />
<PropertyGroup>
<_GeneratedSourcesFileList>$(GeneratedSourcesDir)sources.list</_GeneratedSourcesFileList>
<!-- Add our own pre and post build steps -->
<CompileDependsOn>
_GenerateBindings;
_PrepareNativeReferences;
_CollectGeneratedSources;
$(CompileDependsOn)
_CreateBindingResourcePackage;
</CompileDependsOn>
</PropertyGroup>
<!-- Override the CoreCompile Target to use btouch -->
<Target Name="_GenerateBindings"
Inputs="$(MSBuildAllProjects);@(ObjcBindingApiDefinition);@(ObjcBindingCoreSource);@(ReferencePath);@(ObjcBindingNativeLibrary)"
Outputs="$(_GeneratedSourcesFileList)"
Condition="'$(DesignTimeBuild)' != 'true'">
<ItemGroup>
<BTouchReferencePath Include="@(ReferenceCopyLocalPaths)" Condition="'%(Extension)' == '.dll'" />
</ItemGroup>
<PropertyGroup>
<BTouchEmitDebugInformation>false</BTouchEmitDebugInformation>
<BTouchEmitDebugInformation Condition="'$(Debug)' != ''">true</BTouchEmitDebugInformation>
</PropertyGroup>
<Message Text="BTouchEmitDebugInformation: $(BTouchEmitDebugInformation)"/>
<BTouch
Condition="'$(IsMacEnabled)' == 'true'"
SessionId="$(BuildSessionId)"
OutputPath="$(OutputPath)"
ObjectiveCLibraries="@(ObjcBindingNativeLibrary)"
AdditionalLibPaths="$(AdditionalLibPaths)"
AllowUnsafeBlocks="$(AllowUnsafeBlocks)"
ApiDefinitions="@(ObjcBindingApiDefinition)"
BaseLibDll="$(BaseLibDllPath)"
CoreSources="@(ObjcBindingCoreSource)"
DefineConstants="$(DefineConstants)"
EmitDebugInformation="$(BTouchEmitDebugInformation)"
ExtraArgs="$(BTouchExtraArgs)"
GeneratedSourcesDir="$(GeneratedSourcesDir)"
GeneratedSourcesFileList="$(_GeneratedSourcesFileList)"
Namespace="$(Namespace)"
OutputAssembly="$(OutputAssembly)"
ProcessEnums="$(ProcessEnums)"
ProjectDir="$(MSBuildProjectDirectory)"
References="@(ReferencePath);@(BTouchReferencePath)"
TargetFrameworkIdentifier="$(TargetFrameworkIdentifier)"
FrameworkRoot="$(XamarinMacFrameworkRoot)"
BTouchToolPath="$(BTouchToolPath)"
BTouchToolExe="$(BTouchToolExe)">
</BTouch>
</Target>
<Target Name="_PrepareNativeReferences" Condition="'$(DesignTimeBuild)' != 'true'">
<PrepareNativeReferences
Condition="'$(IsMacEnabled)' == 'true'"
SessionId="$(BuildSessionId)"
IntermediateOutputPath="$(IntermediateOutputPath)"
NativeReferences="@(NativeReference)"
>
<Output ItemName="ManifestResourceWithNoCulture" TaskParameter="EmbeddedResources" Condition="'$(NoBindingEmbedding)' != 'true'"/>
<Output ItemName="_NativeFramework" TaskParameter="NativeFrameworks" Condition="'$(NoBindingEmbedding)' != 'true'"/>
<Output ItemName="Compile" TaskParameter="LinkWithAttributes" />
</PrepareNativeReferences>
</Target>
<Target Name="_CollectNativeFrameworkResources" Returns="@(_NativeFrameworkResource)" DependsOnTargets="_PrepareNativeReferences">
<CreateItem Include="@(_NativeFramework -> '%(Identity)\**\*.*')">
<Output ItemName="_NativeFrameworkResource" TaskParameter="Include" />
</CreateItem>
</Target>
<Target Name="_CompressFrameworks" Inputs="@(_NativeFrameworkResource)" Outputs="$(IntermediateOutputPath)%(_NativeFramework.Filename)%(_NativeFramework.Extension)" DependsOnTargets="_CollectNativeFrameworkResources">
<Delete SessionId="$(BuildSessionId)" Condition="'$(IsMacEnabled)' == 'true'" Files="$(IntermediateOutputPath)%(_NativeFramework.Filename)%(_NativeFramework.Extension)" />
<Zip
Condition="'$(IsMacEnabled)' == 'true'"
SessionId="$(BuildSessionId)"
ToolExe="$(ZipExe)"
ToolPath="$(ZipPath)"
Recursive="true"
Symlinks="true"
Sources="%(_NativeFramework.Identity)"
OutputFile="$(IntermediateOutputPath)%(_NativeFramework.Filename)%(_NativeFramework.Extension)"
WorkingDirectory="%(_NativeFramework.FullPath)" >
</Zip>
<CreateItem Include="$(IntermediateOutputPath)%(_NativeFramework.Filename)%(_NativeFramework.Extension)">
<Output TaskParameter="Include" ItemName="ManifestResourceWithNoCulture" />
</CreateItem>
</Target>
<Target Name="_CollectGeneratedSources" DependsOnTargets="_CompressFrameworks;_GenerateBindings"
Condition="'$(DesignTimeBuild)' != 'true'">
<ReadLinesFromFile File="$(_GeneratedSourcesFileList)" >
<Output TaskParameter="Lines" ItemName="GeneratedSources" />
</ReadLinesFromFile>
<CreateItem Include="@(ObjcBindingCoreSource)">
<Output TaskParameter="Include" ItemName="Compile" />
</CreateItem>
<CreateItem Include="@(GeneratedSources)">
<Output TaskParameter="Include" ItemName="Compile" />
</CreateItem>
<CreateItem Include="@(ObjcBindingNativeLibrary)">
<Output TaskParameter="Include" ItemName="ManifestResourceWithNoCulture" />
</CreateItem>
</Target>
<Import Project="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).After.targets"
Condition="Exists('$(MSBuildThisFileDirectory)$(MSBuildThisFileName).After.targets')"/>
</Project>