Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

328 lines (320 sloc) 15.685 kb
<Project DefaultTargets="DevBuild2Stage" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<UsingTask TaskName="MSBuild.Community.Tasks.FileUpdate" AssemblyFile="$(MSBuildProjectDirectory)\ExternalDependences\MSBuild.Community.Tasks.dll" />
<PropertyGroup Condition=" '$(NTargetName)' == '' ">
<NTargetName>Rebuild</NTargetName>
</PropertyGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<!--Path to root directory of Nemerle sources.-->
<NRoot>$(MSBuildProjectDirectory)</NRoot>
<NVer Condition="'$(TargetFrameworkVersion)' != 'v4.0'">mono-3.5</NVer>
<NVer Condition="'$(TargetFrameworkVersion)' == 'v4.0'">mono-4.0</NVer>
<!-- Original boot -->
<NRootBoot Condition="'$(TargetFrameworkVersion)' != 'v4.0'">$(NRoot)\boot\</NRootBoot>
<NRootBoot Condition="'$(TargetFrameworkVersion)' == 'v4.0'">$(NRoot)\boot-4.0\</NRootBoot>
<!--Path to stages output directory (including current configuration subfolder).-->
<NBin>$(NRoot)\bin\$(Configuration)\$(NVer)\</NBin>
<NObj>$(NRoot)\obj\$(Configuration)\$(NVer)\</NObj>
<!--Path to boot compiler.-->
<NBoot>$(NBin)\boot\</NBoot>
<!-- Project Constants -->
<NProjectConstants Condition="'$(TargetFrameworkVersion)' != 'v4.0'">RUNTIME_MONO</NProjectConstants>
<NProjectConstants Condition="'$(TargetFrameworkVersion)' == 'v4.0'">RUNTIME_MONO;NET_4_0</NProjectConstants>
<NProjectConstants Condition="'$(Configuration)' == 'Debug'">$(NProjectConstants);DEBUG</NProjectConstants>
<NDefineProjectConstants>DefineConstants=$(NProjectConstants)</NDefineProjectConstants>
</PropertyGroup>
<!--Project required to build any Nemerle project (.nproj)-->
<ItemGroup>
<NTasksProject Include="$(NRoot)\Nemerle.XBuild.Tasks.csproj" />
</ItemGroup>
<!--Projects related only to compiler.-->
<ItemGroup>
<NCompilerProject Include="$(NRoot)\Nemerle.nproj" />
<NCompilerProject Include="$(NRoot)\Nemerle.Compiler.nproj" />
<NCompilerProject Include="$(NRoot)\Nemerle.Macros.nproj" />
<NCompilerProject Include="$(NRoot)\ncc.nproj" />
</ItemGroup>
<!--Projects related to PowerPack-->
<ItemGroup>
<NPowerPack Include="$(NRoot)\snippets\peg-parser\Nemerle.Peg\Nemerle.Peg.nproj" />
<NPowerPack Include="$(NRoot)\snippets\peg-parser\Nemerle.Peg.Macros\Nemerle.Peg.Macros.nproj" />
<NPowerPack Include="$(NRoot)\snippets\csharp-parser\CSharpParser\CSharpParser.nproj" />
<NPowerPack Include="$(NRoot)\snippets\csharp-parser\CSharpToNemerle\CSharpToNemerle.nproj" />
<NPowerPack Include="$(NRoot)\snippets\Nemerle.WPF\Nemerle.WPF\Nemerle.WPF.nproj" />
<NPowerPack Include="$(NRoot)\snippets\ComputationExpressions\ComputationExpressions\ComputationExpressions.nproj" />
<NPowerPack Include="$(NRoot)\snippets\ComputationExpressions\ComputationExpressions.Macros\ComputationExpressions.Macros.nproj" />
<NPowerPack Include="$(NRoot)\snippets\ObjectExpressions\NewObjectMacro\NewObjectMacro.nproj" />
<NPowerPack Include="$(NRoot)\snippets\aop\DevMacros.nproj" />
<!-- for Nemerle.Aop build -->
<NPowerPack Include="$(NRoot)\snippets\aop\Nemerle.Aop.nproj" />
</ItemGroup>
<!--Initialize FX and SDK tools locations-->
<Target Name="InitTools">
<GetFrameworkPath>
<Output TaskParameter="Path" PropertyName="FW20" />
</GetFrameworkPath>
<GetFrameworkSdkPath>
<Output TaskParameter="Path" PropertyName="SDK" />
</GetFrameworkSdkPath>
<!--
<PropertyGroup>
<GacUtil>"$(SDK)\bin\gacutil.exe"</GacUtil>
<Ildasm>"$(SDK)\bin\ildasm.exe"</Ildasm>
<PEVerify>"$(SDK)\bin\peverify.exe"</PEVerify>
<NGen>"$(FW20)\ngen.exe"</NGen>
<MSBuild>$(MSBuildBinPath)\msbuild.exe</MSBuild>
<Junction>$(NRoot)\ExternalDependences\junction.exe</Junction>
</PropertyGroup>
-->
<CreateProperty Value="$(SDK)\..\..\..\bin\gacutil">
<Output
TaskParameter="Value"
PropertyName="GacUtil" />
</CreateProperty>
<CreateProperty Value="$(SDK)\..\..\..\bin\ildasm">
<Output
TaskParameter="Value"
PropertyName="Ildasm" />
</CreateProperty>
<CreateProperty Value="$(SDK)\..\..\..\bin\peverify">
<Output
TaskParameter="Value"
PropertyName="PEVerify" />
</CreateProperty>
<CreateProperty Value="$(FW20)\..\..\..\bin\ngen">
<Output
TaskParameter="Value"
PropertyName="NGen" />
</CreateProperty>
<CreateProperty Value="$(MSBuildBinPath)\..\..\..\bin\xbuild">
<Output
TaskParameter="Value"
PropertyName="XBuild" />
</CreateProperty>
<Message Text="Framework tools found at:" Importance="high" />
<Message Text=" XBuild - $(XBuild)" Importance="high" />
<Message Text=" NGen - $(NGen)" Importance="high" />
<Message Text="SDK tools found at:" Importance="high" />
<Message Text=" GacUtil - $(GacUtil)" Importance="high" />
<Message Text=" Ildasm - $(Ildasm)" Importance="high" />
<Message Text=" PEVerify - $(PEVerify)" Importance="high" />
</Target>
<!--Builds and deploy tasks dll into boot directory-->
<Target Name="NTasks" DependsOnTargets="InitTools">
<MSBuild Projects="@(NTasksProject)" Properties="OutputPath=$(NBoot); IntermediateOutputPath=$(NObj)\Tasks\; NKeysDir=$(NBin)\keys" Targets="$(NTargetName)" />
<CreateItem Include="$(NBoot)\Nemerle.XBuild.Tasks.dll">
<Output ItemName="NTasksFiles" TaskParameter="Include" />
</CreateItem>
<CreateItem Include="$(NBoot)\Nemerle.MSBuild.targets">
<Output ItemName="NTasksFiles" TaskParameter="Include" />
</CreateItem>
<CreateItem Include="$(NBoot)\ncc.bat">
<Output ItemName="NTasksFiles" TaskParameter="Include" />
</CreateItem>
<CreateItem Include="$(NBoot)\ncc">
<Output ItemName="NTasksFiles" TaskParameter="Include" />
</CreateItem>
</Target>
<!--Prepare boot-->
<Target Name="NPrepareBoot">
<CreateItem Include="$(NRootBoot)\*.exe">
<Output ItemName="NBootFiles" TaskParameter="Include" />
</CreateItem>
<CreateItem Include="$(NRootBoot)\*.dll">
<Output ItemName="NBootFiles" TaskParameter="Include" />
</CreateItem>
<Copy SourceFiles="@(NBootFiles)" DestinationFolder="$(NBoot)" />
</Target>
<!--Keys-->
<Target Name="NPrepareKeys">
<CreateItem Include="$(NRoot)\misc\keys\*.snk">
<Output ItemName="NKeyFiles" TaskParameter="Include"/>
</CreateItem>
<Copy SourceFiles="@(NKeyFiles)" DestinationFolder="$(NBin)\keys" />
</Target>
<!--Builds compiler using boot-->
<Target Name="Stage1" DependsOnTargets="NPrepareKeys;NPrepareBoot;NTasks">
<!--
<PropertyGroup>
<NPrevBin>$(NBoot)</NPrevBin>
<NCurBin>$(NBin)\Stage1\</NCurBin>
<NCurObj>$(NObj)\Stage1\</NCurObj>
</PropertyGroup>
-->
<CreateProperty Value="$(NBoot)">
<Output
TaskParameter="Value"
PropertyName="NPrevBin" />
</CreateProperty>
<CreateProperty Value="$(NBin)\Stage1\">
<Output
TaskParameter="Value"
PropertyName="NCurBin" />
</CreateProperty>
<CreateProperty Value="$(NObj)\Stage1\">
<Output
TaskParameter="Value"
PropertyName="NCurObj" />
</CreateProperty>
<MSBuild Projects="@(NCompilerProject)" Properties="OutputPath=$(NCurBin); IntermediateOutputPath=$(NCurObj); Nemerle=$(NPrevBin); NKeysDir=$(NBin)\keys; DefineConstants=RUNTIME_MONO" Targets="$(NTargetName)" />
<Copy SourceFiles="@(NTasksFiles)" DestinationFolder="$(NCurBin)" />
</Target>
<!--Builds compiler using Stage1-->
<Target Name="Stage2" DependsOnTargets="Stage1">
<!--
<PropertyGroup>
<NPrevBin>$(NBin)\Stage1\</NPrevBin>
<NCurBin>$(NBin)\Stage2\</NCurBin>
<NCurObj>$(NObj)\Stage2\</NCurObj>
</PropertyGroup>
-->
<CreateProperty Value="$(NBin)\Stage1\">
<Output
TaskParameter="Value"
PropertyName="NPrevBin" />
</CreateProperty>
<CreateProperty Value="$(NBin)\Stage2\">
<Output
TaskParameter="Value"
PropertyName="NCurBin" />
</CreateProperty>
<CreateProperty Value="$(NObj)\Stage2\">
<Output
TaskParameter="Value"
PropertyName="NCurObj" />
</CreateProperty>
<MSBuild Projects="@(NCompilerProject)" Properties="OutputPath=$(NCurBin); IntermediateOutputPath=$(NCurObj); Nemerle=$(NPrevBin); NKeysDir=$(NBin)\keys; DefineConstants=RUNTIME_MONO" Targets="$(NTargetName)" />
<Copy SourceFiles="@(NTasksFiles)" DestinationFolder="$(NCurBin)" />
</Target>
<!--Builds compiler using Stage2-->
<Target Name="Stage3" DependsOnTargets="Stage2">
<!--
<PropertyGroup>
<NPrevBin>$(NBin)\Stage2\</NPrevBin>
<NCurBin>$(NBin)\Stage3\</NCurBin>
<NCurObj>$(NObj)\Stage3\</NCurObj>
</PropertyGroup>
-->
<CreateProperty Value="$(NBin)\Stage2\">
<Output
TaskParameter="Value"
PropertyName="NPrevBin" />
</CreateProperty>
<CreateProperty Value="$(NBin)\Stage3\">
<Output
TaskParameter="Value"
PropertyName="NCurBin" />
</CreateProperty>
<CreateProperty Value="$(NObj)\Stage3\">
<Output
TaskParameter="Value"
PropertyName="NCurObj" />
</CreateProperty>
<MSBuild Projects="@(NCompilerProject)" Properties="OutputPath=$(NCurBin); IntermediateOutputPath=$(NCurObj); Nemerle=$(NPrevBin); NKeysDir=$(NBin)\keys; DefineConstants=RUNTIME_MONO" Targets="$(NTargetName)" />
<Copy SourceFiles="@(NTasksFiles)" DestinationFolder="$(NCurBin)" />
</Target>
<!--Builds compiler using Stage3-->
<Target Name="Stage4" DependsOnTargets="Stage3">
<!--
<PropertyGroup>
<NPrevBin>$(NBin)\Stage3\</NPrevBin>
<NCurBin>$(NBin)\Stage4\</NCurBin>
<NCurObj>$(NObj)\Stage4\</NCurObj>
</PropertyGroup>
-->
<CreateProperty Value="$(NBin)\Stage3\">
<Output
TaskParameter="Value"
PropertyName="NPrevBin" />
</CreateProperty>
<CreateProperty Value="$(NBin)\Stage4\">
<Output
TaskParameter="Value"
PropertyName="NCurBin" />
</CreateProperty>
<CreateProperty Value="$(NObj)\Stage4\">
<Output
TaskParameter="Value"
PropertyName="NCurObj" />
</CreateProperty>
<MSBuild Projects="@(NCompilerProject)" Properties="OutputPath=$(NCurBin); IntermediateOutputPath=$(NCurObj); Nemerle=$(NPrevBin); NKeysDir=$(NBin)\keys; DefineConstants=RUNTIME_MONO" Targets="$(NTargetName)" />
<Copy SourceFiles="@(NTasksFiles)" DestinationFolder="$(NCurBin)" />
</Target>
<!--Builds only PowerPack using Stage1 compiler.-->
<Target Name="PowerPack" DependsOnTargets="Stage1; _PowerPack" />
<!--Compare last two stages on IL level-->
<Target Name="Validate" DependsOnTargets="InitTools">
<!--
<ItemGroup>
<Asm2 Include="$(NPrevBin)\*.dll" />
<Asm2 Include="$(NPrevBin)\*.exe" />
<Asm3 Include="$(NCurBin)\*.dll" />
<Asm3 Include="$(NCurBin)\*.exe" />
</ItemGroup>
-->
<CreateItem Include="$(NPrevBin)\*.dll">
<Output TaskParameter="Include" ItemName="Asm2" />
</CreateItem>
<CreateItem Include="$(NPrevBin)\*.exe">
<Output TaskParameter="Include" ItemName="Asm2" />
</CreateItem>
<CreateItem Include="$(NCurBin)\*.dll">
<Output TaskParameter="Include" ItemName="Asm3" />
</CreateItem>
<CreateItem Include="$(NCurBin)\*.exe">
<Output TaskParameter="Include" ItemName="Asm3" />
</CreateItem>
<Exec Command="$(Ildasm) %(Asm2.FullPath) /output:%(Asm2.FullPath).il /nobar" WorkingDirectory="$(NPrevBin)" />
<Exec Command="$(Ildasm) %(Asm3.FullPath) /output:%(Asm3.FullPath).il /nobar" WorkingDirectory="$(NCurBin)" />
<!--
<ItemGroup>
<IL_PREV Include="$(NPrevBin)\*.il" />
<IL_LAST Include="$(NCurBin)\*.il" />
</ItemGroup>
-->
<CreateItem Include="$(NPrevBin)\*.il">
<Output TaskParameter="Include" ItemName="IL_PREV" />
</CreateItem>
<CreateItem Include="$(NCurBin)\*.il">
<Output TaskParameter="Include" ItemName="IL_LAST" />
</CreateItem>
<MSBuild.Community.Tasks.FileUpdate Files="@(IL_PREV)" Regex="^(//.*)(?=\r)" ReplacementText="// REPLACED" Multiline="True" />
<MSBuild.Community.Tasks.FileUpdate Files="@(IL_LAST)" Regex="^(//.*)(?=\r)" ReplacementText="// REPLACED" Multiline="True" />
<Exec Command="fc $(NPrevBin)\*.il $(NCurBin)\*.il" Condition=" '$(OS)' == 'Windows_NT' "/>
<Exec Command="diff --from-file=$(NPrevBin) $(NCurBin)\*.il" Condition=" '$(OS)' != 'Windows_NT' "/>
<Exec Command="$(PEVerify) %(Asm3.FullPath)" ContinueOnError="True" />
<Delete Files="@(IL_PREV)" />
<Delete Files="@(IL_LAST)" />
</Target>
<!--Runs compiler tests.-->
<Target Name="CompilerTests">
<!--Build tester positive-->
<MSBuild Projects="$(NRoot)\Tests.nproj" Properties="Nemerle=$(NCurBin); Configuration=$(Configuration); IntermediateOutputPath=$(NObj)\Tests\positive\; NTestOutPath=$(NBin)\Tests\positive\" />
<!--Build tester negative-->
<MSBuild Projects="$(NRoot)\Tests.nproj" Properties="Nemerle=$(NCurBin); Configuration=$(Configuration); IntermediateOutputPath=$(NObj)\Tests\negative\; NTestOutPath=$(NBin)\Tests\negative\" />
<!--Delete all temporary files in old testing directory-->
<CreateItem Include="$(NRoot)\ncc\testsuite\*.exe;$(NRoot)\ncc\testsuite\*.dll;$(NRoot)\ncc\testsuite\*.pdb">
<Output ItemName="NTestSuiteTempFiles" TaskParameter="Include"/>
</CreateItem>
<Delete Files="@(NTestSuiteTempFiles)" />
<!--Copy test files to the testing directory-->
<CreateItem Include="$(NRoot)\ncc\testsuite\*.*">
<Output ItemName="NTestSuiteFiles" TaskParameter="Include" />
</CreateItem>
<Copy SourceFiles="@(NTestSuiteFiles)" DestinationFolder="$(NBin)\Tests\positive" />
<Copy SourceFiles="@(NTestSuiteFiles)" DestinationFolder="$(NBin)\Tests\negative" />
<!--Run positive tests-->
<Exec Command="mono $(NBin)\Tests\positive\Tests.exe -d:$(NRoot)\ncc\testsuite\positive -p &quot;-nowarn:10003 -def:$(NProjectConstants)&quot; -s" WorkingDirectory="$(NBin)\Tests\positive" />
<!--Run negative tests-->
<Exec Command="mono $(NBin)\Tests\negative\Tests.exe -d:$(NRoot)\ncc\testsuite\negative -p &quot;-nowarn:10003 -def:$(NProjectConstants)&quot; -s" WorkingDirectory="$(NBin)\Tests\negative" />
</Target>
<!--Helper target to build power pack-->
<Target Name="_PowerPack">
<MSBuild Projects="@(NPowerPack)" Properties="OutputPath=$(NBin)\PowerPack; IntermediateOutputPath=$(NObj)\PowerPack\; Nemerle=$(NCurBin); Configuration=$(Configuration); DefineConstants=RUNTIME_MONO" Targets="$(NTargetName)" />
</Target>
<Target Name="DevBuildQuick" DependsOnTargets="Stage1;" />
<Target Name="DevBuildQuickWithTests" DependsOnTargets="Stage1; CompilerTests" />
<Target Name="DevBuild2Stage" DependsOnTargets="Stage2;" />
<Target Name="DevBuild2StageWithTests" DependsOnTargets="Stage2; CompilerTests" />
<Target Name="DevBuildFull" DependsOnTargets="Stage4; Validate; CompilerTests; _PowerPack" />
</Project>
Jump to Line
Something went wrong with that request. Please try again.