Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup bootstrap build #2594

Merged
merged 7 commits into from
Oct 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion NuGet.Config
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<add key="nuget.org v2" value="https://nuget.org/api/v2/" />
<add key="myget.org roslyn nightly" value="https://dotnet.myget.org/F/roslyn/api/v3/index.json" />
<add key="dotnet.myget.org buildtools v3" value="https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json" />
<!-- <add key="myget.org nugetbuild" value="https://www.myget.org/F/nugetbuild/api/v3/index.json" /> -->
<add key="myget.org nugetbuild" value="https://dotnet.myget.org/F/nuget-build/api/v3/index.json" />
Copy link
Contributor

@cdmihai cdmihai Oct 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove comment above . Seems unneeded.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I un-commented this (and updated the feed URL) :)

<add key="dotnet.myget.org dotnet-core v3" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="myget.org aspnet vnext v3" value="https://www.myget.org/F/aspnetvnext/api/v3/index.json" />
<add key="myget.org aspnet vnext" value="https://www.myget.org/F/aspnetvnext/" />
Expand Down
7 changes: 5 additions & 2 deletions dir.props
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<MicroBuildVersion>0.2.0</MicroBuildVersion>
<GitVersioningVersion>1.6.35</GitVersioningVersion>
<NuSpecReferenceGeneratorVersion>1.4.2</NuSpecReferenceGeneratorVersion>
<NuGetVersion>4.5.0-preview1-4518</NuGetVersion>
</PropertyGroup>

<!-- Common repo directories -->
Expand All @@ -56,8 +57,10 @@
<GitVersioningDir>$(PackagesDir)\Nerdbank.GitVersioning\$(GitVersioningVersion)\build\</GitVersioningDir>

<!-- Tell build tools to use the full framework dlls that contain build tasks (like the nuget assets task) -->
<BuildToolsTaskDir>$(ToolsDir)net45/</BuildToolsTaskDir>
<PackagingTaskDir>$(ToolsDir)net45/</PackagingTaskDir>
<BuildToolsTaskDir Condition="'$(MSBuildRuntimeType)'=='Full'">$(ToolsDir)net45\</BuildToolsTaskDir>
<BuildToolsTaskDir Condition="'$(MSBuildRuntimeType)'!='Full'">$(ToolsDir)</BuildToolsTaskDir>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work in our .net core builds because the bootstrap msbuild coming from build tools is so old that MSBuildRuntimeType is empty and therefore different from "Full"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't download MSBuild when on Full (machine install on the image). We only download it when on Core. So == Core would not work, but != Full should.

<PackagingTaskDir Condition="'$(MSBuildRuntimeType)'=='Full'">$(ToolsDir)net45\</PackagingTaskDir>
<PackagingTaskDir Condition="'$(MSBuildRuntimeType)'!='Full'">$(ToolsDir)</PackagingTaskDir>

