Skip to content

Commit

Permalink
Fix false positives with warning "Bff [path] doesn't appear in any ma…
Browse files Browse the repository at this point in the history
…ster bff, it won't be buildable"

The warning suggests a project bff is not refered to by a master bff.
However the check was done per FastBuild conf instead of per project bff.

We allow some of the confs not to be reachable by a master bff, it can be the case for projects where a dependency is not added for all configurations.
It's not ideal but it will do for now.

 - Bff.cs checks for bffs without master Bff
 - XcodeProj.cs  checks that each bff has at most one master
  • Loading branch information
sylvain-audi committed Oct 30, 2024
1 parent f48b623 commit 0562edd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
20 changes: 8 additions & 12 deletions Sharpmake.Generators/Apple/XCodeProj.cs
Original file line number Diff line number Diff line change
Expand Up @@ -709,20 +709,16 @@ private void PrepareSections(XCodeGenerationContext context, List<Project.Config
{
// master bff path
// we only support projects in one or no master bff, but in that last case just output a warning
var masterBffList = conf.FastBuildMasterBffList.Distinct().ToArray();
if (masterBffList.Length == 0)
foreach (string confMasterBff in conf.FastBuildMasterBffList)
{
Builder.Instance.LogWarningLine("Bff {0} doesn't appear in any master bff, it won't be buildable.", conf.BffFullFileName + FastBuildSettings.FastBuildConfigFileExtension);
}
else if (masterBffList.Length > 1)
{
throw new Error("Bff {0} appears in {1} master bff, sharpmake only supports 1.", conf.BffFullFileName + FastBuildSettings.FastBuildConfigFileExtension, masterBffList.Length);
}
else
{
if (masterBffFilePath != null && masterBffFilePath != masterBffList[0])
if (masterBffFilePath == null)
{
masterBffFilePath = confMasterBff;
}
else if (masterBffFilePath != confMasterBff)
{
throw new Error("Project {0} has a fastbuild target that has distinct master bff, sharpmake only supports 1.", conf);
masterBffFilePath = masterBffList[0];
}
}

// Make the commandline written in the bff available, except the master bff -config
Expand Down
10 changes: 10 additions & 0 deletions Sharpmake.Generators/FastBuild/Bff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ List<string> skipFiles

var allFileCustomBuild = new Dictionary<string, Project.Configuration.CustomFileBuildStepData>();

Dictionary<string, bool> confBffHasMasters = new Dictionary<string, bool>();

var configurationsToBuild = confSourceFiles.Keys.OrderBy(x => x.Platform).ToList();
foreach (Project.Configuration conf in configurationsToBuild)
{
Expand All @@ -296,6 +298,11 @@ List<string> skipFiles
var microsoftPlatformBff = PlatformRegistry.Query<IMicrosoftPlatformBff>(conf.Platform);
var dotNetConf = Util.IsDotNet(conf);

if (conf.FastBuildMasterBffList.Any())
confBffHasMasters[conf.BffFullFileName] = true;
else
confBffHasMasters.TryAdd(conf.BffFullFileName, false);

// TODO: really not ideal, refactor and move the properties we need from it someplace else
var vcxprojPlatform = PlatformRegistry.Query<IPlatformVcxproj>(conf.Platform);

Expand Down Expand Up @@ -1446,6 +1453,9 @@ List<string> skipFiles
++configIndex;
}

foreach (string masterlessBff in confBffHasMasters.Where(x => !x.Value).Select(x => x.Key))
Builder.Instance.LogWarningLine("Bff {0} doesn't appear in any master bff, it won't be buildable.", masterlessBff + FastBuildSettings.FastBuildConfigFileExtension);

// Write all unity sections together at the beginning of the .bff just after the header.
if (_unities.Any())
{
Expand Down

0 comments on commit 0562edd

Please sign in to comment.