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
3 changes: 3 additions & 0 deletions Cake.Recipe/Content/parameters.cake
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ public static class BuildParameters
public static bool ShouldDocumentSourceFiles { get; private set; }
public static bool ShouldRunIntegrationTests { get; private set; }
public static bool ShouldRunGitVersion { get; private set; }
public static bool ShouldUseTargetFrameworkPath { get; private set; }
public static bool ShouldUseDeterministicBuilds
{
get
Expand Down Expand Up @@ -383,6 +384,7 @@ public static class BuildParameters
bool shouldBuildNugetSourcePackage = false,
bool shouldRunIntegrationTests = false,
bool? shouldRunGitVersion = null,
bool shouldUseTargetFrameworkPath = true,
bool? transifexEnabled = null,
TransifexMode transifexPullMode = TransifexMode.OnlyTranslated,
int transifexPullPercentage = 60,
Expand Down Expand Up @@ -473,6 +475,7 @@ public static class BuildParameters
ShouldBuildNugetSourcePackage = shouldBuildNugetSourcePackage;
ShouldRunGitVersion = shouldRunGitVersion ?? BuildParameters.BuildAgentOperatingSystem == PlatformFamily.Windows;
_shouldUseDeterministicBuilds = shouldUseDeterministicBuilds;
ShouldUseTargetFrameworkPath = shouldUseTargetFrameworkPath;

MilestoneReleaseNotesFilePath = milestoneReleaseNotesFilePath ?? RootDirectoryPath.CombineWithFilePath("CHANGELOG.md");
FullReleaseNotesFilePath = fullReleaseNotesFilePath ?? RootDirectoryPath.CombineWithFilePath("ReleaseNotes.md");
Expand Down
9 changes: 3 additions & 6 deletions Cake.Recipe/Content/setup.cake
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,10 @@ Setup<DotNetCoreMSBuildSettings>(context =>
{
settings.WithProperty("ContinuousIntegrationBuild", "true");
}
if (BuildParameters.BuildAgentOperatingSystem != PlatformFamily.Windows)
if (BuildParameters.ShouldUseTargetFrameworkPath && BuildParameters.BuildAgentOperatingSystem != PlatformFamily.Windows)
{
// This needs to be updated when/if we ever starts supporting Cake .NET Core edition.
var frameworkPathOverride = new FilePath(typeof(object).Assembly.Location).GetDirectory().FullPath + "/";

context.Information("Will use FrameworkPathOverride={0} on .NET Core build related tasks since not building on Windows.", frameworkPathOverride);
settings.WithProperty("FrameworkPathOverride", frameworkPathOverride);
context.Information("Will use FrameworkPathOverride={0} on .NET Core build related tasks since not building on Windows.", ToolSettings.TargetFrameworkPathOverride);
settings.WithProperty("FrameworkPathOverride", ToolSettings.TargetFrameworkPathOverride);
}

return settings;
Expand Down
19 changes: 19 additions & 0 deletions Cake.Recipe/Content/toolsettings.cake
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public static class ToolSettings
public static MSBuildToolVersion BuildMSBuildToolVersion { get; private set; }
public static int MaxCpuCount { get; private set; }
public static DirectoryPath OutputDirectory { get; private set; }
public static string TargetFrameworkPathOverride { get; private set; }

public static string CodecovTool { get; private set; }
public static string CoverallsTool { get; private set; }
Expand Down Expand Up @@ -94,6 +95,7 @@ public static class ToolSettings
MSBuildToolVersion buildMSBuildToolVersion = MSBuildToolVersion.Default,
int? maxCpuCount = null,
DirectoryPath outputDirectory = null,
DirectoryPath targetFrameworkPathOverride = null,
string[] dupFinderExcludeFilesByStartingCommentSubstring = null,
int? dupFinderDiscardCost = null,
bool? dupFinderThrowExceptionOnFindingDuplicates = null
Expand All @@ -119,5 +121,22 @@ public static class ToolSettings
BuildMSBuildToolVersion = buildMSBuildToolVersion;
MaxCpuCount = maxCpuCount ?? 0;
OutputDirectory = outputDirectory;
if (BuildParameters.ShouldUseTargetFrameworkPath && targetFrameworkPathOverride == null)
{
if (context.Environment.Runtime.IsCoreClr)
{
var path = context.Tools.Resolve("mono").GetDirectory();
path = path.Combine("../lib/mono/4.5");
TargetFrameworkPathOverride = path.FullPath + "/";
}
else
{
TargetFrameworkPathOverride = new FilePath(typeof(object).Assembly.Location).GetDirectory().FullPath + "/";
}
}
else
{
TargetFrameworkPathOverride = targetFrameworkPathOverride?.FullPath;
}
}
}