Ejemplo n.º 1
0
void LibraryModule::addBrowsableCode (ProjectExporter& exporter, ProjectSaver& projectSaver,
                                      const Array<File>& compiled, const File& localModuleFolder) const
{
    if (sourceFiles.size() == 0)
        findBrowseableFiles (localModuleFolder, sourceFiles);

    Project::Item sourceGroup (Project::Item::createGroup (exporter.getProject(), getID(), "__mainsourcegroup" + getID()));

    const RelativePath moduleFromProject (exporter.getModuleFolderRelativeToProject (getID(), projectSaver));

    for (int i = 0; i < sourceFiles.size(); ++i)
    {
        const String pathWithinModule (FileHelpers::getRelativePathFrom (sourceFiles.getReference(i), localModuleFolder));

        // (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 (sourceFiles.getReference(i)))
            addFileWithGroups (sourceGroup,
                               moduleFromProject.getChildFile (pathWithinModule),
                               pathWithinModule);
    }

    sourceGroup.addFile (localModuleFolder.getChildFile (FileHelpers::getRelativePathFrom (moduleInfo.manifestFile,
                                                                                           moduleInfo.getFolder())), -1, false);
    sourceGroup.addFile (getModuleHeaderFile (localModuleFolder), -1, false);

    exporter.getModulesGroup().state.addChild (sourceGroup.state.createCopy(), -1, nullptr);
}
Ejemplo n.º 2
0
//==============================================================================
void LibraryModule::writeIncludes (ProjectSaver& projectSaver, OutputStream& out)
{
    Project& project = projectSaver.project;
    EnabledModuleList& modules = project.getModules();

    const String id (getID());
    const File localModuleFolder (project.getLocalModuleFolder (id));
    const File localHeader (getModuleHeaderFile (localModuleFolder));
    const bool usingLocalCopyOfModules = modules.shouldCopyModuleFilesLocally (id).getValue();

    if (usingLocalCopyOfModules
          && modules.shouldNotOverwriteModuleCodeOnSave (id).getValue()
          && localModuleFolder.getChildFile ("juce_module_info").exists())
    {
        projectSaver.filesCreated.add (localModuleFolder);
    }
    else
    {
        const File juceModuleFolder (moduleInfo.getFolder());

        localModuleFolder.createDirectory();

        if (usingLocalCopyOfModules)
            projectSaver.copyFolder (juceModuleFolder, localModuleFolder);
        else
            createLocalHeaderWrapper (projectSaver, getModuleHeaderFile (juceModuleFolder), localHeader);

        out << CodeHelpers::createIncludeStatement (localHeader, projectSaver.getGeneratedCodeFolder()
                                                                             .getChildFile ("AppConfig.h")) << newLine;
    }
}
Ejemplo n.º 3
0
//==============================================================================
void LibraryModule::writeIncludes (ProjectSaver& projectSaver, OutputStream& out)
{
    const File localModuleFolder (projectSaver.getLocalModuleFolder (getID()));
    const File localHeader (getModuleHeaderFile (localModuleFolder));

    localModuleFolder.createDirectory();

    if (projectSaver.project.getModules().shouldCopyModuleFilesLocally (getID()).getValue())
    {
        projectSaver.copyFolder (moduleInfo.getFolder(), localModuleFolder);
    }
    else
    {
        localModuleFolder.createDirectory();
        createLocalHeaderWrapper (projectSaver, getModuleHeaderFile (moduleInfo.getFolder()), localHeader);
    }

    out << CodeHelpers::createIncludeStatement (localHeader, projectSaver.getGeneratedCodeFolder()
                                                                         .getChildFile ("AppConfig.h")) << newLine;
}
Ejemplo n.º 4
0
void LibraryModule::getConfigFlags (Project& project, OwnedArray<Project::ConfigFlag>& flags) const
{
    const File header (getModuleHeaderFile (moduleInfo.getFolder()));
    jassert (header.exists());

    StringArray lines;
    header.readLines (lines);

    for (int i = 0; i < lines.size(); ++i)
    {
        String line (lines[i].trim());

        if (line.startsWith ("/**") && line.containsIgnoreCase ("Config:"))
        {
            ScopedPointer <Project::ConfigFlag> config (new Project::ConfigFlag());
            config->sourceModuleID = getID();
            config->symbol = line.fromFirstOccurrenceOf (":", false, false).trim();

            if (config->symbol.length() > 2)
            {
                ++i;

                while (! (lines[i].contains ("*/") || lines[i].contains ("@see")))
                {
                    if (lines[i].trim().isNotEmpty())
                        config->description = config->description.trim() + " " + lines[i].trim();

                    ++i;
                }

                config->description = config->description.upToFirstOccurrenceOf ("*/", false, false);
                config->value.referTo (project.getConfigFlag (config->symbol));
                flags.add (config.release());
            }
        }
    }
}