GCC Code Coverage Report


Directory: ./
File: src/simple_project_generator.cpp
Date: 2026-10-16 17:52:29
Exec Total Coverage
Lines: 245 277 88.4%
Functions: 21 21 100.0%
Branches: 401 469 85.5%

Line Branch Exec Source
1 /***************************************
2 Auteur : Pierre Aubert
3 Mail : pierre.aubert@lapp.in2p3.fr
4 Licence : LGPL-3.0-only
5 ****************************************/
6
7 #include <ctime>
8
9 #include "directory_replace_placeholder.h"
10 #include "simple_project_generator.h"
11 #include "parserClassConfig.h"
12 #include "gitlab_doc.h"
13
14 //C++ Trait Backend
15 #include "CppTraitFromString.h"
16 #include "CppTraitSetter.h"
17 #include "CppTraitGetter.h"
18 #include "CppTraitCopy.h"
19 #include "CppTraitTypeStream.h"
20 #include "CppTraitDataStream.h"
21 #include "CppTraitConfigStream.h"
22 #include "CppTraitCheckStream.h"
23
24 #include "PTraitBackendManager.h"
25
26 //Wrapper Trait Backend
27 #include "WrapperTraitGetterSetter.h"
28 #include "WrapperTraitTypeStream.h"
29 #include "WrapperTraitDataStream.h"
30 #include "PWrapperTraitBackendManager.h"
31
32 //Nanobind Trait Backend
33 #include "NanobindTraitProperty.h"
34 #include "NanobindTraitMethod.h"
35 #include "NanobindTraitTypeStream.h"
36 #include "NanobindTraitDataStream.h"
37 #include "NanobindTraitCheckStream.h"
38 #include "NanobindTraitTestSetup.h"
39 #include "NanobindTraitInclude.h"
40 #include "PNanobindTraitBackendManager.h"
41
42 //Rust Trait Backend
43 #include "RustTraitGetterSetter.h"
44 #include "PRustTraitBackendManager.h"
45
46 //C++ Generator
47 #include "generator_class_cpp.h"
48 //Wrapper Generator
49 #include "wrapper_generator_struct.h"
50 //Nanobind Generator
51 #include "nanobind_generator.h"
52 //Rust Generator
53 #include "generator_class_rust.h"
54
55 #include "simpleClassGenerator.h"
56
57 ///Check if a package is a Phoenix dependency
58 /** @param packageName : name of the package
59 * @return true if it's a Phoenix dependency, false otherwise
60 */
61 105 bool isPhoenixDependency(const PString & packageName){
62
10/16
✓ Branch 0 (2→3) taken 105 times.
✓ Branch 2 (3→4) taken 105 times.
✓ Branch 4 (4→5) taken 14 times.
✓ Branch 5 (4→8) taken 91 times.
✓ Branch 6 (5→6) taken 14 times.
✓ Branch 8 (6→7) taken 14 times.
✗ Branch 10 (7→8) not taken.
✓ Branch 11 (7→9) taken 14 times.
✓ Branch 12 (10→11) taken 14 times.
✓ Branch 13 (10→12) taken 91 times.
✓ Branch 14 (12→13) taken 105 times.
✗ Branch 15 (12→14) not taken.
✗ Branch 16 (16→17) not taken.
✗ Branch 17 (16→18) not taken.
✗ Branch 18 (20→21) not taken.
✗ Branch 19 (20→22) not taken.
105 return (packageName.isSameBegining("Phoenix") || packageName.isSameBegining("phoenix"));
63 }
64
65 ///Generate CMake find_package commands for non-Phoenix dependencies
66 /** @param projectConfig : project configuration
67 * @return CMake find_package commands
68 */
69 4 PString generateCmakeFindBody(const ProjectConfig & projectConfig){
70 4 PString cmakeFindBody;
71
2/2
✓ Branch 0 (21→4) taken 15 times.
✓ Branch 1 (21→22) taken 4 times.
19 for(PackageMap::const_iterator depIt = projectConfig.mapDependencies.begin(); depIt != projectConfig.mapDependencies.end(); ++depIt){
72 15 const PPackageAttribute & pkgAttr = depIt->second;
73
4/4
✓ Branch 0 (5→6) taken 15 times.
✓ Branch 2 (6→7) taken 15 times.
✓ Branch 4 (7→8) taken 2 times.
✓ Branch 5 (7→18) taken 13 times.
15 if(!isPhoenixDependency(pkgAttr.getName())){
74
2/3
✓ Branch 0 (8→9) taken 2 times.
✗ Branch 2 (10→11) not taken.
✓ Branch 3 (10→18) taken 2 times.
2 if(!pkgAttr.getCmakeFind().empty()){
75 ✗ cmakeFindBody += "find_package("+pkgAttr.getCmakeFind()+")";
76 }
77 }
78 }
79 4 return cmakeFindBody;
80 ✗ }
81
82 ///Generate Phoenix pull_extra_module commands
83 /** @param projectConfig : project configuration
84 * @return Phoenix pull_extra_module commands
85 */
86 4 PString generatePhoenixPullExtraModule(const ProjectConfig & projectConfig){
87 4 PString phoenixPullExtraModule;
88
2/2
✓ Branch 0 (23→4) taken 15 times.
✓ Branch 1 (23→24) taken 4 times.
19 for(PackageMap::const_iterator depIt = projectConfig.mapDependencies.begin(); depIt != projectConfig.mapDependencies.end(); ++depIt){
89 15 const PPackageAttribute & pkgAttr = depIt->second;
90
4/4
✓ Branch 0 (5→6) taken 15 times.
✓ Branch 2 (6→7) taken 15 times.
✓ Branch 4 (7→8) taken 13 times.
✓ Branch 5 (7→20) taken 2 times.
15 if(isPhoenixDependency(pkgAttr.getName())){
91
7/7
✓ Branch 0 (8→9) taken 13 times.
✓ Branch 2 (9→10) taken 13 times.
✓ Branch 4 (10→11) taken 13 times.
✓ Branch 6 (11→12) taken 13 times.
✓ Branch 8 (12→13) taken 13 times.
✓ Branch 10 (13→14) taken 13 times.
✓ Branch 12 (14→15) taken 13 times.
13 phoenixPullExtraModule += "pull_extra_module(\""+pkgAttr.getName()+"\" \""+pkgAttr.getUrl()+"\")\n";
92 }
93 }
94 4 return phoenixPullExtraModule;
95 ✗ }
96
97 ///Generate Phoenix find module list
98 /** @param projectConfig : project configuration
99 * @return Phoenix find module list
100 */
101 4 PString generatePhoenixFindModule(const ProjectConfig & projectConfig){
102 4 PString phoenixFindModule;
103
2/2
✓ Branch 0 (16→4) taken 15 times.
✓ Branch 1 (16→17) taken 4 times.
19 for(PackageMap::const_iterator depIt = projectConfig.mapDependencies.begin(); depIt != projectConfig.mapDependencies.end(); ++depIt){
104 15 const PPackageAttribute & pkgAttr = depIt->second;
105
4/4
✓ Branch 0 (5→6) taken 15 times.
✓ Branch 2 (6→7) taken 15 times.
✓ Branch 4 (7→8) taken 13 times.
✓ Branch 5 (7→13) taken 2 times.
15 if(isPhoenixDependency(pkgAttr.getName())){
106
3/3
✓ Branch 0 (8→9) taken 13 times.
✓ Branch 2 (9→10) taken 13 times.
✓ Branch 4 (10→11) taken 13 times.
13 phoenixFindModule += " "+pkgAttr.getName();
107 }
108 }
109 4 return phoenixFindModule;
110 ✗ }
111
112 ///Generate Phoenix global dependencies variable
113 /** @param projectConfig : project configuration
114 * @return Phoenix global dependencies variable
115 */
116 4 PString generatePhoenixGlobalDep(const ProjectConfig & projectConfig){
117 4 PString phoenixGlobalDep;
118
4/4
✓ Branch 0 (3→4) taken 4 times.
✓ Branch 2 (4→5) taken 4 times.
✓ Branch 4 (5→6) taken 4 times.
✓ Branch 6 (6→7) taken 4 times.
4 phoenixGlobalDep += "set(" + projectConfig.name.toUpper() + "_TEST_DEPENDENCIES\n";
119
4/4
✓ Branch 0 (10→11) taken 4 times.
✓ Branch 2 (11→12) taken 4 times.
✓ Branch 4 (12→13) taken 4 times.
✓ Branch 6 (13→14) taken 4 times.
4 phoenixGlobalDep += "\t" + projectConfig.name.toSnakeCase() + "\n";
120
3/3
✓ Branch 0 (31→32) taken 19 times.
✓ Branch 2 (32→18) taken 15 times.
✓ Branch 3 (32→33) taken 4 times.
19 for(PackageMap::const_reverse_iterator depIt = projectConfig.mapDependencies.rbegin(); depIt != projectConfig.mapDependencies.rend(); ++depIt){
121
1/1
✓ Branch 0 (18→19) taken 15 times.
15 const PPackageAttribute & pkgAttr = depIt->second;
122
4/4
✓ Branch 0 (19→20) taken 15 times.
✓ Branch 2 (20→21) taken 15 times.
✓ Branch 4 (21→22) taken 13 times.
✓ Branch 5 (21→29) taken 2 times.
15 if(isPhoenixDependency(pkgAttr.getName())){
123
4/4
✓ Branch 0 (22→23) taken 13 times.
✓ Branch 2 (23→24) taken 13 times.
✓ Branch 4 (24→25) taken 13 times.
✓ Branch 6 (25→26) taken 13 times.
13 phoenixGlobalDep += "\t"+pkgAttr.getCmakeLib()+"\n";
124 }
125 }
126
1/1
✓ Branch 0 (33→34) taken 4 times.
4 phoenixGlobalDep += ")";
127 4 return phoenixGlobalDep;
128 ✗ }
129
130 ///Generate target_link_libraries command
131 /** @param projectConfig : project configuration
132 * @return target_link_libraries command
133 */
134 4 PString generateTargetLinkBody(const ProjectConfig & projectConfig){
135 4 PString targetLinkBody;
136
4/4
✓ Branch 0 (3→4) taken 4 times.
✓ Branch 2 (4→5) taken 4 times.
✓ Branch 4 (5→6) taken 4 times.
✓ Branch 6 (6→7) taken 4 times.
4 targetLinkBody += "target_link_libraries("+projectConfig.name.toSnakeCase()+" ";
137
2/2
✓ Branch 0 (23→11) taken 15 times.
✓ Branch 1 (23→24) taken 4 times.
19 for(PackageMap::const_iterator depIt = projectConfig.mapDependencies.begin(); depIt != projectConfig.mapDependencies.end(); ++depIt){
138 15 const PPackageAttribute & pkgAttr = depIt->second;
139
4/4
✓ Branch 0 (12→13) taken 15 times.
✓ Branch 2 (13→14) taken 15 times.
✓ Branch 4 (14→15) taken 2 times.
✓ Branch 5 (14→20) taken 13 times.
15 if(!isPhoenixDependency(pkgAttr.getName())){
140
3/3
✓ Branch 0 (15→16) taken 2 times.
✓ Branch 2 (16→17) taken 2 times.
✓ Branch 4 (17→18) taken 2 times.
2 targetLinkBody += pkgAttr.getCmakeLib()+" ";
141 }
142 }
143 // Add Phoenix dependencies (to ensure proper linking even if phoenix_create_find should handle it)
144
2/2
✓ Branch 0 (37→25) taken 15 times.
✓ Branch 1 (37→38) taken 4 times.
19 for(PackageMap::const_iterator depIt = projectConfig.mapDependencies.begin(); depIt != projectConfig.mapDependencies.end(); ++depIt){
145 15 const PPackageAttribute & pkgAttr = depIt->second;
146
4/4
✓ Branch 0 (26→27) taken 15 times.
✓ Branch 2 (27→28) taken 15 times.
✓ Branch 4 (28→29) taken 13 times.
✓ Branch 5 (28→34) taken 2 times.
15 if(isPhoenixDependency(pkgAttr.getName())){
147
3/3
✓ Branch 0 (29→30) taken 13 times.
✓ Branch 2 (30→31) taken 13 times.
✓ Branch 4 (31→32) taken 13 times.
13 targetLinkBody += pkgAttr.getCmakeLib()+" ";
148 }
149 }
150
1/1
✓ Branch 0 (38→39) taken 4 times.
4 targetLinkBody += ")\n";
151 4 return targetLinkBody;
152 ✗ }
153
154 ///Generate Pixi dependencies
155 /** @param projectConfig : project configuration
156 * @return Pixi dependencies
157 */
158 4 PString generatePixiBody(const ProjectConfig & projectConfig){
159 4 PString pixiBody;
160
2/2
✓ Branch 0 (71→4) taken 15 times.
✓ Branch 1 (71→72) taken 4 times.
19 for(PackageMap::const_iterator depIt = projectConfig.mapDependencies.begin(); depIt != projectConfig.mapDependencies.end(); ++depIt){
161 15 const PPackageAttribute & pkgAttr = depIt->second;
162
2/2
✓ Branch 0 (5→6) taken 15 times.
✓ Branch 2 (6→7) taken 15 times.
15 PString pixi_name = pkgAttr.getPixiName().toLower();
163
2/2
✓ Branch 0 (7→8) taken 15 times.
✓ Branch 2 (8→9) taken 15 times.
15 PString min_version = pkgAttr.getMinVersion();
164
2/2
✓ Branch 0 (9→10) taken 15 times.
✓ Branch 2 (10→11) taken 15 times.
15 PString max_version = pkgAttr.getMaxVersion();
165
2/3
✓ Branch 0 (11→12) taken 15 times.
✗ Branch 2 (12→13) not taken.
✓ Branch 3 (12→14) taken 15 times.
15 if(pixi_name == "") continue;
166
5/6
✓ Branch 0 (15→16) taken 2 times.
✓ Branch 1 (15→19) taken 13 times.
✓ Branch 2 (17→18) taken 2 times.
✗ Branch 3 (17→19) not taken.
✓ Branch 4 (20→21) taken 2 times.
✓ Branch 5 (20→25) taken 13 times.
15 else if(min_version.empty() && max_version.empty()){
167
2/2
✓ Branch 0 (21→22) taken 2 times.
✓ Branch 2 (22→23) taken 2 times.
2 pixiBody += pixi_name + " = \"*\"\n";
168
1/2
✗ Branch 0 (26→27) not taken.
✓ Branch 1 (26→35) taken 13 times.
13 }else if(max_version.empty()){
169 ✗ pixiBody += pixi_name + " = \"" + min_version + "\"\n";
170 }else{
171
3/3
✓ Branch 0 (35→36) taken 13 times.
✓ Branch 2 (36→37) taken 13 times.
✓ Branch 4 (37→38) taken 13 times.
13 pixiBody += pixi_name + " = \"" + min_version;
172
4/7
✓ Branch 0 (41→42) taken 13 times.
✗ Branch 1 (41→45) not taken.
✓ Branch 2 (43→44) taken 13 times.
✗ Branch 3 (43→45) not taken.
✓ Branch 4 (46→47) taken 13 times.
✗ Branch 5 (46→48) not taken.
✓ Branch 6 (47→48) taken 13 times.
13 if(!min_version.empty() && !max_version.empty()) pixiBody += ",";
173
2/2
✓ Branch 0 (48→49) taken 13 times.
✓ Branch 2 (49→50) taken 13 times.
13 pixiBody += max_version + "\"\n";
174 }
175
3/6
✓ Branch 0 (54→55) taken 15 times.
✗ Branch 1 (54→56) not taken.
✓ Branch 2 (59→60) taken 15 times.
✗ Branch 3 (59→61) not taken.
✓ Branch 4 (64→65) taken 15 times.
✗ Branch 5 (64→67) not taken.
45 }
176 4 return pixiBody;
177 ✗ }
178
179 ///Generate markdown list of Phoenix dependencies
180 /** @param projectConfig : project configuration
181 * @return markdown list of Phoenix dependencies
182 */
183 4 PString generateMarkdownDepList(const ProjectConfig & projectConfig){
184 4 PString packageMdList;
185
2/2
✓ Branch 0 (23→4) taken 15 times.
✓ Branch 1 (23→24) taken 4 times.
19 for(PackageMap::const_iterator depIt = projectConfig.mapDependencies.begin(); depIt != projectConfig.mapDependencies.end(); ++depIt){
186 15 const PPackageAttribute & pkgAttr = depIt->second;
187
4/4
✓ Branch 0 (5→6) taken 15 times.
✓ Branch 2 (6→7) taken 15 times.
✓ Branch 4 (7→8) taken 13 times.
✓ Branch 5 (7→20) taken 2 times.
15 if(isPhoenixDependency(pkgAttr.getName())){
188
7/7
✓ Branch 0 (8→9) taken 13 times.
✓ Branch 2 (9→10) taken 13 times.
✓ Branch 4 (10→11) taken 13 times.
✓ Branch 6 (11→12) taken 13 times.
✓ Branch 8 (12→13) taken 13 times.
✓ Branch 10 (13→14) taken 13 times.
✓ Branch 12 (14→15) taken 13 times.
13 packageMdList += "- ["+pkgAttr.getName()+"]("+pkgAttr.getUrl()+")\n";
189 }
190 }
191 4 return packageMdList;
192 ✗ }
193
194 ///Generate author list for Pixi
195 /** @param projectConfig : project configuration
196 * @return author list for Pixi
197 */
198 4 PString generateAuthorListPixi(const ProjectConfig & projectConfig){
199 4 PString authorListPixi;
200
1/1
✓ Branch 0 (3→4) taken 4 times.
4 authorListPixi += "authors = [\n";
201
2/2
✓ Branch 0 (25→5) taken 8 times.
✓ Branch 1 (25→26) taken 4 times.
12 for(ProjectMembersMap::const_iterator it = projectConfig.authorMap.begin(); it != projectConfig.authorMap.end(); ++it){
202 8 const PProjectMembers & author = it->second;
203
10/10
✓ Branch 0 (6→7) taken 8 times.
✓ Branch 2 (7→8) taken 8 times.
✓ Branch 4 (8→9) taken 8 times.
✓ Branch 6 (9→10) taken 8 times.
✓ Branch 8 (10→11) taken 8 times.
✓ Branch 10 (11→12) taken 8 times.
✓ Branch 12 (12→13) taken 8 times.
✓ Branch 14 (13→14) taken 8 times.
✓ Branch 16 (14→15) taken 8 times.
✓ Branch 18 (15→16) taken 8 times.
8 authorListPixi += " \"" + author.getFirstName() + " " + author.getLastName() + " <" + author.getEmail() + ">\",\n";
204 }
205
1/1
✓ Branch 0 (26→27) taken 4 times.
4 authorListPixi += "]\n";
206 4 return authorListPixi;
207 ✗ }
208
209 ///Generate the nanobind cmake sources list
210 /** @param projectConfig : project configuration
211 * @param vecClassConfigFile : vector of class config files
212 * @param mode : generator mode
213 * @return nanobind cmake sources list
214 */
215 1 PString generateNanobindCmakeSources(const ProjectConfig & projectConfig, const PVecPath & vecClassConfigFile, const GeneratorMode & mode){
216 1 PString nanobindSources;
217
1/1
✓ Branch 0 (3→4) taken 1 times.
1 nanobindSources += "# We are now ready to compile the actual extension module\n";
218
219
2/2
✓ Branch 0 (59→6) taken 2 times.
✓ Branch 1 (59→60) taken 1 times.
4 for(const PPath & classConfigFile : vecClassConfigFile){
220
3/3
✓ Branch 0 (8→9) taken 2 times.
✓ Branch 2 (9→10) taken 2 times.
✓ Branch 4 (10→11) taken 2 times.
2 PPath baseFileName = classConfigFile.getFileName().eraseExtension();
221
2/2
✓ Branch 0 (12→13) taken 2 times.
✓ Branch 2 (13→14) taken 2 times.
2 PString bindingSource = baseFileName + "_binding.cpp";
222
1/1
✓ Branch 0 (15→16) taken 2 times.
2 PString fileModuleName = baseFileName.toLower();
223
224
1/1
✓ Branch 0 (16→17) taken 2 times.
2 nanobindSources += "nanobind_add_module(\n";
225
3/3
✓ Branch 0 (17→18) taken 2 times.
✓ Branch 2 (18→19) taken 2 times.
✓ Branch 4 (19→20) taken 2 times.
2 nanobindSources += "\t" + fileModuleName + " # Name of the module\n";
226
1/1
✓ Branch 0 (22→23) taken 2 times.
2 nanobindSources += "\tSTABLE_ABI # Compatible Python 3.12+ stable ABI\n";
227
1/1
✓ Branch 0 (23→24) taken 2 times.
2 nanobindSources += "\tNB_STATIC # Static linking\n";
228
1/1
✓ Branch 0 (24→25) taken 2 times.
2 nanobindSources += "\tLTO # Link-time optimization\n";
229
3/3
✓ Branch 0 (25→26) taken 2 times.
✓ Branch 2 (26→27) taken 2 times.
✓ Branch 4 (27→28) taken 2 times.
2 nanobindSources += "\t" + bindingSource + " # Source file\n";
230
1/1
✓ Branch 0 (30→31) taken 2 times.
2 nanobindSources += ")\n";
231
6/6
✓ Branch 0 (31→32) taken 2 times.
✓ Branch 2 (32→33) taken 2 times.
✓ Branch 4 (33→34) taken 2 times.
✓ Branch 6 (34→35) taken 2 times.
✓ Branch 8 (35→36) taken 2 times.
✓ Branch 10 (36→37) taken 2 times.
2 nanobindSources += "target_link_libraries(" + fileModuleName + " PRIVATE " + projectConfig.name.toSnakeCase() + ")\n";
232
3/3
✓ Branch 0 (42→43) taken 2 times.
✓ Branch 2 (43→44) taken 2 times.
✓ Branch 4 (44→45) taken 2 times.
2 nanobindSources += "install(TARGETS " + fileModuleName + " LIBRARY DESTINATION ${PYTHON_SITE_PACKAGES} ARCHIVE DESTINATION ${PYTHON_SITE_PACKAGES})\n\n";
233 2 }
234
235 1 return nanobindSources;
236 ✗ }
237
238 ///Generate the Rust module declarations to be written into lib.rs
239 /** @param vecClassConfigFile : vector of class config files
240 * @return rust module declarations (eg "pub mod shadok;\npub mod gibis;\n")
241 */
242 1 PString generateRustModuleDeclarations(const PVecPath & vecClassConfigFile){
243 1 PString decls;
244
2/2
✓ Branch 0 (26→5) taken 2 times.
✓ Branch 1 (26→27) taken 1 times.
4 for(const PPath & classConfigFile : vecClassConfigFile){
245
6/6
✓ Branch 0 (7→8) taken 2 times.
✓ Branch 2 (8→9) taken 2 times.
✓ Branch 4 (9→10) taken 2 times.
✓ Branch 6 (10→11) taken 2 times.
✓ Branch 8 (11→12) taken 2 times.
✓ Branch 10 (12→13) taken 2 times.
2 decls += "pub mod " + classConfigFile.getFileName().eraseExtension().toSnakeCase() + ";\n";
246 }
247 1 return decls;
248 ✗ }
249
250 ///Generate the replacement map for placeholders
251 /** @param projectConfig : project configuration
252 * @param mode : generator mode
253 * @param cmakeFindBody : CMake find_package commands
254 * @param phoenixPullExtraModule : Phoenix pull_extra_module commands
255 * @param phoenixFindModule : Phoenix find module list
256 * @param phoenixGlobalDep : Phoenix global dependencies variable
257 * @param targetLinkBody : target_link_libraries command
258 * @param pixiBody : Pixi dependencies
259 * @param authorListPixi : author list for Pixi
260 * @param nanobindCMakeSources : nanobind cmake sources list
261 * @param rustModuleDeclarations : rust module declarations for lib.rs
262 * @return replacement map for placeholders
263 */
264 4 PMapString generateReplacementMap(const ProjectConfig & projectConfig, const GeneratorMode & mode, const PString & cmakeFindBody, const PString & phoenixPullExtraModule,
265 const PString & phoenixFindModule, const PString & phoenixGlobalDep, const PString & targetLinkBody,
266 const PString & pixiBody, const PString & markdownDepList, const PString & authorListPixi, const PString & nanobindCMakeSources,
267 const PString & rustModuleDeclarations)
268 {
269 4 PMapString mapReplace;
270
2/2
✓ Branch 0 (3→4) taken 1 times.
✓ Branch 1 (3→9) taken 3 times.
4 if(mode.type == ProjectType::NANOBIND_WRAPPER){
271
3/3
✓ Branch 0 (4→5) taken 1 times.
✓ Branch 2 (5→6) taken 1 times.
✓ Branch 4 (6→7) taken 1 times.
1 mapReplace["xxxnanobind_sourcesxxx"] = nanobindCMakeSources; //nanobind cmake sources
272 }
273
2/2
✓ Branch 0 (9→10) taken 1 times.
✓ Branch 1 (9→15) taken 3 times.
4 if(mode.type == ProjectType::RUST){
274
3/3
✓ Branch 0 (10→11) taken 1 times.
✓ Branch 2 (11→12) taken 1 times.
✓ Branch 4 (12→13) taken 1 times.
1 mapReplace["XXXRustModuleDeclarationsXXX"] = rustModuleDeclarations; //rust module declarations for lib.rs
275 }
276
3/3
✓ Branch 0 (15→16) taken 4 times.
✓ Branch 2 (16→17) taken 4 times.
✓ Branch 4 (17→18) taken 4 times.
4 mapReplace["XXXProjectNameXXX"] = projectConfig.name; //project name
277
3/3
✓ Branch 0 (19→20) taken 4 times.
✓ Branch 2 (20→21) taken 4 times.
✓ Branch 4 (21→22) taken 4 times.
4 mapReplace["XXXPROJECT_NAMEXXX"] = projectConfig.name.toUpper(); //project name uppercase
278
3/3
✓ Branch 0 (25→26) taken 4 times.
✓ Branch 2 (26→27) taken 4 times.
✓ Branch 4 (27→28) taken 4 times.
4 mapReplace["xxxproject_namexxx"] = projectConfig.name.toSnakeCase(); //project library
279
3/3
✓ Branch 0 (31→32) taken 4 times.
✓ Branch 2 (32→33) taken 4 times.
✓ Branch 4 (33→34) taken 4 times.
4 mapReplace["XXXProjectNameDescriptionXXX"] = projectConfig.description; //description
280
3/3
✓ Branch 0 (35→36) taken 4 times.
✓ Branch 2 (36→37) taken 4 times.
✓ Branch 4 (37→38) taken 4 times.
4 mapReplace["XXXProjectNameUrlXXX"] = projectConfig.url; //project url
281
3/3
✓ Branch 0 (39→40) taken 4 times.
✓ Branch 2 (40→41) taken 4 times.
✓ Branch 4 (41→42) taken 4 times.
4 mapReplace["XXXProjectVersionXXX"] = projectConfig.version; //project version
282
3/3
✓ Branch 0 (43→44) taken 4 times.
✓ Branch 2 (44→45) taken 4 times.
✓ Branch 4 (45→46) taken 4 times.
4 mapReplace["XXXProjectNameHomepageUrlXXX"] = projectConfig.url; //project doc url (TODO add it or deduce it from the project url for gitlab)
283
3/3
✓ Branch 0 (47→48) taken 4 times.
✓ Branch 2 (48→49) taken 4 times.
✓ Branch 4 (49→50) taken 4 times.
4 mapReplace["XXXProjectNameRunnerTagXXX"] = projectConfig.runnerTag; //Project CI runner tag
284
3/3
✓ Branch 0 (51→52) taken 4 times.
✓ Branch 2 (52→53) taken 4 times.
✓ Branch 4 (53→54) taken 4 times.
4 mapReplace["XXXProjectFindPackageDependenciesXXX"] = cmakeFindBody; //project find_package
285
3/3
✓ Branch 0 (55→56) taken 4 times.
✓ Branch 2 (56→57) taken 4 times.
✓ Branch 4 (57→58) taken 4 times.
4 mapReplace["XXXProjectPhoenixDependenciesXXX"] = phoenixPullExtraModule; //project pull_extra_module
286
3/3
✓ Branch 0 (59→60) taken 4 times.
✓ Branch 2 (60→61) taken 4 times.
✓ Branch 4 (61→62) taken 4 times.
4 mapReplace["XXXProjectNameCMakeFindDependenciesXXX"] = phoenixFindModule; //project dependencies of phoenix_create_find
287
3/3
✓ Branch 0 (63→64) taken 4 times.
✓ Branch 2 (64→65) taken 4 times.
✓ Branch 4 (65→66) taken 4 times.
4 mapReplace["XXXProjectDependenciesCMakeVarXXX"] = phoenixGlobalDep; //cmake variable to hold test dependencies
288
3/3
✓ Branch 0 (67→68) taken 4 times.
✓ Branch 2 (68→69) taken 4 times.
✓ Branch 4 (69→70) taken 4 times.
4 mapReplace["XXXProjectNameTargetLinkLibDependenciesXXX"] = targetLinkBody; //full target_link_library command of generated lib
289
5/5
✓ Branch 0 (71→72) taken 4 times.
✓ Branch 2 (72→73) taken 4 times.
✓ Branch 4 (73→74) taken 4 times.
✓ Branch 6 (74→75) taken 4 times.
✓ Branch 8 (75→76) taken 4 times.
4 mapReplace["XXXCxxWorkflowUrlXXX"] = projectConfig.ciToolkitUrl+"@"+projectConfig.ciToolkitVersion; //Url and version of the CI workflow
290
3/3
✓ Branch 0 (79→80) taken 4 times.
✓ Branch 2 (80→81) taken 4 times.
✓ Branch 4 (81→82) taken 4 times.
4 mapReplace["XXXGitlabPagesUrlXXX"] = getGitlabDocUrl(projectConfig.url); //group to which the project belongs to
291
3/3
✓ Branch 0 (85→86) taken 4 times.
✓ Branch 2 (86→87) taken 4 times.
✓ Branch 4 (87→88) taken 4 times.
4 mapReplace["xxxphoenixprojectpixipackagenamexxx"] = projectConfig.name.toLower(); //name of the pixi package
292
3/3
✓ Branch 0 (91→92) taken 4 times.
✓ Branch 2 (92→93) taken 4 times.
✓ Branch 4 (93→94) taken 4 times.
4 mapReplace["xxxprojectnamepixiextradependenciesxxx"] = pixiBody; //extra pixi dependencies
293
3/3
✓ Branch 0 (95→96) taken 4 times.
✓ Branch 2 (96→97) taken 4 times.
✓ Branch 4 (97→98) taken 4 times.
4 mapReplace["XXXProjectNameMarkdownListDependenciesXXX"] = markdownDepList; //markdown list of Phoenix dependencies
294
3/3
✓ Branch 0 (99→100) taken 4 times.
✓ Branch 2 (100→101) taken 4 times.
✓ Branch 4 (101→102) taken 4 times.
4 mapReplace["XXXProjectAuthorListPixiXXX"] = authorListPixi; //author list for pixi.toml
295 4 return mapReplace;
296 ✗ }
297
298 ///Generate all replacement data for project generation
299 /** @param projectConfig : project configuration
300 * @return replacement map for placeholders
301 */
302 4 PMapString generateAllReplacementData(const ProjectConfig & projectConfig, const GeneratorMode & mode, const PVecPath & vecClassConfigFile){
303 // Generate various bodies using dedicated functions
304
1/1
✓ Branch 0 (2→3) taken 4 times.
4 PString cmakeFindBody = generateCmakeFindBody(projectConfig);
305
1/1
✓ Branch 0 (3→4) taken 4 times.
4 PString phoenixPullExtraModule = generatePhoenixPullExtraModule(projectConfig);
306
1/1
✓ Branch 0 (4→5) taken 4 times.
4 PString phoenixFindModule = generatePhoenixFindModule(projectConfig);
307
1/1
✓ Branch 0 (5→6) taken 4 times.
4 PString phoenixGlobalDep = generatePhoenixGlobalDep(projectConfig);
308
1/1
✓ Branch 0 (6→7) taken 4 times.
4 PString targetLinkBody = generateTargetLinkBody(projectConfig);
309
1/1
✓ Branch 0 (7→8) taken 4 times.
4 PString pixiBody = generatePixiBody(projectConfig);
310
1/1
✓ Branch 0 (8→9) taken 4 times.
4 PString markdownDepList = generateMarkdownDepList(projectConfig);
311
1/1
✓ Branch 0 (9→10) taken 4 times.
4 PString authorListPixi = generateAuthorListPixi(projectConfig);
312
1/1
✓ Branch 0 (10→11) taken 4 times.
4 PString nanobindCMakeSources;
313
2/2
✓ Branch 0 (11→12) taken 1 times.
✓ Branch 1 (11→16) taken 3 times.
4 if(mode.type == ProjectType::NANOBIND_WRAPPER){
314
1/1
✓ Branch 0 (12→13) taken 1 times.
1 nanobindCMakeSources = generateNanobindCmakeSources(projectConfig, vecClassConfigFile, mode);
315 }
316
1/1
✓ Branch 0 (16→17) taken 4 times.
4 PString rustModuleDeclarations;
317
2/2
✓ Branch 0 (17→18) taken 1 times.
✓ Branch 1 (17→22) taken 3 times.
4 if(mode.type == ProjectType::RUST){
318
1/1
✓ Branch 0 (18→19) taken 1 times.
1 rustModuleDeclarations = generateRustModuleDeclarations(vecClassConfigFile);
319 }
320
321 time_t timestamp;
322
1/1
✓ Branch 0 (24→25) taken 4 times.
4 PString dateStr = ctime(&(timestamp = time(nullptr)));
323
2/2
✓ Branch 0 (25→26) taken 4 times.
✓ Branch 2 (26→27) taken 4 times.
4 dateStr = dateStr.eraseLastChar("\n"); // Remove the trailing \n
324
325 // Generate the replacement map
326 return generateReplacementMap(projectConfig, mode, cmakeFindBody, phoenixPullExtraModule,
327 phoenixFindModule, phoenixGlobalDep, targetLinkBody,
328
1/1
✓ Branch 0 (30→31) taken 4 times.
8 pixiBody, markdownDepList, authorListPixi, nanobindCMakeSources, rustModuleDeclarations);
329 4 }
330
331 ///Load configuration pdata of generated sources
332 /** @param[out] param : ProjectParam to be updated
333 * @param pdataDir : directory where to save pdata configuration
334 * @param vecClassConfigFile : vector of class configuration files (.pdata files)
335 * @return true on success, false otherwise
336 */
337 4 bool simple_project_load_config(ProjectParam & param, const PPath & pdataDir, const PVecPath & vecClassConfigFile){
338 4 bool b(true);
339
2/2
✓ Branch 0 (42→4) taken 8 times.
✓ Branch 1 (42→43) taken 4 times.
16 for(const PPath & classConfigFile : vecClassConfigFile){
340
1/1
✓ Branch 0 (6→7) taken 8 times.
8 PDataConfig dataConfig;
341
2/2
✓ Branch 0 (7→8) taken 8 times.
✓ Branch 2 (8→9) taken 8 times.
8 dataConfig.getFileName() = classConfigFile;
342
4/5
✓ Branch 0 (9→10) taken 8 times.
✓ Branch 2 (10→11) taken 8 times.
✓ Branch 4 (11→12) taken 8 times.
✗ Branch 6 (12→13) not taken.
✓ Branch 7 (12→18) taken 8 times.
8 if(!parserClassConfig(dataConfig.getVecClassConfig(), dataConfig.getVecInclude(), classConfigFile)){
343 ✗ std::cerr << "simple_project_load_config : can't load file '" << classConfigFile << "'" << std::endl;
344 ✗ b = false; //Best effort strategy
345 }
346
1/1
✓ Branch 0 (18→19) taken 8 times.
8 param.vecDataConfig.push_back(dataConfig);
347
348
2/2
✓ Branch 0 (19→20) taken 8 times.
✓ Branch 2 (20→21) taken 8 times.
8 PPath destFile = pdataDir / classConfigFile.getFileName();
349
1/1
✓ Branch 0 (22→23) taken 8 times.
8 PString fileContent = classConfigFile.loadFileContent();
350
2/3
✓ Branch 0 (23→24) taken 8 times.
✗ Branch 2 (24→25) not taken.
✓ Branch 3 (24→30) taken 8 times.
8 if(!destFile.saveFileContent(fileContent)){
351 ✗ std::cerr << "simple_project_load_config : cannot copy pdata file to project pdata directory '"<<destFile<<"'" << std::endl;
352 ✗ b = false; //Best effort strategy
353 }
354 8 }
355 4 return b;
356 }
357
358 ///Generate C++ classes with all standard traits
359 /** @param projectParam : ProjectParam to be used
360 * @return true on success, false otherwise
361 */
362 2 bool generateCppClassesFull(const ProjectParam & projectParam){
363
1/1
✓ Branch 0 (2→3) taken 2 times.
2 PTraitBackendManager manager;
364
1/1
✓ Branch 0 (3→4) taken 2 times.
2 manager.addTraitBackend<CppTraitFromString>();
365
1/1
✓ Branch 0 (4→5) taken 2 times.
2 manager.addTraitBackend<CppTraitCopy>();
366
1/1
✓ Branch 0 (5→6) taken 2 times.
2 manager.addTraitBackend<CppTraitSetter>();
367
1/1
✓ Branch 0 (6→7) taken 2 times.
2 manager.addTraitBackend<CppTraitGetter>();
368
1/1
✓ Branch 0 (7→8) taken 2 times.
2 manager.addTraitBackend<CppTraitTypeStream>();
369
1/1
✓ Branch 0 (8→9) taken 2 times.
2 manager.addTraitBackend<CppTraitDataStream>();
370
1/1
✓ Branch 0 (9→10) taken 2 times.
2 manager.addTraitBackend<CppTraitConfigStream>();
371
1/1
✓ Branch 0 (10→11) taken 2 times.
2 manager.addTraitBackend<CppTraitCheckStream>();
372
1/1
✓ Branch 0 (11→12) taken 2 times.
4 return generator_class_full(manager, projectParam);
373 2 }
374
375 ///Generate wrapper classes
376 /** @param projectParam : ProjectParam to be used
377 * @return true on success, false otherwise
378 */
379 1 bool generateWrapperClassesFull(const ProjectParam & projectParam){
380
1/1
✓ Branch 0 (2→3) taken 1 times.
1 PWrapperTraitBackendManager manager;
381
1/1
✓ Branch 0 (3→4) taken 1 times.
1 manager.addTraitBackend<WrapperTraitGetterSetter>();
382
1/1
✓ Branch 0 (4→5) taken 1 times.
1 manager.addTraitBackend<WrapperTraitTypeStream>();
383
1/1
✓ Branch 0 (5→6) taken 1 times.
1 manager.addTraitBackend<WrapperTraitDataStream>();
384
1/1
✓ Branch 0 (6→7) taken 1 times.
2 return wrapper_generator_class_full(manager, projectParam);
385 1 }
386
387 ///Generate nanobind wrapper classes
388 /** @param projectParam : ProjectParam to be used
389 * @return true on success, false otherwise
390 */
391 1 bool generateNanobindClassesFull(const ProjectParam & projectParam){
392
1/1
✓ Branch 0 (2→3) taken 1 times.
1 PNanobindTraitBackendManager manager;
393
1/1
✓ Branch 0 (3→4) taken 1 times.
1 manager.addTraitBackend<NanobindTraitProperty>();
394
1/1
✓ Branch 0 (4→5) taken 1 times.
1 manager.addTraitBackend<NanobindTraitMethod>();
395
1/1
✓ Branch 0 (5→6) taken 1 times.
1 manager.addTraitBackend<NanobindTraitTypeStream>();
396
1/1
✓ Branch 0 (6→7) taken 1 times.
1 manager.addTraitBackend<NanobindTraitDataStream>();
397
1/1
✓ Branch 0 (7→8) taken 1 times.
1 manager.addTraitBackend<NanobindTraitCheckStream>();
398
1/1
✓ Branch 0 (8→9) taken 1 times.
1 manager.addTraitBackend<NanobindTraitTestSetup>();
399
1/1
✓ Branch 0 (9→10) taken 1 times.
1 manager.addTraitBackend<NanobindTraitInclude>();
400
1/1
✓ Branch 0 (10→11) taken 1 times.
2 return generator_nanobind_full(manager, projectParam);
401 1 }
402
403
404 ///Generate rust classes
405 /** @param projectParam : ProjectParam to be used
406 * @return true on success, false otherwise
407 */
408 1 bool generateRustClassesFull(const ProjectParam & projectParam){
409
1/1
✓ Branch 0 (2→3) taken 1 times.
1 ProjectParam updatedParam(projectParam);
410
1/1
✓ Branch 0 (3→4) taken 1 times.
1 updatedParam.mode.moduleName = updatedParam.name.toLower(); //Cargo crate name, matches xxxphoenixprojectpixipackagenamexxx
411
1/1
✓ Branch 0 (6→7) taken 1 times.
1 PRustTraitBackendManager manager;
412
1/1
✓ Branch 0 (7→8) taken 1 times.
1 manager.addTraitBackend<RustTraitGetterSetter>();
413
1/1
✓ Branch 0 (8→9) taken 1 times.
2 return generator_rust_class_full(manager, updatedParam);
414 1 }
415
416 ///Create a ProjectParam with PString and PPath converted into std::string
417 /** @param projectParam : ProjectParam to be converted
418 * @return converted ProjectParam
419 */
420 1 ProjectParam stripNanobindUnsupportedType(const ProjectParam & projectParam){
421 1 ProjectParam output(projectParam);
422 1 PVecDataConfig & vecConfig = output.vecDataConfig;
423
2/2
✓ Branch 0 (64→4) taken 2 times.
✓ Branch 1 (64→65) taken 1 times.
6 for(PVecDataConfig::iterator itConfig(vecConfig.begin()); itConfig != vecConfig.end(); ++itConfig){
424
1/1
✓ Branch 0 (6→7) taken 2 times.
2 PVecClassConfig & vecClass = itConfig->getVecClassConfig();
425
2/2
✓ Branch 0 (53→8) taken 4 times.
✓ Branch 1 (53→54) taken 2 times.
12 for(PVecClassConfig::iterator itClass(vecClass.begin()); itClass != vecClass.end(); ++itClass){
426
1/1
✓ Branch 0 (10→11) taken 4 times.
4 PVecClassAttribute & vecAttr = itClass->getListAttribute();
427
2/2
✓ Branch 0 (42→12) taken 11 times.
✓ Branch 1 (42→43) taken 4 times.
30 for(PVecClassAttribute::iterator itAttr(vecAttr.begin()); itAttr != vecAttr.end(); ++itAttr){
428
2/2
✓ Branch 0 (14→15) taken 11 times.
✓ Branch 2 (15→16) taken 11 times.
22 PString name = itAttr->getType();
429
7/7
✓ Branch 0 (18→19) taken 11 times.
✓ Branch 2 (19→20) taken 11 times.
✓ Branch 4 (20→21) taken 11 times.
✓ Branch 6 (21→22) taken 11 times.
✓ Branch 8 (22→23) taken 11 times.
✓ Branch 10 (23→24) taken 11 times.
✓ Branch 12 (24→25) taken 11 times.
11 itAttr->setType(name.replace("PPath", "std::string").replace("PString", "std::string"));
430 11 }
431 }
432 }
433 1 return output;
434 ✗ }
435
436 ///Save generated sources of project
437 /** @param projectParam : ProjectParam to be used
438 * @return true on success, false otherwise
439 */
440 4 bool simple_project_generate_source(const ProjectParam & projectParam){
441
4/5
✓ Branch 0 (2→3) taken 1 times.
✓ Branch 1 (2→5) taken 1 times.
✓ Branch 2 (2→7) taken 1 times.
✓ Branch 3 (2→16) taken 1 times.
✗ Branch 4 (2→18) not taken.
4 switch(projectParam.mode.type){
442 1 case ProjectType::CPP:
443 1 return generateCppClassesFull(projectParam);
444 1 case ProjectType::WRAPPER:
445 1 return generateWrapperClassesFull(projectParam);
446 1 case ProjectType::NANOBIND_WRAPPER:
447 {
448
1/1
✓ Branch 0 (7→8) taken 1 times.
1 ProjectParam strip(stripNanobindUnsupportedType(projectParam));
449
4/6
✓ Branch 0 (8→9) taken 1 times.
✓ Branch 2 (9→10) taken 1 times.
✗ Branch 3 (9→13) not taken.
✓ Branch 4 (10→11) taken 1 times.
✓ Branch 6 (11→12) taken 1 times.
✗ Branch 7 (11→13) not taken.
1 return generateCppClassesFull(strip) && generateNanobindClassesFull(strip);
450 1 }
451 1 case ProjectType::RUST:
452 1 return generateRustClassesFull(projectParam);
453 ✗ default:
454 ✗ return false;
455 }
456 }
457
458 ///Create a simple project from a configuration
459 /** @param descriptionFile : description of the full project
460 * @param vecClassConfigFile : vector of class configuration files (.pdata files)
461 * @param projectType : type of the project (SimpleCpp)
462 * @param mode : all modes of the generator (data/check/type/config stream)
463 * @return true on success, false otherwise
464 */
465 5 bool simple_project_generator(const PPath & descriptionFile, const PVecPath & vecClassConfigFile, const PString & projectType,
466 const GeneratorMode & mode)
467 {
468 //First, let's read the toml config of the project
469
1/1
✓ Branch 0 (2→3) taken 5 times.
5 ProjectConfig projectConfig;
470
2/3
✓ Branch 0 (3→4) taken 5 times.
✗ Branch 2 (4→5) not taken.
✓ Branch 3 (4→10) taken 5 times.
5 if(!project_generator_loadConfig(projectConfig, descriptionFile)){
471 ✗ std::cerr << "simple_project_generator : cannot parse project description file '"<<descriptionFile<<"'" << std::endl;
472 ✗ return false;
473 }
474 //Then look in the config files if the packages exists
475
3/3
✓ Branch 0 (10→11) taken 5 times.
✓ Branch 2 (11→12) taken 1 times.
✓ Branch 3 (11→17) taken 4 times.
5 if(!project_generator_loadPackageInfo(projectConfig)){
476
4/4
✓ Branch 0 (12→13) taken 1 times.
✓ Branch 2 (13→14) taken 1 times.
✓ Branch 4 (14→15) taken 1 times.
✓ Branch 6 (15→16) taken 1 times.
1 std::cerr << "simple_project_generator : cannot find package info of project '"<<projectConfig.name<<"'" << std::endl;
477 1 return false;
478 }
479 // Generate replacement data
480
1/1
✓ Branch 0 (17→18) taken 4 times.
4 PMapString mapReplace = generateAllReplacementData(projectConfig, mode, vecClassConfigFile);
481
14/14
✓ Branch 0 (18→19) taken 4 times.
✓ Branch 2 (19→20) taken 4 times.
✓ Branch 4 (20→21) taken 4 times.
✓ Branch 6 (21→22) taken 4 times.
✓ Branch 8 (22→23) taken 4 times.
✓ Branch 10 (23→24) taken 4 times.
✓ Branch 12 (24→25) taken 4 times.
✓ Branch 14 (25→26) taken 4 times.
✓ Branch 16 (26→27) taken 4 times.
✓ Branch 18 (27→28) taken 4 times.
✓ Branch 20 (28→29) taken 4 times.
✓ Branch 22 (29→30) taken 4 times.
✓ Branch 24 (41→42) taken 4 times.
✓ Branch 26 (42→43) taken 4 times.
4 PPath inputConfigPlaceholderDir = PPath::getProgramPrefix() / PPath("share") / PPath("PhoenixGenerator") / PPath("Projects") / PPath(projectType), outputPath("./");
482
2/3
✓ Branch 0 (44→45) taken 4 times.
✗ Branch 2 (45→46) not taken.
✓ Branch 3 (45→51) taken 4 times.
4 if(!directory_replace_placeholder(outputPath, inputConfigPlaceholderDir, mapReplace)){
483 ✗ std::cerr << "simple_project_generator : cannot replace placeholder in project generation '"<<projectConfig.name<<"'" << std::endl;
484 ✗ return false;
485 }
486
4/4
✓ Branch 0 (51→52) taken 4 times.
✓ Branch 2 (52→53) taken 4 times.
✓ Branch 4 (53→54) taken 4 times.
✓ Branch 6 (54→55) taken 4 times.
4 PPath mainPath = PPath(".") / PPath(projectConfig.name);
487
6/6
✓ Branch 0 (58→59) taken 4 times.
✓ Branch 2 (59→60) taken 4 times.
✓ Branch 4 (60→61) taken 4 times.
✓ Branch 6 (63→64) taken 4 times.
✓ Branch 8 (64→65) taken 4 times.
✓ Branch 10 (65→66) taken 4 times.
4 PPath srcPath = mainPath / PPath("src"), pdataDir = mainPath / PPath("pdata");
488
2/3
✓ Branch 0 (68→69) taken 4 times.
✗ Branch 2 (69→70) not taken.
✓ Branch 3 (69→75) taken 4 times.
4 if(!pdataDir.createDirectory()){
489 ✗ std::cerr << "simple_project_generator : cannot create pdata directory '"<<pdataDir<<"'" << std::endl;
490 ✗ return false;
491 }
492
1/1
✓ Branch 0 (75→76) taken 4 times.
4 ProjectParam param;
493
1/1
✓ Branch 0 (76→77) taken 4 times.
4 param.mode = mode;
494
1/1
✓ Branch 0 (77→78) taken 4 times.
4 param.name = projectConfig.name;
495
1/1
✓ Branch 0 (78→79) taken 4 times.
4 param.version = projectConfig.version;
496
1/1
✓ Branch 0 (79→80) taken 4 times.
4 param.outputProjectDir = mainPath;
497
1/1
✓ Branch 0 (80→81) taken 4 times.
4 param.outputSourceDir = srcPath;
498
4/4
✓ Branch 0 (81→82) taken 3 times.
✓ Branch 1 (81→83) taken 1 times.
✓ Branch 2 (82→83) taken 1 times.
✓ Branch 3 (82→91) taken 2 times.
4 if(param.mode.type == ProjectType::CPP || param.mode.type == ProjectType::NANOBIND_WRAPPER){
499
3/3
✓ Branch 0 (83→84) taken 2 times.
✓ Branch 2 (84→85) taken 2 times.
✓ Branch 4 (85→86) taken 2 times.
2 param.outputTestDir = mainPath / PPath("TESTS");
500
3/4
✓ Branch 0 (91→92) taken 1 times.
✓ Branch 1 (91→93) taken 1 times.
✓ Branch 2 (92→93) taken 1 times.
✗ Branch 3 (92→101) not taken.
2 }else if(param.mode.type == ProjectType::WRAPPER || param.mode.type == ProjectType::RUST){
501
3/3
✓ Branch 0 (93→94) taken 2 times.
✓ Branch 2 (94→95) taken 2 times.
✓ Branch 4 (95→96) taken 2 times.
2 param.outputTestDir = mainPath / PPath("tests");
502 }
503
504
2/3
✓ Branch 0 (101→102) taken 4 times.
✗ Branch 2 (102→103) not taken.
✓ Branch 3 (102→108) taken 4 times.
4 if(!simple_project_load_config(param, pdataDir, vecClassConfigFile)){
505 ✗ std::cerr << "simple_project_generator : cannot load config to generate project in '"<<srcPath<<"'" << std::endl;
506 ✗ return false;
507 }
508
2/3
✓ Branch 0 (108→109) taken 4 times.
✗ Branch 2 (109→110) not taken.
✓ Branch 3 (109→115) taken 4 times.
4 if(!simple_project_generate_source(param)){
509 ✗ std::cerr << "simple_project_generator : cannot generate sources in '"<<srcPath<<"'" << std::endl;
510 ✗ return false;
511 }
512 // Generate class generator script
513
2/3
✓ Branch 0 (115→116) taken 4 times.
✗ Branch 2 (116→117) not taken.
✓ Branch 3 (116→122) taken 4 times.
4 if(!generateClassGeneratorScript(vecClassConfigFile, pdataDir, param.mode)){
514 ✗ std::cerr << "simple_project_generator : cannot generate class generator script in pdata directory '"<<pdataDir<<"'" << std::endl;
515 ✗ return false;
516 }
517 4 return true;
518 5 }
519
520
521