2424
2525
2626// ==============================================================================
27- static void exitWithError (const String& error)
27+ static void exitWithError (const juce:: String& error)
2828{
2929 std::cout << error << std::endl << std::endl;
30- JUCEApplication::getInstance ()->setApplicationReturnValue (1 );
31- JUCEApplication::getInstance ()->quit ();
30+ juce:: JUCEApplication::getInstance ()->setApplicationReturnValue (1 );
31+ juce:: JUCEApplication::getInstance ()->quit ();
3232}
3333
3434static void hideDockIcon ()
3535{
3636 #if JUCE_MAC
37- Process::setDockIconVisible (false );
37+ juce:: Process::setDockIconVisible (false );
3838 #endif
3939}
4040
@@ -49,7 +49,7 @@ static void setupSignalHandling()
4949{
5050 const int signals[] = { SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGABRT };
5151
52- for (int i = 0 ; i < numElementsInArray (signals); ++i)
52+ for (int i = 0 ; i < juce:: numElementsInArray (signals); ++i)
5353 {
5454 ::signal (signals[i], killWithoutMercy);
5555 ::siginterrupt (signals[i], 1 );
@@ -83,7 +83,7 @@ void CommandLineValidator::validate (const juce::String& fileOrID, PluginTests::
8383 if (exitCode > 0 )
8484 exitWithError (" *** FAILED" );
8585 else
86- JUCEApplication::getInstance ()->quit ();
86+ juce:: JUCEApplication::getInstance ()->quit ();
8787 },
8888 [] (auto m)
8989 {
@@ -96,7 +96,7 @@ void CommandLineValidator::validate (const juce::String& fileOrID, PluginTests::
9696// ==============================================================================
9797namespace
9898{
99- ArgumentList::Argument getArgumentAfterOption (const ArgumentList& args, StringRef option)
99+ juce:: ArgumentList::Argument getArgumentAfterOption (const juce:: ArgumentList& args, juce:: StringRef option)
100100 {
101101 for (int i = 0 ; i < args.size () - 1 ; ++i)
102102 if (args[i] == option)
@@ -105,94 +105,94 @@ namespace
105105 return {};
106106 }
107107
108- var getOptionValue (const ArgumentList& args, StringRef option, var defaultValue, StringRef errorMessage)
108+ juce:: var getOptionValue (const juce:: ArgumentList& args, juce:: StringRef option, juce:: var defaultValue, juce:: StringRef errorMessage)
109109 {
110110 if (args.containsOption (option))
111111 {
112112 const auto nextArg = getArgumentAfterOption (args, option);
113113
114114 if (nextArg.isShortOption () || nextArg.isLongOption ())
115- ConsoleApplication::fail (errorMessage, -1 );
115+ juce:: ConsoleApplication::fail (errorMessage, -1 );
116116
117117 return nextArg.text ;
118118 }
119119
120120 return defaultValue;
121121 }
122122
123- int getStrictnessLevel (const ArgumentList& args)
123+ int getStrictnessLevel (const juce:: ArgumentList& args)
124124 {
125- return jlimit (1 , 10 , (int ) getOptionValue (args, " --strictness-level" , 5 , " Missing strictness level argument! (Must be between 1 - 10)" ));
125+ return juce:: jlimit (1 , 10 , (int ) getOptionValue (args, " --strictness-level" , 5 , " Missing strictness level argument! (Must be between 1 - 10)" ));
126126 }
127127
128- int64 getRandomSeed (const ArgumentList& args)
128+ juce:: int64 getRandomSeed (const juce:: ArgumentList& args)
129129 {
130- const String seedString = getOptionValue (args, " --random-seed" , " 0" , " Missing random seed argument!" ).toString ();
130+ const juce:: String seedString = getOptionValue (args, " --random-seed" , " 0" , " Missing random seed argument!" ).toString ();
131131
132132 if (! seedString.containsOnly (" x-0123456789acbdef" ))
133- ConsoleApplication::fail (" Invalid random seed argument!" , -1 );
133+ juce:: ConsoleApplication::fail (" Invalid random seed argument!" , -1 );
134134
135135 if (seedString.startsWith (" 0x" ))
136136 return seedString.getHexValue64 ();
137137
138138 return seedString.getLargeIntValue ();
139139 }
140140
141- int64 getTimeout (const ArgumentList& args)
141+ juce:: int64 getTimeout (const juce:: ArgumentList& args)
142142 {
143143 return getOptionValue (args, " --timeout-ms" , 30000 , " Missing timeout-ms level argument!" );
144144 }
145145
146- int getNumRepeats (const ArgumentList& args)
146+ int getNumRepeats (const juce:: ArgumentList& args)
147147 {
148- return jmax (1 , (int ) getOptionValue (args, " --repeat" , 1 , " Missing repeat argument! (Must be greater than 0)" ));
148+ return juce:: jmax (1 , (int ) getOptionValue (args, " --repeat" , 1 , " Missing repeat argument! (Must be greater than 0)" ));
149149 }
150150
151- File getDataFile (const ArgumentList& args)
151+ juce:: File getDataFile (const juce:: ArgumentList& args)
152152 {
153153 return getOptionValue (args, " --data-file" , {}, " Missing data-file path argument!" ).toString ();
154154 }
155155
156- File getOutputDir (const ArgumentList& args)
156+ juce:: File getOutputDir (const juce:: ArgumentList& args)
157157 {
158158 return getOptionValue (args, " --output-dir" , {}, " Missing output-dir path argument!" ).toString ();
159159 }
160160
161- std::vector<double > getSampleRates (const ArgumentList& args)
161+ std::vector<double > getSampleRates (const juce:: ArgumentList& args)
162162 {
163- StringArray input = StringArray::fromTokens (getOptionValue (args,
163+ juce:: StringArray input = juce:: StringArray::fromTokens (getOptionValue (args,
164164 " --sample-rates" ,
165- String (" 44100,48000,96000" ),
165+ juce:: String (" 44100,48000,96000" ),
166166 " Missing sample rate list argument!" )
167167 .toString (),
168168 " ," ,
169169 " \" " );
170170 std::vector<double > output;
171171
172- for (String sr : input)
172+ for (juce:: String sr : input)
173173 output.push_back (sr.getDoubleValue ());
174174
175175 return output;
176176 }
177177
178- std::vector<int > getBlockSizes (const ArgumentList& args)
178+ std::vector<int > getBlockSizes (const juce:: ArgumentList& args)
179179 {
180- StringArray input = StringArray::fromTokens (getOptionValue (args,
180+ juce:: StringArray input = juce:: StringArray::fromTokens (getOptionValue (args,
181181 " --block-sizes" ,
182- String (" 64,128,256,512,1024" ),
182+ juce:: String (" 64,128,256,512,1024" ),
183183 " Missing block size list argument!" )
184184 .toString (),
185185 " ," ,
186186 " \" " );
187187 std::vector<int > output;
188188
189- for (String sr : input)
189+ for (juce:: String sr : input)
190190 output.push_back (sr.getIntValue ());
191191
192192 return output;
193193 }
194194
195- StringArray getDisabledTests (const ArgumentList& args)
195+ juce:: StringArray getDisabledTests (const juce:: ArgumentList& args)
196196 {
197197 const auto value = getOptionValue (args, " --disabled-tests" , {}, " Missing disabled-tests path argument!" ).toString ();
198198
@@ -219,7 +219,7 @@ namespace
219219 return true ;
220220
221221 // The above will check if the file actually exists which isn't really what we want for CLI parsing
222- if (auto f = File::createFileWithoutCheckingPath (arg);
222+ if (auto f = juce:: File::createFileWithoutCheckingPath (arg);
223223 f.hasFileExtension (" .vst3" )
224224 #if JUCE_PLUGINHOST_VST
225225 || f.hasFileExtension (" .dll" )
@@ -238,9 +238,9 @@ struct Option
238238 bool requiresValue;
239239};
240240
241- static String getEnvironmentVariableName (Option opt)
241+ static juce:: String getEnvironmentVariableName (Option opt)
242242{
243- return String (opt.name ).trimCharactersAtStart (" -" ).replace (" -" , " _" ).toUpperCase ();
243+ return juce:: String (opt.name ).trimCharactersAtStart (" -" ).replace (" -" , " _" ).toUpperCase ();
244244}
245245
246246static Option possibleOptions[] =
@@ -259,7 +259,7 @@ static Option possibleOptions[] =
259259 { " --vst3validator" , true },
260260};
261261
262- static StringArray mergeEnvironmentVariables (StringArray args, std::function<String (const String& name, const String& defaultValue)> environmentVariableProvider = [] (const String& name, const String& defaultValue) { return SystemStats::getEnvironmentVariable (name, defaultValue); })
262+ static juce:: StringArray mergeEnvironmentVariables (juce:: StringArray args, std::function<juce:: String (const juce:: String& name, const juce:: String& defaultValue)> environmentVariableProvider = [] (const juce:: String& name, const juce:: String& defaultValue) { return juce:: SystemStats::getEnvironmentVariable (name, defaultValue); })
263263{
264264 for (auto arg : possibleOptions)
265265 {
@@ -289,14 +289,15 @@ static StringArray mergeEnvironmentVariables (StringArray args, std::function<St
289289
290290// ==============================================================================
291291// ==============================================================================
292- static String getHelpMessage ()
292+ static juce:: String getHelpMessage ()
293293{
294- const String appName (JUCEApplication::getInstance ()->getApplicationName ());
294+ const juce:: String appName (juce:: JUCEApplication::getInstance ()->getApplicationName ());
295295
296- String help;
296+ auto & newLine = juce::newLine;
297+ juce::String help;
297298 help << " //==============================================================================" << newLine
298299 << appName << newLine
299- << SystemStats::getJUCEVersion () << newLine
300+ << juce:: SystemStats::getJUCEVersion () << newLine
300301 << newLine
301302 << " Description: " << newLine
302303 << " Validate plugins to test compatibility with hosts and verify plugin API conformance" << newLine << newLine
@@ -348,12 +349,12 @@ static String getHelpMessage()
348349 return help;
349350}
350351
351- static String getVersionText ()
352+ static juce:: String getVersionText ()
352353{
353- return String (ProjectInfo::projectName ) + " - " + ProjectInfo::versionString ;
354+ return juce:: String (" pluginval " ) + " - " + VERSION ;
354355}
355356
356- static int getNumTestFailures (UnitTestRunner& testRunner)
357+ static int getNumTestFailures (juce:: UnitTestRunner& testRunner)
357358{
358359 int numFailures = 0 ;
359360
@@ -366,16 +367,16 @@ static int getNumTestFailures (UnitTestRunner& testRunner)
366367
367368static void runUnitTests ()
368369{
369- UnitTestRunner testRunner;
370+ juce:: UnitTestRunner testRunner;
370371 testRunner.runTestsInCategory (" pluginval" );
371372 const int numFailures = getNumTestFailures (testRunner);
372373
373374 if (numFailures > 0 )
374- ConsoleApplication::fail (String (numFailures) + " tests failed!!!" );
375+ juce:: ConsoleApplication::fail (juce:: String (numFailures) + " tests failed!!!" );
375376}
376377
377378// ==============================================================================
378- static ArgumentList createCommandLineArgs (String commandLine)
379+ static juce:: ArgumentList createCommandLineArgs (juce:: String commandLine)
379380{
380381 if (commandLine.contains (" strictnessLevel" ))
381382 {
@@ -387,9 +388,9 @@ static ArgumentList createCommandLineArgs (String commandLine)
387388 .replace (" -NSDocumentRevisionsDebugMode YES" , " " )
388389 .trim ();
389390
390- const auto exe = File::getSpecialLocation (File::currentExecutableFile);
391+ const auto exe = juce:: File::getSpecialLocation (juce:: File::currentExecutableFile);
391392
392- StringArray args;
393+ juce:: StringArray args;
393394 args.addTokens (commandLine, true );
394395 args = mergeEnvironmentVariables (args);
395396 args.trim ();
@@ -399,7 +400,7 @@ static ArgumentList createCommandLineArgs (String commandLine)
399400
400401 // If only a plugin path is supplied as the last arg, add an implicit --validate
401402 // option for it so the rest of the CLI works
402- ArgumentList argList (exe.getFullPathName (), args);
403+ juce:: ArgumentList argList (exe.getFullPathName (), args);
403404
404405 if (argList.size () > 0 )
405406 {
@@ -416,44 +417,44 @@ static ArgumentList createCommandLineArgs (String commandLine)
416417 return argList;
417418}
418419
419- static void performCommandLine (CommandLineValidator& validator, const ArgumentList& args)
420+ static void performCommandLine (CommandLineValidator& validator, const juce:: ArgumentList& args)
420421{
421422 hideDockIcon ();
422423
423- ConsoleApplication cli;
424+ juce:: ConsoleApplication cli;
424425 cli.addVersionCommand (" --version" , getVersionText ());
425426 cli.addHelpCommand (" --help|-h" , getHelpMessage (), true );
426427 cli.addCommand ({ " --validate" ,
427428 " --validate [pathToPlugin]" ,
428- " Validates the file (or IDs for AUs)." , String (),
429+ " Validates the file (or IDs for AUs)." , juce:: String (),
429430 [&validator] (const auto & validatorArgs)
430431 {
431432 auto [fileOrIDToValidate, options] = parseCommandLine (validatorArgs);
432433 validator.validate (fileOrIDToValidate, options);
433434 }});
434435 cli.addCommand ({ " --run-tests" ,
435436 " --run-tests" ,
436- " Runs the internal unit tests." , String (),
437+ " Runs the internal unit tests." , juce:: String (),
437438 [] (const auto &) { runUnitTests (); }});
438439
439440 if (const auto retValue = cli.findAndRunCommand (args); retValue != 0 )
440441 {
441- JUCEApplication::getInstance ()->setApplicationReturnValue (retValue);
442- JUCEApplication::getInstance ()->quit ();
442+ juce:: JUCEApplication::getInstance ()->setApplicationReturnValue (retValue);
443+ juce:: JUCEApplication::getInstance ()->quit ();
443444 }
444445
445446 // --validate runs async so will quit itself when done
446447 if (! args.containsOption (" --validate" ))
447- JUCEApplication::getInstance ()->quit ();
448+ juce:: JUCEApplication::getInstance ()->quit ();
448449}
449450
450451// ==============================================================================
451- void performCommandLine (CommandLineValidator& validator, const String& commandLine)
452+ void performCommandLine (CommandLineValidator& validator, const juce:: String& commandLine)
452453{
453454 performCommandLine (validator, createCommandLineArgs (commandLine));
454455}
455456
456- bool shouldPerformCommandLine (const String& commandLine)
457+ bool shouldPerformCommandLine (const juce:: String& commandLine)
457458{
458459 const auto args = createCommandLineArgs (commandLine);
459460 return args.containsOption (" --help|-h" )
@@ -472,7 +473,7 @@ std::pair<juce::String, PluginTests::Options> parseCommandLine (const juce::Argu
472473 // getCurrentWorkingDirectory is needed to handle relative paths
473474 // It preserves absolute paths and first checks for ~ on Mac/Windows
474475 if (fileOrID.contains (" ~" ) || fileOrID.contains (" ." ))
475- fileOrID = File::getCurrentWorkingDirectory ().getChildFile (fileOrID).getFullPathName ();
476+ fileOrID = juce:: File::getCurrentWorkingDirectory ().getChildFile (fileOrID).getFullPathName ();
476477
477478 PluginTests::Options options;
478479 options.strictnessLevel = getStrictnessLevel (args);
@@ -492,7 +493,7 @@ std::pair<juce::String, PluginTests::Options> parseCommandLine (const juce::Argu
492493 return { fileOrID, options };
493494}
494495
495- std::pair<juce::String, PluginTests::Options> parseCommandLine (const String& cmd)
496+ std::pair<juce::String, PluginTests::Options> parseCommandLine (const juce:: String& cmd)
496497{
497498 return parseCommandLine (createCommandLineArgs (cmd));
498499}
0 commit comments