Browse Source

Projucer: Moved the live-build settings into a separate CompileEngineSettings class and refactored some redundant code

tags/2021-05-28
ed 7 years ago
parent
commit
01339a5365
17 changed files with 193 additions and 159 deletions
  1. +2
    -0
      extras/Projucer/Builds/MacOSX/Projucer.xcodeproj/project.pbxproj
  2. +1
    -0
      extras/Projucer/Builds/VisualStudio2013/Projucer_App.vcxproj
  3. +3
    -0
      extras/Projucer/Builds/VisualStudio2013/Projucer_App.vcxproj.filters
  4. +1
    -0
      extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj
  5. +3
    -0
      extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj.filters
  6. +1
    -0
      extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj
  7. +3
    -0
      extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters
  8. +2
    -0
      extras/Projucer/Projucer.jucer
  9. +0
    -5
      extras/Projucer/Source/Application/jucer_Application.cpp
  10. +0
    -1
      extras/Projucer/Source/Application/jucer_Application.h
  11. +42
    -122
      extras/Projucer/Source/LiveBuildEngine/jucer_CompileEngineClient.cpp
  12. +7
    -16
      extras/Projucer/Source/LiveBuildEngine/jucer_CompileEngineClient.h
  13. +110
    -0
      extras/Projucer/Source/LiveBuildEngine/jucer_CompileEngineSettings.h
  14. +1
    -1
      extras/Projucer/Source/Project/UI/Sidebar/jucer_LiveBuildTab.h
  15. +7
    -14
      extras/Projucer/Source/Project/UI/jucer_ProjectContentComponent.cpp
  16. +7
    -0
      extras/Projucer/Source/Project/jucer_Project.h
  17. +3
    -0
      extras/Projucer/Source/Utility/Helpers/jucer_PresetIDs.h

+ 2
- 0
extras/Projucer/Builds/MacOSX/Projucer.xcodeproj/project.pbxproj View File

@@ -294,6 +294,7 @@
9F01BA9942D038EA8B5289A8 = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QTKit.framework; path = System/Library/Frameworks/QTKit.framework; sourceTree = SDKROOT; };
9F2D3E5FC10F7C3270908E97 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_ButtonDocument.h"; path = "../../Source/ComponentEditor/Documents/jucer_ButtonDocument.h"; sourceTree = "SOURCE_ROOT"; };
9F959ECF8CD9B7314AE604A9 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_LabelHandler.h"; path = "../../Source/ComponentEditor/Components/jucer_LabelHandler.h"; sourceTree = "SOURCE_ROOT"; };
A081306A9E95CA114B81910F = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_CompileEngineSettings.h"; path = "../../Source/LiveBuildEngine/jucer_CompileEngineSettings.h"; sourceTree = "SOURCE_ROOT"; };
A085174413736ACC8D7D42A2 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_ProjectWizard_openGL.h"; path = "../../Source/Wizards/jucer_ProjectWizard_openGL.h"; sourceTree = "SOURCE_ROOT"; };
A0BBBFBA13A1308B3CD725D5 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "jucer_ComponentLayoutPanel.h"; path = "../../Source/ComponentEditor/UI/jucer_ComponentLayoutPanel.h"; sourceTree = "SOURCE_ROOT"; };
A160AEF56553A658E6EA6A8E = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "jucer_MainTemplate_Window.cpp"; path = "../../Source/BinaryData/Templates/jucer_MainTemplate_Window.cpp"; sourceTree = "SOURCE_ROOT"; };
@@ -629,6 +630,7 @@
A978DFE87D9BB5EFE5B3DAAC,
D2FE76E4CF003856278343CC,
BA186B51EE4884CD8E3F2741,
A081306A9E95CA114B81910F,
ADD6A3CF5D7DE55E57E8E38B,
A9954DC7F876A7006743ACB6,
ADA538034910F52FDD2DC88D,


+ 1
- 0
extras/Projucer/Builds/VisualStudio2013/Projucer_App.vcxproj View File

@@ -1561,6 +1561,7 @@
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_CompileEngineClient.h"/>
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_CompileEngineDLL.h"/>
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_CompileEngineServer.h"/>
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_CompileEngineSettings.h"/>
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_CppHelpers.h"/>
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_DiagnosticMessage.h"/>
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_DownloadCompileEngineThread.h"/>