<!-- Output directories -->
<BinDir>$(RepoRoot)bin$([System.IO.Path]::DirectorySeparatorChar)</BinDir>
Expand Down
3 changes: 2 additions & 1 deletion src/.nuget/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"NuSpec.ReferenceGenerator": "1.4.2",
"Microsoft.Net.Compilers": "2.3.1",
"MicroBuild.Core": "0.2.0",
"Microsoft.DotNet.BuildTools.GenAPI": "1.0.0-beta2-00731-01"
"Microsoft.DotNet.BuildTools.GenAPI": "1.0.0-beta2-00731-01",
"NuGet.Build.Tasks": "4.5.0-preview1-4518"
},
"frameworks": {
"net46": {}
Expand Down
49 changes: 42 additions & 7 deletions targets/BootStrapMSBuild.proj
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,23 @@

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

<!-- TODO: Automate getting NuGet.Build.Tasks.dll + all dependencies. -->
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.build.tasks\$(NuGetVersion)\lib\net45\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.build.tasks\$(NuGetVersion)\runtimes\any\native\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.commands\$(NuGetVersion)\lib\net45\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.common\$(NuGetVersion)\lib\net45\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.configuration\$(NuGetVersion)\lib\net45\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.dependencyresolver.core\$(NuGetVersion)\lib\net45\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.frameworks\$(NuGetVersion)\lib\net45\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.librarymodel\$(NuGetVersion)\lib\net45\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.packaging\$(NuGetVersion)\lib\net45\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.packaging.core\$(NuGetVersion)\lib\net45\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.projectmodel\$(NuGetVersion)\lib\net45\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.protocol\$(NuGetVersion)\lib\net45\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.versioning\$(NuGetVersion)\lib\net45\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuspec.referencegenerator\$(NuGetVersion)\lib\net45\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\Newtonsoft.Json\9.0.1\lib\net45\**\*.*" />

<FreshlyBuiltBinaries Include="$(DeploymentDir)**\*.dll" />
<FreshlyBuiltBinaries Include="$(DeploymentDir)**\*.exe" />
<FreshlyBuiltBinaries Include="$(DeploymentDir)**\*.pdb" />
Expand All @@ -71,6 +88,8 @@

<Copy SourceFiles="@(InstalledNuGetFiles)"
DestinationFiles="@(InstalledNuGetFiles->'$(BootstrapDestination)Microsoft\NuGet\%(Filename)%(Extension)')" />
<Copy SourceFiles="@(NuGetCommonExtensions)"
DestinationFiles="@(NuGetCommonExtensions -> '$(BootstrapDestination)..\Common7\IDE\CommonExtensions\Microsoft\NuGet\%(RecursiveDir)%(FileName)%(Extension)')" />

<!-- Delete shim projects, because they point where we can't follow. -->
<!-- It would be better to just not copy these. -->
Expand All @@ -88,22 +107,38 @@
<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" />

<!-- TODO: Automate getting NuGet.Build.Tasks.dll + all dependencies. -->
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.build.tasks\$(NuGetVersion)\lib\netstandard1.3\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.build.tasks\$(NuGetVersion)\runtimes\any\native\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.commands\$(NuGetVersion)\lib\netstandard1.3\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.common\$(NuGetVersion)\lib\netstandard1.3\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.configuration\$(NuGetVersion)\lib\netstandard1.3\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.dependencyresolver.core\$(NuGetVersion)\lib\netstandard1.3\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.frameworks\$(NuGetVersion)\lib\netstandard1.3\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.librarymodel\$(NuGetVersion)\lib\netstandard1.3\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.packaging\$(NuGetVersion)\lib\netstandard1.3\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.packaging.core\$(NuGetVersion)\lib\netstandard1.3\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.projectmodel\$(NuGetVersion)\lib\netstandard1.3\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.protocol\$(NuGetVersion)\lib\netstandard1.3\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuget.versioning\$(NuGetVersion)\lib\netstandard1.0\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\nuspec.referencegenerator\$(NuGetVersion)\lib\netstandard1.3\**\*.*" />
<NuGetCommonExtensions Include="$(ProjectDir)packages\Newtonsoft.Json\9.0.1\lib\netstandard1.0\**\*.*" />
</ItemGroup>

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

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

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

<Copy SourceFiles="@(NuGetCommonExtensions)"
DestinationFiles="@(NuGetCommonExtensions -> '$(BootstrapDestination)%(RecursiveDir)%(FileName)%(Extension)')" />

<!-- Microsoft.Portable.CSharp.targets imports this file with a capital T -->
<Copy SourceFiles="$(DeploymentDir)\Microsoft.CSharp.targets"
Expand Down
33 changes: 4 additions & 29 deletions targets/DeployDependencies.proj
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,6 @@
SkipUnchangedFiles="true" />
</Target>

<!-- Copy content of BuildTools package to deployment folders -->
<Target Name="CopyBuildTools">
<PropertyGroup>
<BuildToolsVersionFile>$(RepoRoot)BuildToolsVersion.txt</BuildToolsVersionFile>
</PropertyGroup>
<ReadLinesFromFile File="$(BuildToolsVersionFile)">
<Output TaskParameter="Lines" ItemName="BuildToolsVersion" />
</ReadLinesFromFile>
<PropertyGroup>
<BuildToolsVersion>@(BuildToolsVersion)</BuildToolsVersion>
</PropertyGroup>
<ItemGroup>
<BuildToolsFiles Include="$(ToolPackagesDir)Microsoft.DotNet.BuildTools\$(BuildToolsVersion)\lib\*.*" />
</ItemGroup>
<Copy SourceFiles="@(BuildToolsFiles)"
DestinationFolder="$(DeploymentDir)"
SkipUnchangedFiles="true"
/>
<Copy SourceFiles="@(BuildToolsFiles)"
DestinationFolder="$(TestDeploymentDir)"
SkipUnchangedFiles="true"
/>
</Target>

<Target Name="CopyPackageContent">
<ItemGroup>
<!-- We want the list of files *after* restore, which happens
Expand Down Expand Up @@ -75,7 +51,7 @@
/>
</Target>

<UsingTask TaskName="PrereleaseResolveNuGetPackageAssets" AssemblyFile="$(ToolsDir)net45/Microsoft.DotNet.Build.Tasks.dll"/>
<UsingTask TaskName="PrereleaseResolveNuGetPackageAssets" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll"/>

<PropertyGroup>
<!--At build time, we target netstandard to be runnable on many runtimes.
Expand Down Expand Up @@ -185,7 +161,7 @@
</Target>

<Target Name="FixupFilenames"
DependsOnTargets="CopyBuildTools;DeployRuntime"
DependsOnTargets="DeployRuntime"
Condition="'$(OsEnvironment)'!='Windows_NT'">

<!-- Portable targets package has mismatched casing for Microsoft.CSharp.Targets -->
Expand All @@ -208,11 +184,10 @@
SourceFiles="$(TestDeploymentDir)\dotnet"
DestinationFiles="$(TestDeploymentDir)\dotnet.exe"
Condition="'$(MonoBuild)' != 'true'"
/>

/>
</Target>

<Target Name="DeployDependencies"
DependsOnTargets="CopyBuildTools;CopyPackageContent;CopyCompilerTools;DeployRuntime;FixupFilenames" />
DependsOnTargets="CopyPackageContent;CopyCompilerTools;DeployRuntime;FixupFilenames" />

</Project>