From 210686a4052a3349c18ff853982d9febc00146ce Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 20 Sep 2016 17:30:41 -0700 Subject: [PATCH 1/4] Making build use Sake --- .gitignore | 3 +- build.cmd | 3 +- build.ps1 | 67 +++++++++++++++++++++++++++++++ src/AspNetCore/AspNetCore.vcxproj | 8 ++-- src/IISLib/IISLib.vcxproj | 8 ++-- 5 files changed, 79 insertions(+), 10 deletions(-) create mode 100644 build.ps1 diff --git a/.gitignore b/.gitignore index efccce79d1..50c65f5468 100644 --- a/.gitignore +++ b/.gitignore @@ -45,4 +45,5 @@ src/*/x64/Release/ src/AspNetCore/aspnetcore_msg.h src/AspNetCore/aspnetcore_msg.rc -src/AspNetCore/version.h \ No newline at end of file +src/AspNetCore/version.h +.build \ No newline at end of file diff --git a/build.cmd b/build.cmd index 0d744a8940..7d4894cb4a 100644 --- a/build.cmd +++ b/build.cmd @@ -1 +1,2 @@ -msbuild "%~dp0\Build\build.msbuild" /v:minimal /maxcpucount /nodeReuse:false %* \ No newline at end of file +@ECHO OFF +PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*; exit $LASTEXITCODE" \ No newline at end of file diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000000..8f2f99691a --- /dev/null +++ b/build.ps1 @@ -0,0 +1,67 @@ +$ErrorActionPreference = "Stop" + +function DownloadWithRetry([string] $url, [string] $downloadLocation, [int] $retries) +{ + while($true) + { + try + { + Invoke-WebRequest $url -OutFile $downloadLocation + break + } + catch + { + $exceptionMessage = $_.Exception.Message + Write-Host "Failed to download '$url': $exceptionMessage" + if ($retries -gt 0) { + $retries-- + Write-Host "Waiting 10 seconds before retrying. Retries left: $retries" + Start-Sleep -Seconds 10 + + } + else + { + $exception = $_.Exception + throw $exception + } + } + } +} + +cd $PSScriptRoot + +$repoFolder = $PSScriptRoot +$env:REPO_FOLDER = $repoFolder + +$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip" +if ($env:KOREBUILD_ZIP) +{ + $koreBuildZip=$env:KOREBUILD_ZIP +} + +$buildFolder = ".build" +$buildFile="$buildFolder\KoreBuild.ps1" + +if (!(Test-Path $buildFolder)) { + Write-Host "Downloading KoreBuild from $koreBuildZip" + + $tempFolder=$env:TEMP + "\KoreBuild-" + [guid]::NewGuid() + New-Item -Path "$tempFolder" -Type directory | Out-Null + + $localZipFile="$tempFolder\korebuild.zip" + + DownloadWithRetry -url $koreBuildZip -downloadLocation $localZipFile -retries 6 + + Add-Type -AssemblyName System.IO.Compression.FileSystem + [System.IO.Compression.ZipFile]::ExtractToDirectory($localZipFile, $tempFolder) + + New-Item -Path "$buildFolder" -Type directory | Out-Null + copy-item "$tempFolder\**\build\*" $buildFolder -Recurse + + # Cleanup + if (Test-Path $tempFolder) { + Remove-Item -Recurse -Force $tempFolder + } +} + +&"$buildFile" $args \ No newline at end of file diff --git a/src/AspNetCore/AspNetCore.vcxproj b/src/AspNetCore/AspNetCore.vcxproj index e3d552cc05..fb903b5862 100644 --- a/src/AspNetCore/AspNetCore.vcxproj +++ b/src/AspNetCore/AspNetCore.vcxproj @@ -32,27 +32,27 @@ DynamicLibrary true - v120 + v140 Unicode DynamicLibrary true - v120 + v140 Unicode false DynamicLibrary false - v120 + v140 true Unicode DynamicLibrary false - v120 + v140 true Unicode diff --git a/src/IISLib/IISLib.vcxproj b/src/IISLib/IISLib.vcxproj index eeaf5e04f5..5f6181152e 100644 --- a/src/IISLib/IISLib.vcxproj +++ b/src/IISLib/IISLib.vcxproj @@ -28,26 +28,26 @@ StaticLibrary true - v120 + v140 Unicode StaticLibrary true - v120 + v140 Unicode StaticLibrary false - v120 + v140 true Unicode StaticLibrary false - v120 + v140 true Unicode From 0327e3b9935c85aacdf2090b72c91f5d3de1a7a7 Mon Sep 17 00:00:00 2001 From: Sourabh Shirhatti Date: Wed, 21 Sep 2016 15:02:10 -0700 Subject: [PATCH 2/4] Change output directory to work with KoreBuild --- Build/Build.Settings | 2 +- src/AspNetCore/AspNetCore.vcxproj | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Build/Build.Settings b/Build/Build.Settings index c1752abb93..ae2912343a 100644 --- a/Build/Build.Settings +++ b/Build/Build.Settings @@ -8,7 +8,7 @@ v120 v140 v120 - $(SolutionDir)$(Configuration)\$(Platform)\ + $(MSBuildProjectDirectory)\bin\$(Configuration)\$(Platform)\ $(OutputPath) aspnetcore diff --git a/src/AspNetCore/AspNetCore.vcxproj b/src/AspNetCore/AspNetCore.vcxproj index fb903b5862..bcd8be1fd8 100644 --- a/src/AspNetCore/AspNetCore.vcxproj +++ b/src/AspNetCore/AspNetCore.vcxproj @@ -25,7 +25,6 @@ AspNetCoreModule AspNetCore aspnetcore - $(SolutionDir)bin\$(Configuration)\$(Platform)\ true From 9982e73d3e9907a73db00e24626bd5c98c5e1ab4 Mon Sep 17 00:00:00 2001 From: Sourabh Shirhatti Date: Mon, 26 Sep 2016 15:07:33 -0700 Subject: [PATCH 3/4] Change project structure to accomodate test projects --- AspNetCoreModule.sln | 21 ++++++++++++++++++++- global.json | 3 +++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 global.json diff --git a/AspNetCoreModule.sln b/AspNetCoreModule.sln index 986f3e555a..a8ba10859c 100644 --- a/AspNetCoreModule.sln +++ b/AspNetCoreModule.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.25123.0 +VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AspNetCore", "src\AspNetCore\AspNetCore.vcxproj", "{439824F9-1455-4CC4-BD79-B44FA0A16552}" ProjectSection(ProjectDependencies) = postProject @@ -10,26 +10,41 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AspNetCore", "src\AspNetCor EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IISLib", "src\IISLib\IISLib.vcxproj", "{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{02F461DC-5166-4E88-AAD5-CF110016A647}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2097C03C-E2F7-4396-B3BC-4335F1B87B5E}" + ProjectSection(SolutionItems) = preProject + global.json = global.json + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{FDD2EDF8-1B62-4978-9815-9D95260B8B91}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 + Release|Any CPU = Release|Any CPU Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {439824F9-1455-4CC4-BD79-B44FA0A16552}.Debug|Any CPU.ActiveCfg = Debug|Win32 {439824F9-1455-4CC4-BD79-B44FA0A16552}.Debug|Win32.ActiveCfg = Release|x64 {439824F9-1455-4CC4-BD79-B44FA0A16552}.Debug|Win32.Build.0 = Release|x64 {439824F9-1455-4CC4-BD79-B44FA0A16552}.Debug|x64.ActiveCfg = Release|x64 {439824F9-1455-4CC4-BD79-B44FA0A16552}.Debug|x64.Build.0 = Release|x64 + {439824F9-1455-4CC4-BD79-B44FA0A16552}.Release|Any CPU.ActiveCfg = Release|Win32 {439824F9-1455-4CC4-BD79-B44FA0A16552}.Release|Win32.ActiveCfg = Release|Win32 {439824F9-1455-4CC4-BD79-B44FA0A16552}.Release|Win32.Build.0 = Release|Win32 {439824F9-1455-4CC4-BD79-B44FA0A16552}.Release|x64.ActiveCfg = Release|Win32 {439824F9-1455-4CC4-BD79-B44FA0A16552}.Release|x64.Build.0 = Release|Win32 + {4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Debug|Any CPU.ActiveCfg = Debug|Win32 {4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Debug|Win32.ActiveCfg = Release|x64 {4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Debug|Win32.Build.0 = Release|x64 {4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Debug|x64.ActiveCfg = Release|x64 {4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Debug|x64.Build.0 = Release|x64 + {4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Release|Any CPU.ActiveCfg = Release|Win32 {4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Release|Win32.ActiveCfg = Release|Win32 {4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Release|Win32.Build.0 = Release|Win32 {4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Release|x64.ActiveCfg = Release|Win32 @@ -38,4 +53,8 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {439824F9-1455-4CC4-BD79-B44FA0A16552} = {FDD2EDF8-1B62-4978-9815-9D95260B8B91} + {4787A64F-9A3E-4867-A55A-70CB4B2B2FFE} = {FDD2EDF8-1B62-4978-9815-9D95260B8B91} + EndGlobalSection EndGlobal diff --git a/global.json b/global.json new file mode 100644 index 0000000000..0c827e1b26 --- /dev/null +++ b/global.json @@ -0,0 +1,3 @@ +{ + "projects": [ "test" ] +} \ No newline at end of file From d245ded51d615246d5770ed6c1af1336a1e0b248 Mon Sep 17 00:00:00 2001 From: Sourabh Shirhatti Date: Mon, 26 Sep 2016 17:08:07 -0700 Subject: [PATCH 4/4] Produce fake nupkg for testing --- makefile.shade | 20 ++++++++++++++++++++ nuget/AspNetCore.nuspec | 19 +++++++++++++++++++ src/AspNetCore/AspNetCore.vcxproj | 5 +++++ 3 files changed, 44 insertions(+) create mode 100644 makefile.shade create mode 100644 nuget/AspNetCore.nuspec diff --git a/makefile.shade b/makefile.shade new file mode 100644 index 0000000000..6be672789f --- /dev/null +++ b/makefile.shade @@ -0,0 +1,20 @@ +default BASE_DIR_LOCAL='${Directory.GetCurrentDirectory()}' +default BUILD_DIR_LOCAL='${Path.Combine(BASE_DIR_LOCAL, "artifacts", "build")}' +var VERSION='0.1' +var FULL_VERSION='0.1' + +use-standard-lifecycle +k-standard-goals + +#make-nupkg target='package' + log info='Make nuget package containing ASP.NET Core Module' + @{ + var nugetExePath = Environment.GetEnvironmentVariable("KOREBUILD_NUGET_EXE"); + if (string.IsNullOrEmpty(nugetExePath)) + { + nugetExePath = Path.Combine(BASE_DIR_LOCAL, ".build", "nuget.exe"); + } + + var nuspecPath = Path.Combine(BASE_DIR_LOCAL, "nuget", "AspNetCore.nuspec"); + ExecClr(nugetExePath, "pack " + nuspecPath + " -OutputDirectory " + BUILD_DIR_LOCAL + " -prop VERSION=1.0.0-" + BuildNumber); + } diff --git a/nuget/AspNetCore.nuspec b/nuget/AspNetCore.nuspec new file mode 100644 index 0000000000..c4298b6822 --- /dev/null +++ b/nuget/AspNetCore.nuspec @@ -0,0 +1,19 @@ + + + + Microsoft.AspNetCore.AspNetCoreModule + Microsoft ASP.NET Core Module + $VERSION$ + Microsoft + Microsoft + http://www.microsoft.com/web/webpi/eula/net_library_eula_ENU.htm + © Microsoft Corporation. All rights reserved. + http://www.asp.net/ + true + ASP.NET Core Module + en-US + + + + + \ No newline at end of file diff --git a/src/AspNetCore/AspNetCore.vcxproj b/src/AspNetCore/AspNetCore.vcxproj index bcd8be1fd8..bc85154a61 100644 --- a/src/AspNetCore/AspNetCore.vcxproj +++ b/src/AspNetCore/AspNetCore.vcxproj @@ -231,6 +231,11 @@ + + + PreserveNewest + +