+ 3
- 0
extras/Projucer/Builds/VisualStudio2013/Projucer_App.vcxproj.filters View File

@@ -2160,6 +2160,9 @@
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_CompileEngineServer.h">
<Filter>Projucer\LiveBuildEngine</Filter>
</ClInclude>
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_CompileEngineSettings.h">
<Filter>Projucer\LiveBuildEngine</Filter>
</ClInclude>
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_CppHelpers.h">
<Filter>Projucer\LiveBuildEngine</Filter>
</ClInclude>


+ 1
- 0
extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj View File

@@ -1561,6 +1561,7 @@
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_CompileEngineClient.h"/>
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_CompileEngineDLL.h"/>
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_CompileEngineServer.h"/>
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_CompileEngineSettings.h"/>
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_CppHelpers.h"/>
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_DiagnosticMessage.h"/>
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_DownloadCompileEngineThread.h"/>


+ 3
- 0
extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj.filters View File

@@ -2160,6 +2160,9 @@
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_CompileEngineServer.h">
<Filter>Projucer\LiveBuildEngine</Filter>
</ClInclude>
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_CompileEngineSettings.h">
<Filter>Projucer\LiveBuildEngine</Filter>
</ClInclude>
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_CppHelpers.h">
<Filter>Projucer\LiveBuildEngine</Filter>
</ClInclude>


+ 1
- 0
extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj View File

@@ -1561,6 +1561,7 @@
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_CompileEngineClient.h"/>
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_CompileEngineDLL.h"/>
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_CompileEngineServer.h"/>
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_CompileEngineSettings.h"/>
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_CppHelpers.h"/>
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_DiagnosticMessage.h"/>
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_DownloadCompileEngineThread.h"/>


+ 3
- 0
extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters View File

@@ -2160,6 +2160,9 @@
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_CompileEngineServer.h">
<Filter>Projucer\LiveBuildEngine</Filter>
</ClInclude>
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_CompileEngineSettings.h">
<Filter>Projucer\LiveBuildEngine</Filter>
</ClInclude>
<ClInclude Include="..\..\Source\LiveBuildEngine\jucer_CppHelpers.h">
<Filter>Projucer\LiveBuildEngine</Filter>
</ClInclude>


+ 2
- 0
extras/Projucer/Projucer.jucer View File

@@ -516,6 +516,8 @@
resource="0" file="Source/LiveBuildEngine/jucer_CompileEngineServer.cpp"/>
<FILE id="RraER0" name="jucer_CompileEngineServer.h" compile="0" resource="0"
file="Source/LiveBuildEngine/jucer_CompileEngineServer.h"/>
<FILE id="hKqvP1" name="jucer_CompileEngineSettings.h" compile="0"
resource="0" file="Source/LiveBuildEngine/jucer_CompileEngineSettings.h"/>
<FILE id="YlfzAt" name="jucer_CppHelpers.h" compile="0" resource="0"
file="Source/LiveBuildEngine/jucer_CppHelpers.h"/>
<FILE id="yW3rHq" name="jucer_DiagnosticMessage.h" compile="0" resource="0"


+ 0
- 5
extras/Projucer/Source/Application/jucer_Application.cpp View File

