|
| 1 | +<Project DefaultTargets="NccFull" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> |
| 2 | + |
| 3 | + <UsingTask TaskName="MSBuild.Community.Tasks.FileUpdate" AssemblyFile="$(MSBuildProjectDirectory)\ExternalDependences\MSBuild.Community.Tasks.dll" /> |
| 4 | + |
| 5 | + <PropertyGroup> |
| 6 | + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
| 7 | + <NInstall Condition=" '$(NInstall)' == '' ">$(ProgramFiles)\Nemerle</NInstall> |
| 8 | + <NRoot>$(MSBuildProjectDirectory)</NRoot> |
| 9 | + <NBoot>$(NRoot)\boot</NBoot> |
| 10 | + <NBin>$(NRoot)\bin\$(Configuration)</NBin> |
| 11 | + </PropertyGroup> |
| 12 | + |
| 13 | + <Target Name="RunTests"> |
| 14 | + <!--Build tester--> |
| 15 | + <MSBuild Projects="$(NRoot)\Tests.nproj"> |
| 16 | + </MSBuild> |
| 17 | + <!--Run negative tests--> |
| 18 | + <Exec Command="tests.exe -d:negative -p "-nowarn:10003 -def:RUNTIME_MS" -s" WorkingDirectory="$(NRoot)\ncc\testsuite" /> |
| 19 | + <!--Run positive tests--> |
| 20 | + <Exec Command="tests.exe -d:positive -p "-nowarn:10003 -def:RUNTIME_MS" -s" WorkingDirectory="$(NRoot)\ncc\testsuite" /> |
| 21 | + </Target> |
| 22 | + |
| 23 | + <Target Name="RegProgFiles" DependsOnTargets="_InitTools"> |
| 24 | + <ItemGroup> |
| 25 | + <FilesToCopyToProgFiles Include="$(NBin)\*.*" /> |
| 26 | + </ItemGroup> |
| 27 | + <Copy SourceFiles="@(FilesToCopyToProgFiles)" DestinationFolder="$(NInstall)" /> |
| 28 | + <Copy SourceFiles="$(NRoot)\tools\msbuild-task\Nemerle.MSBuild.targets" DestinationFolder="$(NInstall)" /> |
| 29 | + <ItemGroup> |
| 30 | + <FilesToRegInProgFiles Include="$(NInstall)\Nemerle.dll" /> |
| 31 | + <FilesToRegInProgFiles Include="$(NInstall)\Nemerle.Compiler.dll" /> |
| 32 | + <FilesToRegInProgFiles Include="$(NInstall)\Nemerle.Macros.dll" /> |
| 33 | + <FilesToRegInProgFiles Include="$(NInstall)\Nemerle.MSBuild.Tasks.dll" /> |
| 34 | + <FilesToRegInProgFiles Include="$(NInstall)\ncc.exe" /> |
| 35 | +</ItemGroup> |
| 36 | + <Exec Command="$(GacUtil) /u %(FilesToRegInProgFiles.Filename)" IgnoreExitCode="True" WorkingDirectory="$(NInstall)" /> |
| 37 | + <Exec Command="$(NGen) uninstall %(FilesToRegInProgFiles.Filename)" WorkingDirectory="$(NInstall)" IgnoreExitCode="True" /> |
| 38 | + <Exec Command="$(NGen) install "%(FilesToRegInProgFiles.FullPath)"" WorkingDirectory="$(NInstall)" /> |
| 39 | + <PropertyGroup> |
| 40 | + <TargetLocation>"$(NInstall)\Nemerle.MSBuild.targets"</TargetLocation> |
| 41 | + </PropertyGroup> |
| 42 | + <Exec Command="reg.exe add HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\MSBuild\SafeImports /v NemerleTarget /d $(TargetLocation) /f" StdOutEncoding="Windows-1251" /> |
| 43 | + <Exec Command="reg.exe add HKCU\Software\Microsoft\VisualStudio\9.0\Configuration\MSBuild\SafeImports /v NemerleTarget /d $(TargetLocation) /f" StdOutEncoding="Windows-1251" /> |
| 44 | + <Exec Command="reg.exe add HKCU\Software\Microsoft\VisualStudio\9.0Exp\Configuration\MSBuild\SafeImports /v NemerleTarget /d $(TargetLocation) /f" StdOutEncoding="Windows-1251" /> |
| 45 | + </Target> |
| 46 | + |
| 47 | + <Target Name="NccFast" DependsOnTargets="_InitTools; _Stage1; RegProgFiles"> |
| 48 | + <OnError ExecuteTargets="_RestoreBoot" /> |
| 49 | + </Target> |
| 50 | + |
| 51 | + <Target Name="NccFull" DependsOnTargets="_InitTools; _Stage4; _Validate; RegProgFiles; RunTests"> |
| 52 | + <OnError ExecuteTargets="_RestoreBoot" /> |
| 53 | + </Target> |
| 54 | + |
| 55 | + <Target Name="Tools"> |
| 56 | + <MSBuild Projects="Tools.sln" /> |
| 57 | + </Target> |
| 58 | + |
| 59 | + <Target Name="Shell"> |
| 60 | + <MSBuild Projects="VSIntegration\Shell\NemerleStudio.sln" /> |
| 61 | + </Target> |
| 62 | + |
| 63 | + <Target Name="VSIntegration"> |
| 64 | + <MSBuild Projects="VSIntegration\Nemerle.VSIP.sln" /> |
| 65 | + </Target> |
| 66 | + |
| 67 | + <Target Name="Installer" DependsOnTargets="NccFull; Tools; VSIntegration; Shell"> |
| 68 | + <RemoveDir Directories="$(NRoot)\misc\packages\wix\dist;$(NRoot)\misc\packages\wix\bin;$(NRoot)\misc\packages\wix\obj"> |
| 69 | + </RemoveDir> |
| 70 | + <MSBuild Projects="$(NRoot)\misc\packages\wix\nemerle.sln" /> |
| 71 | + </Target> |
| 72 | + |
| 73 | + |
| 74 | + <Target Name="InstallerOnly"> |
| 75 | + <RemoveDir Directories="$(NRoot)\misc\packages\wix\dist;$(NRoot)\misc\packages\wix\bin;$(NRoot)\misc\packages\wix\obj" /> |
| 76 | + <MSBuild Projects="$(NRoot)\misc\packages\wix\nemerle.wixproj" /> |
| 77 | + </Target> |
| 78 | + |
| 79 | + <!--Builds compiler using boot--> |
| 80 | + <Target Name="_Stage1"> |
| 81 | + |
| 82 | + <Exec Command="$(MSBuild) Nemerle-2008.sln /p:Configuration=$(Configuration) /t:clean" /> |
| 83 | + <!--Rebuild compiler--> |
| 84 | + <Exec Command="$(MSBuild) Nemerle-2008.sln /p:Configuration=$(Configuration)" /> |
| 85 | + </Target> |
| 86 | + |
| 87 | + <Target Name="_Stage2" DependsOnTargets="_Stage1;_BackupBoot"> |
| 88 | + <ItemGroup> |
| 89 | + <BinFiles1 Include="$(NBin)\*.*" /> |
| 90 | + </ItemGroup> |
| 91 | + <!--Copy output of stage1 to boot.--> |
| 92 | + <Copy SourceFiles="@(BinFiles1)" DestinationFolder="$(NBoot)" /> |
| 93 | + |
| 94 | + <Exec Command="$(MSBuild) Nemerle-2008.sln /p:Configuration=$(Configuration) /t:clean" /> |
| 95 | + <!--Rebuild compiler--> |
| 96 | + <Exec Command="$(MSBuild) Nemerle-2008.sln /p:Configuration=$(Configuration)" /> |
| 97 | + </Target> |
| 98 | + |
| 99 | + <Target Name="_Stage3" DependsOnTargets="_Stage2"> |
| 100 | + <ItemGroup> |
| 101 | + <BinFiles2 Include="$(NBin)\*.*" /> |
| 102 | + </ItemGroup> |
| 103 | + <!--Copy output of stage2 to boot.--> |
| 104 | + <Copy SourceFiles="@(BinFiles2)" DestinationFolder="$(NBoot)" /> |
| 105 | + |
| 106 | + <Exec Command="$(MSBuild) Nemerle-2008.sln /p:Configuration=$(Configuration) /t:clean" /> |
| 107 | + <!--Rebuild compiler--> |
| 108 | + <Exec Command="$(MSBuild) Nemerle-2008.sln /p:Configuration=$(Configuration)" /> |
| 109 | + </Target> |
| 110 | + |
| 111 | + |
| 112 | + <Target Name="_Stage4" DependsOnTargets="_Stage3"> |
| 113 | + <ItemGroup> |
| 114 | + <BinFiles3 Include="$(NBin)\*.*" /> |
| 115 | + </ItemGroup> |
| 116 | + <!--Copy output of stage2 to boot.--> |
| 117 | + <Copy SourceFiles="@(BinFiles3)" DestinationFolder="$(NBoot)" /> |
| 118 | + |
| 119 | + <Exec Command="$(MSBuild) Nemerle-2008.sln /p:Configuration=$(Configuration) /t:clean" /> |
| 120 | + <!--Rebuild compiler--> |
| 121 | + <Exec Command="$(MSBuild) Nemerle-2008.sln /p:Configuration=$(Configuration)" /> |
| 122 | + </Target> |
| 123 | + |
| 124 | + |
| 125 | + <!--Initialize FX and SDK tools location--> |
| 126 | + <Target Name="_InitTools"> |
| 127 | + <GetFrameworkPath> |
| 128 | + <Output TaskParameter="Path" PropertyName="FW" /> |
| 129 | + </GetFrameworkPath> |
| 130 | + <GetFrameworkSdkPath> |
| 131 | + <Output TaskParameter="Path" PropertyName="SDK" /> |
| 132 | + </GetFrameworkSdkPath> |
| 133 | + <PropertyGroup> |
| 134 | + <GacUtil>"$(SDK)\bin\gacutil.exe"</GacUtil> |
| 135 | + <NGen>"$(SystemRoot)\Microsoft.NET\Framework\v2.0.50727\ngen.exe"</NGen> |
| 136 | + <Ildasm>"$(SDK)\bin\ildasm.exe"</Ildasm> |
| 137 | + <PEVerify>"$(SDK)\bin\peverify.exe"</PEVerify> |
| 138 | + <MSBuild>$(MSBuildBinPath)\msbuild.exe</MSBuild> |
| 139 | + </PropertyGroup> |
| 140 | + <Exec Command="echo Tools found at folowing locations" /> |
| 141 | + <Exec Command="echo GacUtil - $(GacUtil)" /> |
| 142 | + <Exec Command="echo NGen - $(NGen)" /> |
| 143 | + <Exec Command="echo Ildasm - $(Ildasm)" /> |
| 144 | + <Exec Command="echo PEVerify - $(PEVerify)" /> |
| 145 | + <Exec Command="echo MSBuild - $(MSBuild)" /> |
| 146 | +</Target> |
| 147 | + |
| 148 | + |
| 149 | + <!--Compare last two stages on IL level--> |
| 150 | + <Target Name="_Validate" DependsOnTargets="_InitTools"> |
| 151 | + <ItemGroup> |
| 152 | + <Asm2 Include="$(NBoot)\*.dll" /> |
| 153 | + <Asm2 Include="$(NBoot)\ncc.exe" /> |
| 154 | + <Asm3 Include="$(NBin)\*.dll" /> |
| 155 | + <Asm3 Include="$(NBin)\ncc.exe" /> |
| 156 | + </ItemGroup> |
| 157 | + <Exec Command="$(Ildasm) %(Asm2.FullPath) /output:%(Asm2.FullPath).il /nobar" WorkingDirectory="$(NBoot)" /> |
| 158 | + <Exec Command="$(Ildasm) %(Asm3.FullPath) /output:%(Asm3.FullPath).il /nobar" WorkingDirectory="$(NBin)" /> |
| 159 | + <ItemGroup> |
| 160 | + <IL_PREV Include="$(NBoot)\*.il" /> |
| 161 | + <IL_LAST Include="$(NBin)\*.il" /> |
| 162 | + </ItemGroup> |
| 163 | + <MSBuild.Community.Tasks.FileUpdate Files="@(IL_PREV)" Regex="^(//.*)(?=\r)" ReplacementText="// REPLACED" Multiline="True" /> |
| 164 | + <MSBuild.Community.Tasks.FileUpdate Files="@(IL_LAST)" Regex="^(//.*)(?=\r)" ReplacementText="// REPLACED" Multiline="True" /> |
| 165 | + <Exec Command="fc $(NBoot)\*.il $(NBin)\*.il" /> |
| 166 | + <Exec Command="$(PEVerify) %(Asm2.FullPath)" ContinueOnError="True" /> |
| 167 | + <Delete Files="@(IL_PREV)" /> |
| 168 | + <Delete Files="@(IL_LAST)" /> |
| 169 | + </Target> |
| 170 | + |
| 171 | + |
| 172 | + <!--Copy current boot content to boot\old directory--> |
| 173 | + <Target Name="_BackupBoot"> |
| 174 | + <ItemGroup> |
| 175 | + <BootFilesToBackup Include="$(NBoot)\*.*" /> |
| 176 | + </ItemGroup> |
| 177 | + <Copy SourceFiles="@(BootFilesToBackup)" DestinationFolder="$(NBoot)\old" /> |
| 178 | + </Target> |
| 179 | + <!--Restore boot content from boot\old directory--> |
| 180 | + <Target Name="_RestoreBoot" Condition="Exists('$(NBoot)\old')"> |
| 181 | + <ItemGroup> |
| 182 | + <BootFilesToDelete Include="$(NBoot)\*.*" /> |
| 183 | + <BootFilesToBackup Include="$(NBoot)\old\*.*" /> |
| 184 | + </ItemGroup> |
| 185 | + <Delete Files="@(BootFilesToDelete)" /> |
| 186 | + <Copy SourceFiles="@(BootFilesToBackup)" DestinationFolder="$(NBoot)" /> |
| 187 | + </Target> |
| 188 | +</Project> |
0 commit comments