Skip to content

Commit

Permalink
Consolidate bootstrap projects
Browse files Browse the repository at this point in the history
Move BootStrapMSBuild.proj to the targets folder
Move the logic from BootStrapAppLocalMSBuild.proj and BootStrapFullFramework.proj into BootStrapMSBuild.proj as different targets
Update scripts
  • Loading branch information
jeffkl committed Nov 2, 2016
1 parent 2d4c2ea commit 1a7b43a
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 109 deletions.
19 changes: 0 additions & 19 deletions BootStrapMSBuild.proj

This file was deleted.

4 changes: 2 additions & 2 deletions RebuildWithLocalMSBuild.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if %ERRORLEVEL% NEQ 0 (
taskkill /F /IM vbcscompiler.exe

set MSBUILDLOGPATH=%~dp0msbuild_move_bootstrap.log
set MSBUILD_ARGS=/verbosity:minimal BootStrapMSbuild.proj /p:Configuration=Debug-NetCore
set MSBUILD_ARGS=/verbosity:minimal targets\BootStrapMSbuild.proj /p:Configuration=Debug-NetCore

echo.
echo ** Moving bootstrapped MSBuild to the bootstrap folder
Expand All @@ -41,7 +41,7 @@ call "%~dp0build.cmd"
set MSBUILD_ARGS=

if %ERRORLEVEL% NEQ 0 (
echo.
echo.
echo build.cmd with bootstrapped MSBuild failed with errorlevel %ERRORLEVEL% 1>&2
goto :error
)
Expand Down
2 changes: 1 addition & 1 deletion cibuild.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ echo ** Moving bootstrapped MSBuild to the bootstrap folder
taskkill /F /IM vbcscompiler.exe

set MSBUILDLOGPATH=%~dp0msbuild_move_bootstrap-%HOST%.log
set MSBUILD_ARGS=/verbosity:minimal BootStrapMSbuild.proj /p:Configuration=%BUILD_CONFIGURATION%
set MSBUILD_ARGS=/verbosity:minimal targets\BootStrapMSbuild.proj /p:Configuration=%BUILD_CONFIGURATION%

call "%~dp0build.cmd"
if %ERRORLEVEL% NEQ 0 (
Expand Down
2 changes: 1 addition & 1 deletion cibuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ MSBUILD_ZIP="$PACKAGES_DIR/msbuild.zip"
HOME_DEFAULT="$WORKSPACE/msbuild-CI-home"

PROJECT_FILE_ARG='"'"$THIS_SCRIPT_PATH/build.proj"'"'
BOOTSTRAP_FILE_ARG='"'"$THIS_SCRIPT_PATH/BootStrapMSBuild.proj"'"'
BOOTSTRAP_FILE_ARG='"'"$THIS_SCRIPT_PATH/targets/BootStrapMSBuild.proj"'"'
BOOTSTRAPPED_RUNTIME_HOST='"'"$THIS_SCRIPT_PATH/bin/Bootstrap-NetCore/dotnet"'"'
MSBUILD_BOOTSTRAPPED_EXE='"'"$THIS_SCRIPT_PATH/bin/Bootstrap-NetCore/MSBuild.dll"'"'

Expand Down
27 changes: 0 additions & 27 deletions targets/BootStrapAppLocalMSBuild.proj

This file was deleted.

59 changes: 0 additions & 59 deletions targets/BootStrapFullFrameworkMSBuild.proj

This file was deleted.

107 changes: 107 additions & 0 deletions targets/BootStrapMSBuild.proj
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\dir.props" />

<!--
Copies the binaries of MSBuild to a bootstrap folder so we can rebuild msbuild with itself.
On netcore and mono it performs a directory copy.
On full framework it performs a more involved deployment.
-->
<Target Name="Build">

<!-- This sometimes fails so it might need be retried. -->
<RemoveDir
Directories="$(BootstrapDestination)"
ContinueOnError="true"/>

<CallTarget
Targets="BootstrapNetCore"
Condition="'$(NetCoreBuild)' == 'true' Or '$(MonoBuild)' == 'true'"
/>

<CallTarget
Targets="Bootstrap"
Condition="'$(FullFrameworkBuild)' == 'true'"
/>

</Target>

<Target Name="Bootstrap">

<ItemGroup>
<InstalledVersionedExtensions Include="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\**\*.targets" />
<InstalledVersionedExtensions Include="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\**\*.props" />

<ShimTargets Include="Microsoft.Data.Entity.targets" />
<ShimTargets Include="Microsoft.ServiceModel.targets" />
<ShimTargets Include="Microsoft.WinFx.targets" />
<ShimTargets Include="Microsoft.WorkflowBuildExtensions.targets" />
<ShimTargets Include="Microsoft.Xaml.targets" />
<ShimTargets Include="Workflow.Targets" />
<ShimTargets Include="Workflow.VisualBasic.Targets" />

<InstalledMicrosoftExtensions Include="$(MSBuildExtensionsPath)\Microsoft\**\*.props" />
<InstalledMicrosoftExtensions Include="$(MSBuildExtensionsPath)\Microsoft\**\*.targets" />

<InstalledNuGetFiles Include="$(MSBuildExtensionsPath)\Microsoft\NuGet\*" />

<FreshlyBuiltBinaries Include="$(DeploymentDir)**\*.dll" />
<FreshlyBuiltBinaries Include="$(DeploymentDir)*.exe" />
<FreshlyBuiltBinaries Include="$(DeploymentDir)*.pdb" />
<FreshlyBuiltBinaries Include="$(DeploymentDir)*.exe.config" />

<FreshlyBuiltProjects Include="$(DeploymentDir)*props" />
<FreshlyBuiltProjects Include="$(DeploymentDir)*targets" />
<FreshlyBuiltProjects Include="$(DeploymentDir)*tasks" />
</ItemGroup>

<!-- Copy in props and targets from the machine-installed MSBuildExtensionsPath -->
<Copy SourceFiles="@(InstalledVersionedExtensions)"
DestinationFiles="@(InstalledVersionedExtensions->'$(BootstrapDestination)$(TargetMSBuildToolsVersion)\%(RecursiveDir)%(Filename)%(Extension)')" />
<Copy SourceFiles="@(InstalledMicrosoftExtensions)"
DestinationFiles="@(InstalledMicrosoftExtensions->'$(BootstrapDestination)Microsoft\%(RecursiveDir)%(Filename)%(Extension)')" />

<Copy SourceFiles="@(InstalledNuGetFiles)"
DestinationFiles="@(InstalledNuGetFiles->'$(BootstrapDestination)Microsoft\NuGet\%(Filename)%(Extension)')" />

<!-- Delete shim projects, because they point where we can't follow. -->
<!-- It would be better to just not copy these. -->
<Delete Files="@(ShimTargets->'$(BootstrapDestination)$(TargetMSBuildToolsVersion)\Bin\%(FileName)%(Extension)')" />

<!-- Copy our binaries -->
<Copy SourceFiles="@(FreshlyBuiltBinaries)"
DestinationFiles="@(FreshlyBuiltBinaries -> '$(BootstrapDestination)$(TargetMSBuildToolsVersion)\Bin\%(RecursiveDir)%(Filename)%(Extension)')" />

<!-- Copy our freshly-built props and targets, overwriting anything we copied from the machine -->
<Copy SourceFiles="@(FreshlyBuiltProjects)"
DestinationFolder="$(BootstrapDestination)$(TargetMSBuildToolsVersion)\Bin" />
</Target>

<Target Name="BootstrapNetCore">
<ItemGroup>
<DeployedItems Include="$(DeploymentDir)\**\*.*"/>
<!-- Work around https://github.com/Microsoft/msbuild/issues/658
by making sure NuGet DLLs are next to MSBuild.exe -->
<DeployedItems Include="$(ToolsDir)\NuGet*.dll" />
</ItemGroup>

<RemoveDir
Directories="$(BootstrapDestination)"
ContinueOnError="true"/>

<RemoveDir
Directories="$(BootstrapDestination)"
ContinueOnError="true"/>

<Copy SourceFiles="@(DeployedItems)"
DestinationFolder="$(BootstrapDestination)\%(RecursiveDir)"
/>

<!-- Microsoft.Portable.CSharp.targets imports this file with a capital T -->
<Copy SourceFiles="$(DeploymentDir)\Microsoft.CSharp.targets"
DestinationFiles="$(BootstrapDestination)\Microsoft.CSharp.Targets" />

<RemoveDir
Directories="$(BaseOutputPathWithConfig)" />
</Target>
</Project>

0 comments on commit 1a7b43a

Please sign in to comment.