* Modify Coherence to use UniverseCoherence

* Update CoherenceBuild to use CLI
* Remove support for publishing symbols
This commit is contained in:
Pranav K 2016-02-25 20:20:41 -08:00
Родитель e4a39dfd64
Коммит ae62821eae
6 изменённых файлов: 102 добавлений и 171 удалений

17
.gitignore поставляемый
Просмотреть файл

@ -2,10 +2,19 @@
[Bb]in/
TestResults/
.nuget/
.build/
.testPublish/
*.sln.ide/
_ReSharper.*/
packages/
artifacts/
PublishProfiles/
.vs/
bower_components/
node_modules/
**/wwwroot/lib/
debugSettings.json
project.lock.json
*.user
*.suo
*.cache
@ -13,6 +22,7 @@ PublishProfiles/
_ReSharper.*
nuget.exe
*net45.csproj
*net451.csproj
*k10.csproj
*.psess
*.vsp
@ -22,5 +32,8 @@ nuget.exe
*.ncrunchsolution
*.*sdf
*.ipch
/Coherence.sln.ide
project.lock.json
.settings
*.sln.ide
node_modules
**/[Cc]ompiler/[Rr]esources/**/*.js
*launchSettings.json

Просмотреть файл

@ -1,40 +1,39 @@
@echo off
cd %~dp0
@ECHO off
SETLOCAL
SET REPO_FOLDER=%~dp0
CD "%REPO_FOLDER%"
SET BUILD_FOLDER=.build
SET KOREBUILD_FOLDER=%BUILD_FOLDER%\KoreBuild-dotnet
SET KOREBUILD_VERSION=
SET NUGET_PATH=%BUILD_FOLDER%\NuGet.exe
SET NUGET_VERSION=latest
SET CACHED_NUGET=%LocalAppData%\NuGet\nuget.%NUGET_VERSION%.exe
SET BUILDCMD_KOREBUILD_VERSION=
SET BUILDCMD_DNX_VERSION=
IF EXIST %CACHED_NUGET% goto copynuget
echo Downloading latest version of NuGet.exe...
IF NOT EXIST %LocalAppData%\NuGet md %LocalAppData%\NuGet
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/%NUGET_VERSION%/nuget.exe' -OutFile '%CACHED_NUGET%'"
:copynuget
IF EXIST .nuget\nuget.exe goto restore
md .nuget
copy %CACHED_NUGET% .nuget\nuget.exe > nul
:restore
IF EXIST packages\Sake goto getdnx
IF "%BUILDCMD_KOREBUILD_VERSION%"=="" (
.nuget\nuget.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre
) ELSE (
.nuget\nuget.exe install KoreBuild -version %BUILDCMD_KOREBUILD_VERSION% -ExcludeVersion -o packages -nocache -pre
)
.nuget\NuGet.exe restore
.nuget\NuGet.exe install Sake -ExcludeVersion -Source https://www.nuget.org/api/v2/ -Out packages
:getdnx
IF "%BUILDCMD_DNX_VERSION%"=="" (
SET BUILDCMD_DNX_VERSION=latest
)
IF "%SKIP_DNX_INSTALL%"=="" (
CALL packages\KoreBuild\build\dnvm install %BUILDCMD_DNX_VERSION% -runtime CLR -arch x86 -alias default
) ELSE (
CALL packages\KoreBuild\build\dnvm use default -runtime CLR -arch x86
IF NOT EXIST %BUILD_FOLDER% (
md %BUILD_FOLDER%
)
packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %*
IF NOT EXIST %NUGET_PATH% (
IF NOT EXIST %CACHED_NUGET% (
echo Downloading latest version of NuGet.exe...
IF NOT EXIST %LocalAppData%\NuGet (
md %LocalAppData%\NuGet
)
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/%NUGET_VERSION%/nuget.exe' -OutFile '%CACHED_NUGET%'"
)
copy %CACHED_NUGET% %NUGET_PATH% > nul
)
SET KOREBUILD_DOWNLOAD_ARGS=
IF NOT "%KOREBUILD_VERSION%"=="" (
SET KOREBUILD_DOWNLOAD_ARGS=-version %KOREBUILD_VERSION%
)
IF NOT EXIST %KOREBUILD_FOLDER% (
%BUILD_FOLDER%\nuget.exe install KoreBuild-dotnet -ExcludeVersion -o %BUILD_FOLDER% -nocache -pre %KOREBUILD_DOWNLOAD_ARGS%
)
"%KOREBUILD_FOLDER%\build\KoreBuild.cmd" %*

Просмотреть файл

@ -1,10 +1,5 @@
use namespace="System"
use namespace="System.Collections.Generic"
use namespace="System.Diagnostics"
use namespace="System.IO"
use namespace="System.Linq"
use import="BuildEnv"
use import="Environment"
default BASE_DIR='${Directory.GetCurrentDirectory()}'
default TARGET_DIR='${Path.Combine(BASE_DIR, "artifacts")}'
@ -17,15 +12,16 @@ default COHERENCE_BUILD_PROJ='${Path.Combine(SRC_DIR, "CoherenceBuild")}'
default BUILD_SHARE='${Environment.GetEnvironmentVariable("BUILD_SHARE")}'
default BUILD_BRANCH='${Environment.GetEnvironmentVariable("BUILD_BRANCH")}'
default PACKAGE_DROP_SHARE='${Environment.GetEnvironmentVariable("PACKAGE_DROP_SHARE")}'
default NUGET_SYMBOLS_SHARE='${Environment.GetEnvironmentVariable("NUGET_SYMBOLS_SHARE")}'
default SYMBOLS_NUGET_EXE='${Environment.GetEnvironmentVariable("SYMBOLS_NUGET_EXE")}'
default NUGET_PUBLISH_FEED='${Environment.GetEnvironmentVariable("NUGET_PUBLISH_FEED")}'
default APIKEY='${Environment.GetEnvironmentVariable("APIKEY")}'
use-standard-lifecycle
#package-restore target='initialize'
exec program='cmd' commandline='/C dnu restore'
exec program='dotnet' commandline='restore'
#build-project target='compile'
exec program='dotnet' commandline='build -f net451' workingdir='${COHERENCE_BUILD_PROJ}'
#copy-bits target='package'
@{
@ -39,5 +35,5 @@ use-standard-lifecycle
Directory.CreateDirectory(BUILD_DIR);
}
var args = '--drop-folder ${BUILD_SHARE} --build-branch ${BUILD_BRANCH} --output-path ${BUILD_DIR} --symbols-source-path ${NUGET_SYMBOLS_SHARE} --symbols-output-path ${SYMBOLS_DIR} --symbols-nuget-exe ${SYMBOLS_NUGET_EXE} --nuget-publish-feed ${NUGET_PUBLISH_FEED} --apikey ${APIKEY} --ci-volatile-share ${PACKAGE_DROP_SHARE}'
exec program='cmd' commandline='/C dnx CoherenceBuild ${args}' workingdir='${COHERENCE_BUILD_PROJ}'
var args = '--drop-folder ${BUILD_SHARE} --build-branch ${BUILD_BRANCH} --output-path ${BUILD_DIR} --nuget-publish-feed ${NUGET_PUBLISH_FEED} --apikey ${APIKEY} --ci-volatile-share ${PACKAGE_DROP_SHARE}'
exec program='dotnet' commandline='run -f net451 -- ${args}' workingdir='${COHERENCE_BUILD_PROJ}'

Просмотреть файл

@ -10,21 +10,11 @@ namespace CoherenceBuild
{
public static class PackagePublisher
{
public static void PublishSymbolsPackages(
string outputPath,
string symbolsOutputPath,
string symbolSourcePath,
string symbolsNuGetExe,
ProcessResult processResult)
public static void PublishToShare(
ProcessResult processResult,
string outputPath)
{
Directory.CreateDirectory(symbolsOutputPath);
var pdbOutputPath = Path.Combine(symbolSourcePath, "pdbrepo");
var sourceFilesPath = Path.Combine(symbolSourcePath, "sources");
Directory.CreateDirectory(pdbOutputPath);
Directory.CreateDirectory(sourceFilesPath);
Directory.CreateDirectory(outputPath);
var packagesToCopy = processResult.AllPackages.Values;
Parallel.ForEach(packagesToCopy, new ParallelOptions { MaxDegreeOfParallelism = 4 }, packageInfo =>
@ -39,39 +29,10 @@ namespace CoherenceBuild
});
Console.WriteLine("Copied to {0}", packagePath);
if (File.Exists(packageInfo.SymbolsPath))
{
var symbolsPath = Path.Combine(symbolsOutputPath, Path.GetFileName(packageInfo.SymbolsPath));
// REVIEW: Should we copy symbol packages elsewhere
Program.Retry(() =>
{
File.Copy(packageInfo.SymbolsPath, symbolsPath, overwrite: true);
ExtractPdbsAndSourceFiles(packageInfo.SymbolsPath, sourceFilesPath, pdbOutputPath, symbolsNuGetExe);
});
Console.WriteLine("Copied to {0}", symbolsPath);
}
});
}
private static void ExtractPdbsAndSourceFiles(string symbolsPath, string sourceFilesPath, string pdbPath, string nugetExePath)
{
nugetExePath = Path.Combine(nugetExePath, "nuget.exe");
string processArgs = string.Format("pushsymbol \"{0}\" -symbolserver \"{1}\" -sourceserver \"{2}\"", symbolsPath, pdbPath, sourceFilesPath);
var psi = new ProcessStartInfo(nugetExePath, processArgs)
{
UseShellExecute = false,
};
using (var process = Process.Start(psi))
{
process.WaitForExit();
}
}
public static void PublishNuGetPackages(ProcessResult processResult, string feed, string apiKey)
public static void PublishToFeed(ProcessResult processResult, string feed, string apiKey)
{
var server = new PackageServer(feed, "Custom DNX");
var packagesToPushInOrder = Enumerable.Concat(

Просмотреть файл

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.CommandLineUtils;
using NuGet;
@ -10,46 +11,13 @@ namespace CoherenceBuild
{
class Program
{
private static readonly string[] ReposToSkip = new[]
private static readonly string[] ReposToScan = new[]
{
"Coherence",
"Coherence-External",
"Coherence-Signed",
"Coherence-Signed-External",
"Data",
"DiagnosticsPages",
"dnvm",
"DNX-Darwin",
"DNX-Linux",
"DnxTools",
"docfx",
"docfx-signed",
"Entropy",
"Glimpse",
"Helios",
"HttpClient",
"IBC",
"latest-dev",
"latest-packages",
"DataCommon.SQLite",
"MusicStore",
"NuGet.Packaging",
"NuGet.Versioning",
"ServerTests",
"Setup",
"Setup-Osx-Pkg",
"SqlClient",
"Stress",
"System.Data.Common",
"Templates",
"WebHooks",
"WebHooks-Signed",
"WebSocketAbstractions",
"xunit-performance",
"Xunit",
"Benchmarks",
"Performance",
"NodeServices",
"UniverseCoherence",
"CoreCLR",
"Roslyn",
"libuv-build-windows",
"SignalR-Client-Cpp",
};
static int Main(string[] args)
@ -58,9 +26,6 @@ namespace CoherenceBuild
var dropFolder = app.Option("--drop-folder", "Drop folder", CommandOptionType.SingleValue);
var buildBranch = app.Option("--build-branch", "Build branch (dev \\ release)", CommandOptionType.SingleValue);
var outputPath = app.Option("--output-path", "Output path", CommandOptionType.SingleValue);
var symbolSourcePath = app.Option("--symbols-source-path", "Symbol source path", CommandOptionType.SingleValue);
var symbolsOutputPath = app.Option("--symbols-output-path", "Symbols output path", CommandOptionType.SingleValue);
var symbolsNuGetExe = app.Option("--symbols-nuget-exe", "Symbols NuGet exe", CommandOptionType.SingleValue);
var nugetPublishFeed = app.Option("--nuget-publish-feed", "Feed to push packages to", CommandOptionType.SingleValue);
var apiKey = app.Option("--apikey", "NuGet API Key", CommandOptionType.SingleValue);
var ciVolatileShare = app.Option("--ci-volatile-share", "CI Volatile share", CommandOptionType.SingleValue);
@ -82,16 +47,11 @@ namespace CoherenceBuild
return 1;
}
PackagePublisher.PublishSymbolsPackages(
outputPath.Value(),
symbolsOutputPath.Value(),
symbolSourcePath.Value(),
symbolsNuGetExe.Value(),
processResult);
PackagePublisher.PublishToShare(processResult, outputPath.Value());
if (nugetPublishFeed.HasValue())
if (nugetPublishFeed.HasValue() && !string.IsNullOrEmpty(nugetPublishFeed.Value()))
{
PackagePublisher.PublishNuGetPackages(processResult, nugetPublishFeed.Value(), apiKey.Value());
PackagePublisher.PublishToFeed(processResult, nugetPublishFeed.Value(), apiKey.Value());
}
CIVolatileFeedPublisher.CleanupVolatileFeed(outputPath.Value(), ciVolatileShare.Value());
@ -105,17 +65,13 @@ namespace CoherenceBuild
private static ProcessResult ReadPackagesToProcess(DirectoryInfo di, string buildBranch)
{
var processResult = new ProcessResult();
foreach (var projectFolder in di.EnumerateDirectories())
var dictionaryLock = new object();
foreach (var repo in ReposToScan)
{
if (ReposToSkip.Contains(projectFolder.Name, StringComparer.OrdinalIgnoreCase))
{
continue;
}
var repoDirectory = Path.Combine(di.FullName, repo, buildBranch);
var latestPath = FindLatest(repoDirectory, buildBranch);
var latestPath = FindLatest(projectFolder, buildBranch);
if (!Directory.Exists(latestPath))
if (latestPath == null)
{
Log.WriteError("Couldn't find latest for {0}", latestPath);
continue;
@ -127,23 +83,24 @@ namespace CoherenceBuild
if (!build.Exists)
{
Log.WriteError("Can't find build dir for {0}", projectFolder.Name);
Log.WriteError("Can't find build dir for {0}", repo);
continue;
}
var isCoreCLR = projectFolder.Name.Equals("CoreCLR", StringComparison.OrdinalIgnoreCase);
var isCoreCLR = repo.Equals("CoreCLR", StringComparison.OrdinalIgnoreCase);
foreach (var packageInfo in build.EnumerateFiles("*.nupkg"))
Parallel.ForEach(build.GetFiles("*.nupkg", SearchOption.AllDirectories), packageInfo =>
{
if (packageInfo.FullName.EndsWith(".symbols.nupkg", StringComparison.OrdinalIgnoreCase))
{
continue;
return;
}
Console.WriteLine("Processing " + packageInfo + "...");
string symbolsPath = Path.Combine(packageInfo.Directory.FullName,
Path.GetFileNameWithoutExtension(packageInfo.Name) + ".symbols.nupkg");
string symbolsPath = Path.Combine(
packageInfo.Directory.FullName,
Path.GetFileNameWithoutExtension(packageInfo.Name) + ".symbols.nupkg");
Retry(() =>
{
@ -157,33 +114,34 @@ namespace CoherenceBuild
IsCoreCLRPackage = isCoreCLR
};
if (isCoreCLR)
lock (dictionaryLock)
{
processResult.CoreCLRPackages[zipPackage.Id] = info;
}
else
{
processResult.ProductPackages[zipPackage.Id] = info;
}
if (isCoreCLR)
{
processResult.CoreCLRPackages[zipPackage.Id] = info;
}
else
{
processResult.ProductPackages[zipPackage.Id] = info;
}
processResult.AllPackages[zipPackage.Id] = info;
processResult.AllPackages[zipPackage.Id] = info;
}
});
}
});
}
return processResult;
}
private static string FindLatest(DirectoryInfo projectFolder, string buildBranch)
private static string FindLatest(string repoDirectory, string buildBranch)
{
var latestPath = Path.Combine(projectFolder.FullName, buildBranch);
if (!Directory.Exists(latestPath))
if (!Directory.Exists(repoDirectory))
{
return latestPath;
return null;
}
return new DirectoryInfo(latestPath)
return new DirectoryInfo(repoDirectory)
.EnumerateDirectories()
.Select(d =>
{

Просмотреть файл

@ -6,11 +6,15 @@
"Microsoft.Extensions.CommandLineUtils": "1.0.0-*"
},
"compilationOptions": {
"emitEntryPoint": true
},
"commands": {
"CoherenceBuild": "CoherenceBuild"
},
"frameworks": {
"dnx451": { }
"net451": { }
}
}