@@ -1107,11 +1107,6 @@ void ProjucerApplication::createNewPIP()
showPIPCreatorWindow();
}
void ProjucerApplication::updateNewlyOpenedProject (Project& p)
{
LiveBuildProjectSettings::updateNewlyOpenedProject (p);
}
void ProjucerApplication::askUserToOpenFile()
{
FileChooser fc ("Open File");


+ 0
- 1
extras/Projucer/Source/Application/jucer_Application.h View File

@@ -94,7 +94,6 @@ public:
void createNewProject();
void createNewProjectFromClipboard();
void createNewPIP();
void updateNewlyOpenedProject (Project&);
void askUserToOpenFile();
bool openFile (const File&);
bool closeAllDocuments (bool askUserToSave);


+ 42
- 122
extras/Projucer/Source/LiveBuildEngine/jucer_CompileEngineClient.cpp View File

@@ -42,94 +42,26 @@
#endif
//==============================================================================
namespace ProjectProperties
static File getProjucerTempFolder() noexcept
{
const Identifier liveSettingsType ("LIVE_SETTINGS");
#if JUCE_MAC
const Identifier liveSettingsSubtype ("OSX");
#elif JUCE_WINDOWS
const Identifier liveSettingsSubtype ("WINDOWS");
#elif JUCE_LINUX
const Identifier liveSettingsSubtype ("LINUX");
return { "~/Library/Caches/com.juce.projucer" };
#else
return File::getSpecialLocation (File::tempDirectory).getChildFile ("com.juce.projucer");
#endif
static ValueTree getLiveSettings (Project& project)
{
return project.getProjectRoot().getOrCreateChildWithName (liveSettingsType, nullptr)
.getOrCreateChildWithName (liveSettingsSubtype, nullptr);
}
static ValueWithDefault getLiveSetting (Project& p, const Identifier& i, var defaultValue = var())
{
auto tree = getLiveSettings (p);
return { tree, i, p.getUndoManagerFor (tree), defaultValue };
}
static ValueWithDefault getUserHeaderPathValue (Project& p) { return getLiveSetting (p, Ids::headerPath); }
static ValueWithDefault getSystemHeaderPathValue (Project& p) { return getLiveSetting (p, Ids::systemHeaderPath); }
static ValueWithDefault getExtraDLLsValue (Project& p) { return getLiveSetting (p, Ids::extraDLLs); }
static ValueWithDefault getExtraCompilerFlagsValue (Project& p) { return getLiveSetting (p, Ids::extraCompilerFlags); }
static ValueWithDefault getExtraPreprocessorDefsValue (Project& p) { return getLiveSetting (p, Ids::defines); }
static ValueWithDefault getWindowsTargetPlatformVersionValue (Project& p) { return getLiveSetting (p, Ids::liveWindowsTargetPlatformVersion, "10.0.16299.0"); }
static File getProjucerTempFolder()
{
#if JUCE_MAC
return File ("~/Library/Caches/com.juce.projucer");
#else
return File::getSpecialLocation (File::tempDirectory).getChildFile ("com.juce.projucer");
#endif
}
static File getCacheLocation (Project& project)
{
auto cacheFolderName = project.getProjectFilenameRootString() + "_" + project.getProjectUIDString();
#if JUCE_DEBUG
cacheFolderName += "_debug";
#endif
return getProjucerTempFolder()
.getChildFile ("Intermediate Files")
.getChildFile (cacheFolderName);
}
}
//==============================================================================
void LiveBuildProjectSettings::getLiveSettings (Project& project, PropertyListBuilder& props)
static File getCacheLocationForProject (Project& project) noexcept
{
using namespace ProjectProperties;
props.addSearchPathProperty (getUserHeaderPathValue (project), "User Header Paths", "User header search paths.");
props.addSearchPathProperty (getSystemHeaderPathValue (project), "System header paths", "System header search paths.");
auto cacheFolderName = project.getProjectFilenameRootString() + "_" + project.getProjectUIDString();
props.add (new TextPropertyComponent (getExtraPreprocessorDefsValue (project), "Preprocessor Definitions", 32768, true),
"Extra preprocessor definitions. Use the form \"NAME1=value NAME2=value\", using whitespace or commas "
"to separate the items - to include a space or comma in a definition, precede it with a backslash.");
props.add (new TextPropertyComponent (getExtraCompilerFlagsValue (project), "Extra Compiler Flags", 2048, true),
"Extra command-line flags to be passed to the compiler. This string can contain references to preprocessor"
" definitions in the form ${NAME_OF_DEFINITION}, which will be replaced with their values.");
props.add (new TextPropertyComponent (getExtraDLLsValue (project), "Extra Dynamic Libraries", 2048, true),
"Extra dynamic libs that the running code may require. Use new-lines or commas to separate the items.");
props.add (new TextPropertyComponent (getWindowsTargetPlatformVersionValue (project), "Windows Target Platform", 256, false),
"The Windows target platform to use.");
}
void LiveBuildProjectSettings::updateNewlyOpenedProject (Project&) { /* placeholder */ }
#if JUCE_DEBUG
cacheFolderName += "_debug";
#endif
bool LiveBuildProjectSettings::isBuildDisabled (Project& p)
{
const bool defaultBuildDisabled = true;
return p.getStoredProperties().getBoolValue ("buildDisabled", defaultBuildDisabled);
return getProjucerTempFolder().getChildFile ("Intermediate Files").getChildFile (cacheFolderName);
}
void LiveBuildProjectSettings::setBuildDisabled (Project& p, bool b) { p.getStoredProperties().setValue ("buildDisabled", b); }
bool LiveBuildProjectSettings::areWarningsDisabled (Project& p) { return p.getStoredProperties().getBoolValue ("warningsDisabled"); }
void LiveBuildProjectSettings::setWarningsDisabled (Project& p, bool b) { p.getStoredProperties().setValue ("warningsDisabled", b); }
//==============================================================================
class ClientIPC : public MessageHandler,
private InterprocessConnection,
@@ -161,26 +93,22 @@ public:
void launchServer()
{
DBG ("Client: Launching Server...");
const String pipeName ("ipc_" + String::toHexString (Random().nextInt64()));
const String command (createCommandLineForLaunchingServer (pipeName,
owner.project.getProjectUIDString(),
ProjectProperties::getCacheLocation (owner.project)));
auto pipeName = "ipc_" + String::toHexString (Random().nextInt64());
auto command = createCommandLineForLaunchingServer (pipeName, owner.project.getProjectUIDString(),
getCacheLocationForProject (owner.project));
#if RUN_CLANG_IN_CHILD_PROCESS
if (! childProcess.start (command))
{
jassertfalse;
}
#else
server = createClangServer (command);
#endif
bool ok = connectToPipe (pipeName, 10000);
jassert (ok);
if (ok)
if (connectToPipe (pipeName, 10000))
MessageTypes::sendPing (*this);
else
jassertfalse;
startTimer (serverKeepAliveTimeout);
}
@@ -317,14 +245,14 @@ public:
build.setSystemIncludes (getSystemIncludePaths());
build.setUserIncludes (getUserIncludes());
build.setGlobalDefs (getGlobalDefs (project));
build.setCompileFlags (ProjectProperties::getExtraCompilerFlagsValue (project).get().toString().trim());
build.setGlobalDefs (getGlobalDefs());
build.setCompileFlags (project.getCompileEngineSettings().getExtraCompilerFlagsString());
build.setExtraDLLs (getExtraDLLs());
build.setJuceModulesFolder (EnabledModuleList::findDefaultModulesFolder (project).getFullPathName());
build.setUtilsCppInclude (project.getAppIncludeFile().getFullPathName());
build.setWindowsTargetPlatformVersion (ProjectProperties::getWindowsTargetPlatformVersionValue (project).get().toString());
build.setWindowsTargetPlatformVersion (project.getCompileEngineSettings().getWindowsTargetPlatformVersionString());
scanForProjectFiles (project, build);
@@ -376,15 +304,14 @@ private:
void valueTreeParentChanged (ValueTree&) override { projectStructureChanged(); }
void valueTreeChildOrderChanged (ValueTree&, int, int) override {}
static String getGlobalDefs (Project& proj)
String getGlobalDefs()
{
StringArray defs;
defs.add (ProjectProperties::getExtraPreprocessorDefsValue (proj).get().toString());
defs.add (project.getCompileEngineSettings().getExtraPreprocessorDefsString());
{
auto projectDefines = proj.getPreprocessorDefs();
StringArray result;
auto projectDefines = project.getPreprocessorDefs();
for (int i = 0; i < projectDefines.size(); ++i)
{
@@ -398,7 +325,7 @@ private:
}
}
for (Project::ExporterIterator exporter (proj); exporter.next();)
for (Project::ExporterIterator exporter (project); exporter.next();)
if (exporter->canLaunchProject())
defs.add (exporter->getExporterIdentifierMacro() + "=1");
@@ -422,7 +349,7 @@ private:
if (projectItem.shouldBeCompiled())
{
const File f (projectItem.getFile());
auto f = projectItem.getFile();
if (f.exists())
compileUnits.add (f);
@@ -430,7 +357,7 @@ private:
if (projectItem.shouldBeAddedToTargetProject() && ! projectItem.shouldBeAddedToBinaryResources())
{
const File f (projectItem.getFile());
auto f = projectItem.getFile();
if (f.exists())
userFiles.add (f);
@@ -455,11 +382,11 @@ private:
{
if (exporter->canLaunchProject())
{
for (const LibraryModule* m : modules)
for (auto* m : modules)
{
const File localModuleFolder = proj.getModules().shouldCopyModuleFilesLocally (m->moduleInfo.getID()).getValue()
? proj.getLocalModuleFolder (m->moduleInfo.getID())
: m->moduleInfo.getFolder();
auto localModuleFolder = proj.getModules().shouldCopyModuleFilesLocally (m->moduleInfo.getID()).getValue()
? proj.getLocalModuleFolder (m->moduleInfo.getID())
: m->moduleInfo.getFolder();
m->findAndAddCompiledUnits (*exporter, nullptr, compileUnits,
@@ -477,14 +404,14 @@ private:
for (int i = 0; ; ++i)
{
const File binaryDataCpp (proj.getBinaryDataCppFile (i));
auto binaryDataCpp = proj.getBinaryDataCppFile (i);
if (! binaryDataCpp.exists())
break;
compileUnits.add (binaryDataCpp);
}
for (int i = compileUnits.size(); --i >= 0;)
for (auto i = compileUnits.size(); --i >= 0;)
if (compileUnits.getReference(i).hasFileExtension (".r"))
compileUnits.remove (i);
@@ -493,14 +420,14 @@ private:
static bool doesProjectMatchSavedHeaderState (Project& project)
{
ValueTree liveModules (project.getProjectRoot().getChildWithName (Ids::MODULES));
auto liveModules = project.getProjectRoot().getChildWithName (Ids::MODULES);
ScopedPointer<XmlElement> xml (XmlDocument::parse (project.getFile()));
if (xml == nullptr || ! xml->hasTagName (Ids::JUCERPROJECT.toString()))
return false;
ValueTree diskModules (ValueTree::fromXml (*xml).getChildWithName (Ids::MODULES));
auto diskModules = ValueTree::fromXml (*xml).getChildWithName (Ids::MODULES);
return liveModules.isEquivalentTo (diskModules);
}
@@ -521,14 +448,15 @@ private:
{
StringArray paths;
paths.add (project.getGeneratedCodeFolder().getFullPathName());
paths.addArray (getSearchPathsFromString (ProjectProperties::getUserHeaderPathValue (project).get().toString()));
paths.addArray (getSearchPathsFromString (project.getCompileEngineSettings().getUserHeaderPathString()));
return convertSearchPathsToAbsolute (paths);
}
StringArray getSystemIncludePaths()
{
StringArray paths;
paths.addArray (getSearchPathsFromString (ProjectProperties::getSystemHeaderPathValue (project).get().toString()));
paths.addArray (getSearchPathsFromString (project.getCompileEngineSettings().getSystemHeaderPathString()));
auto isVST3Host = project.getModules().isModuleEnabled ("juce_audio_processors")
&& project.isConfigFlagEnabled ("JUCE_PLUGINHOST_VST3");
@@ -558,10 +486,10 @@ private:
StringArray getExtraDLLs()
{
StringArray dlls;
dlls.addTokens (ProjectProperties::getExtraDLLsValue (project).get().toString(), "\n\r,", StringRef());
auto dlls = StringArray::fromTokens (project.getCompileEngineSettings().getExtraDLLsString(), "\n\r,", {});
dlls.trim();
dlls.removeEmptyStrings();
return dlls;
}
@@ -570,14 +498,11 @@ private:
//==============================================================================
CompileEngineChildProcess::CompileEngineChildProcess (Project& p)
: project (p),
continuousRebuild (false)
: project (p)
{
ProjucerApplication::getApp().openDocumentManager.addListener (this);
createProcess();
errorList.setWarningsEnabled (! LiveBuildProjectSettings::areWarningsDisabled (project));
errorList.setWarningsEnabled (project.getCompileEngineSettings().areWarningsEnabled());
}
CompileEngineChildProcess::~CompileEngineChildProcess()
@@ -773,7 +698,7 @@ private:
void timerCallback() override
{
if (owner.continuousRebuild)
if (owner.project.getCompileEngineSettings().isContinuousRebuildEnabled())
flushEditorChanges();
else
stopTimer();
@@ -911,11 +836,6 @@ void CompileEngineChildProcess::handlePing()
}
//==============================================================================
void CompileEngineChildProcess::setContinuousRebuild (bool b)
{
continuousRebuild = b;
}
void CompileEngineChildProcess::flushEditorChanges()
{
for (Editor* ed : editors)
@@ -967,7 +887,7 @@ void CompileEngineChildProcess::handleHighlightCode (const SourceCodeRange& loca
void CompileEngineChildProcess::cleanAllCachedFilesForProject (Project& p)
{
File cacheFolder (ProjectProperties::getCacheLocation (p));
File cacheFolder (getCacheLocationForProject (p));
if (cacheFolder.isDirectory())
cacheFolder.deleteRecursively();


+ 7
- 16
extras/Projucer/Source/LiveBuildEngine/jucer_CompileEngineClient.h View File

@@ -38,33 +38,38 @@ public:
CompileEngineChildProcess (Project&);
~CompileEngineChildProcess();
//==============================================================================
bool openedOk() const { return process != nullptr; }
void editorOpened (const File& file, CodeDocument& document);
bool documentAboutToClose (OpenDocumentManager::Document*) override;
//==============================================================================
void cleanAll();
void openPreview (const ClassDatabase::Class&);
void reinstantiatePreviews();
void processActivationChanged (bool isForeground);
//==============================================================================
bool canLaunchApp() const;
void launchApp();
bool canKillApp() const;
void killApp();
bool isAppRunning() const noexcept;
//==============================================================================
const ClassDatabase::ClassList& getComponentList() const { return lastComponentList; }
void setContinuousRebuild (bool continuousBuild);
//==============================================================================
void flushEditorChanges();
static void cleanAllCachedFilesForProject (Project&);
//==============================================================================
Project& project;
ActivityList activityList;
ErrorList errorList;
//==============================================================================
std::function<void (const String&)> crashHandler;
//==============================================================================
@@ -93,7 +98,6 @@ private:
class ChildProcess;
ScopedPointer<ChildProcess> process, runningAppProcess;
ClassDatabase::ClassList lastComponentList;
bool continuousRebuild;
struct Editor;
OwnedArray<Editor> editors;
@@ -153,16 +157,3 @@ private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ChildProcessCache)
};
//==============================================================================
struct LiveBuildProjectSettings
{
static void getLiveSettings (Project&, PropertyListBuilder&);
static void updateNewlyOpenedProject (Project& p);
static bool isBuildDisabled (Project&);
static void setBuildDisabled (Project&, bool);
static bool areWarningsDisabled (Project&);
static void setWarningsDisabled (Project&, bool);
};

+ 110
- 0
extras/Projucer/Source/LiveBuildEngine/jucer_CompileEngineSettings.h View File

@@ -0,0 +1,110 @@
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2017 - ROLI Ltd.
JUCE is an open source library subject to commercial or open-source
licensing.
By using JUCE, you agree to the terms of both the JUCE 5 End-User License
Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
27th April 2017).
End User License Agreement: www.juce.com/juce-5-licence
Privacy Policy: www.juce.com/juce-5-privacy-policy
Or: You may also use this code under the terms of the GPL v3 (see
www.gnu.org/licenses).
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
#pragma once
//==============================================================================
class CompileEngineSettings
{
public:
CompileEngineSettings (ValueTree& projectRoot)
: tree (projectRoot.getOrCreateChildWithName ("LIVE_SETTINGS", nullptr)
.getOrCreateChildWithName (getLiveSettingsSubType(), nullptr)),
buildEnabledValue (tree, Ids::buildEnabled, nullptr, false),
continuousRebuildEnabledValue (tree, Ids::continuousRebuildEnabled, nullptr, false),
warningsEnabledValue (tree, Ids::warningsEnabled, nullptr, true),
userHeaderPathValue (tree, Ids::headerPath, nullptr),
systemHeaderPathValue (tree, Ids::systemHeaderPath, nullptr),
extraDLLsValue (tree, Ids::extraDLLs, nullptr),
extraCompilerFlagsValue (tree, Ids::extraCompilerFlags, nullptr),
extraPreprocessorDefsValue (tree, Ids::defines, nullptr),
windowsTargetPlatformValue (tree, Ids::windowsTargetPlatformVersion, nullptr, "10.0.16299.0")
{
}
//==============================================================================
void setBuildEnabled (bool enabled) noexcept { buildEnabledValue = enabled; }
void setContinuousRebuildEnabled (bool enabled) noexcept { continuousRebuildEnabledValue = enabled; }
void setWarningsEnabled (bool enabled) { warningsEnabledValue = enabled; }
bool isBuildEnabled() const noexcept { return buildEnabledValue.get(); }
bool isContinuousRebuildEnabled() const noexcept { return continuousRebuildEnabledValue.get(); }
bool areWarningsEnabled() const noexcept { return warningsEnabledValue.get(); }
String getUserHeaderPathString() const noexcept { return userHeaderPathValue.get(); }
String getSystemHeaderPathString() const noexcept { return systemHeaderPathValue.get(); }
String getExtraDLLsString() const noexcept { return extraDLLsValue.get(); }
String getExtraCompilerFlagsString() const noexcept { return extraCompilerFlagsValue.get(); }
String getExtraPreprocessorDefsString() const noexcept { return extraPreprocessorDefsValue.get(); }
String getWindowsTargetPlatformVersionString() const noexcept { return windowsTargetPlatformValue.get(); }
//==============================================================================
void getLiveSettings (PropertyListBuilder& props)
{
props.addSearchPathProperty (userHeaderPathValue, "User Header Paths", "User header search paths.");
props.addSearchPathProperty (systemHeaderPathValue, "System Header Paths", "System header search paths.");
props.add (new TextPropertyComponent (extraPreprocessorDefsValue, "Preprocessor Definitions", 32768, true),
"Extra preprocessor definitions. Use the form \"NAME1=value NAME2=value\", using whitespace or commas "
"to separate the items - to include a space or comma in a definition, precede it with a backslash.");
props.add (new TextPropertyComponent (extraCompilerFlagsValue, "Extra Compiler Flags", 2048, true),
"Extra command-line flags to be passed to the compiler. This string can contain references to preprocessor"
" definitions in the form ${NAME_OF_DEFINITION}, which will be replaced with their values.");
props.add (new TextPropertyComponent (extraDLLsValue, "Extra Dynamic Libraries", 2048, true),
"Extra dynamic libs that the running code may require. Use new-lines or commas to separate the items.");
props.add (new TextPropertyComponent (windowsTargetPlatformValue, "Windows Target Platform", 256, false),
"The Windows target platform to use.");
}
private:
ValueTree tree;
ValueWithDefault buildEnabledValue, continuousRebuildEnabledValue, warningsEnabledValue, userHeaderPathValue, systemHeaderPathValue,
extraDLLsValue, extraCompilerFlagsValue, extraPreprocessorDefsValue, windowsTargetPlatformValue;
//==============================================================================
String getLiveSettingsSubType() const noexcept
{
#if JUCE_MAC
return "OSX";
#elif JUCE_WINDOWS
return "WINDOWS";
#elif JUCE_LINUX
return "LINUX";
#endif
// unknown platform?!
jassertfalse;
return {};
}
//==============================================================================
};

+ 1
- 1
extras/Projucer/Source/Project/UI/Sidebar/jucer_LiveBuildTab.h View File

@@ -35,7 +35,7 @@ struct LiveBuildSettingsComponent : public Component
addAndMakeVisible (&group);
PropertyListBuilder props;
LiveBuildProjectSettings::getLiveSettings (p, props);
p.getCompileEngineSettings().getLiveSettings (props);
group.setProperties (props);
group.setName ("Live Build Settings");


+ 7
- 14
extras/Projucer/Source/Project/UI/jucer_ProjectContentComponent.cpp View File

@@ -1168,7 +1168,7 @@ void ProjectContentComponent::setBuildEnabled (bool isEnabled, bool displayError
if (! displayError)
lastCrashMessage = {};
LiveBuildProjectSettings::setBuildDisabled (*project, ! isEnabled);
project->getCompileEngineSettings().setBuildEnabled (isEnabled);
killChildProcess();
refreshTabsIfBuildStatusChanged();
@@ -1208,7 +1208,7 @@ void ProjectContentComponent::handleCrash (const String& message)
bool ProjectContentComponent::isBuildEnabled() const
{
return project != nullptr && ! LiveBuildProjectSettings::isBuildDisabled (*project)
return project != nullptr && project->getCompileEngineSettings().isBuildEnabled()
&& CompileEngineDLL::getInstance()->isLoaded();
}
@@ -1222,7 +1222,7 @@ void ProjectContentComponent::refreshTabsIfBuildStatusChanged()
bool ProjectContentComponent::areWarningsEnabled() const
{
return project != nullptr && ! LiveBuildProjectSettings::areWarningsDisabled (*project);
return project != nullptr && project->getCompileEngineSettings().areWarningsEnabled();
}
void ProjectContentComponent::updateWarningState()
@@ -1235,7 +1235,7 @@ void ProjectContentComponent::toggleWarnings()
{
if (project != nullptr)
{
LiveBuildProjectSettings::setWarningsDisabled (*project, areWarningsEnabled());
project->getCompileEngineSettings().setWarningsEnabled (! areWarningsEnabled());
updateWarningState();
}
}
@@ -1314,16 +1314,14 @@ void ProjectContentComponent::timerCallback()
bool ProjectContentComponent::isContinuousRebuildEnabled()
{
return getAppSettings().getGlobalProperties().getBoolValue ("continuousRebuild", true);
return project != nullptr && project->getCompileEngineSettings().isContinuousRebuildEnabled();
}
void ProjectContentComponent::setContinuousRebuildEnabled (bool b)
{
if (childProcess != nullptr)
if (project != nullptr && childProcess != nullptr)
{
childProcess->setContinuousRebuild (b);
getAppSettings().getGlobalProperties().setValue ("continuousRebuild", b);
project->getCompileEngineSettings().setContinuousRebuildEnabled (b);
ProjucerApplication::getCommandManager().commandStatusChanged();
}
}
@@ -1331,13 +1329,8 @@ void ProjectContentComponent::setContinuousRebuildEnabled (bool b)
ReferenceCountedObjectPtr<CompileEngineChildProcess> ProjectContentComponent::getChildProcess()
{
if (childProcess == nullptr && isBuildEnabled())
{
childProcess = ProjucerApplication::getApp().childProcessCache->getOrCreate (*project);
if (childProcess != nullptr)
childProcess->setContinuousRebuild (isContinuousRebuildEnabled());
}
return childProcess;
}


+ 7
- 0
extras/Projucer/Source/Project/jucer_Project.h View File

@@ -27,6 +27,7 @@
#pragma once
#include "jucer_ProjectType.h"
#include "../LiveBuildEngine/jucer_CompileEngineSettings.h"
class ProjectExporter;
class LibraryModule;
@@ -347,6 +348,9 @@ public:
//==============================================================================
bool shouldSendGUIBuilderAnalyticsEvent() noexcept;
//==============================================================================
CompileEngineSettings& getCompileEngineSettings() { return compileEngineSettings; }
private:
ValueTree projectRoot { Ids::JUCERPROJECT };
@@ -361,6 +365,9 @@ private:
pluginAUMainTypeValue, pluginRTASCategoryValue, pluginRTASBypassDisabledValue, pluginRTASMultiMonoDisabledValue,
pluginAAXIdentifierValue, pluginAAXCategoryValue, pluginAAXBypassDisabledValue, pluginAAXMultiMonoDisabledValue;
//==============================================================================
CompileEngineSettings compileEngineSettings { projectRoot };
//==============================================================================
File tempDirectory = {};
bool openInIDEAfterSaving = false;


+ 3
- 0
extras/Projucer/Source/Utility/Helpers/jucer_PresetIDs.h View File

@@ -321,6 +321,9 @@ namespace Ids
DECLARE_ID (website);
DECLARE_ID (mainClass);
DECLARE_ID (moduleFlags);
DECLARE_ID (buildEnabled);
DECLARE_ID (continuousRebuildEnabled);
DECLARE_ID (warningsEnabled);
const Identifier ID ("id");
const Identifier ID_uppercase ("ID");


Loading…
Cancel
Save