Skip to content

Commit

Permalink
On OSX/Linux, acquire special build of Mono MSBuild for net46 builds
Browse files Browse the repository at this point in the history
  • Loading branch information
DustinCampbell committed Dec 13, 2016
1 parent eb78bd2 commit 4d5caed
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
33 changes: 32 additions & 1 deletion build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public class BuildPlan
public string DotNetInstallScriptURL { get; set; }
public string DotNetChannel { get; set; }
public string DotNetVersion { get; set; }
public string DownloadURL { get; set; }
public string MSBuildForMono { get; set; }
public string[] Frameworks { get; set; }
public string[] Rids { get; set; }
public string MainProject { get; set; }
Expand Down Expand Up @@ -112,6 +114,27 @@ Task("AcquirePackages")
noCache: true,
outputDirectory: $"\"{packagesFolder}\"");

var msbuildMonoInstallFolder = System.IO.Path.Combine(packagesFolder, "Microsoft.Build.Runtime.Mono");
if (!IsRunningOnWindows())
{
if (DirectoryExists(msbuildMonoInstallFolder))
{
DeleteDirectory(msbuildMonoInstallFolder, recursive: true);
}

CreateDirectory(msbuildMonoInstallFolder);

var msbuildMonoZip = System.IO.Path.Combine(msbuildMonoInstallFolder, buildPlan.MSBuildForMono);

using (var client = new WebClient())
{
client.DownloadFile($"{buildPlan.DownloadURL}/{buildPlan.MSBuildForMono}", msbuildMonoZip);
}

Unzip(msbuildMonoZip, msbuildMonoInstallFolder);
DeleteFile(msbuildMonoZip);
}

if (DirectoryExists(msbuildNet46Folder))
{
DeleteDirectory(msbuildNet46Folder, recursive: true);
Expand All @@ -130,7 +153,15 @@ Task("AcquirePackages")
var msbuildNet46InstallFolder = System.IO.Path.Combine(msbuildInstallFolder, "net46");
var msbuildNetCoreAppInstallFolder = System.IO.Path.Combine(msbuildInstallFolder, "netcoreapp1.0");

CopyDirectory(msbuildNet46InstallFolder, msbuildNet46Folder);
if (IsRunningOnWindows())
{
CopyDirectory(msbuildNet46InstallFolder, msbuildNet46Folder);
}
else
{
CopyDirectory(msbuildMonoInstallFolder, msbuildNet46Folder);
}

CopyDirectory(msbuildNetCoreAppInstallFolder, msbuildNetCoreAppFolder);

var sdks = new []
Expand Down
2 changes: 2 additions & 0 deletions build.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"DotNetInstallScriptURL": "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview2/scripts/obtain",
"DotNetChannel": "preview",
"DotNetVersion": "1.0.0-preview2-003131",
"DownloadURL": "https://omnisharpdownload.blob.core.windows.net/ext",
"MSBuildForMono": "Microsoft.Build.Runtime.Mono-alpha1.zip",
"BuildToolsFolder": ".tools",
"ArtifactsFolder": "artifacts",
"PackagesFolder": "packages",
Expand Down

0 comments on commit 4d5caed

Please sign in to comment.