1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-14 00:14:18 +00:00

Projucer: Prevent duplicate module headers being added to the project when copying module files locally

This commit is contained in:
ed 2019-07-04 09:40:24 +01:00
parent 8c31fb2511
commit 302e4a6166

View file

@ -520,11 +520,16 @@ void LibraryModule::addBrowseableCode (ProjectExporter& exporter, const Array<Fi
if (sourceFiles.isEmpty())
findBrowseableFiles (localModuleFolder, sourceFiles);
auto sourceGroup = Project::Item::createGroup (exporter.getProject(), getID(), "__mainsourcegroup" + getID(), false);
auto sourceGroup = Project::Item::createGroup (exporter.getProject(), getID(), "__mainsourcegroup" + getID(), false);
auto moduleFromProject = exporter.getModuleFolderRelativeToProject (getID());
auto moduleHeader = moduleInfo.getHeader();
auto moduleHeader = moduleInfo.getHeader();
auto& project = exporter.getProject();
if (project.getEnabledModules().shouldCopyModuleFilesLocally (getID()).getValue())
moduleHeader = project.getLocalModuleFolder (getID()).getChildFile (moduleHeader.getFileName());
auto isModuleHeader = [&] (const File& f) { return f.getFileName() == moduleHeader.getFileName(); };
for (auto& sourceFile : sourceFiles)
{
@ -532,10 +537,8 @@ void LibraryModule::addBrowseableCode (ProjectExporter& exporter, const Array<Fi
// (Note: in exporters like MSVC we have to avoid adding the same file twice, even if one of those instances
// is flagged as being excluded from the build, because this overrides the other and it fails to compile)
if ((exporter.canCopeWithDuplicateFiles() || ! compiled.contains (sourceFile)) && sourceFile != moduleHeader)
addFileWithGroups (sourceGroup,
moduleFromProject.getChildFile (pathWithinModule),
pathWithinModule);
if ((exporter.canCopeWithDuplicateFiles() || ! compiled.contains (sourceFile)) && ! isModuleHeader (sourceFile))
addFileWithGroups (sourceGroup, moduleFromProject.getChildFile (pathWithinModule), pathWithinModule);
}
sourceGroup.sortAlphabetically (true, true);