Browse Source

Projucer: Fixed a couple of potential race conditions when saving a project

tags/2021-05-28
ed 8 years ago
parent
commit
b9ea65b0c1
13 changed files with 78 additions and 71 deletions
  1. +7
    -7
      extras/Projucer/Source/Project Saving/jucer_ProjectExport_Android.h
  2. +15
    -16
      extras/Projucer/Source/Project Saving/jucer_ProjectExport_CodeBlocks.h
  3. +16
    -17
      extras/Projucer/Source/Project Saving/jucer_ProjectExport_MSVC.h
  4. +8
    -9
      extras/Projucer/Source/Project Saving/jucer_ProjectExport_Make.h
  5. +8
    -9
      extras/Projucer/Source/Project Saving/jucer_ProjectExport_XCode.h
  6. +1
    -1
      extras/Projucer/Source/Project Saving/jucer_ProjectExporter.cpp
  7. +1
    -0
      extras/Projucer/Source/Project Saving/jucer_ProjectExporter.h
  8. +2
    -0
      extras/Projucer/Source/Project Saving/jucer_ProjectSaver.h
  9. +1
    -0
      extras/Projucer/Source/Project/jucer_ConfigTree_Exporter.h
  10. +2
    -3
      extras/Projucer/Source/Project/jucer_ConfigTree_Modules.h
  11. +11
    -5
      extras/Projucer/Source/Project/jucer_Module.cpp
  12. +3
    -1
      extras/Projucer/Source/Project/jucer_Module.h
  13. +3
    -3
      extras/Projucer/Source/Project/jucer_ModulesPanel.h

+ 7
- 7
extras/Projucer/Source/Project Saving/jucer_ProjectExport_Android.h View File

@@ -87,6 +87,13 @@ public:
return nullptr;
}
//==============================================================================
void initialiseDependencyPathValues() override
{
sdkPath.referTo (Value (new DependencyPathValueSource (getSetting (Ids::androidSDKPath), Ids::androidSDKPath, TargetOS::getThisOS())));
ndkPath.referTo (Value (new DependencyPathValueSource (getSetting (Ids::androidNDKPath), Ids::androidNDKPath, TargetOS::getThisOS())));
}
//==============================================================================
CachedValue<String> androidRepositories, androidDependencies,
androidScreenOrientation, androidActivityClass, androidActivitySubClassName,
@@ -132,7 +139,6 @@ public:
buildToolsVersion (settings, Ids::buildToolsVersion, nullptr, "26.0.0"),
AndroidExecutable (findAndroidExecutable())
{
initialiseDependencyPathValues();
name = getName();
if (getTargetLocationString().isEmpty())
@@ -872,12 +878,6 @@ private:
return s + CodeHelpers::makeValidIdentifier (project.getProjectFilenameRoot(), false, true, false);
}
void initialiseDependencyPathValues()
{
sdkPath.referTo (Value (new DependencyPathValueSource (getSetting (Ids::androidSDKPath), Ids::androidSDKPath, TargetOS::getThisOS())));
ndkPath.referTo (Value (new DependencyPathValueSource (getSetting (Ids::androidNDKPath), Ids::androidNDKPath, TargetOS::getThisOS())));
}
//==============================================================================
void copyActivityJavaFiles (const OwnedArray<LibraryModule>& modules, const File& targetFolder, const String& package) const
{


+ 15
- 16
extras/Projucer/Source/Project Saving/jucer_ProjectExport_CodeBlocks.h View File

@@ -91,8 +91,6 @@ public:
if (getTargetLocationString().isEmpty())
getTargetLocationValue() = getDefaultBuildsRootFolder() + getTargetFolderName (os);
initialiseDependencyPathValues();
}
//==============================================================================
@@ -177,6 +175,21 @@ public:
jassert (targets.size() > 0);
}
//==============================================================================
void initialiseDependencyPathValues() override
{
DependencyPathOS pathOS = isLinux() ? TargetOS::linux
: TargetOS::windows;
vst3Path.referTo (Value (new DependencyPathValueSource (getSetting (Ids::vst3Folder), Ids::vst3Path, pathOS)));
if (! isLinux())
{
aaxPath.referTo (Value (new DependencyPathValueSource (getSetting (Ids::aaxFolder), Ids::aaxPath, pathOS)));
rtasPath.referTo (Value (new DependencyPathValueSource (getSetting (Ids::rtasFolder), Ids::rtasPath, pathOS)));
}
}
private:
//==============================================================================
class CodeBlocksBuildConfiguration : public BuildConfiguration
@@ -723,20 +736,6 @@ private:
xml.createNewChildElement ("Add")->setAttribute (nm, value);
}
void initialiseDependencyPathValues()
{
DependencyPathOS pathOS = isLinux() ? TargetOS::linux
: TargetOS::windows;
vst3Path.referTo (Value (new DependencyPathValueSource (getSetting (Ids::vst3Folder), Ids::vst3Path, pathOS)));
if (! isLinux())
{
aaxPath.referTo (Value (new DependencyPathValueSource (getSetting (Ids::aaxFolder), Ids::aaxPath, pathOS)));
rtasPath.referTo (Value (new DependencyPathValueSource (getSetting (Ids::rtasFolder), Ids::rtasPath, pathOS)));
}
}
CodeBlocksOS os;
OwnedArray<CodeBlocksTarget> targets;


