Skip to content

Commit 66ec105

Browse files
Adding the ability to run yaml file directly
1 parent 2fbeb7c commit 66ec105

14 files changed

+429
-145
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
builds/
4242
Builds/
4343
Build/
44+
build/
4445
v0.*/
4546
*.bak
4647
*.runcpp2/

Jenkinsfile

Lines changed: 71 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ pipeline
347347
}
348348
post { failure { script { FAILED_STAGE = env.STAGE_NAME } } }
349349
}
350+
//TODO: Move this to shell or cpp
350351
stage('Linux Integration Test')
351352
{
352353
agent { label 'linux' }
@@ -359,10 +360,10 @@ pipeline
359360
bash "ls -lah ./Build/Src/Tests"
360361
bash "cd ./Build && ./runcpp2 -l " +
361362
"-c ../DefaultYAMLs/DefaultUserConfig.yaml " +
362-
"--log-level info ../Tests/test.cpp"
363+
"--log-level info ../Tests/Test.cpp"
363364
bash "cd ./Build && ./runcpp2 -l -b -o . " +
364365
"-c ../DefaultYAMLs/DefaultUserConfig.yaml " +
365-
"--log-level info ../Tests/test.cpp"
366+
"--log-level info ../Tests/Test.cpp"
366367
bash "ls -lah ./Build"
367368

368369

@@ -373,7 +374,7 @@ pipeline
373374
bash "ls -lah ./Build/Src/Tests"
374375
bash "cd ./Build && ./runcpp2 -l -b -o . " +
375376
"-c ../DefaultYAMLs/DefaultUserConfig.yaml " +
376-
"--log-level info ../Tests/test_static.cpp"
377+
"--log-level info ../Tests/TestStatic.cpp"
377378
bash "ls -lah ./Build"
378379

379380

@@ -384,8 +385,40 @@ pipeline
384385
bash "ls -lah ./Build/Src/Tests"
385386
bash "cd ./Build && ./runcpp2 -l " +
386387
"-c ../DefaultYAMLs/DefaultUserConfig.yaml " +
387-
"--log-level info ../Tests/testLocalDependency.cpp"
388+
"--log-level info ../Tests/TestLocalDependency.cpp"
388389

390+
cleanWs()
391+
bash "ls -lah"
392+
unstash 'linux_build'
393+
bash "ls -lah"
394+
bash "ls -lah ./Build/Src/Tests"
395+
bash "cd ./Build && ./runcpp2 -l " +
396+
"-c ../DefaultYAMLs/DefaultUserConfig.yaml " +
397+
"--log-level info ../Tests/TestSeparateYaml.cpp"
398+
399+
cleanWs()
400+
bash "ls -lah"
401+
unstash 'linux_build'
402+
bash "ls -lah"
403+
bash "ls -lah ./Build/Src/Tests"
404+
script
405+
{
406+
def retResult =
407+
sh( script: "cd ./Build && ./runcpp2 -l " +
408+
"-c ../DefaultYAMLs/DefaultUserConfig.yaml " +
409+
"--log-level info ../Tests/TestMissingSource.yaml",
410+
returnStatus: true)
411+
echo("Return result: ${retResult}")
412+
}
413+
414+
cleanWs()
415+
bash "ls -lah"
416+
unstash 'linux_build'
417+
bash "ls -lah"
418+
bash "ls -lah ./Build/Src/Tests"
419+
bash "cd ./Build && ./runcpp2 -l " +
420+
"-c ../DefaultYAMLs/DefaultUserConfig.yaml " +
421+
"--log-level info ../Tests/YamlOnlyTest.yaml"
389422

390423
cleanWs()
391424
bash "ls -lah"
@@ -415,6 +448,7 @@ pipeline
415448
}
416449
post { failure { script { FAILED_STAGE = env.STAGE_NAME } } }
417450
}
451+
//TODO: Move this to shell or cpp
418452
stage('Windows Integration Test')
419453
{
420454
agent { label 'windows' }
@@ -426,10 +460,10 @@ pipeline
426460
bat 'dir'
427461
bat "cd .\\Build\\Debug && .\\runcpp2.exe -l " +
428462
"-c ..\\..\\DefaultYAMLs\\DefaultUserConfig.yaml " +
429-
"--log-level info ..\\..\\Tests\\test.cpp"
463+
"--log-level info ..\\..\\Tests\\Test.cpp"
430464
bat "cd .\\Build\\Debug && .\\runcpp2.exe -l -b -o . " +
431465
"-c ..\\..\\DefaultYAMLs\\DefaultUserConfig.yaml " +
432-
"--log-level info ..\\..\\Tests\\test.cpp"
466+
"--log-level info ..\\..\\Tests\\Test.cpp"
433467
bat "dir .\\Build\\Debug"
434468

435469

@@ -439,7 +473,7 @@ pipeline
439473
bat 'dir'
440474
bat "cd .\\Build\\Debug && .\\runcpp2.exe -l -b -o . " +
441475
"-c ..\\..\\DefaultYAMLs\\DefaultUserConfig.yaml " +
442-
"--log-level info ..\\..\\Tests\\test_static.cpp"
476+
"--log-level info ..\\..\\Tests\\TestStatic.cpp"
443477
bat "dir .\\Build\\Debug"
444478

445479

@@ -449,8 +483,37 @@ pipeline
449483
bat 'dir'
450484
bat "cd .\\Build\\Debug && .\\runcpp2.exe -l " +
451485
"-c ..\\..\\DefaultYAMLs\\DefaultUserConfig.yaml " +
452-
"--log-level info ..\\..\\Tests\\testLocalDependency.cpp"
486+
"--log-level info ..\\..\\Tests\\TestLocalDependency.cpp"
453487

488+
cleanWs()
489+
bat 'dir'
490+
unstash 'windows_build'
491+
bat 'dir'
492+
bat "cd .\\Build\\Debug && .\\runcpp2.exe -l " +
493+
"-c ..\\..\\DefaultYAMLs\\DefaultUserConfig.yaml " +
494+
"--log-level info ..\\..\\Tests\\TestSeparateYaml.cpp"
495+
496+
cleanWs()
497+
bat 'dir'
498+
unstash 'windows_build'
499+
bat 'dir'
500+
script
501+
{
502+
def retResult =
503+
bat(script: "cd .\\Build\\Debug && .\\runcpp2.exe -l " +
504+
"-c ..\\..\\DefaultYAMLs\\DefaultUserConfig.yaml " +
505+
"--log-level info ..\\..\\Tests\\TestMissingSource.yaml",
506+
returnStatus: true)
507+
echo("Return result: ${retResult}")
508+
}
509+
510+
cleanWs()
511+
bat 'dir'
512+
unstash 'windows_build'
513+
bat 'dir'
514+
bat "cd .\\Build\\Debug && .\\runcpp2.exe -l " +
515+
"-c ..\\..\\DefaultYAMLs\\DefaultUserConfig.yaml " +
516+
"--log-level info ..\\..\\Tests\\YamlOnlyTest.yaml"
454517

455518
cleanWs()
456519
bat 'dir'

Src/runcpp2/ParseUtil.hpp

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ namespace runcpp2
161161
return true;
162162
}
163163

