-
Notifications
You must be signed in to change notification settings - Fork 40
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
Port MSBuild targets from Korebuild into an SDK package #145
Conversation
@@ -0,0 +1,27 @@ | |||
; EditorConfig to support per-solution formatting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually a new VS2017 thing. cref https://blogs.msdn.microsoft.com/dotnet/2016/12/15/code-style-configuration-in-the-vs2017-rc-update/
@@ -0,0 +1,8 @@ | |||
<!-- | |||
WARNING: These targets are indented for building Microsoft's ASP.NET Core repos, and is not intended |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is indented
supposed to be intended
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. yeah.
@@ -0,0 +1,5 @@ | |||
{ | |||
"sdk": { | |||
"version": "1.0.0-preview4-004233" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
global.json in an msbuild project?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup. global.json also used by the dotnet.exe muxer to determine SDK version.
<version>1.0.0-$versionsuffix$</version> | ||
<authors>Microsoft</authors> | ||
<description>Build targets and customizations to Microsoft.NET.Sdk</description> | ||
<!-- TODO use contentFiles for cs files--> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This work item is tracked somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's part of aspnet/KoreBuild#150
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
[assembly: System.Reflection.AssemblyMetadata("Serviceable", "True")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed? There's not supposed to be a DLL in this project, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is not .dll for the SDK. This file is added to the <Compile>
items.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it needed? Oh wait, is this for all our regular projects to consume (i.e. we can delete this from all the other repos)? Or is this actually compiled into a DLL right here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. This is for regular projects. we started deleting AssemblyInfo.cs from our projects because all of its content is generated by Microsoft.NET.SDK (with the exception of the this serviceable attrbute).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<BuildNumber Condition="'$(BuildNumber)'==''">$(_SecondBasedTimeStamp)</BuildNumber> | ||
<VersionSuffix Condition="'$(VersionSuffix)'!='' AND '$(BuildNumber)' != ''">$(VersionSuffix)-$(BuildNumber)</VersionSuffix> | ||
<VersionSuffix Condition="'$(VersionSuffix)'==''">$(BuildNumber)</VersionSuffix> | ||
<PackWithoutBuildNumber Condition="'$(PackWithoutBuildNumber)'==''">false</PackWithoutBuildNumber> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the CI setup to use this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet. At the moment, CI unzips *.nupkg files, edits the nuspec xml, and re-zips with the timestamp-free version. This piece here will let us set the version numbers correctly upfront.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're likely not going to do that. We almost never want to publish timestamp free builds until they're verified which this allows. But leaving this in doesn't hurt.
#pack-sdk target='package' | ||
@{ | ||
var buildNumber = E("BuildNumber") ?? BuildNumber; | ||
NugetPack(E("KOREBUILD_NUGET_EXE") ?? ".build/NuGet.exe", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: extra space
🚢 🇮🇹 after minor thing(s) |
@@ -1,7 +1,7 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<configuration> | |||
<packageSources> | |||
<add key="AspNetVNext" value="https://www.myget.org/F/aspnetcidev/api/v3/index.json" /> | |||
<add key="AspNetVNext" value="https://dotnet.myget.org/F/aspnetcore-ci-dev/api/v3/index.json" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<add key="AspNetCore" value="https://dotnet.myget.org/F/aspnetcore-ci-dev/api/v3/index.json" />
to be consistent with other repos. That said, does this actually need to reference our dev feed? Can we get away pointing to aspnet-master or something like that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, it looks like this project doesn't need anything from the nightly feed. I'll just remove altogether.
@@ -0,0 +1,49 @@ | |||
<!-- | |||
WARNING: These targets are indented for building Microsoft's ASP.NET Core repos, and is not intended |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: These targets are indented intended for
Create second-based build number for local builds. | ||
635556672000000000 is Jan 1, 2015. | ||
--> | ||
<_SecondBasedTimeStamp>$([System.DateTime]::UtcNow.Subtract($([System.DateTime]::FromBinary(635556672000000000))).TotalSeconds.ToString("F0"))</_SecondBasedTimeStamp> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does <_Timestamp>$([System.DateTime]::UtcNow.Ticks.ToString("x").PadLeft(20, '0')</_Timestamp>
work? I know they removed the special version length restriction in recent builds of NuGet, so we could simplify this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might work. But I still prefer the shorter version.
Plus, it's possible some might build with NuGet 4.0 but need to install to project.json which uses NuGet 3.5. I'm not confident the version-length restriction is fixed there.
<_SecondBasedTimeStamp>t$([System.Int64]::Parse($(_SecondBasedTimeStamp)).ToString("x9"))</_SecondBasedTimeStamp> | ||
|
||
<!-- for aspnet CI --> | ||
<BuildNumber Condition="'$(BuildNumber)'==''">$(KOREBUILD_BUILD_NUMBER)</BuildNumber> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just modify the CI to specify /p:BuildNumber=%build.number%
and remove references to KoreBuild here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too early. We can do this when we migrate everything to MSbuild.
<BuildNumber Condition="'$(BuildNumber)'==''">$(_SecondBasedTimeStamp)</BuildNumber> | ||
<VersionSuffix Condition="'$(VersionSuffix)'!='' AND '$(BuildNumber)' != ''">$(VersionSuffix)-$(BuildNumber)</VersionSuffix> | ||
<VersionSuffix Condition="'$(VersionSuffix)'==''">$(BuildNumber)</VersionSuffix> | ||
<PackWithoutBuildNumber Condition="'$(PackWithoutBuildNumber)'==''">false</PackWithoutBuildNumber> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're likely not going to do that. We almost never want to publish timestamp free builds until they're verified which this allows. But leaving this in doesn't hurt.
<_PackageReferences Include="@(_ResolvedFloatingVersion)" Condition="'%(Identity)'=='%(_ResolvedFloatingVersion.ResolvedName)'" /> | ||
</ItemGroup> | ||
|
||
<Message Importance="Normal" Text="Proj: %(_ProjectReferences.FileName) %(_ProjectReferences.PackageVersion)" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debugging code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, but it doesn't hurt to leave it. Doesn't show up by default in log output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe make Importance='Low"
?
</PropertyGroup> | ||
<!-- end workaround --> | ||
|
||
<!-- workaround https://github.com/NuGet/Home/issues/4063 --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there an RC3 build we could use that addresses these workarounds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet. We're still stuck on RC.2 because of blocking issues.
"src/Internal.AspNetCore.Sdk/Internal.AspNetCore.Sdk.nuspec", | ||
BUILD_DIR, | ||
"-Verbosity Detailed" | ||
+ " -Properties versionsuffix=alpha-" + buildNumber); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird formatting. Can you move this to the previous line?
|
||
<PropertyGroup> | ||
<!-- these imports substitute for a package reference to Internal.AspNetCore.Sdk --> | ||
<CustomBeforeMicrosoftCommonProps>$(MSBuildThisFileDirectory)..\src\Internal.AspNetCore.Sdk\build\Internal.AspNetCore.Sdk.props</CustomBeforeMicrosoftCommonProps> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<_SdkProjectDirectory>$(MSBuildThisFileDirectory)..\src\Internal.AspNetCore.Sdk</_SdkProjectDirectory>
and reuse. Probably better if we do
$([MSBuild]::GetDirectoryNameOfFileAbove($(MsBuildThisFileDirectory), NuGet.config))
since it makes multiple levels of folder hierarchy possible without hardcoding the relative directory structure
@{ | ||
var buildNumber = E("BuildNumber") ?? BuildNumber; | ||
NugetPack(E("KOREBUILD_NUGET_EXE") ?? ".build/NuGet.exe", | ||
"src/Internal.AspNetCore.Sdk/Internal.AspNetCore.Sdk.nuspec", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't we dotnet pack
the csproj?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no csproj.
a826c28
to
efa9ff1
Compare
Fixes the requirement for running 'build initialize' before opening aspnet repos in VS 2017.
Changes:
Instead of our repos importing MSBuild targets directly from the korebuild download folder, we will use NuGet to distribute these shared properties and targets.
More context:
MSBuild is working on adding first-class support for distributing SDKs via NuGet. (See dotnet/msbuild#1493). When this is in, we may be able to use that instead of a PackageReference.
cc @Eilon for naming stuff
cc @pranavkm for implementation review