Skip to content
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
43 changes: 0 additions & 43 deletions scripts/cake/UtilsManaged.cake
Original file line number Diff line number Diff line change
Expand Up @@ -15,49 +15,6 @@ var UNSUPPORTED_TESTS = new Dictionary<string, string>
{ "SkipOn", skipTestOnPlatform },
};

void RunDotNetPack(
FilePath solution,
DirectoryPath outputPath = null,
string bl = ".pack",
string configuration = null,
string additionalArgs = null,
Dictionary<string, string> properties = null)
{
EnsureDirectoryExists(OUTPUT_NUGETS_PATH);

var c = new DotNetPackSettings();
var msb = new DotNetMSBuildSettings();
c.MSBuildSettings = msb;

c.Configuration = configuration ?? CONFIGURATION;
c.Verbosity = DotNetVerbosity.Minimal;

var relativeSolution = MakeAbsolute(ROOT_PATH).GetRelativePath(MakeAbsolute(solution));
var blPath = ROOT_PATH.Combine("output/logs/binlogs").CombineWithFilePath(relativeSolution + bl + ".binlog");
msb.BinaryLogger = new MSBuildBinaryLoggerSettings {
Enabled = true,
FileName = blPath.FullPath,
};

c.NoBuild = true;

c.OutputDirectory = outputPath ?? OUTPUT_NUGETS_PATH;

msb.Properties ["NoDefaultExcludes"] = new [] { "true" };

if (properties != null) {
foreach (var prop in properties) {
if (!string.IsNullOrEmpty(prop.Value)) {
msb.Properties [prop.Key] = new [] { prop.Value };
}
}
}

c.ArgumentCustomization = args => args.Append(additionalArgs);

DotNetPack(solution.FullPath, c);
}

void RunTests(FilePath testAssembly, DirectoryPath output, bool is32)
{
var dir = testAssembly.GetDirectory();
Expand Down
68 changes: 68 additions & 0 deletions scripts/cake/msbuild.cake
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,29 @@ string[] GetNuGetSources()
return adds.ToArray();
}

ProcessArgumentBuilder AppendForwardingLogger(ProcessArgumentBuilder args)
{
if (BuildSystem.IsLocalBuild)
return args;

// URL copied from https://github.com/microsoft/azure-pipelines-tasks/blob/7faf3e8146d43753b9f360edfae3d2e75ad78c76/Tasks/DotNetCoreCLIV2/make.json
var loggerUrl = "https://vstsagenttools.blob.core.windows.net/tools/msbuildlogger/3/msbuildlogger.zip";

var AGENT_TEMPDIRECTORY = (DirectoryPath)EnvironmentVariable("AGENT_TEMPDIRECTORY");
var loggerDir = AGENT_TEMPDIRECTORY.Combine("msbuildlogger");
EnsureDirectoryExists(loggerDir);

var loggerZip = loggerDir.CombineWithFilePath("msbuildlogger.zip");
if (!FileExists(loggerZip))
DownloadFile(loggerUrl, loggerZip);

var loggerDll = loggerDir.CombineWithFilePath("Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll");
if (!FileExists(loggerDll))
Unzip(loggerZip, loggerDir);

return args.Append($"-dl:CentralLogger,\"{loggerDll}\"*ForwardingLogger,\"{loggerDll}\"");
}

void RunNuGetRestorePackagesConfig(FilePath sln)
{
var dir = sln.GetDirectory();
Expand Down Expand Up @@ -160,6 +183,51 @@ void RunDotNetBuild(
}
}
c.Sources = GetNuGetSources();

c.ArgumentCustomization = AppendForwardingLogger;

DotNetBuild(solution.FullPath, c);
}

void RunDotNetPack(
FilePath solution,
DirectoryPath outputPath = null,
string bl = ".pack",
string configuration = null,
string additionalArgs = null,
Dictionary<string, string> properties = null)
{
EnsureDirectoryExists(OUTPUT_NUGETS_PATH);

var c = new DotNetPackSettings();
var msb = new DotNetMSBuildSettings();
c.MSBuildSettings = msb;

c.Configuration = configuration ?? CONFIGURATION;
c.Verbosity = DotNetVerbosity.Minimal;

var relativeSolution = MakeAbsolute(ROOT_PATH).GetRelativePath(MakeAbsolute(solution));
var blPath = ROOT_PATH.Combine("output/logs/binlogs").CombineWithFilePath(relativeSolution + bl + ".binlog");
msb.BinaryLogger = new MSBuildBinaryLoggerSettings {
Enabled = true,
FileName = blPath.FullPath,
};

c.NoBuild = true;

c.OutputDirectory = outputPath ?? OUTPUT_NUGETS_PATH;

msb.Properties ["NoDefaultExcludes"] = new [] { "true" };

if (properties != null) {
foreach (var prop in properties) {
if (!string.IsNullOrEmpty(prop.Value)) {
msb.Properties [prop.Key] = new [] { prop.Value };
}
}
}

c.ArgumentCustomization = args => AppendForwardingLogger(args).Append(additionalArgs);

DotNetPack(solution.FullPath, c);
}