164-
inline bool GetParsableInfo(const std::string& contentToParse, std::string& outParsableInfo)
164+
inline DS::Result<void> GetParsableInfo(const std::string& contentToParse,
165+
std::string& outParsableInfo)
165166
{
166167
ssLOG_FUNC_DEBUG();
167168

@@ -197,32 +198,29 @@ namespace runcpp2
197198
contentReadyToParse = false;
198199
};
199200

200-
auto checkFinishedGettingParsableContent = [&]() -> bool
201+
auto checkFinishedGettingParsableContent = [&]() -> DS::Result<bool>
201202
{
202203
if(singleLineComments)
203204
{
204205
//Check for end of continuous section
205-
if( currentLine.size() < 2 ||
206-
currentLine.at(0) != '/' ||
207-
currentLine.at(1) != '/')
206+
if(currentLine.size() < 2 || currentLine[0] != '/' || currentLine[1] != '/')
208207
{
209208
contentReadyToParse = true;
210209
return true;
211210
}
212211

213212
if(preceedingSpace && currentLine.size() < 3)
214213
{
215-
ssLOG_ERROR("Inconsistent spacing for single line comment");
216214
resetPrefixState();
217-
return false;
215+
return DS_ERROR_MSG("Inconsistent spacing for single line comment");
218216
}
219217
}
220218
else
221219
{
222220
//Check for closing */
223221
if( currentLine.size() >= 2 &&
224-
currentLine.at(currentLine.size() - 1) == '/' &&
225-
currentLine.at(currentLine.size() - 2) == '*')
222+
currentLine[currentLine.size() - 1] == '/' &&
223+
currentLine[currentLine.size() - 2] == '*')
226224
{
227225
currentLine.erase(currentLine.size() - 2, 2);
228226
TrimRight(currentLine);
@@ -275,7 +273,8 @@ namespace runcpp2
275273
{
276274
Trim(currentLine);
277275

278-
if(checkFinishedGettingParsableContent())
276+
bool check = checkFinishedGettingParsableContent().DS_TRY();
277+
if(check)
279278
break;
280279

281280
currentLine.erase(0, (preceedingSpace ? 3 : 2));
@@ -287,7 +286,8 @@ namespace runcpp2
287286
{
288287
TrimRight(currentLine);
289288

290-
if(checkFinishedGettingParsableContent())
289+
bool check = checkFinishedGettingParsableContent().DS_TRY();
290+
if(check)
291291
break;
292292

293293
currentLine += '\n';
@@ -296,7 +296,7 @@ namespace runcpp2
296296

297297
currentLine.clear();
298298
}
299-
}
299+
} //else
300300

301301
//Special case for last character/line
302302
if(i == source.size() - 1 && insideCommentToParse)
@@ -305,7 +305,8 @@ namespace runcpp2
305305

306306
if(singleLineComments)
307307
{
308-
if(checkFinishedGettingParsableContent())
308+
bool check = checkFinishedGettingParsableContent().DS_TRY();
309+
if(check)
309310
break;
310311

311312
currentLine.erase(0, (preceedingSpace ? 3 : 2));
@@ -314,20 +315,20 @@ namespace runcpp2
314315
}
315316
else
316317
{
317-
if(checkFinishedGettingParsableContent())
318+
bool check = checkFinishedGettingParsableContent().DS_TRY();
319+
if(check)
318320
break;
319321

320-
ssLOG_ERROR("Missing closing */ in block comment");
321-
resetPrefixState();
322-
break;
322+
//resetPrefixState();
323+
return DS_ERROR_MSG("Missing closing */ in block comment");
323324
}
324325
}
325-
}
326+
} //for(int i = 0; i < source.size(); i++)
326327

327328
if(!contentReadyToParse)
328329
outParsableInfo.clear();
329330

330-
return true;
331+
return {};
331332
}
332333

333334
inline bool MergeYAML_NodeChildren( YAML::NodePtr nodeToMergeFrom,

0 commit comments

Comments
 (0)