Skip to content

Commit 72edb8c

Browse files
Merge pull request #40 from Neko-Box-Coder/ImprovedConfig
Improving user config & build process to be more flexible
2 parents 4433d5b + 10c8165 commit 72edb8c

26 files changed

+594
-336
lines changed

DefaultYAMLs/DefaultUserConfig.yaml

Lines changed: 153 additions & 63 deletions
Large diffs are not rendered by default.

Include/runcpp2/CompilingLinking.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ namespace runcpp2
3535
const std::vector<Data::DependencyInfo*>& availableDependencies,
3636
const Data::Profile& profile,
3737
const std::vector<std::string>& compiledObjectsPaths,
38-
bool buildExecutable,
39-
const std::string exeExt);
38+
bool buildExecutable);
4039
}
4140

4241
#endif

Include/runcpp2/Data/BuildTypeHelper.hpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,15 @@ namespace runcpp2
1212
{
1313
namespace BuildTypeHelper
1414
{
15-
const FileProperties* GetOutputFileProperties( const FilesTypesInfo& filesTypes,
16-
BuildType buildType,
17-
bool asExecutable);
18-
1915
bool NeedsLinking(BuildType buildType);
2016

21-
bool GetOutputPath( const ghc::filesystem::path& buildDir,
22-
const std::string& scriptName,
23-
const Profile& profile,
24-
const BuildType buildType,
25-
const bool asExecutable,
26-
ghc::filesystem::path& outPath);
17+
bool GetPossibleOutputPaths(const ghc::filesystem::path& buildDir,
18+
const std::string& scriptName,
19+
const Profile& profile,
20+
const BuildType buildType,
21+
const bool asExecutable,
22+
std::vector<ghc::filesystem::path>& outPaths,
23+
std::vector<bool>& outIsRunnable);
2724
}
2825
}
2926
}

Include/runcpp2/Data/StageInfo.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ namespace runcpp2
4040
std::vector<std::string> Setup;
4141
std::vector<std::string> Cleanup;
4242
std::vector<RunPart> RunParts;
43+
std::vector<std::string> ExpectedOutputFiles;
4344
};
4445

4546
struct
@@ -52,6 +53,7 @@ namespace runcpp2
5253

5354
using SubstitutionMap = std::unordered_map<std::string, std::vector<std::string>>;
5455

56+
//TODO: Make this static function?
5557
bool PerformSubstituions( const SubstitutionMap& substitutionMap,
5658
std::string& inOutSubstitutedString) const;
5759

Include/runcpp2/PipelineSteps.hpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,21 @@ namespace runcpp2
102102
int& returnStatus);
103103

104104
PipelineResult
105-
HandleBuildOutput( const ghc::filesystem::path& target,
105+
HandleBuildOutput( const std::vector<ghc::filesystem::path>& targets,
106106
const std::vector<std::string>& filesToCopyPaths,
107107
const Data::ScriptInfo& scriptInfo,
108108
const Data::Profile& profile,
109109
const std::string& buildOutputDir,
110110
const std::unordered_map<CmdOptions, std::string>& currentOptions);
111111

112-
PipelineResult GetTargetPath( const ghc::filesystem::path& buildDir,
113-
const std::string& scriptName,
114-
const Data::Profile& profile,
115-
const std::unordered_map<CmdOptions, std::string>& currentOptions,
116-
const Data::ScriptInfo& scriptInfo,
117-
ghc::filesystem::path& outTarget);
112+
PipelineResult GetBuiltTargetPaths( const ghc::filesystem::path& buildDir,
113+
const std::string& scriptName,
114+
const Data::Profile& profile,
115+
const std::unordered_map< CmdOptions,
116+
std::string>& currentOptions,
117+
const Data::ScriptInfo& scriptInfo,
118+
std::vector<ghc::filesystem::path>& outTargets,
119+
ghc::filesystem::path* outRunnableTarget);
118120

119121
bool GatherSourceFiles( const ghc::filesystem::path& absoluteScriptPath,
120122
const Data::ScriptInfo& scriptInfo,

Jenkinsfile

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,12 @@ pipeline
254254
bash "cd ./Build && ./runcpp2 -l " +
255255
"-c ../DefaultYAMLs/DefaultUserConfig.yaml " +
256256
"--log-level info ../Examples/test.cpp"
257-
}
258-
{
257+
bash "cd ./Build && ./runcpp2 -l -b " +
258+
"-c ../DefaultYAMLs/DefaultUserConfig.yaml " +
259+
"--log-level info ../Examples/test.cpp"
260+
bash "ls -lah ./Build"
261+
262+
259263
cleanWs()
260264
bash "ls -lah"
261265
unstash 'linux_build'
@@ -264,6 +268,7 @@ pipeline
264268
bash "cd ./Build && ./runcpp2 -l -b " +
265269
"-c ../DefaultYAMLs/DefaultUserConfig.yaml " +
266270
"--log-level info ../Examples/test_static.cpp"
271+
bash "ls -lah ./Build"
267272
}
268273
post { failure { script { FAILED_STAGE = env.STAGE_NAME } } }
269274
}
@@ -295,15 +300,20 @@ pipeline
295300
bat "cd .\\Build\\Debug && .\\runcpp2.exe -l " +
296301
"-c ..\\..\\DefaultYAMLs\\DefaultUserConfig.yaml " +
297302
"--log-level info ..\\..\\Examples\\test.cpp"
298-
}
299-
{
303+
bat "cd .\\Build\\Debug && .\\runcpp2.exe -l -b " +
304+
"-c ..\\..\\DefaultYAMLs\\DefaultUserConfig.yaml " +
305+
"--log-level info ..\\..\\Examples\\test.cpp"
306+
bat "dir .\\Build\\Debug"
307+
308+
300309
cleanWs()
301310
bat 'dir'
302311
unstash 'windows_build'
303312
bat 'dir'
304313
bat "cd .\\Build\\Debug && .\\runcpp2.exe -l -b " +
305314
"-c ..\\..\\DefaultYAMLs\\DefaultUserConfig.yaml " +
306315
"--log-level info ..\\..\\Examples\\test_static.cpp"
316+
bat "dir .\\Build\\Debug"
307317
}
308318
post { failure { script { FAILED_STAGE = env.STAGE_NAME } } }
309319
}