+ 16
- 17
extras/Projucer/Source/Project Saving/jucer_ProjectExport_MSVC.h View File

@@ -34,8 +34,6 @@ public:
getTargetLocationValue() = getDefaultBuildsRootFolder() + folderName;
updateOldSettings();
initialiseDependencyPathValues();
}
virtual int getVisualStudioVersion() const = 0;
@@ -132,6 +130,22 @@ public:
}
}
//==============================================================================
void initialiseDependencyPathValues() override
{
vst3Path.referTo (Value (new DependencyPathValueSource (getSetting (Ids::vst3Folder),
Ids::vst3Path,
TargetOS::windows)));
aaxPath.referTo (Value (new DependencyPathValueSource (getSetting (Ids::aaxFolder),
Ids::aaxPath,
TargetOS::windows)));
rtasPath.referTo (Value (new DependencyPathValueSource (getSetting (Ids::rtasFolder),
Ids::rtasPath,
TargetOS::windows)));
}
//==============================================================================
class MSVCBuildConfiguration : public BuildConfiguration
{
@@ -1698,21 +1712,6 @@ protected:
: (".\\" + filename);
}
void initialiseDependencyPathValues()
{
vst3Path.referTo (Value (new DependencyPathValueSource (getSetting (Ids::vst3Folder),
Ids::vst3Path,
TargetOS::windows)));
aaxPath.referTo (Value (new DependencyPathValueSource (getSetting (Ids::aaxFolder),
Ids::aaxPath,
TargetOS::windows)));
rtasPath.referTo (Value (new DependencyPathValueSource (getSetting (Ids::rtasFolder),
Ids::rtasPath,
TargetOS::windows)));
}
static bool shouldUseStdCall (const RelativePath& path)
{
return path.getFileNameWithoutExtension().startsWithIgnoreCase ("juce_audio_plugin_client_RTAS_");


+ 8
- 9
extras/Projucer/Source/Project Saving/jucer_ProjectExport_Make.h View File

@@ -310,8 +310,6 @@ public:
if (getTargetLocationString().isEmpty())
getTargetLocationValue() = getDefaultBuildsRootFolder() + "LinuxMakefile";
initialiseDependencyPathValues();
}
//==============================================================================
@@ -401,6 +399,14 @@ public:
jassert (targets.size() > 0);
}
//==============================================================================
void initialiseDependencyPathValues() override
{
vst3Path.referTo (Value (new DependencyPathValueSource (getSetting (Ids::vst3Folder),
Ids::vst3Path,
TargetOS::linux)));
}
private:
bool isWebBrowserComponentEnabled() const
{
@@ -746,13 +752,6 @@ private:
return phonyTargetLine.toString();
}
void initialiseDependencyPathValues()
{
vst3Path.referTo (Value (new DependencyPathValueSource (getSetting (Ids::vst3Folder),
Ids::vst3Path,
TargetOS::linux)));
}
OwnedArray<MakefileTarget> targets;
JUCE_DECLARE_NON_COPYABLE (MakefileProjectExporter)


+ 8
- 9
extras/Projucer/Source/Project Saving/jucer_ProjectExport_XCode.h View File

