mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Projucer: Removed old jucerVersion property from .jucer file root and added jucerFormatVersion property for indicating changes to .jucer file format not tied to JUCE version
This commit is contained in:
parent
af968f5d78
commit
91d9679f0b
6 changed files with 31 additions and 24 deletions
|
|
@ -253,11 +253,8 @@ void MainWindow::moveProject (File newProjectFileToOpen, OpenInIDE openInIDE)
|
|||
closeCurrentProject (OpenDocumentManager::SaveIfNeeded::no);
|
||||
openFile (newProjectFileToOpen);
|
||||
|
||||
if (currentProject != nullptr)
|
||||
ProjucerApplication::getApp().getCommandManager()
|
||||
.invokeDirectly (openInIDE == OpenInIDE::yes ? CommandIDs::saveAndOpenInIDE
|
||||
: CommandIDs::saveProject,
|
||||
false);
|
||||
if (currentProject != nullptr && openInIDE == OpenInIDE::yes)
|
||||
ProjucerApplication::getApp().getCommandManager().invokeDirectly (CommandIDs::openInIDE, false);
|
||||
}
|
||||
|
||||
void MainWindow::setProject (std::unique_ptr<Project> newProject)
|
||||
|
|
|
|||
|
|
@ -970,7 +970,8 @@ void Project::saveAndMoveTemporaryProject (bool openInIDE)
|
|||
auto newDirectory = newParentDirectory.getChildFile (tempDirectory.getFileName());
|
||||
auto oldJucerFileName = getFile().getFileName();
|
||||
|
||||
writeProjectFile();
|
||||
ProjectSaver saver (*this);
|
||||
saver.save();
|
||||
|
||||
tempDirectory.copyDirectoryTo (newDirectory);
|
||||
tempDirectory.deleteRecursively();
|
||||
|
|
@ -1091,20 +1092,6 @@ bool Project::updateCachedFileState()
|
|||
return true;
|
||||
}
|
||||
|
||||
void Project::writeProjectFile()
|
||||
{
|
||||
updateCachedFileState();
|
||||
|
||||
auto newSerialisedXml = serialiseProjectXml (getProjectRoot().createXml());
|
||||
jassert (newSerialisedXml.isNotEmpty());
|
||||
|
||||
if (newSerialisedXml != cachedFileState.second)
|
||||
{
|
||||
getFile().replaceWithText (newSerialisedXml);
|
||||
cachedFileState = { getFile().getLastModificationTime(), newSerialisedXml };
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
File Project::resolveFilename (String filename) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -475,7 +475,9 @@ public:
|
|||
|
||||
//==============================================================================
|
||||
bool updateCachedFileState();
|
||||
void writeProjectFile();
|
||||
String getCachedFileStateContent() const noexcept { return cachedFileState.second; }
|
||||
|
||||
String serialiseProjectXml (std::unique_ptr<XmlElement>) const;
|
||||
|
||||
//==============================================================================
|
||||
String getUniqueTargetFolderSuffixForExporter (const Identifier& exporterIdentifier, const String& baseTargetFolder);
|
||||
|
|
@ -566,7 +568,6 @@ private:
|
|||
std::pair<Time, String> cachedFileState;
|
||||
|
||||
void saveAndMoveTemporaryProject (bool openInIDE);
|
||||
String serialiseProjectXml (std::unique_ptr<XmlElement>) const;
|
||||
|
||||
//==============================================================================
|
||||
friend class Item;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@
|
|||
static constexpr const char* generatedGroupID = "__jucelibfiles";
|
||||
static constexpr const char* generatedGroupUID = "__generatedcode__";
|
||||
|
||||
constexpr int jucerFormatVersion = 1;
|
||||
|
||||
//==============================================================================
|
||||
ProjectSaver::ProjectSaver (Project& p)
|
||||
: project (p),
|
||||
|
|
@ -294,7 +296,7 @@ Result ProjectSaver::saveProject (ProjectExporter* specifiedExporterToSave)
|
|||
writeProjects (modules, specifiedExporterToSave);
|
||||
runPostExportScript();
|
||||
|
||||
project.writeProjectFile();
|
||||
writeProjectFile();
|
||||
|
||||
if (generatedCodeFolder.exists())
|
||||
{
|
||||
|
|
@ -332,6 +334,25 @@ void ProjectSaver::writePluginDefines (MemoryOutputStream& out) const
|
|||
<< pluginDefines << newLine;
|
||||
}
|
||||
|
||||
void ProjectSaver::writeProjectFile()
|
||||
{
|
||||
auto root = project.getProjectRoot();
|
||||
|
||||
root.removeProperty ("jucerVersion", nullptr);
|
||||
root.setProperty (Ids::jucerFormatVersion, jucerFormatVersion, nullptr);
|
||||
|
||||
project.updateCachedFileState();
|
||||
|
||||
auto newSerialisedXml = project.serialiseProjectXml (root.createXml());
|
||||
jassert (newSerialisedXml.isNotEmpty());
|
||||
|
||||
if (newSerialisedXml != project.getCachedFileStateContent())
|
||||
{
|
||||
project.getFile().replaceWithText (newSerialisedXml);
|
||||
project.updateCachedFileState();
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSaver::writeAppConfig (MemoryOutputStream& out, const OwnedArray<LibraryModule>& modules, const String& userContent)
|
||||
{
|
||||
if (! project.shouldUseAppConfig())
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ private:
|
|||
void writePluginDefines();
|
||||
void writeAppConfigFile (const OwnedArray<LibraryModule>& modules, const String& userContent);
|
||||
|
||||
void writeMainProjectFile();
|
||||
void writeProjectFile();
|
||||
void writeAppConfig (MemoryOutputStream& outStream, const OwnedArray<LibraryModule>& modules, const String& userContent);
|
||||
void writeAppHeader (MemoryOutputStream& outStream, const OwnedArray<LibraryModule>& modules);
|
||||
void writeAppHeader (const OwnedArray<LibraryModule>& modules);
|
||||
|
|
|
|||
|
|
@ -370,6 +370,7 @@ namespace Ids
|
|||
DECLARE_ID (postExportShellCommandWin);
|
||||
DECLARE_ID (liveBuildEnabled);
|
||||
DECLARE_ID (guiEditorEnabled);
|
||||
DECLARE_ID (jucerFormatVersion);
|
||||
|
||||
const Identifier ID ("id");
|
||||
const Identifier ID_uppercase ("ID");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue