Skip to content

Commit

Permalink
Merge branch 'saudi/fix-xcode-bff-warnings' into 'main'
Browse files Browse the repository at this point in the history
Fix false positives with warning "Bff [path] doesn't appear in any master bff,...

See merge request Sharpmake/sharpmake!564
  • Loading branch information
jspelletier committed Oct 31, 2024
2 parents f48b623 + 0562edd commit f76ee4e
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 f76ee4e

Please sign in to comment.