Browse Source

Build: Ensure that plugin and manufacturer codes are exactly four characters in length

v6.1.6
reuk 4 years ago
parent
commit
d13a23ad14
No known key found for this signature in database GPG Key ID: 9ADCD339CFC98A11
3 changed files with 24 additions and 6 deletions
  1. +9
    -5
      extras/Build/CMake/JUCEUtils.cmake
  2. +1
    -1
      extras/Projucer/Source/Project/jucer_Project.cpp
  3. +14
    -0
      extras/Projucer/Source/ProjectSaving/jucer_ProjectSaver.cpp

+ 9
- 5
extras/Build/CMake/JUCEUtils.cmake View File

@@ -446,8 +446,12 @@ function(_juce_version_code version_in out_var)
set(${out_var} "${hex}" PARENT_SCOPE)
endfunction()

function(_juce_to_char_literal str out_var)
string(APPEND str " ") # Make sure there are at least 4 characters in the string.
function(_juce_to_char_literal str out_var help_text)
string(LENGTH "${str}" string_length)

if(NOT "${string_length}" EQUAL "4")
message(FATAL_ERROR "The ${help_text} code must contain exactly four characters, but it was set to '${str}'")
endif()

# Round-tripping through a file is the simplest way to convert a string to hex...
string(SUBSTRING "${str}" 0 4 four_chars)
@@ -1137,11 +1141,11 @@ function(_juce_configure_plugin_targets target)
get_target_property(use_legacy_compatibility_plugin_code ${target} JUCE_USE_LEGACY_COMPATIBILITY_PLUGIN_CODE)

if(use_legacy_compatibility_plugin_code)
set(project_manufacturer_code "project_manufacturer_code-NOTFOUND")
set(project_manufacturer_code "proj")
endif()

_juce_to_char_literal(${project_manufacturer_code} project_manufacturer_code)
_juce_to_char_literal(${project_plugin_code} project_plugin_code)
_juce_to_char_literal(${project_manufacturer_code} project_manufacturer_code "plugin manufacturer")
_juce_to_char_literal(${project_plugin_code} project_plugin_code "plugin")

_juce_get_vst3_category_string(${target} vst3_category_string)



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

@@ -2579,7 +2579,7 @@ StringPairArray Project::getAudioPluginFlags() const
for (int i = 0; i < 4; ++i)
hexRepresentation = (hexRepresentation << 8u)
| (static_cast<unsigned int> (fourCharCode[i]) & 0xffu);
| (static_cast<unsigned int> (fourCharCode[i]) & 0xffu);
return "0x" + String::toHexString (static_cast<int> (hexRepresentation));
};


+ 14
- 0
extras/Projucer/Source/ProjectSaving/jucer_ProjectSaver.cpp View File

@@ -292,6 +292,20 @@ Result ProjectSaver::saveProject (ProjectExporter* specifiedExporterToSave)
if (errors.isEmpty())
{
if (project.isAudioPluginProject())
{
const auto isInvalidCode = [] (String code)
{
return code.length() != 4 || code.toStdString().size() != 4;
};
if (isInvalidCode (project.getPluginManufacturerCodeString()))
return Result::fail ("The plugin manufacturer code must contain exactly four characters.");
if (isInvalidCode (project.getPluginCodeString()))
return Result::fail ("The plugin code must contain exactly four characters.");
}
if (project.isAudioPluginProject())
{
if (project.shouldBuildUnityPlugin())


Loading…
Cancel
Save