Skip to content

Commit

Permalink
Merge pull request #562 from WildGums/GitHubSync/20240523-215710
Browse files Browse the repository at this point in the history
GitHubSync update
  • Loading branch information
GeertvanHorrik authored May 23, 2024
2 parents 6ffbca0 + 5aa8be8 commit c461248
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: windows-latest # Required for some (WPF) projects

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
id: checkout
with:
fetch-depth: 0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:
- name: Dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@0fb21704c18a42ce5aa8d720ea4b912f5e6babef #2.0.0
uses: dependabot/fetch-metadata@5e5f99653a5b510e8555840e80cbf1514ad4af38 #2.1.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve Dependabot PR
Expand Down
13 changes: 13 additions & 0 deletions deployment/cake/components-tasks.cake
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,10 @@ public class ComponentsProcessor : ProcessorBase

// Special exception for Blazor projects
var isBlazorProject = IsBlazorProject(BuildContext, component);
var isPackageContainerProject = IsPackageContainerProject(BuildContext, component);

BuildContext.CakeContext.LogSeparator("Packaging component '{0}'", component);
CakeContext.Information("IsPackageContainerProject = '{0}'", isPackageContainerProject);

var projectDirectory = GetProjectDirectory(component);
var projectFileName = GetProjectFileName(BuildContext, component);
Expand Down Expand Up @@ -287,6 +289,17 @@ public class ComponentsProcessor : ProcessorBase
noBuild = false;
}

if (isPackageContainerProject)
{
// In debug / local builds, automatic building of reference projects
// is enabled for convenience. If that is the case, noBuild must be
// set to false, but *only* in debug mode
if (BuildContext.General.IsLocalBuild)
{
noBuild = false;
}
}

// As described in the this issue: https://github.com/NuGet/Home/issues/4360
// we should not use IsTool, but set BuildOutputTargetFolder instead
msBuildSettings.WithProperty("CopyLocalLockFileAssemblies", "true");
Expand Down
63 changes: 63 additions & 0 deletions deployment/cake/lib-generic.cake
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,35 @@ private static bool IsCppProject(string projectName)
return projectName.EndsWith(".vcxproj");
}

//--------------------------------------------------------------

private static bool IsPackageContainerProject(BuildContext buildContext, string projectName)
{
var isPackageContainer = false;

var projectFileName = CreateInlinedProjectXml(buildContext, projectName);

var projectFileContents = System.IO.File.ReadAllText(projectFileName);

var xmlDocument = XDocument.Parse(projectFileContents);
var projectElement = xmlDocument.Root;

foreach (var propertyGroupElement in projectElement.Elements("PropertyGroup"))
{
var packageContainerElement = propertyGroupElement.Element("PackageContainer");
if (packageContainerElement != null)
{
if (packageContainerElement.Value.ToLower() == "true")
{
isPackageContainer = true;
}
break;
}
}

return isPackageContainer;
}

//-------------------------------------------------------------

private static bool IsBlazorProject(BuildContext buildContext, string projectName)
Expand Down Expand Up @@ -595,6 +624,40 @@ private static bool ShouldProcessProject(BuildContext buildContext, string proje
return true;
}

private static string CreateInlinedProjectXml(BuildContext buildContext, string projectName)
{
buildContext.CakeContext.Information($"Running 'msbuild /pp' for project '{projectName}'");

var projectInlinedFileName = System.IO.Path.Combine(GetProjectOutputDirectory(buildContext, projectName),
"..", $"{projectName}.inlined.xml");

// Note: disabled caching until we correctly clean up everything
//if (!buildContext.CakeContext.FileExists(projectInlinedFileName))
{
// Run "msbuild /pp" to create a single project file

var msBuildSettings = new MSBuildSettings
{
Verbosity = Verbosity.Quiet,
ToolVersion = MSBuildToolVersion.Default,
Configuration = buildContext.General.Solution.ConfigurationName,
MSBuildPlatform = MSBuildPlatform.x86, // Always require x86, see platform for actual target platform
PlatformTarget = PlatformTarget.MSIL
};

ConfigureMsBuild(buildContext, msBuildSettings, projectName, "pp");

msBuildSettings.Target = string.Empty;
msBuildSettings.ArgumentCustomization = args => args.Append($"/pp:{projectInlinedFileName}");

var projectFileName = GetProjectFileName(buildContext, projectName);

RunMsBuild(buildContext, projectName, projectFileName, msBuildSettings, "pp");
}

return projectInlinedFileName;
}

//-------------------------------------------------------------

private static List<string> GetProjectRuntimesIdentifiers(BuildContext buildContext, Cake.Core.IO.FilePath solutionOrProjectFileName, List<string> runtimeIdentifiersToInvestigate)
Expand Down
10 changes: 5 additions & 5 deletions deployment/cake/lib-msbuild.cake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#addin "nuget:?package=Cake.Issues&version=4.1.0"
#addin "nuget:?package=Cake.Issues.MsBuild&version=4.1.0"
#addin "nuget:?package=Cake.Issues&version=4.4.0"
#addin "nuget:?package=Cake.Issues.MsBuild&version=4.4.0"

#tool "nuget:?package=MSBuild.Extension.Pack&version=1.9.1"

Expand Down Expand Up @@ -67,7 +67,7 @@ private static void ConfigureMsBuild(BuildContext buildContext, MSBuildSettings
}
else
{
buildContext.CakeContext.Information("This is a local build, disabling building of project references");
buildContext.CakeContext.Information("This is a local build, not disabling building of project references");
}

// Continuous integration build
Expand Down Expand Up @@ -154,7 +154,7 @@ private static void ConfigureMsBuildForDotNet(BuildContext buildContext, DotNetM
}
else
{
buildContext.CakeContext.Information($"This is a local build, disabling building of project references");
buildContext.CakeContext.Information($"This is a local build, not disabling building of project references");
}

// Continuous integration build
Expand Down Expand Up @@ -488,4 +488,4 @@ private static void InjectAssemblySearchPathsInProjectFile(BuildContext buildCon
{
buildContext.CakeContext.Error($"Failed to process assembly search paths for project '{projectFileName}': {ex.Message}");
}
}
}
2 changes: 1 addition & 1 deletion deployment/cake/sourcecontrol-github.cake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#addin "nuget:?package=Cake.GitHub&version=0.1.0"
#addin "nuget:?package=Octokit&version=10.0.0"
#addin "nuget:?package=Octokit&version=11.0.1"

//-------------------------------------------------------------

Expand Down
5 changes: 5 additions & 0 deletions src/Directory.Build.shared.explicit.props
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>

<!-- Disable Fody warnings as errors because of ObsoleteEx, etc breaking the code to an unrepairable state -->
<PropertyGroup>
<FodyTreatWarningsAsErrors>false</FodyTreatWarningsAsErrors>
</PropertyGroup>

<!--
Fix for .NET Core 3.0, see https://github.com/dotnet/core-sdk/issues/192, it
uses obj/release instead of [outputdirectory]
Expand Down

0 comments on commit c461248

Please sign in to comment.