summaryrefslogtreecommitdiff
path: root/Tools/IL.targets
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/IL.targets')
-rwxr-xr-xTools/IL.targets58
1 files changed, 58 insertions, 0 deletions
diff --git a/Tools/IL.targets b/Tools/IL.targets
new file mode 100755
index 0000000000..ed536452e0
--- /dev/null
+++ b/Tools/IL.targets
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+
+ <!-- Required by Microsoft.Common.targets -->
+ <Target Name="CreateManifestResourceNames" Condition="'@(EmbeddedResource)' != ''" />
+
+ <!-- Default to ILAsm shipped with buildtools -->
+ <PropertyGroup Condition="'$(IlasmToolPath)' == ''">
+ <IlasmPath>$(MSBuildThisFileDirectory)\ilasm\</IlasmPath>
+ <IlasmToolPath Condition="'$(RunningOnUnix)'!='true' And Exists('$(IlasmPath)ilasm.exe')">$(IlasmPath)ilasm.exe</IlasmToolPath>
+ <IlasmToolPath Condition="'$(RunningOnUnix)'=='true' And Exists('$(IlasmPath)ilasm')">$(IlasmPath)ilasm</IlasmToolPath>
+ </PropertyGroup>
+
+ <!-- If buildtools wasn't restored with ILAsm, on Windows we can fallback to ILAsm from the framework -->
+ <Target Name="GetIlasmPath"
+ Condition="'$(RunningOnUnix)'!='true' And '$(IlasmToolPath)' == ''">
+ <GetFrameworkPath>
+ <Output TaskParameter="Path" PropertyName="IlasmPath" />
+ </GetFrameworkPath>
+ <PropertyGroup>
+ <IlasmPath>$(IlasmPath)\</IlasmPath>
+ <IlasmToolPath>$(IlasmPath)ilasm</IlasmToolPath>
+ </PropertyGroup>
+ </Target>
+
+ <Target Name="CoreCompile"
+ Inputs="$(MSBuildAllProjects);
+ @(Compile)"
+ Outputs="@(IntermediateAssembly);"
+ Returns=""
+ DependsOnTargets="GetIlasmPath;$(CoreCompileDependsOn)">
+ <Error Condition="'$(IlasmToolPath)' == ''" Text="IlasmToolPath must be set in order to build ilproj's outside of Windows." />
+ <PropertyGroup>
+ <_OutputTypeArgument Condition="'$(OutputType)' == 'Library'">-DLL</_OutputTypeArgument>
+ <_OutputTypeArgument Condition="'$(OutputType)' == 'Exe'">-EXE</_OutputTypeArgument>
+
+ <_KeyFileArgument Condition="'$(KeyOriginatorFile)' != ''">-KEY=$(KeyOriginatorFile)</_KeyFileArgument>
+
+ <_IlasmSwitches>-QUIET -NOLOGO</_IlasmSwitches>
+ <_IlasmSwitches Condition="'$(FoldIdenticalMethods)' == 'True'">$(_IlasmSwitches) -FOLD</_IlasmSwitches>
+ <_IlasmSwitches Condition="'$(SizeOfStackReserve)' != ''">$(_IlasmSwitches) -STACK=$(SizeOfStackReserve)</_IlasmSwitches>
+ <_IlasmSwitches Condition="'$(DebugType)' == 'Full'">$(_IlasmSwitches) -DEBUG</_IlasmSwitches>
+ <_IlasmSwitches Condition="'$(DebugType)' == 'Impl'">$(_IlasmSwitches) -DEBUG=IMPL</_IlasmSwitches>
+ <_IlasmSwitches Condition="'$(DebugType)' == 'PdbOnly'">$(_IlasmSwitches) -DEBUG=OPT</_IlasmSwitches>
+ <_IlasmSwitches Condition="'$(Optimize)' == 'True'">$(_IlasmSwitches) -OPTIMIZE</_IlasmSwitches>
+ </PropertyGroup>
+
+ <Exec Command="$(IlasmToolPath) $(_IlasmSwitches) $(_OutputTypeArgument) $(IlasmFlags) -OUTPUT=@(IntermediateAssembly) $(_KeyFileArgument) @(Compile, ' ')">
+ <Output TaskParameter="ExitCode" PropertyName="_ILAsmExitCode" />
+ </Exec>
+ <Error Text="ILAsm failed" Condition="'$(_ILAsmExitCode)' != '0'" />
+
+ <CallTarget Targets="$(TargetsTriggeredByCompilation)" Condition="'$(TargetsTriggeredByCompilation)' != ''"/>
+ </Target>
+
+ <Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
+
+</Project>