@@ -61,8 +61,6 @@ public:
if (getTargetLocationString().isEmpty())
getTargetLocationValue() = getDefaultBuildsRootFolder() + (iOS ? "iOS" : "MacOSX");
initialiseDependencyPathValues();
if (iOS)
{
if (getScreenOrientationValue().toString().isEmpty())
@@ -362,6 +360,14 @@ public:
return (MD5 (getPostBuildScript().toUTF8()).toHexString() == "265ac212a7e734c5bbd6150e1eae18a1");
}
//==============================================================================
void initialiseDependencyPathValues() override
{
vst3Path.referTo (Value (new DependencyPathValueSource (getSetting (Ids::vst3Folder), Ids::vst3Path, TargetOS::osx)));
aaxPath. referTo (Value (new DependencyPathValueSource (getSetting (Ids::aaxFolder), Ids::aaxPath, TargetOS::osx)));
rtasPath.referTo (Value (new DependencyPathValueSource (getSetting (Ids::rtasFolder), Ids::rtasPath, TargetOS::osx)));
}
protected:
//==============================================================================
class XcodeBuildConfiguration : public BuildConfiguration
@@ -2865,12 +2871,5 @@ private:
return getOSXVersionName (version) + " SDK";
}
void initialiseDependencyPathValues()
{
vst3Path.referTo (Value (new DependencyPathValueSource (getSetting (Ids::vst3Folder), Ids::vst3Path, TargetOS::osx)));
aaxPath. referTo (Value (new DependencyPathValueSource (getSetting (Ids::aaxFolder), Ids::aaxPath, TargetOS::osx)));
rtasPath.referTo (Value (new DependencyPathValueSource (getSetting (Ids::rtasFolder), Ids::rtasPath, TargetOS::osx)));
}
JUCE_DECLARE_NON_COPYABLE (XCodeProjectExporter)
};

+ 1
- 1
extras/Projucer/Source/Project Saving/jucer_ProjectExporter.cpp View File

