Skip to content

Commit

Permalink
Merge pull request #2308 from JoeRobich/load-newer-sdks
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeRobich authored Dec 14, 2021
2 parents 8ddf23f + 3f5fc8e commit 06e19a6
Show file tree
Hide file tree
Showing 15 changed files with 723 additions and 45 deletions.
52 changes: 30 additions & 22 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -919,51 +919,51 @@ Task("PublishNet6Builds")
{
if (!Platform.Current.IsWindows)
{
PublishBuild(project, env, buildPlan, configuration, "linux-x64", "net6.0", includeMSBuild: false);
PublishBuild(project, env, buildPlan, configuration, "linux-arm64", "net6.0", includeMSBuild: false);
PublishBuild(project, env, buildPlan, configuration, "osx-x64", "net6.0", includeMSBuild: false);
PublishBuild(project, env, buildPlan, configuration, "osx-arm64", "net6.0", includeMSBuild: false);
PublishBuild(project, env, buildPlan, configuration, "linux-x64", "net6.0");
PublishBuild(project, env, buildPlan, configuration, "linux-arm64", "net6.0");
PublishBuild(project, env, buildPlan, configuration, "osx-x64", "net6.0");
PublishBuild(project, env, buildPlan, configuration, "osx-arm64", "net6.0");
}
else
{
PublishBuild(project, env, buildPlan, configuration, "win7-x86", "net6.0", includeMSBuild: false);
PublishBuild(project, env, buildPlan, configuration, "win7-x64", "net6.0", includeMSBuild: false);
PublishBuild(project, env, buildPlan, configuration, "win10-arm64", "net6.0", includeMSBuild: false);
PublishBuild(project, env, buildPlan, configuration, "win7-x86", "net6.0");
PublishBuild(project, env, buildPlan, configuration, "win7-x64", "net6.0");
PublishBuild(project, env, buildPlan, configuration, "win10-arm64", "net6.0");
}
}
else if (Platform.Current.IsWindows)
{
if (Platform.Current.IsX86)
{
PublishBuild(project, env, buildPlan, configuration, "win7-x86", "net6.0", includeMSBuild: false);
PublishBuild(project, env, buildPlan, configuration, "win7-x86", "net6.0");
}
else if (Platform.Current.IsX64)
{
PublishBuild(project, env, buildPlan, configuration, "win7-x64", "net6.0", includeMSBuild: false);
PublishBuild(project, env, buildPlan, configuration, "win7-x64", "net6.0");
}
else
{
PublishBuild(project, env, buildPlan, configuration, "win10-arm64", "net6.0", includeMSBuild: false);
PublishBuild(project, env, buildPlan, configuration, "win10-arm64", "net6.0");
}
}
else
{
if (Platform.Current.IsMacOS)
{
PublishBuild(project, env, buildPlan, configuration, "osx-x64", "net6.0", includeMSBuild: false);
PublishBuild(project, env, buildPlan, configuration, "osx-arm64", "net6.0", includeMSBuild: false);
PublishBuild(project, env, buildPlan, configuration, "osx-x64", "net6.0");
PublishBuild(project, env, buildPlan, configuration, "osx-arm64", "net6.0");
}
else
{
PublishBuild(project, env, buildPlan, configuration, "linux-x64", "net6.0", includeMSBuild: false);
PublishBuild(project, env, buildPlan, configuration, "linux-arm64", "net6.0", includeMSBuild: false);
PublishBuild(project, env, buildPlan, configuration, "linux-x64", "net6.0");
PublishBuild(project, env, buildPlan, configuration, "linux-arm64", "net6.0");
}
}
}
});

string PublishBuild(string project, BuildEnvironment env, BuildPlan plan, string configuration, string rid, string framework, bool includeMSBuild)
string PublishBuild(string project, BuildEnvironment env, BuildPlan plan, string configuration, string rid, string framework)
{
var projectName = project + ".csproj";
var projectFileName = CombinePaths(env.Folders.Source, project, projectName);
Expand Down Expand Up @@ -998,7 +998,15 @@ string PublishBuild(string project, BuildEnvironment env, BuildPlan plan, string
throw;
}

if (includeMSBuild)
if (framework is "net6.0")
{
// Delete NuGet libraries so they can be loaded from SDK folder.
foreach (var filePath in DirectoryHelper.GetFiles(outputFolder, "NuGet.*.dll"))
{
FileHelper.Delete(filePath);
}
}
else
{
// Copy MSBuild to output
DirectoryHelper.Copy($"{env.Folders.MSBuild}", CombinePaths(outputFolder, ".msbuild"));
Expand All @@ -1024,9 +1032,9 @@ Task("PublishWindowsBuilds")
if (publishAll)
{
var outputFolderX86 = PublishBuild(project, env, buildPlan, configuration, "win7-x86", "net472", includeMSBuild: true);
var outputFolderX64 = PublishBuild(project, env, buildPlan, configuration, "win7-x64", "net472", includeMSBuild: true);
var outputFolderArm64 = PublishBuild(project, env, buildPlan, configuration, "win10-arm64", "net472", includeMSBuild: true);
var outputFolderX86 = PublishBuild(project, env, buildPlan, configuration, "win7-x86", "net472");
var outputFolderX64 = PublishBuild(project, env, buildPlan, configuration, "win7-x64", "net472");
var outputFolderArm64 = PublishBuild(project, env, buildPlan, configuration, "win10-arm64", "net472");
outputFolder = Platform.Current.IsX86
? outputFolderX86
Expand All @@ -1036,15 +1044,15 @@ Task("PublishWindowsBuilds")
}
else if (Platform.Current.IsX86)
{
outputFolder = PublishBuild(project, env, buildPlan, configuration, "win7-x86", "net472", includeMSBuild: true);
outputFolder = PublishBuild(project, env, buildPlan, configuration, "win7-x86", "net472");
}
else if (Platform.Current.IsX64)
{
outputFolder = PublishBuild(project, env, buildPlan, configuration, "win7-x64", "net472", includeMSBuild: true);
outputFolder = PublishBuild(project, env, buildPlan, configuration, "win7-x64", "net472");
}
else
{
outputFolder = PublishBuild(project, env, buildPlan, configuration, "win10-arm64", "net472", includeMSBuild: true);
outputFolder = PublishBuild(project, env, buildPlan, configuration, "win10-arm64", "net472");
}
CreateRunScript(project, outputFolder, env.Folders.ArtifactsScripts);
Expand Down
7 changes: 6 additions & 1 deletion scripts/common.cake
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,14 @@ public static class FileHelper

public static class DirectoryHelper
{
public static string[] GetFiles(string path, string searchPattern = "*.*")
{
return System.IO.Directory.GetFiles(path, searchPattern);
}

public static void Copy(string source, string destination, bool copySubDirectories = true)
{
var files = System.IO.Directory.GetFiles(source);
var files = GetFiles(source);
var subDirectories = System.IO.Directory.GetDirectories(source);

if (!Exists(destination))
Expand Down
Loading

0 comments on commit 06e19a6

Please sign in to comment.