205 lines
7.6 KiB
Plaintext
205 lines
7.6 KiB
Plaintext
|
<!--
|
||
|
##############################################################################
|
||
|
#
|
||
|
# Microsoft Research Singularity
|
||
|
#
|
||
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||
|
#
|
||
|
# File: Targets\InterfaceAssembly.targets
|
||
|
|
||
|
This file contains the build logic for interface assemblies. Interface assemblies
|
||
|
contain MSIL metadata, but do not contain method bodies. Interface assemblies allow
|
||
|
cyclic dependencies (e.g. kernel.exe also IoSystem.dll both refer to each other),
|
||
|
and also allow one assembly to be replaced with another at runtime (or at ngen).
|
||
|
|
||
|
Projects that import this file can set the following properties:
|
||
|
|
||
|
AssemblyName Name of assembly, excluding file extension
|
||
|
OutputType 'Exe' or 'Library'
|
||
|
AllowUnsafeBlocks 'true' to allow unverifiable code
|
||
|
NoStrongName 'true' to turn off assembly strong name signing
|
||
|
InterfaceAssemblyIsKey 'true' to pass /key to csic.exe
|
||
|
CSIC Overrides the default compiler tool, $(BUILDDIR)\csic.exe
|
||
|
OutputPath Specifies output path for the assembly. Default is $(ILLSDIR).
|
||
|
NoStdLib 'true' to pass /nostdlib to csic.exe
|
||
|
|
||
|
Projects can declare the following items:
|
||
|
|
||
|
Compile Source file (.cs or .sg, etc.)
|
||
|
ProjectReference A reference to another interface project. The project can
|
||
|
also declare the optional 'Alias' metadata tag. This will
|
||
|
add the "=<aliasvalue>" suffix to the /r: reference arg.
|
||
|
|
||
|
-->
|
||
|
|
||
|
<Project DefaultTarget="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||
|
|
||
|
<!-- Supply defaults. -->
|
||
|
<PropertyGroup>
|
||
|
<NoStdlib Condition="'$(NoStdlib)'==''">false</NoStdlib>
|
||
|
<AllowUnsafeBlocks Condition="'$(AllowUnsafeBlocks)'==''">false</AllowUnsafeBlocks>
|
||
|
<NoStrongName Condition="'$(NoStrongName)'==''">false</NoStrongName>
|
||
|
<InterfaceAssemblyIsKey Condition="'$(InterfaceAssemblyIsKey)'==''">false</InterfaceAssemblyIsKey>
|
||
|
<OutputPath Condition="'$(OutputPath)'==''">$(ILLSDIR)</OutputPath>
|
||
|
<CSIC Condition="'$(CSIC)'==''">$(BUILDDIR)\csic.exe</CSIC>
|
||
|
</PropertyGroup>
|
||
|
|
||
|
|
||
|
<!-- Build the command line for the csic compiler. -->
|
||
|
<PropertyGroup>
|
||
|
<CompilerFlags></CompilerFlags>
|
||
|
</PropertyGroup>
|
||
|
|
||
|
<Choose>
|
||
|
<When Condition="'$(OutputType)'=='Exe'">
|
||
|
<PropertyGroup>
|
||
|
<AssemblyExt>.exe</AssemblyExt>
|
||
|
</PropertyGroup>
|
||
|
</When>
|
||
|
<When Condition="'$(OutputType)'=='Library'">
|
||
|
<PropertyGroup>
|
||
|
<AssemblyExt>.ill</AssemblyExt>
|
||
|
</PropertyGroup>
|
||
|
</When>
|
||
|
<Otherwise>
|
||
|
<ItemGroup>
|
||
|
<Error Include="The value '$(OutputType)' is not valid for the 'OutputType' property."/>
|
||
|
</ItemGroup>
|
||
|
</Otherwise>
|
||
|
</Choose>
|
||
|
|
||
|
|
||
|
<PropertyGroup>
|
||
|
<AssemblyFileName>$(AssemblyName)$(AssemblyExt)</AssemblyFileName>
|
||
|
<OutputAssemblyPath>$(OutputPath)\$(AssemblyFileName)</OutputAssemblyPath>
|
||
|
</PropertyGroup>
|
||
|
|
||
|
|
||
|
<Choose>
|
||
|
<When Condition="'$(NoStdlib)'=='false'"/>
|
||
|
|
||
|
<When Condition="'$(NoStdlib)'=='true'">
|
||
|
<PropertyGroup>
|
||
|
<CompilerFlags>$(CompilerFlags) /nostdlib</CompilerFlags>
|
||
|
</PropertyGroup>
|
||
|
</When>
|
||
|
|
||
|
<Otherwise>
|
||
|
<ItemGroup>
|
||
|
<Error Include="The value '$(NoStdlib)' is not a valid choice for the 'NoStdlib' property."/>
|
||
|
</ItemGroup>
|
||
|
</Otherwise>
|
||
|
</Choose>
|
||
|
|
||
|
<Choose>
|
||
|
<When Condition="'$(AllowUnsafeBlocks)'=='true'">
|
||
|
<PropertyGroup>
|
||
|
<CompilerFlags>$(CompilerFlags) /unsafe</CompilerFlags>
|
||
|
</PropertyGroup>
|
||
|
</When>
|
||
|
<When Condition="'$(AllowUnsafeBlocks)'=='false'">
|
||
|
</When>
|
||
|
<Otherwise>
|
||
|
<PropertyGroup>
|
||
|
<ERROR>The value '$(AllowUnsafeBlocks)' is not a valid choice for the 'AllowUnsafeBlocks' property.</ERROR>
|
||
|
</PropertyGroup>
|
||
|
</Otherwise>
|
||
|
</Choose>
|
||
|
|
||
|
|
||
|
|
||
|
<Choose>
|
||
|
<When Condition="'$(NoStrongName)'=='false'">
|
||
|
|
||
|
<ItemGroup>
|
||
|
<DependentProject Include="$(SINGULARITY_ROOT)\Build\BuildKey.proj"/>
|
||
|
<Dependency Include="$(StrongNameKeyFile)"/>
|
||
|
</ItemGroup>
|
||
|
|
||
|
</When>
|
||
|
</Choose>
|
||
|
|
||
|
<Choose>
|
||
|
<When Condition="'$(InterfaceAssemblyIsKey)'=='true'">
|
||
|
<PropertyGroup>
|
||
|
<CompilerFlags>$(CompilerFlags) /key</CompilerFlags>
|
||
|
</PropertyGroup>
|
||
|
</When>
|
||
|
</Choose>
|
||
|
|
||
|
<!-- TARGETS -->
|
||
|
|
||
|
<Target Name="CheckErrors">
|
||
|
<Error Condition="'@(Error)'!=''" Text="%(Error.Identity)"/>
|
||
|
<Error Condition="'$(AssemblyName)'==''" Text="The 'AssemblyName' property is required."/>
|
||
|
<Error Condition="'$(OutputPath)'==''" Text="The 'OutputPath' property is required."/>
|
||
|
<Error Condition="'$(OutputType)'==''" Text="The 'OutputType' property is required."/>
|
||
|
</Target>
|
||
|
|
||
|
<Target Name="ShowDebugInfo" DependsOnTargets="CheckErrors">
|
||
|
<Message Text="Projects: @(ProjectReference,' ')"/>
|
||
|
<Message Text="Dependent project: %(ProjectReference.Identity)"/>
|
||
|
<Message Text="_aliased_refs: %(_aliased_refs.Identity)"/>
|
||
|
<Message Text="Reference: %(Reference.Identity) alias %(Reference.Alias)"/>
|
||
|
</Target>
|
||
|
|
||
|
<Target Name="BuildDependentProjects" DependsOnTargets="CheckErrors">
|
||
|
<MSBuild Projects="@(ProjectReference);@(DependentProject)" Targets="Build">
|
||
|
<Output TaskParameter="TargetOutputs" ItemName="__built_items" />
|
||
|
</MSBuild>
|
||
|
|
||
|
<!-- i hate this. -->
|
||
|
<CreateItem Include="@(ProjectReference->'$(OutputPath)\%(filename).ill')" AdditionalMetadata="Alias=%(ProjectReference.Alias)">
|
||
|
<Output TaskParameter="Include" ItemName="Reference"/>
|
||
|
</CreateItem>
|
||
|
|
||
|
<!-- now create "_aliased_refs" set -->
|
||
|
<CreateItem Include="@(Reference)">
|
||
|
<Output TaskParameter="Include" Condition="'%(Reference.Alias)'==''" ItemName="_aliased_refs" />
|
||
|
</CreateItem>
|
||
|
|
||
|
<CreateItem Include="%(Reference.Identity)=%(Reference.Alias)">
|
||
|
<Output TaskParameter="Include" Condition="'%(Reference.Alias)'!=''" ItemName="_aliased_refs" />
|
||
|
</CreateItem>
|
||
|
|
||
|
</Target>
|
||
|
|
||
|
<Target Name="BuildStrongName" DependsOnTargets="CheckErrors"
|
||
|
Inputs="$(BUILDDIR)\BuildKey.snk"
|
||
|
Outputs="$(OutputPath)\public.snk"
|
||
|
Condition="'$(NoStrongName)'!='true'"
|
||
|
>
|
||
|
<MakeDir Directories="$(OutputPath)"/>
|
||
|
<Exec Command="$(BUILDDIR)\sn -q -p $(BUILDDIR)\BuildKey.snk $(OutputPath)\public.snk"/>
|
||
|
</Target>
|
||
|
|
||
|
|
||
|
<Target Name="BuildAssembly"
|
||
|
Inputs="@(Compile);@(Reference);@(Dependency);$(MSBuildProjectFullPath)"
|
||
|
Outputs="$(OutputAssemblyPath)"
|
||
|
DependsOnTargets="CheckErrors;BuildStrongName;BuildDependentProjects">
|
||
|
|
||
|
<MakeDir Directories="$(OutputPath)"/>
|
||
|
<Exec Command="$(CSIC) -out:$(OutputAssemblyPath) -outdir:$(OutputPath) $(CompilerFlags) @(_aliased_refs->'/r:%(Identity)',' ') -t:library @(Compile,' ') || (
|
||
|
echo Deleting corrupted output - $(OutputAssemblyPath) & del $(OutputAssemblyPath) /q & exit 1)"/>
|
||
|
</Target>
|
||
|
|
||
|
<Target Name="Build"
|
||
|
Outputs="$(OutputAssemblyPath)"
|
||
|
DependsOnTargets="BuildAssembly">
|
||
|
</Target>
|
||
|
|
||
|
<Target Name="Clean" DependsOnTargets="$(CleanDependsOn)">
|
||
|
<Delete Files="$(OutputAssemblyPath)"/>
|
||
|
<Delete Files="$(OutputPath)\$(AssemblyName).pdb"/>
|
||
|
<Delete Files="$(OutputPath)\$(AssemblyName).il"/>
|
||
|
</Target>
|
||
|
|
||
|
<Target Name="ShowCommands">
|
||
|
<MSBuild Projects="@(ProjectReference);@(DependentProject)" Targets="ShowCommands"/>
|
||
|
<Message Text="$(CSIC) -out:$(OutputAssemblyPath) -outdir:$(OutputPath) $(CompilerFlags) @(_aliased_refs->'/r:%(Identity)',' ') -t:library @(Compile,' ')"/>
|
||
|
</Target>
|
||
|
|
||
|
</Project>
|
||
|
|