@@ -500,7 +500,7 @@ String ProjectExporter::getPathForModuleString (const String& moduleID) const
auto exporterPath = settings.getChildWithName (Ids::MODULEPATHS)
.getChildWithProperty (Ids::ID, moduleID) [Ids::path].toString();
if (exporterPath.isEmpty() || project.getModules().shouldUseGlobalPath (moduleID).getValue())
if (exporterPath.isEmpty() || project.getModules().shouldUseGlobalPath (moduleID))
{
auto id = EnabledModuleList::isJuceModule (moduleID) ? Ids::defaultJuceModulePath
: Ids::defaultUserModulePath;


+ 1
- 0
extras/Projucer/Source/Project Saving/jucer_ProjectExporter.h View File

@@ -81,6 +81,7 @@ public:
virtual bool canCopeWithDuplicateFiles() = 0;
virtual bool supportsUserDefinedConfigurations() const = 0; // false if exporter only supports two configs Debug and Release
virtual void updateDeprecatedProjectSettingsInteractively();
virtual void initialiseDependencyPathValues() {}
// IDE targeted by exporter
virtual bool isXcode() const = 0;


+ 2
- 0
extras/Projucer/Source/Project Saving/jucer_ProjectSaver.h View File

@@ -674,6 +674,8 @@ private:
if (specifiedExporterToSave.isNotEmpty() && exporter->getName() != specifiedExporterToSave)
continue;
exporter->initialiseDependencyPathValues();
if (exporter->getTargetFolder().createDirectory())
{
exporter->copyMainGroupFromProject();


+ 1
- 0
extras/Projucer/Source/Project/jucer_ConfigTree_Exporter.h View File

@@ -32,6 +32,7 @@ public:
: project (p), exporter (e), configListTree (exporter->getConfigurations()),
exporterIndex (index)
{
exporter->initialiseDependencyPathValues();
configListTree.addListener (this);
targetLocationValue.referTo (exporter->getTargetLocationValue());
targetLocationValue.addListener (this);


+ 2
- 3
extras/Projucer/Source/Project/jucer_ConfigTree_Modules.h View File

@@ -124,7 +124,6 @@ private:
void refresh()
{
auto& modules = project.getModules();
const auto& isUsingGlobalPathValue = modules.shouldUseGlobalPath (moduleID);
setEnabled (modules.isModuleEnabled (moduleID));
@@ -158,11 +157,11 @@ private:
"must be valid on the filesystem of the target machine that will be performing this build. If this "
"is empty then the global path will be used.");
pathComponent->setEnabled (! isUsingGlobalPathValue.getValue());
pathComponent->setEnabled (! modules.shouldUseGlobalPath (moduleID));
pathComponent->getValue().addListener (this);
}
globalPathValue.referTo (isUsingGlobalPathValue);
globalPathValue.referTo (modules.getShouldUseGlobalPathValue (moduleID));
auto menuItemString = (TargetOS::getThisOS() == TargetOS::osx ? "\"Projucer->Global Search Paths...\""
: "\"File->Global Search Paths...\"");


+ 11
- 5
extras/Projucer/Source/Project/jucer_Module.cpp View File

@@ -222,7 +222,7 @@ static Array<File> getAllPossibleModulePathsFromExporters (Project& project)
{
auto id = modules.getModuleID (i);
if (modules.shouldUseGlobalPath (id).getValue())
if (modules.shouldUseGlobalPath (id))
continue;
const auto path = exporter->getPathForModuleString (id);
@@ -651,7 +651,13 @@ bool EnabledModuleList::isAudioPluginModuleMissing() const
&& ! isModuleEnabled ("juce_audio_plugin_client");
}
Value EnabledModuleList::shouldUseGlobalPath (const String& moduleID) const
bool EnabledModuleList::shouldUseGlobalPath (const String& moduleID) const
{
return static_cast<bool> (state.getChildWithProperty (Ids::ID, moduleID)
.getProperty (Ids::useGlobalPath));
}
Value EnabledModuleList::getShouldUseGlobalPathValue (const String& moduleID) const
{
return state.getChildWithProperty (Ids::ID, moduleID)
.getPropertyAsValue (Ids::useGlobalPath, getUndoManager());
@@ -704,7 +710,7 @@ File EnabledModuleList::findUserModuleFolder (const String& possiblePaths, const
File EnabledModuleList::getModuleFolder (const String& moduleID)
{
if (shouldUseGlobalPath (moduleID).getValue())
if (shouldUseGlobalPath (moduleID))
{
if (isJuceModule (moduleID))
return getModuleFolderFromPathIfItExists (getAppSettings().getStoredPath (Ids::defaultJuceModulePath).toString(), moduleID, project);
@@ -761,7 +767,7 @@ void EnabledModuleList::addModule (const File& moduleFolder, bool copyLocally, b
shouldShowAllModuleFilesInProject (moduleID) = true;
shouldCopyModuleFilesLocally (moduleID) = copyLocally;
shouldUseGlobalPath (moduleID) = useGlobalPath;
getShouldUseGlobalPathValue (moduleID) = useGlobalPath;
RelativePath path (moduleFolder.getParentDirectory(),
project.getProjectFolder(), RelativePath::projectFolder);
@@ -842,7 +848,7 @@ bool EnabledModuleList::areMostModulesUsingGlobalPath() const
for (auto i = getNumModules(); --i >= 0;)
{
if (shouldUseGlobalPath (getModuleID (i)).getValue())
if (shouldUseGlobalPath (getModuleID (i)))
++numYes;
else
++numNo;


+ 3
- 1
extras/Projucer/Source/Project/jucer_Module.h View File

@@ -144,7 +144,9 @@ public:
bool isModuleEnabled (const String& moduleID) const;
Value shouldUseGlobalPath (const String& moduleID) const;
bool shouldUseGlobalPath (const String& moduleID) const;
Value getShouldUseGlobalPathValue (const String& moduleID) const;
Value shouldShowAllModuleFilesInProject (const String& moduleID);
Value shouldCopyModuleFilesLocally (const String& moduleID) const;


+ 3
- 3
extras/Projucer/Source/Project/jucer_ModulesPanel.h View File

@@ -142,7 +142,7 @@ public:
//======================================================================
String pathText;
if (project.getModules().shouldUseGlobalPath (moduleID).getValue())
if (project.getModules().shouldUseGlobalPath (moduleID))
{
pathText = "Global";
}
@@ -250,14 +250,14 @@ private:
auto moduleIDs = moduleList.getAllModules();
for (auto id : moduleIDs)
moduleList.shouldUseGlobalPath (id).setValue (enableGlobalPaths);
moduleList.getShouldUseGlobalPathValue (id).setValue (enableGlobalPaths);
}
else
{
auto selected = list.getSelectedRows();
for (auto i = 0; i < selected.size(); ++i)
moduleList.shouldUseGlobalPath (moduleList.getModuleID (selected[i])).setValue (enableGlobalPaths);
moduleList.getShouldUseGlobalPathValue (moduleList.getModuleID (selected[i])).setValue (enableGlobalPaths);
}
}
}


Loading…
Cancel
Save