From da899b8f8c732358f77f273df2ec1604fcb6cd9d Mon Sep 17 00:00:00 2001 From: Neko Box Coder Date: Mon, 31 Aug 2026 00:39:31 +0100 Subject: [PATCH 1/4] Adding C profiles. Changing preferred profile to gcc --- DefaultYAMLs/Default/clang++.yaml | 6 +- DefaultYAMLs/Default/clang.yaml | 112 ++++++++++++++++++++++++++++ DefaultYAMLs/Default/gcc.yaml | 112 ++++++++++++++++++++++++++++ DefaultYAMLs/DefaultUserConfig.yaml | 4 +- 4 files changed, 230 insertions(+), 4 deletions(-) create mode 100644 DefaultYAMLs/Default/clang.yaml create mode 100644 DefaultYAMLs/Default/gcc.yaml diff --git a/DefaultYAMLs/Default/clang++.yaml b/DefaultYAMLs/Default/clang++.yaml index fc4de7a2..0c10a892 100644 --- a/DefaultYAMLs/Default/clang++.yaml +++ b/DefaultYAMLs/Default/clang++.yaml @@ -27,7 +27,7 @@ Compiler: DefaultPlatform: Flags: "{Profile.Intern_CompileFlags}" Executable: "clang++" - RunParts: &g++_CompileRunParts + RunParts: &clang++_CompileRunParts - Type: Once CommandPart: "{Stage.Executable} -c {Stage.CompileFlags}" - Type: Repeats @@ -49,13 +49,13 @@ Compiler: DefaultPlatform: Flags: "{Profile.Intern_CompileFlags}" Executable: "clang++" - RunParts: *g++_CompileRunParts + RunParts: *clang++_CompileRunParts ExpectedOutputFiles: *g++_CompileExpectedOutputFiles Shared: DefaultPlatform: Flags: "{Profile.Intern_CompileFlags} -fpic" Executable: "clang++" - RunParts: *g++_CompileRunParts + RunParts: *clang++_CompileRunParts ExpectedOutputFiles: *g++_CompileExpectedOutputFiles Linker: CheckExistence: diff --git a/DefaultYAMLs/Default/clang.yaml b/DefaultYAMLs/Default/clang.yaml new file mode 100644 index 00000000..a80c477c --- /dev/null +++ b/DefaultYAMLs/Default/clang.yaml @@ -0,0 +1,112 @@ +# DO NOT modify this file. Changes will be overwritten when there's a reset or update + +Name: "clang" +FileExtensions: [.c] +Languages: ["c"] +Import: "./CommonFileTypes.yaml" +Parameters: + Profile.CompileMode: + Default: "Debug" + Constraint: + - "Debug:-std=c99 -Wall -g -Og" + - "Release:-std=c++17 -Wall -O2 -DNDEBUG=1" + Profile.OutputPreprocess: + Default: "false" + Constraint: + - "true: -E" + - "1: -E" + - "false:" + - "0:" +Variables: + Profile.Intern_CompileFlags: "{Profile.CompileMode}{Profile.OutputPreprocess}" +Compiler: + CheckExistence: + DefaultPlatform: "clang -v" + CompileTypes: + Executable: + DefaultPlatform: + Flags: "{Profile.Intern_CompileFlags}" + Executable: "clang" + RunParts: &gcc_CompileRunParts + - Type: Once + CommandPart: "{Stage.Executable} -c {Stage.CompileFlags}" + - Type: Repeats + CommandPart: " -D{Stage.DefineNameOnly}=" + - Type: Repeats + CommandPart: " \"-D{Stage.DefineName}={Stage.DefineValue}\"" + - Type: Repeats + CommandPart: " -isystem \"{Stage.IncludeDirectory.Dep.Path}\"" + - Type: Repeats + CommandPart: " -I\"{Stage.IncludeDirectory.Source.Path}\"" + - Type: Once + CommandPart: " \"{Stage.Input.Path}\" -o \"{Stage.Output.Directory}{/}\ + {Stage.ObjectLinkFile.Prefix}{Stage.Input.Name}\ + {Stage.ObjectLinkFile.Extension}\"" + ExpectedOutputFiles: &gcc_CompileExpectedOutputFiles + - "{Stage.Output.Directory}{/}{Stage.ObjectLinkFile.Prefix}{Stage.Input.Name}\ + {Stage.ObjectLinkFile.Extension}" + Static: + DefaultPlatform: + Flags: "{Profile.Intern_CompileFlags}" + Executable: "clang" + RunParts: *gcc_CompileRunParts + ExpectedOutputFiles: *gcc_CompileExpectedOutputFiles + Shared: + DefaultPlatform: + Flags: "{Profile.Intern_CompileFlags} -fpic" + Executable: "clang" + RunParts: *gcc_CompileRunParts + ExpectedOutputFiles: *gcc_CompileExpectedOutputFiles +Linker: + CheckExistence: + DefaultPlatform: "clang -v" + LinkTypes: + Executable: + Unix: + Flags: "-Wl,-rpath,\\$ORIGIN" + Executable: "clang" + RunParts: + - Type: Once + CommandPart: "{Stage.Executable} {Stage.LinkFlags} -o \"{Stage.Output.Directory}\ + {/}{Stage.Output.Name}\"" + - Type: Repeats + CommandPart: " \"{Stage.Input.Path}\"" + ExpectedOutputFiles: ["{Stage.Output.Directory}{/}{Stage.Output.Name}"] + Windows: + Flags: "-Wl,-rpath,\\$ORIGIN" + Executable: "clang" + RunParts: + - Type: Once + CommandPart: "{Stage.Executable} {Stage.LinkFlags} -o \"{Stage.Output.Directory}\ + {/}{Stage.Output.Name}{Stage.ExecutableFile.Extension}\"" + - Type: Repeats + CommandPart: " \"{Stage.Input.Path}\"" + ExpectedOutputFiles: + - "{Stage.Output.Directory}{/}{Stage.Output.Name}{Stage.ExecutableFile.Extension}" + Static: + DefaultPlatform: + Flags: "" + Executable: "clang" + RunParts: + - Type: Once + CommandPart: "{Stage.Executable} {Stage.LinkFlags} -o \"{Stage.Output.Directory}\ + {/}{Stage.StaticLinkFile.Prefix}{Stage.Output.Name}{Stage.StaticLinkFile.Extension}\"" + - Type: Repeats + CommandPart: " \"{Stage.Input.Path}\"" + ExpectedOutputFiles: + - "{Stage.Output.Directory}{/}{Stage.StaticLinkFile.Prefix}{Stage.Output.Name}\ + {Stage.StaticLinkFile.Extension}" + Shared: + DefaultPlatform: + Flags: "-shared -Wl,-rpath,\\$ORIGIN" + Executable: "clang" + RunParts: + - Type: Once + CommandPart: "{Stage.Executable} {Stage.LinkFlags} -o \"{Stage.Output.Directory}\ + {/}{Stage.SharedLibraryFile.Prefix}{Stage.Output.Name}\ + {Stage.SharedLibraryFile.Extension}\"" + - Type: Repeats + CommandPart: " \"{Stage.Input.Path}\"" + ExpectedOutputFiles: + - "{Stage.Output.Directory}{/}{Stage.SharedLibraryFile.Prefix}{Stage.Output.Name}\ + {Stage.SharedLibraryFile.Extension}" diff --git a/DefaultYAMLs/Default/gcc.yaml b/DefaultYAMLs/Default/gcc.yaml new file mode 100644 index 00000000..51b63e3f --- /dev/null +++ b/DefaultYAMLs/Default/gcc.yaml @@ -0,0 +1,112 @@ +# DO NOT modify this file. Changes will be overwritten when there's a reset or update + +Name: "gcc" +FileExtensions: [.c] +Languages: ["c"] +Import: "./CommonFileTypes.yaml" +Parameters: + Profile.CompileMode: + Default: "Debug" + Constraint: + - "Debug:-std=c99 -Wall -g -Og" + - "Release:-std=c++17 -Wall -O2 -DNDEBUG=1" + Profile.OutputPreprocess: + Default: "false" + Constraint: + - "true: -E" + - "1: -E" + - "false:" + - "0:" +Variables: + Profile.Intern_CompileFlags: "{Profile.CompileMode}{Profile.OutputPreprocess}" +Compiler: + CheckExistence: + DefaultPlatform: "gcc -v" + CompileTypes: + Executable: + DefaultPlatform: + Flags: "{Profile.Intern_CompileFlags}" + Executable: "gcc" + RunParts: &gcc_CompileRunParts + - Type: Once + CommandPart: "{Stage.Executable} -c {Stage.CompileFlags}" + - Type: Repeats + CommandPart: " -D{Stage.DefineNameOnly}=" + - Type: Repeats + CommandPart: " \"-D{Stage.DefineName}={Stage.DefineValue}\"" + - Type: Repeats + CommandPart: " -isystem \"{Stage.IncludeDirectory.Dep.Path}\"" + - Type: Repeats + CommandPart: " -I\"{Stage.IncludeDirectory.Source.Path}\"" + - Type: Once + CommandPart: " \"{Stage.Input.Path}\" -o \"{Stage.Output.Directory}{/}\ + {Stage.ObjectLinkFile.Prefix}{Stage.Input.Name}\ + {Stage.ObjectLinkFile.Extension}\"" + ExpectedOutputFiles: &gcc_CompileExpectedOutputFiles + - "{Stage.Output.Directory}{/}{Stage.ObjectLinkFile.Prefix}{Stage.Input.Name}\ + {Stage.ObjectLinkFile.Extension}" + Static: + DefaultPlatform: + Flags: "{Profile.Intern_CompileFlags}" + Executable: "gcc" + RunParts: *gcc_CompileRunParts + ExpectedOutputFiles: *gcc_CompileExpectedOutputFiles + Shared: + DefaultPlatform: + Flags: "{Profile.Intern_CompileFlags} -fpic" + Executable: "gcc" + RunParts: *gcc_CompileRunParts + ExpectedOutputFiles: *gcc_CompileExpectedOutputFiles +Linker: + CheckExistence: + DefaultPlatform: "gcc -v" + LinkTypes: + Executable: + Unix: + Flags: "-Wl,-rpath,\\$ORIGIN" + Executable: "gcc" + RunParts: + - Type: Once + CommandPart: "{Stage.Executable} {Stage.LinkFlags} -o \"{Stage.Output.Directory}\ + {/}{Stage.Output.Name}\"" + - Type: Repeats + CommandPart: " \"{Stage.Input.Path}\"" + ExpectedOutputFiles: ["{Stage.Output.Directory}{/}{Stage.Output.Name}"] + Windows: + Flags: "-Wl,-rpath,\\$ORIGIN" + Executable: "gcc" + RunParts: + - Type: Once + CommandPart: "{Stage.Executable} {Stage.LinkFlags} -o \"{Stage.Output.Directory}\ + {/}{Stage.Output.Name}{Stage.ExecutableFile.Extension}\"" + - Type: Repeats + CommandPart: " \"{Stage.Input.Path}\"" + ExpectedOutputFiles: + - "{Stage.Output.Directory}{/}{Stage.Output.Name}{Stage.ExecutableFile.Extension}" + Static: + DefaultPlatform: + Flags: "" + Executable: "gcc" + RunParts: + - Type: Once + CommandPart: "{Stage.Executable} {Stage.LinkFlags} -o \"{Stage.Output.Directory}\ + {/}{Stage.StaticLinkFile.Prefix}{Stage.Output.Name}{Stage.StaticLinkFile.Extension}\"" + - Type: Repeats + CommandPart: " \"{Stage.Input.Path}\"" + ExpectedOutputFiles: + - "{Stage.Output.Directory}{/}{Stage.StaticLinkFile.Prefix}{Stage.Output.Name}\ + {Stage.StaticLinkFile.Extension}" + Shared: + DefaultPlatform: + Flags: "-shared -Wl,-rpath,\\$ORIGIN" + Executable: "gcc" + RunParts: + - Type: Once + CommandPart: "{Stage.Executable} {Stage.LinkFlags} -o \"{Stage.Output.Directory}\ + {/}{Stage.SharedLibraryFile.Prefix}{Stage.Output.Name}\ + {Stage.SharedLibraryFile.Extension}\"" + - Type: Repeats + CommandPart: " \"{Stage.Input.Path}\"" + ExpectedOutputFiles: + - "{Stage.Output.Directory}{/}{Stage.SharedLibraryFile.Prefix}{Stage.Output.Name}\ + {Stage.SharedLibraryFile.Extension}" diff --git a/DefaultYAMLs/DefaultUserConfig.yaml b/DefaultYAMLs/DefaultUserConfig.yaml index 17346132..1d85be80 100644 --- a/DefaultYAMLs/DefaultUserConfig.yaml +++ b/DefaultYAMLs/DefaultUserConfig.yaml @@ -4,12 +4,14 @@ # A profile to be used if not specified while running the build script PreferredProfile: - DefaultPlatform: "g++" + DefaultPlatform: "gcc" Windows: "msvc" # List of compiler/linker profiles that instruct how to compile/link # See "./Default/g++.yaml" for the documentation of each field in a profile entry Profiles: +- Import: "./Default/gcc.yaml" +- Import: "./Default/clang.yaml" - Import: "./Default/g++.yaml" - Import: "./Default/clang++.yaml" - Import: "./Default/vs2022_v17+.yaml" From 93aedc6282980caa7d50118324773641fc20a9d3 Mon Sep 17 00:00:00 2001 From: Neko Box Coder Date: Mon, 31 Aug 2026 00:41:01 +0100 Subject: [PATCH 2/4] Updating System2 --- External/System2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/External/System2 b/External/System2 index 085a998e..282ec691 160000 --- a/External/System2 +++ b/External/System2 @@ -1 +1 @@ -Subproject commit 085a998e2e59d23fd914d6ac74338a99421c39fc +Subproject commit 282ec6914adb2da9d0179866aa6f6eac492780f1 From 2046a68b9abd5605e31f8e682e54250aeba04b34 Mon Sep 17 00:00:00 2001 From: Neko Box Coder Date: Mon, 31 Aug 2026 00:39:54 +0100 Subject: [PATCH 3/4] Updating test to test C file --- Tests/C_ProfileTest/System2Test.c | 64 +++++++++++++++++++++++++++++++ Tests/RunTests.cpp | 28 +++++++------- 2 files changed, 79 insertions(+), 13 deletions(-) create mode 100644 Tests/C_ProfileTest/System2Test.c diff --git a/Tests/C_ProfileTest/System2Test.c b/Tests/C_ProfileTest/System2Test.c new file mode 100644 index 00000000..0ae37958 --- /dev/null +++ b/Tests/C_ProfileTest/System2Test.c @@ -0,0 +1,64 @@ +/* runcpp2 +Dependencies: +- Name: System2 + Platforms: [DefaultPlatform] + Source: + Local: + Path: "../../External/System2" + LibraryType: Header + IncludePaths: ["."] +*/ + +#include "System2.h" +#include + +int main(int argc, char** argv) +{ + (void)argc; + (void)argv; + + //NOTE: This will fail for C++, this tests to use C Profile only + System2CommandInfo commandInfo = { + .RedirectInput = true, + .RedirectOutput = true + }; + + //Run the command in shell (subprocess is also available, see main.c) + { + #if defined(__unix__) || defined(__APPLE__) + System2Run("read testVar && echo testVar is \\\"$testVar\\\"", &commandInfo); + #elif defined(_WIN32) + System2Run("set /p testVar= && echo testVar is \"!testVar!\"", &commandInfo); + #else + #error "Unexpected platform?" + #endif + } + + //Send input to the command + { + char input[] = "test content\n"; + System2WriteToInput(&commandInfo, input, sizeof(input)); + } + + //Wait for command to finish and get return code + int returnCode = -1; + System2GetCommandReturnValue(&commandInfo, -1, &returnCode); + + //Capture output and print it + { + char outputBuffer[1024]; + uint32_t bytesRead = 0; + + System2ReadFromOutput(&commandInfo, outputBuffer, 1023, &bytesRead); + outputBuffer[bytesRead] = 0; + + printf("%s\n", outputBuffer); + printf("%s: %d\n", "Command has executed with return value", returnCode); + } + + System2CleanupCommand(&commandInfo); + return 0; + + //Output: testVar is "test content" + //Output: Command has executed with return value: 0 +} diff --git a/Tests/RunTests.cpp b/Tests/RunTests.cpp index ada99a70..94f7afb2 100644 --- a/Tests/RunTests.cpp +++ b/Tests/RunTests.cpp @@ -69,29 +69,31 @@ bool ListDir(const std::string& dirLoc = ".") #define COMMON_RUNCPP2_ARGS "-l -c ../DefaultYAMLs/DefaultUserConfig.yaml --log-level info" +#define RUN_TEST(testName) SH( "cd ./Build && ./" RUNCPP2_EXE " run " COMMON_RUNCPP2_ARGS " " testName); +#define BUILD_TEST(testName, outputLoc) \ + SH( "cd ./Build && ./" RUNCPP2_EXE " build -o " outputLoc " " COMMON_RUNCPP2_ARGS " " testName); + int main(int, char**) { CH(ListDir()); - SH( "cd ./Build && ./" RUNCPP2_EXE " run " COMMON_RUNCPP2_ARGS - " ../Tests/MultiSourcesAndStatic/Test.cpp"); - SH( "cd ./Build && ./" RUNCPP2_EXE " build -o ./TestStaticOutput " COMMON_RUNCPP2_ARGS - " ../Tests/MultiSourcesAndStatic/TestStatic.cpp"); + RUN_TEST("../Tests/MultiSourcesAndStatic/Test.cpp"); + + BUILD_TEST("../Tests/MultiSourcesAndStatic/TestStatic.cpp", "TestStaticOutput"); CH(ListDir("./Build/TestStaticOutput")); - SH( "cd ./Build && ./" RUNCPP2_EXE " run " COMMON_RUNCPP2_ARGS - " ../Tests/LocalDependency/TestLocalDependency.cpp"); - SH( "cd ./Build && ./" RUNCPP2_EXE " run " COMMON_RUNCPP2_ARGS - " ../Tests/SeparateYaml/TestSeparateYaml.cpp"); + + RUN_TEST("../Tests/LocalDependency/TestLocalDependency.cpp"); + RUN_TEST("../Tests/SeparateYaml/TestSeparateYaml.cpp"); if(RunCommand( "cd ./Build && ./" RUNCPP2_EXE " run " COMMON_RUNCPP2_ARGS " ../Tests/MissingSource/TestMissingSource.yaml")) { printf("We expect this to failed, somehow passed?...\n"); return 1; } - SH( "cd ./Build && ./" RUNCPP2_EXE " run " COMMON_RUNCPP2_ARGS - " ../Tests/YamlOnly/YamlOnlyTest.yaml"); - SH( "cd ./Build && ./" RUNCPP2_EXE " run " COMMON_RUNCPP2_ARGS - " ../Examples/InteractiveTutorial.cpp --test ./" RUNCPP2_EXE - " ../DefaultYAMLs/DefaultUserConfig.yaml"); + RUN_TEST("../Tests/YamlOnly/YamlOnlyTest.yaml"); + RUN_TEST("../Tests/C_ProfileTest/System2Test.c"); + RUN_TEST( "../Examples/InteractiveTutorial.cpp --test ./" RUNCPP2_EXE + " ../DefaultYAMLs/DefaultUserConfig.yaml"); + printf("Done\n"); return 0; From dfa559b213c1d16fa523f3625864b6b75b3bc67f Mon Sep 17 00:00:00 2001 From: Neko Box Coder Date: Wed, 2 Sep 2026 00:58:50 +0100 Subject: [PATCH 4/4] Updating jenkinsfile to sleep before stashing --- Jenkinsfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5a70c7ee..fd2c85dc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -150,7 +150,7 @@ pipeline Trigger: $GITHUB_PUSH_REF , $GITHUB_PR_REF , $GITHUB_PR_ACTION - ^refs/heads/master , , $|^ , .[a-zA-Z0-9/]* , (opened|synchronize)$ + ^refs/heads/master , , $|^ , .[a-zA-Z0-9/\-_]* , (opened|synchronize)$ Param: TARGET_REF @@ -336,6 +336,7 @@ pipeline bash 'cp ./BootstrapBuild/runcpp2 ./Build' bash "./Build/runcpp2 run -l -c ./DefaultYAMLs/DefaultUserConfig.yaml " + "./Build.cpp --runcpp2-path ./Build/runcpp2" + sleep 5 stash 'linux_debug_build' } post { failure { script { FAILED_STAGE = env.STAGE_NAME } } } @@ -354,6 +355,7 @@ pipeline bat ".\\Build\\runcpp2.exe run -l -c " + ".\\DefaultYAMLs\\DefaultUserConfig.yaml .\\Build.cpp --runcpp2-path " + ".\\Build\\runcpp2.exe" + sleep 5 stash 'windows_debug_build' } post { failure { script { FAILED_STAGE = env.STAGE_NAME } } } @@ -371,6 +373,7 @@ pipeline bash 'cp ./BootstrapBuild/runcpp2 ./Build' bash "./Build/runcpp2 run -l -c ./DefaultYAMLs/DefaultUserConfig.yaml " + "./Build.cpp --runcpp2-path ./Build/runcpp2 --release" + sleep 5 stash 'linux_release_build' } post { failure { script { FAILED_STAGE = env.STAGE_NAME } } } @@ -389,6 +392,7 @@ pipeline bat ".\\Build\\runcpp2.exe run -l -c " + ".\\DefaultYAMLs\\DefaultUserConfig.yaml .\\Build.cpp --runcpp2-path " + ".\\Build\\runcpp2.exe --release" + sleep 5 stash 'windows_release_build' } post { failure { script { FAILED_STAGE = env.STAGE_NAME } } }