Src/Tests/Data/BuildTypeTest.cpp

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -66,33 +66,26 @@ int main(int argc, char** argv)
6666

6767
ssTEST_OUTPUT_EXECUTION
6868
(
69-
ghc::filesystem::path outPath;
70-
bool result = runcpp2::Data::BuildTypeHelper::GetOutputPath(
71-
buildDir, scriptName, profile, runcpp2::Data::BuildType::STATIC, false, outPath);
69+
std::vector<ghc::filesystem::path> outTargets;
70+
std::vector<bool> outIsRunnable;
71+
bool result = BuildTypeHelper::GetPossibleOutputPaths( buildDir,
72+
scriptName,
73+
profile,
74+
BuildType::STATIC,
75+
false,
76+
outTargets,
77+
outIsRunnable);
7278
);
7379

7480
ssTEST_OUTPUT_ASSERT("GetOutputPath should succeed", result == true);
81+
ssTEST_OUTPUT_ASSERT("GetOutputPath should return a single target", outTargets.size() == 1);
7582
#ifdef _WIN32
76-
ssTEST_OUTPUT_ASSERT("Static library path", outPath, "build/test.lib");
83+
ssTEST_OUTPUT_ASSERT("Static library path", outTargets.at(0), "build/test.lib");
7784
#else
78-
ssTEST_OUTPUT_ASSERT("Static library path", outPath, "build/libtest.a");
85+
ssTEST_OUTPUT_ASSERT("Static library path", outTargets.at(0), "build/libtest.a");
7986
#endif
8087
};
8188

82-
ssTEST("BuildType Should Map To Correct File Types")
83-
{
84-
ssTEST_OUTPUT_SETUP
85-
(
86-
runcpp2::Data::FilesTypesInfo filesTypes;
87-
);
88-
89-
ssTEST_OUTPUT_ASSERT( "Static build type",
90-
BuildTypeHelper::GetOutputFileProperties( filesTypes,
91-
BuildType::STATIC,
92-
false),
93-
&filesTypes.StaticLinkFile);
94-
};
95-
9689
ssTEST_END_TEST_GROUP();
9790
return 0;
9891
}

Src/Tests/Data/DependencyInfoTest.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ int main(int argc, char** argv)
1313
{
1414
ssTEST_OUTPUT_SETUP
1515
(
16+
//NOTE: This is just a test YAML for validating parsing, don't use it for actual config
1617
const char* yamlStr = R"(
1718
Name: MyLibrary
1819
Platforms:

Src/Tests/Data/DependencyLinkPropertyTest.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ int main(int argc, char** argv)
1313
{
1414
ssTEST_OUTPUT_SETUP
1515
(
16+
//NOTE: This is just a test YAML for validating parsing, don't use it for actual config
1617
const char* yamlStr = R"(
1718
MSVC:
1819
SearchLibraryNames: [mylib, mylib_static]

Src/Tests/Data/DependencySourceTest.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ int main(int argc, char** argv)
1313
{
1414
ssTEST_OUTPUT_SETUP
1515
(
16+
//NOTE: This is just a test YAML for validating parsing, don't use it for actual config
1617
const char* yamlStr = R"(
1718
Git:
1819
URL: https://github.com/user/repo.git
@@ -57,6 +58,7 @@ int main(int argc, char** argv)
5758
{
5859
ssTEST_OUTPUT_SETUP
5960
(
61+
//NOTE: This is just a test YAML for validating parsing, don't use it for actual config
6062
const char* yamlStr = R"(
6163
Local:
6264
Path: ../external/mylib

0 commit comments

Comments
 (0)