| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*************************************** | ||
| 2 | Auteur : Pierre Aubert | ||
| 3 | Mail : pierre.aubert@lapp.in2p3.fr | ||
| 4 | Licence : CeCILL-C | ||
| 5 | ****************************************/ | ||
| 6 | |||
| 7 | #include <ctime> | ||
| 8 | |||
| 9 | #include "directory_replace_placeholder.h" | ||
| 10 | #include "simple_project_generator.h" | ||
| 11 | #include "parserClassConfig.h" | ||
| 12 | |||
| 13 | //C++ Trait Backend | ||
| 14 | #include "CppTraitFromString.h" | ||
| 15 | #include "CppTraitSetter.h" | ||
| 16 | #include "CppTraitGetter.h" | ||
| 17 | #include "CppTraitCopy.h" | ||
| 18 | #include "CppTraitTypeStream.h" | ||
| 19 | #include "CppTraitDataStream.h" | ||
| 20 | #include "CppTraitConfigStream.h" | ||
| 21 | #include "CppTraitCheckStream.h" | ||
| 22 | |||
| 23 | #include "PTraitBackendManager.h" | ||
| 24 | |||
| 25 | //Wrapper Trait Backend | ||
| 26 | #include "WrapperTraitGetterSetter.h" | ||
| 27 | #include "WrapperTraitTypeStream.h" | ||
| 28 | #include "WrapperTraitDataStream.h" | ||
| 29 | |||
| 30 | #include "PWrapperTraitBackendManager.h" | ||
| 31 | |||
| 32 | //C++ Generator | ||
| 33 | #include "generator_class_cpp.h" | ||
| 34 | //Wrapper Generator | ||
| 35 | #include "wrapper_generator_struct.h" | ||
| 36 | |||
| 37 | #include "simpleClassGenerator.h" | ||
| 38 | |||
| 39 | ///Check if a package is a Phoenix dependency | ||
| 40 | /** @param packageName : name of the package | ||
| 41 | * @return true if it's a Phoenix dependency, false otherwise | ||
| 42 | */ | ||
| 43 | 54 | bool isPhoenixDependency(const PString & packageName){ | |
| 44 |
10/16✓ Branch 0 (2→3) taken 54 times.
✓ Branch 2 (3→4) taken 54 times.
✓ Branch 4 (4→5) taken 6 times.
✓ Branch 5 (4→8) taken 48 times.
✓ Branch 6 (5→6) taken 6 times.
✓ Branch 8 (6→7) taken 6 times.
✗ Branch 10 (7→8) not taken.
✓ Branch 11 (7→9) taken 6 times.
✓ Branch 12 (11→12) taken 6 times.
✓ Branch 13 (11→13) taken 48 times.
✓ Branch 14 (13→14) taken 54 times.
✗ Branch 15 (13→15) not taken.
✗ Branch 16 (17→18) not taken.
✗ Branch 17 (17→19) not taken.
✗ Branch 18 (21→22) not taken.
✗ Branch 19 (21→23) not taken.
|
54 | return (packageName.isSameBegining("Phoenix") || packageName.isSameBegining("phoenix")); |
| 45 | } | ||
| 46 | |||
| 47 | ///Generate CMake find_package commands for non-Phoenix dependencies | ||
| 48 | /** @param projectConfig : project configuration | ||
| 49 | * @return CMake find_package commands | ||
| 50 | */ | ||
| 51 | 2 | PString generateCmakeFindBody(const ProjectConfig & projectConfig){ | |
| 52 | 2 | PString cmakeFindBody; | |
| 53 |
2/2✓ Branch 0 (21→4) taken 9 times.
✓ Branch 1 (21→22) taken 2 times.
|
11 | for(PackageMap::const_iterator depIt = projectConfig.mapDependencies.begin(); depIt != projectConfig.mapDependencies.end(); ++depIt){ |
| 54 | 9 | const PPackageAttribute & pkgAttr = depIt->second; | |
| 55 |
4/4✓ Branch 0 (5→6) taken 9 times.
✓ Branch 2 (6→7) taken 9 times.
✓ Branch 4 (7→8) taken 1 times.
✓ Branch 5 (7→18) taken 8 times.
|
9 | if(!isPhoenixDependency(pkgAttr.getName())){ |
| 56 |
2/3✓ Branch 0 (8→9) taken 1 times.
✓ Branch 2 (10→11) taken 1 times.
✗ Branch 3 (10→18) not taken.
|
1 | if(!pkgAttr.getCmakeFind().empty()){ |
| 57 |
4/4✓ Branch 0 (11→12) taken 1 times.
✓ Branch 2 (12→13) taken 1 times.
✓ Branch 4 (13→14) taken 1 times.
✓ Branch 6 (14→15) taken 1 times.
|
1 | cmakeFindBody += "find_package("+pkgAttr.getCmakeFind()+")"; |
| 58 | } | ||
| 59 | } | ||
| 60 | } | ||
| 61 | 2 | return cmakeFindBody; | |
| 62 | ✗ | } | |
| 63 | |||
| 64 | ///Generate Phoenix pull_extra_module commands | ||
| 65 | /** @param projectConfig : project configuration | ||
| 66 | * @return Phoenix pull_extra_module commands | ||
| 67 | */ | ||
| 68 | 2 | PString generatePhoenixPullExtraModule(const ProjectConfig & projectConfig){ | |
| 69 | 2 | PString phoenixPullExtraModule; | |
| 70 |
2/2✓ Branch 0 (23→4) taken 9 times.
✓ Branch 1 (23→24) taken 2 times.
|
11 | for(PackageMap::const_iterator depIt = projectConfig.mapDependencies.begin(); depIt != projectConfig.mapDependencies.end(); ++depIt){ |
| 71 | 9 | const PPackageAttribute & pkgAttr = depIt->second; | |
| 72 |
4/4✓ Branch 0 (5→6) taken 9 times.
✓ Branch 2 (6→7) taken 9 times.
✓ Branch 4 (7→8) taken 8 times.
✓ Branch 5 (7→20) taken 1 times.
|
9 | if(isPhoenixDependency(pkgAttr.getName())){ |
| 73 |
7/7✓ Branch 0 (8→9) taken 8 times.
✓ Branch 2 (9→10) taken 8 times.
✓ Branch 4 (10→11) taken 8 times.
✓ Branch 6 (11→12) taken 8 times.
✓ Branch 8 (12→13) taken 8 times.
✓ Branch 10 (13→14) taken 8 times.
✓ Branch 12 (14→15) taken 8 times.
|
8 | phoenixPullExtraModule += "pull_extra_module(\""+pkgAttr.getName()+"\" \""+pkgAttr.getUrl()+"\")\n"; |
| 74 | } | ||
| 75 | } | ||
| 76 | 2 | return phoenixPullExtraModule; | |
| 77 | ✗ | } | |
| 78 | |||
| 79 | ///Generate Phoenix find module list | ||
| 80 | /** @param projectConfig : project configuration | ||
| 81 | * @return Phoenix find module list | ||
| 82 | */ | ||
| 83 | 2 | PString generatePhoenixFindModule(const ProjectConfig & projectConfig){ | |
| 84 | 2 | PString phoenixFindModule; | |
| 85 |
2/2✓ Branch 0 (16→4) taken 9 times.
✓ Branch 1 (16→17) taken 2 times.
|
11 | for(PackageMap::const_iterator depIt = projectConfig.mapDependencies.begin(); depIt != projectConfig.mapDependencies.end(); ++depIt){ |
| 86 | 9 | const PPackageAttribute & pkgAttr = depIt->second; | |
| 87 |
4/4✓ Branch 0 (5→6) taken 9 times.
✓ Branch 2 (6→7) taken 9 times.
✓ Branch 4 (7→8) taken 8 times.
✓ Branch 5 (7→13) taken 1 times.
|
9 | if(isPhoenixDependency(pkgAttr.getName())){ |
| 88 |
3/3✓ Branch 0 (8→9) taken 8 times.
✓ Branch 2 (9→10) taken 8 times.
✓ Branch 4 (10→11) taken 8 times.
|
8 | phoenixFindModule += " "+pkgAttr.getName(); |
| 89 | } | ||
| 90 | } | ||
| 91 | 2 | return phoenixFindModule; | |
| 92 | ✗ | } | |
| 93 | |||
| 94 | ///Generate Phoenix global dependencies variable | ||
| 95 | /** @param projectConfig : project configuration | ||
| 96 | * @return Phoenix global dependencies variable | ||
| 97 | */ | ||
| 98 | 2 | PString generatePhoenixGlobalDep(const ProjectConfig & projectConfig){ | |
| 99 | 2 | PString phoenixGlobalDep; | |
| 100 |
4/4✓ Branch 0 (3→4) taken 2 times.
✓ Branch 2 (4→5) taken 2 times.
✓ Branch 4 (5→6) taken 2 times.
✓ Branch 6 (6→7) taken 2 times.
|
2 | phoenixGlobalDep += "set(" + projectConfig.name.toUpper() + "_TEST_DEPENDENCIES\n"; |
| 101 |
4/4✓ Branch 0 (10→11) taken 2 times.
✓ Branch 2 (11→12) taken 2 times.
✓ Branch 4 (12→13) taken 2 times.
✓ Branch 6 (13→14) taken 2 times.
|
2 | phoenixGlobalDep += "\t" + projectConfig.name.toSnakeCase() + "\n"; |
| 102 |
3/3✓ Branch 0 (31→32) taken 11 times.
✓ Branch 2 (32→18) taken 9 times.
✓ Branch 3 (32→33) taken 2 times.
|
11 | for(PackageMap::const_reverse_iterator depIt = projectConfig.mapDependencies.rbegin(); depIt != projectConfig.mapDependencies.rend(); ++depIt){ |
| 103 |
1/1✓ Branch 0 (18→19) taken 9 times.
|
9 | const PPackageAttribute & pkgAttr = depIt->second; |
| 104 |
4/4✓ Branch 0 (19→20) taken 9 times.
✓ Branch 2 (20→21) taken 9 times.
✓ Branch 4 (21→22) taken 8 times.
✓ Branch 5 (21→29) taken 1 times.
|
9 | if(isPhoenixDependency(pkgAttr.getName())){ |
| 105 |
4/4✓ Branch 0 (22→23) taken 8 times.
✓ Branch 2 (23→24) taken 8 times.
✓ Branch 4 (24→25) taken 8 times.
✓ Branch 6 (25→26) taken 8 times.
|
8 | phoenixGlobalDep += "\t"+pkgAttr.getCmakeLib()+"\n"; |
| 106 | } | ||
| 107 | } | ||
| 108 |
1/1✓ Branch 0 (33→34) taken 2 times.
|
2 | phoenixGlobalDep += ")"; |
| 109 | 2 | return phoenixGlobalDep; | |
| 110 | ✗ | } | |
| 111 | |||
| 112 | ///Generate target_link_libraries command | ||
| 113 | /** @param projectConfig : project configuration | ||
| 114 | * @return target_link_libraries command | ||
| 115 | */ | ||
| 116 | 2 | PString generateTargetLinkBody(const ProjectConfig & projectConfig){ | |
| 117 | 2 | PString targetLinkBody; | |
| 118 |
4/4✓ Branch 0 (3→4) taken 2 times.
✓ Branch 2 (4→5) taken 2 times.
✓ Branch 4 (5→6) taken 2 times.
✓ Branch 6 (6→7) taken 2 times.
|
2 | targetLinkBody += "target_link_libraries("+projectConfig.name.toSnakeCase()+" "; |
| 119 |
2/2✓ Branch 0 (23→11) taken 9 times.
✓ Branch 1 (23→24) taken 2 times.
|
11 | for(PackageMap::const_iterator depIt = projectConfig.mapDependencies.begin(); depIt != projectConfig.mapDependencies.end(); ++depIt){ |
| 120 | 9 | const PPackageAttribute & pkgAttr = depIt->second; | |
| 121 |
4/4✓ Branch 0 (12→13) taken 9 times.
✓ Branch 2 (13→14) taken 9 times.
✓ Branch 4 (14→15) taken 1 times.
✓ Branch 5 (14→20) taken 8 times.
|
9 | if(!isPhoenixDependency(pkgAttr.getName())){ |
| 122 |
3/3✓ Branch 0 (15→16) taken 1 times.
✓ Branch 2 (16→17) taken 1 times.
✓ Branch 4 (17→18) taken 1 times.
|
1 | targetLinkBody += pkgAttr.getCmakeLib()+" "; |
| 123 | } | ||
| 124 | } | ||
| 125 |
1/1✓ Branch 0 (24→25) taken 2 times.
|
2 | targetLinkBody += ")\n"; |
| 126 | 2 | return targetLinkBody; | |
| 127 | ✗ | } | |
| 128 | |||
| 129 | ///Generate Pixi dependencies | ||
| 130 | /** @param projectConfig : project configuration | ||
| 131 | * @return Pixi dependencies | ||
| 132 | */ | ||
| 133 | 2 | PString generatePixiBody(const ProjectConfig & projectConfig){ | |
| 134 | 2 | PString pixiBody; | |
| 135 |
2/2✓ Branch 0 (69→4) taken 9 times.
✓ Branch 1 (69→70) taken 2 times.
|
11 | for(PackageMap::const_iterator depIt = projectConfig.mapDependencies.begin(); depIt != projectConfig.mapDependencies.end(); ++depIt){ |
| 136 | 9 | const PPackageAttribute & pkgAttr = depIt->second; | |
| 137 |
2/2✓ Branch 0 (5→6) taken 9 times.
✓ Branch 2 (6→7) taken 9 times.
|
9 | PString pixi_name = pkgAttr.getPixiName().toLower(); |
| 138 |
2/2✓ Branch 0 (7→8) taken 9 times.
✓ Branch 2 (8→9) taken 9 times.
|
9 | PString min_version = pkgAttr.getMinVersion(); |
| 139 |
2/2✓ Branch 0 (9→10) taken 9 times.
✓ Branch 2 (10→11) taken 9 times.
|
9 | PString max_version = pkgAttr.getMaxVersion(); |
| 140 |
2/3✓ Branch 0 (11→12) taken 9 times.
✗ Branch 2 (12→13) not taken.
✓ Branch 3 (12→14) taken 9 times.
|
9 | if(pixi_name == "") continue; |
| 141 |
5/6✓ Branch 0 (15→16) taken 1 times.
✓ Branch 1 (15→19) taken 8 times.
✓ Branch 2 (17→18) taken 1 times.
✗ Branch 3 (17→19) not taken.
✓ Branch 4 (20→21) taken 1 times.
✓ Branch 5 (20→25) taken 8 times.
|
9 | else if(min_version.empty() && max_version.empty()){ |
| 142 |
2/2✓ Branch 0 (21→22) taken 1 times.
✓ Branch 2 (22→23) taken 1 times.
|
1 | pixiBody += pixi_name + " = \"*\"\n"; |
| 143 |
2/2✓ Branch 0 (26→27) taken 1 times.
✓ Branch 1 (26→35) taken 7 times.
|
8 | }else if(max_version.empty()){ |
| 144 |
4/4✓ Branch 0 (27→28) taken 1 times.
✓ Branch 2 (28→29) taken 1 times.
✓ Branch 4 (29→30) taken 1 times.
✓ Branch 6 (30→31) taken 1 times.
|
1 | pixiBody += pixi_name + " = \"" + min_version + "\"\n"; |
| 145 | }else{ | ||
| 146 |
3/3✓ Branch 0 (35→36) taken 7 times.
✓ Branch 2 (36→37) taken 7 times.
✓ Branch 4 (37→38) taken 7 times.
|
7 | pixiBody += pixi_name + " = \"" + min_version; |
| 147 |
4/7✓ Branch 0 (41→42) taken 7 times.
✗ Branch 1 (41→45) not taken.
✓ Branch 2 (43→44) taken 7 times.
✗ Branch 3 (43→45) not taken.
✓ Branch 4 (46→47) taken 7 times.
✗ Branch 5 (46→48) not taken.
✓ Branch 6 (47→48) taken 7 times.
|
7 | if(!min_version.empty() && !max_version.empty()) pixiBody += ","; |
| 148 |
2/2✓ Branch 0 (48→49) taken 7 times.
✓ Branch 2 (49→50) taken 7 times.
|
7 | pixiBody += max_version + "\"\n"; |
| 149 | } | ||
| 150 | 9 | } | |
| 151 | 2 | return pixiBody; | |
| 152 | ✗ | } | |
| 153 | |||
| 154 | ///Generate markdown list of Phoenix dependencies | ||
| 155 | /** @param projectConfig : project configuration | ||
| 156 | * @return markdown list of Phoenix dependencies | ||
| 157 | */ | ||
| 158 | 2 | PString generateMarkdownDepList(const ProjectConfig & projectConfig){ | |
| 159 | 2 | PString packageMdList; | |
| 160 |
2/2✓ Branch 0 (23→4) taken 9 times.
✓ Branch 1 (23→24) taken 2 times.
|
11 | for(PackageMap::const_iterator depIt = projectConfig.mapDependencies.begin(); depIt != projectConfig.mapDependencies.end(); ++depIt){ |
| 161 | 9 | const PPackageAttribute & pkgAttr = depIt->second; | |
| 162 |
4/4✓ Branch 0 (5→6) taken 9 times.
✓ Branch 2 (6→7) taken 9 times.
✓ Branch 4 (7→8) taken 8 times.
✓ Branch 5 (7→20) taken 1 times.
|
9 | if(isPhoenixDependency(pkgAttr.getName())){ |
| 163 |
7/7✓ Branch 0 (8→9) taken 8 times.
✓ Branch 2 (9→10) taken 8 times.
✓ Branch 4 (10→11) taken 8 times.
✓ Branch 6 (11→12) taken 8 times.
✓ Branch 8 (12→13) taken 8 times.
✓ Branch 10 (13→14) taken 8 times.
✓ Branch 12 (14→15) taken 8 times.
|
8 | packageMdList += "- ["+pkgAttr.getName()+"]("+pkgAttr.getUrl()+")\n"; |
| 164 | } | ||
| 165 | } | ||
| 166 | 2 | return packageMdList; | |
| 167 | ✗ | } | |
| 168 | |||
| 169 | ///Generate author list for Pixi | ||
| 170 | /** @param projectConfig : project configuration | ||
| 171 | * @return author list for Pixi | ||
| 172 | */ | ||
| 173 | 2 | PString generateAuthorListPixi(const ProjectConfig & projectConfig){ | |
| 174 | 2 | PString authorListPixi; | |
| 175 |
1/1✓ Branch 0 (3→4) taken 2 times.
|
2 | authorListPixi += "authors = [\n"; |
| 176 |
2/2✓ Branch 0 (25→5) taken 4 times.
✓ Branch 1 (25→26) taken 2 times.
|
6 | for(ProjectMembersMap::const_iterator it = projectConfig.authorMap.begin(); it != projectConfig.authorMap.end(); ++it){ |
| 177 | 4 | const PProjectMembers & author = it->second; | |
| 178 |
10/10✓ Branch 0 (6→7) taken 4 times.
✓ Branch 2 (7→8) taken 4 times.
✓ Branch 4 (8→9) taken 4 times.
✓ Branch 6 (9→10) taken 4 times.
✓ Branch 8 (10→11) taken 4 times.
✓ Branch 10 (11→12) taken 4 times.
✓ Branch 12 (12→13) taken 4 times.
✓ Branch 14 (13→14) taken 4 times.
✓ Branch 16 (14→15) taken 4 times.
✓ Branch 18 (15→16) taken 4 times.
|
4 | authorListPixi += " \"" + author.getFirstName() + " " + author.getLastName() + " <" + author.getEmail() + ">\",\n"; |
| 179 | } | ||
| 180 |
1/1✓ Branch 0 (26→27) taken 2 times.
|
2 | authorListPixi += "]\n"; |
| 181 | 2 | return authorListPixi; | |
| 182 | ✗ | } | |
| 183 | |||
| 184 | ///Generate project author list for codemeta.json | ||
| 185 | /** @param projectConfig : project configuration | ||
| 186 | * @return project author list | ||
| 187 | */ | ||
| 188 | 2 | PString generateProjectAuthorList(const ProjectConfig & projectConfig){ | |
| 189 | 2 | PString projectAuthorList; | |
| 190 | 2 | bool firstAuthor = true; | |
| 191 |
2/2✓ Branch 0 (40→4) taken 4 times.
✓ Branch 1 (40→41) taken 2 times.
|
6 | for(ProjectMembersMap::const_iterator it = projectConfig.authorMap.begin(); it != projectConfig.authorMap.end(); ++it){ |
| 192 | 4 | const PProjectMembers & author = it->second; | |
| 193 |
3/3✓ Branch 0 (5→6) taken 2 times.
✓ Branch 1 (5→7) taken 2 times.
✓ Branch 2 (6→7) taken 2 times.
|
4 | if(!firstAuthor) projectAuthorList += ",\n"; |
| 194 |
1/1✓ Branch 0 (7→8) taken 4 times.
|
4 | projectAuthorList += " {\n"; |
| 195 |
1/1✓ Branch 0 (8→9) taken 4 times.
|
4 | projectAuthorList += " \"@type\": \"Person\",\n"; |
| 196 |
4/4✓ Branch 0 (9→10) taken 4 times.
✓ Branch 2 (10→11) taken 4 times.
✓ Branch 4 (11→12) taken 4 times.
✓ Branch 6 (12→13) taken 4 times.
|
4 | projectAuthorList += " \"givenName\": \"" + author.getFirstName() + "\",\n"; |
| 197 |
4/4✓ Branch 0 (15→16) taken 4 times.
✓ Branch 2 (16→17) taken 4 times.
✓ Branch 4 (17→18) taken 4 times.
✓ Branch 6 (18→19) taken 4 times.
|
4 | projectAuthorList += " \"familyName\": \"" + author.getLastName() + "\",\n"; |
| 198 |
4/4✓ Branch 0 (21→22) taken 4 times.
✓ Branch 2 (22→23) taken 4 times.
✓ Branch 4 (23→24) taken 4 times.
✓ Branch 6 (24→25) taken 4 times.
|
4 | projectAuthorList += " \"email\": \"" + author.getEmail() + "\",\n"; |
| 199 |
1/1✓ Branch 0 (27→28) taken 4 times.
|
4 | projectAuthorList += " \"affiliation\": {\n"; |
| 200 |
1/1✓ Branch 0 (28→29) taken 4 times.
|
4 | projectAuthorList += " \"@type\": \"Organization\",\n"; |
| 201 |
4/4✓ Branch 0 (29→30) taken 4 times.
✓ Branch 2 (30→31) taken 4 times.
✓ Branch 4 (31→32) taken 4 times.
✓ Branch 6 (32→33) taken 4 times.
|
4 | projectAuthorList += " \"name\": \"" + author.getAffiliation() + "\"\n"; |
| 202 |
1/1✓ Branch 0 (35→36) taken 4 times.
|
4 | projectAuthorList += " }\n"; |
| 203 |
1/1✓ Branch 0 (36→37) taken 4 times.
|
4 | projectAuthorList += " }"; |
| 204 | 4 | firstAuthor = false; | |
| 205 | } | ||
| 206 | 2 | return projectAuthorList; | |
| 207 | ✗ | } | |
| 208 | |||
| 209 | ///Generate project contributor list for codemeta.json | ||
| 210 | /** @param projectConfig : project configuration | ||
| 211 | * @return project contributor list | ||
| 212 | */ | ||
| 213 | 2 | PString generateProjectContributorList(const ProjectConfig & projectConfig){ | |
| 214 | 2 | PString projectContributorList; | |
| 215 | 2 | bool firstContributor = true; | |
| 216 |
2/2✓ Branch 0 (40→4) taken 2 times.
✓ Branch 1 (40→41) taken 2 times.
|
4 | for(ProjectMembersMap::const_iterator it = projectConfig.contributorMap.begin(); it != projectConfig.contributorMap.end(); ++it){ |
| 217 | 2 | const PProjectMembers & contributor = it->second; | |
| 218 |
1/3✗ Branch 0 (5→6) not taken.
✓ Branch 1 (5→7) taken 2 times.
✗ Branch 2 (6→7) not taken.
|
2 | if(!firstContributor) projectContributorList += ",\n"; |
| 219 |
1/1✓ Branch 0 (7→8) taken 2 times.
|
2 | projectContributorList += " {\n"; |
| 220 |
1/1✓ Branch 0 (8→9) taken 2 times.
|
2 | projectContributorList += " \"@type\": \"Person\",\n"; |
| 221 |
4/4✓ Branch 0 (9→10) taken 2 times.
✓ Branch 2 (10→11) taken 2 times.
✓ Branch 4 (11→12) taken 2 times.
✓ Branch 6 (12→13) taken 2 times.
|
2 | projectContributorList += " \"givenName\": \"" + contributor.getFirstName() + "\",\n"; |
| 222 |
4/4✓ Branch 0 (15→16) taken 2 times.
✓ Branch 2 (16→17) taken 2 times.
✓ Branch 4 (17→18) taken 2 times.
✓ Branch 6 (18→19) taken 2 times.
|
2 | projectContributorList += " \"familyName\": \"" + contributor.getLastName() + "\",\n"; |
| 223 |
4/4✓ Branch 0 (21→22) taken 2 times.
✓ Branch 2 (22→23) taken 2 times.
✓ Branch 4 (23→24) taken 2 times.
✓ Branch 6 (24→25) taken 2 times.
|
2 | projectContributorList += " \"email\": \"" + contributor.getEmail() + "\",\n"; |
| 224 |
1/1✓ Branch 0 (27→28) taken 2 times.
|
2 | projectContributorList += " \"affiliation\": {\n"; |
| 225 |
1/1✓ Branch 0 (28→29) taken 2 times.
|
2 | projectContributorList += " \"@type\": \"Organization\",\n"; |
| 226 |
4/4✓ Branch 0 (29→30) taken 2 times.
✓ Branch 2 (30→31) taken 2 times.
✓ Branch 4 (31→32) taken 2 times.
✓ Branch 6 (32→33) taken 2 times.
|
2 | projectContributorList += " \"name\": \"" + contributor.getAffiliation() + "\"\n"; |
| 227 |
1/1✓ Branch 0 (35→36) taken 2 times.
|
2 | projectContributorList += " }\n"; |
| 228 |
1/1✓ Branch 0 (36→37) taken 2 times.
|
2 | projectContributorList += " }"; |
| 229 | 2 | firstContributor = false; | |
| 230 | } | ||
| 231 | 2 | return projectContributorList; | |
| 232 | ✗ | } | |
| 233 | |||
| 234 | ///Generate maintainer information for codemeta.json | ||
| 235 | /** @param projectConfig : project configuration | ||
| 236 | * @return maintainer information | ||
| 237 | */ | ||
| 238 | 2 | PString generateMaintainer(const ProjectConfig & projectConfig){ | |
| 239 | 2 | PString maintainer; | |
| 240 | 2 | const PProjectMembers & maintainerPerson = projectConfig.maintainerMap.begin()->second; | |
| 241 |
1/1✓ Branch 0 (5→6) taken 2 times.
|
2 | maintainer += " \"@type\": \"Person\",\n"; |
| 242 |
4/4✓ Branch 0 (6→7) taken 2 times.
✓ Branch 2 (7→8) taken 2 times.
✓ Branch 4 (8→9) taken 2 times.
✓ Branch 6 (9→10) taken 2 times.
|
2 | maintainer += " \"givenName\": \"" + maintainerPerson.getFirstName() + "\",\n"; |
| 243 |
4/4✓ Branch 0 (12→13) taken 2 times.
✓ Branch 2 (13→14) taken 2 times.
✓ Branch 4 (14→15) taken 2 times.
✓ Branch 6 (15→16) taken 2 times.
|
2 | maintainer += " \"familyName\": \"" + maintainerPerson.getLastName() + "\",\n"; |
| 244 |
4/4✓ Branch 0 (18→19) taken 2 times.
✓ Branch 2 (19→20) taken 2 times.
✓ Branch 4 (20→21) taken 2 times.
✓ Branch 6 (21→22) taken 2 times.
|
2 | maintainer += " \"email\": \"" + maintainerPerson.getEmail() + "\",\n"; |
| 245 |
1/1✓ Branch 0 (24→25) taken 2 times.
|
2 | maintainer += " \"affiliation\": {\n"; |
| 246 |
1/1✓ Branch 0 (25→26) taken 2 times.
|
2 | maintainer += " \"@type\": \"Organization\",\n"; |
| 247 |
4/4✓ Branch 0 (26→27) taken 2 times.
✓ Branch 2 (27→28) taken 2 times.
✓ Branch 4 (28→29) taken 2 times.
✓ Branch 6 (29→30) taken 2 times.
|
2 | maintainer += " \"name\": \"" + maintainerPerson.getAffiliation() + "\"\n"; |
| 248 |
1/1✓ Branch 0 (32→33) taken 2 times.
|
2 | maintainer += " }"; |
| 249 | 2 | return maintainer; | |
| 250 | ✗ | } | |
| 251 | |||
| 252 | ///Generate keywords list for codemeta.json | ||
| 253 | /** @param projectConfig : project configuration | ||
| 254 | * @return keywords list | ||
| 255 | */ | ||
| 256 | 2 | PString generateKeywordsBody(const ProjectConfig & projectConfig){ | |
| 257 | 2 | PString keywordsBody; | |
| 258 |
1/2✓ Branch 0 (4→5) taken 2 times.
✗ Branch 1 (4→27) not taken.
|
2 | if(!projectConfig.keywordList.empty()){ |
| 259 | 2 | bool firstKeyword = true; | |
| 260 |
2/2✓ Branch 0 (25→6) taken 10 times.
✓ Branch 1 (25→26) taken 2 times.
|
24 | for(std::vector<PString>::const_iterator it = projectConfig.keywordList.begin(); it != projectConfig.keywordList.end(); ++it){ |
| 261 |
3/3✓ Branch 0 (6→7) taken 8 times.
✓ Branch 1 (6→8) taken 2 times.
✓ Branch 2 (7→8) taken 8 times.
|
10 | if(!firstKeyword) keywordsBody += ",\n"; |
| 262 |
3/3✓ Branch 0 (10→11) taken 10 times.
✓ Branch 2 (11→12) taken 10 times.
✓ Branch 4 (12→13) taken 10 times.
|
10 | keywordsBody += " \"" + *it + "\""; |
| 263 | 10 | firstKeyword = false; | |
| 264 | } | ||
| 265 | } | ||
| 266 | 2 | return keywordsBody; | |
| 267 | ✗ | } | |
| 268 | |||
| 269 | ///Generate the replacement map for placeholders | ||
| 270 | /** @param projectConfig : project configuration | ||
| 271 | * @param cmakeFindBody : CMake find_package commands | ||
| 272 | * @param phoenixPullExtraModule : Phoenix pull_extra_module commands | ||
| 273 | * @param phoenixFindModule : Phoenix find module list | ||
| 274 | * @param phoenixGlobalDep : Phoenix global dependencies variable | ||
| 275 | * @param targetLinkBody : target_link_libraries command | ||
| 276 | * @param pixiBody : Pixi dependencies | ||
| 277 | * @param authorListPixi : author list for Pixi | ||
| 278 | * @param projectAuthorList : project author list | ||
| 279 | * @param projectContributorList : project contributor list | ||
| 280 | * @param maintainer : maintainer information | ||
| 281 | * @param keywordsBody : keywords list | ||
| 282 | * @param dateStr : creation date string | ||
| 283 | * @return replacement map for placeholders | ||
| 284 | */ | ||
| 285 | 2 | PMapString generateReplacementMap(const ProjectConfig & projectConfig, const PString & cmakeFindBody, const PString & phoenixPullExtraModule, | |
| 286 | const PString & phoenixFindModule, const PString & phoenixGlobalDep, const PString & targetLinkBody, | ||
| 287 | const PString & pixiBody, const PString & markdownDepList, const PString & authorListPixi, | ||
| 288 | const PString & projectAuthorList, const PString & projectContributorList, const PString & maintainer, | ||
| 289 | const PString & keywordsBody, const PString & dateStr) | ||
| 290 | { | ||
| 291 | 2 | PMapString mapReplace; | |
| 292 |
3/3✓ Branch 0 (3→4) taken 2 times.
✓ Branch 2 (4→5) taken 2 times.
✓ Branch 4 (5→6) taken 2 times.
|
2 | mapReplace["XXXProjectNameXXX"] = projectConfig.name; //project name |
| 293 |
4/4✓ 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.
|
2 | mapReplace["XXXPROJECT_NAMEXXX"] = projectConfig.name.toUpper(); //project name uppercase |
| 294 |
4/4✓ Branch 0 (13→14) taken 2 times.
✓ Branch 2 (14→15) taken 2 times.
✓ Branch 4 (15→16) taken 2 times.
✓ Branch 6 (16→17) taken 2 times.
|
2 | mapReplace["xxxproject_namexxx"] = projectConfig.name.toSnakeCase(); //project library |
| 295 |
3/3✓ Branch 0 (19→20) taken 2 times.
✓ Branch 2 (20→21) taken 2 times.
✓ Branch 4 (21→22) taken 2 times.
|
2 | mapReplace["XXXProjectNameDescriptionXXX"] = projectConfig.description; //description |
| 296 |
3/3✓ Branch 0 (23→24) taken 2 times.
✓ Branch 2 (24→25) taken 2 times.
✓ Branch 4 (25→26) taken 2 times.
|
2 | mapReplace["XXXProjectNameUrlXXX"] = projectConfig.url; //project url |
| 297 |
3/3✓ Branch 0 (27→28) taken 2 times.
✓ Branch 2 (28→29) taken 2 times.
✓ Branch 4 (29→30) taken 2 times.
|
2 | mapReplace["XXXProjectVersionXXX"] = projectConfig.version; //project version |
| 298 |
3/3✓ Branch 0 (31→32) taken 2 times.
✓ Branch 2 (32→33) taken 2 times.
✓ Branch 4 (33→34) taken 2 times.
|
2 | mapReplace["XXXProjectNameHomepageUrlXXX"] = projectConfig.url; //project doc url (TODO add it or deduce it from the project url for gitlab) |
| 299 |
3/3✓ Branch 0 (35→36) taken 2 times.
✓ Branch 2 (36→37) taken 2 times.
✓ Branch 4 (37→38) taken 2 times.
|
2 | mapReplace["XXXProjectNameRunnerTagXXX"] = projectConfig.runnerTag; //Project CI runner tag |
| 300 |
3/3✓ Branch 0 (39→40) taken 2 times.
✓ Branch 2 (40→41) taken 2 times.
✓ Branch 4 (41→42) taken 2 times.
|
2 | mapReplace["XXXProjectFindPackageDependenciesXXX"] = cmakeFindBody; //project find_package |
| 301 |
3/3✓ Branch 0 (43→44) taken 2 times.
✓ Branch 2 (44→45) taken 2 times.
✓ Branch 4 (45→46) taken 2 times.
|
2 | mapReplace["XXXProjectPhoenixDependenciesXXX"] = phoenixPullExtraModule; //project pull_extra_module |
| 302 |
3/3✓ Branch 0 (47→48) taken 2 times.
✓ Branch 2 (48→49) taken 2 times.
✓ Branch 4 (49→50) taken 2 times.
|
2 | mapReplace["XXXProjectNameCMakeFindDependenciesXXX"] = phoenixFindModule; //project dependencies of phoenix_create_find |
| 303 |
3/3✓ Branch 0 (51→52) taken 2 times.
✓ Branch 2 (52→53) taken 2 times.
✓ Branch 4 (53→54) taken 2 times.
|
2 | mapReplace["XXXProjectDependenciesCMakeVarXXX"] = phoenixGlobalDep; //cmake variable to hold test dependencies |
| 304 |
3/3✓ Branch 0 (55→56) taken 2 times.
✓ Branch 2 (56→57) taken 2 times.
✓ Branch 4 (57→58) taken 2 times.
|
2 | mapReplace["XXXProjectNameTargetLinkLinDependenciesXXX"] = targetLinkBody; //full target_link_library command of generated lib |
| 305 |
5/5✓ Branch 0 (59→60) taken 2 times.
✓ Branch 2 (60→61) taken 2 times.
✓ Branch 4 (61→62) taken 2 times.
✓ Branch 6 (62→63) taken 2 times.
✓ Branch 8 (63→64) taken 2 times.
|
2 | mapReplace["XXXCxxWorkflowUrlXXX"] = projectConfig.ciToolkitUrl+"@"+projectConfig.ciToolkitVersion; //Url and version of the CI workflow |
| 306 |
4/4✓ Branch 0 (67→68) taken 2 times.
✓ Branch 2 (68→69) taken 2 times.
✓ Branch 4 (69→70) taken 2 times.
✓ Branch 6 (70→71) taken 2 times.
|
2 | mapReplace["xxxphoenixprojectpixipackagenamexxx"] = projectConfig.name.toLower(); //name of the pixi package |
| 307 |
3/3✓ Branch 0 (73→74) taken 2 times.
✓ Branch 2 (74→75) taken 2 times.
✓ Branch 4 (75→76) taken 2 times.
|
2 | mapReplace["xxxprojectnamepixiextradependenciesxxx"] = pixiBody; //extra pixi dependencies |
| 308 |
3/3✓ Branch 0 (77→78) taken 2 times.
✓ Branch 2 (78→79) taken 2 times.
✓ Branch 4 (79→80) taken 2 times.
|
2 | mapReplace["XXXProjectNameMarkdownListDependenciesXXX"] = markdownDepList; //markdown list of Phoenix dependencies |
| 309 |
3/3✓ Branch 0 (81→82) taken 2 times.
✓ Branch 2 (82→83) taken 2 times.
✓ Branch 4 (83→84) taken 2 times.
|
2 | mapReplace["XXXcreationDateXXX"] = dateStr; //creation date |
| 310 |
3/3✓ Branch 0 (85→86) taken 2 times.
✓ Branch 2 (86→87) taken 2 times.
✓ Branch 4 (87→88) taken 2 times.
|
2 | mapReplace["XXXProjectAuthorListPixiXXX"] = authorListPixi; //author list for pixi.toml |
| 311 |
3/3✓ Branch 0 (89→90) taken 2 times.
✓ Branch 2 (90→91) taken 2 times.
✓ Branch 4 (91→92) taken 2 times.
|
2 | mapReplace["XXXAuthorListXXX"] = projectAuthorList; //author list for codemeta.json |
| 312 |
3/3✓ Branch 0 (93→94) taken 2 times.
✓ Branch 2 (94→95) taken 2 times.
✓ Branch 4 (95→96) taken 2 times.
|
2 | mapReplace["XXXContributorListXXX"] = projectContributorList; //contributor list for codemeta.json |
| 313 |
3/3✓ Branch 0 (97→98) taken 2 times.
✓ Branch 2 (98→99) taken 2 times.
✓ Branch 4 (99→100) taken 2 times.
|
2 | mapReplace["XXXMaintainerXXX"] = maintainer; //maintainer for codemeta.json |
| 314 |
3/3✓ Branch 0 (101→102) taken 2 times.
✓ Branch 2 (102→103) taken 2 times.
✓ Branch 4 (103→104) taken 2 times.
|
2 | mapReplace["XXXKeywordListsXXX"] = keywordsBody; //keyword list for codemeta.json |
| 315 | 2 | return mapReplace; | |
| 316 | ✗ | } | |
| 317 | |||
| 318 | ///Generate all replacement data for project generation | ||
| 319 | /** @param projectConfig : project configuration | ||
| 320 | * @return replacement map for placeholders | ||
| 321 | */ | ||
| 322 | 2 | PMapString generateAllReplacementData(const ProjectConfig & projectConfig){ | |
| 323 | // Generate various bodies using dedicated functions | ||
| 324 |
1/1✓ Branch 0 (2→3) taken 2 times.
|
2 | PString cmakeFindBody = generateCmakeFindBody(projectConfig); |
| 325 |
1/1✓ Branch 0 (3→4) taken 2 times.
|
2 | PString phoenixPullExtraModule = generatePhoenixPullExtraModule(projectConfig); |
| 326 |
1/1✓ Branch 0 (4→5) taken 2 times.
|
2 | PString phoenixFindModule = generatePhoenixFindModule(projectConfig); |
| 327 |
1/1✓ Branch 0 (5→6) taken 2 times.
|
2 | PString phoenixGlobalDep = generatePhoenixGlobalDep(projectConfig); |
| 328 |
1/1✓ Branch 0 (6→7) taken 2 times.
|
2 | PString targetLinkBody = generateTargetLinkBody(projectConfig); |
| 329 |
1/1✓ Branch 0 (7→8) taken 2 times.
|
2 | PString pixiBody = generatePixiBody(projectConfig); |
| 330 |
1/1✓ Branch 0 (8→9) taken 2 times.
|
2 | PString markdownDepList = generateMarkdownDepList(projectConfig); |
| 331 |
1/1✓ Branch 0 (9→10) taken 2 times.
|
2 | PString authorListPixi = generateAuthorListPixi(projectConfig); |
| 332 |
1/1✓ Branch 0 (10→11) taken 2 times.
|
2 | PString projectAuthorList = generateProjectAuthorList(projectConfig); |
| 333 |
1/1✓ Branch 0 (11→12) taken 2 times.
|
2 | PString projectContributorList = generateProjectContributorList(projectConfig); |
| 334 |
1/1✓ Branch 0 (12→13) taken 2 times.
|
2 | PString maintainer = generateMaintainer(projectConfig); |
| 335 |
1/1✓ Branch 0 (13→14) taken 2 times.
|
2 | PString keywordsBody = generateKeywordsBody(projectConfig); |
| 336 | |||
| 337 | time_t timestamp; | ||
| 338 |
1/1✓ Branch 0 (16→17) taken 2 times.
|
2 | PString dateStr = ctime(&(timestamp = time(nullptr))); |
| 339 |
3/3✓ Branch 0 (17→18) taken 2 times.
✓ Branch 2 (18→19) taken 2 times.
✓ Branch 4 (19→20) taken 2 times.
|
2 | dateStr = dateStr.eraseLastChar("\n"); // Remove the trailing \n |
| 340 | |||
| 341 | // Generate the replacement map | ||
| 342 | return generateReplacementMap(projectConfig, cmakeFindBody, phoenixPullExtraModule, | ||
| 343 | phoenixFindModule, phoenixGlobalDep, targetLinkBody, | ||
| 344 | pixiBody, markdownDepList, authorListPixi, projectAuthorList, | ||
| 345 |
1/1✓ Branch 0 (22→23) taken 2 times.
|
4 | projectContributorList, maintainer, keywordsBody, dateStr); |
| 346 | 2 | } | |
| 347 | |||
| 348 | ///Load configuration pdata of generated sources | ||
| 349 | /** @param[out] param : ProjectParam to be updated | ||
| 350 | * @param pdataDir : directory where to save pdata configuration | ||
| 351 | * @param vecClassConfigFile : vector of class configuration files (.pdata files) | ||
| 352 | * @return true on success, false otherwise | ||
| 353 | */ | ||
| 354 | 2 | bool simple_project_load_config(ProjectParam & param, const PPath & pdataDir, const PVecPath & vecClassConfigFile){ | |
| 355 | 2 | bool b(true); | |
| 356 |
2/2✓ Branch 0 (42→4) taken 4 times.
✓ Branch 1 (42→43) taken 2 times.
|
8 | for(const PPath & classConfigFile : vecClassConfigFile){ |
| 357 |
1/1✓ Branch 0 (6→7) taken 4 times.
|
4 | PDataConfig dataConfig; |
| 358 |
2/2✓ Branch 0 (7→8) taken 4 times.
✓ Branch 2 (8→9) taken 4 times.
|
4 | dataConfig.getFileName() = classConfigFile; |
| 359 |
4/5✓ Branch 0 (9→10) taken 4 times.
✓ Branch 2 (10→11) taken 4 times.
✓ Branch 4 (11→12) taken 4 times.
✗ Branch 6 (12→13) not taken.
✓ Branch 7 (12→18) taken 4 times.
|
4 | if(!parserClassConfig(dataConfig.getVecClassConfig(), dataConfig.getVecInclude(), classConfigFile)){ |
| 360 | ✗ | std::cerr << "simple_project_load_config : can't load file '" << classConfigFile << "'" << std::endl; | |
| 361 | ✗ | b = false; //Best effort strategy | |
| 362 | } | ||
| 363 |
1/1✓ Branch 0 (18→19) taken 4 times.
|
4 | param.vecDataConfig.push_back(dataConfig); |
| 364 | |||
| 365 |
2/2✓ Branch 0 (19→20) taken 4 times.
✓ Branch 2 (20→21) taken 4 times.
|
4 | PPath destFile = pdataDir / classConfigFile.getFileName(); |
| 366 |
1/1✓ Branch 0 (22→23) taken 4 times.
|
4 | PString fileContent = classConfigFile.loadFileContent(); |
| 367 |
2/3✓ Branch 0 (23→24) taken 4 times.
✗ Branch 2 (24→25) not taken.
✓ Branch 3 (24→30) taken 4 times.
|
4 | if(!destFile.saveFileContent(fileContent)){ |
| 368 | ✗ | std::cerr << "simple_project_load_config : cannot copy pdata file to project pdata directory '"<<destFile<<"'" << std::endl; | |
| 369 | ✗ | b = false; //Best effort strategy | |
| 370 | } | ||
| 371 | 4 | } | |
| 372 | 2 | return b; | |
| 373 | } | ||
| 374 | |||
| 375 | ///Save generated sources of project | ||
| 376 | /** @param projectParam : ProjectParam to be used | ||
| 377 | * @return true on success, false otherwise | ||
| 378 | */ | ||
| 379 | 2 | bool simple_project_generate_source(const ProjectParam & projectParam){ | |
| 380 |
2/2✓ Branch 0 (2→3) taken 1 times.
✓ Branch 1 (2→16) taken 1 times.
|
2 | if(projectParam.mode.type == ProjectType::CPP){ |
| 381 |
1/1✓ Branch 0 (3→4) taken 1 times.
|
1 | PTraitBackendManager manager; |
| 382 |
1/1✓ Branch 0 (4→5) taken 1 times.
|
1 | manager.addTraitBackend<CppTraitFromString>(); |
| 383 |
1/1✓ Branch 0 (5→6) taken 1 times.
|
1 | manager.addTraitBackend<CppTraitCopy>(); |
| 384 |
1/1✓ Branch 0 (6→7) taken 1 times.
|
1 | manager.addTraitBackend<CppTraitSetter>(); |
| 385 |
1/1✓ Branch 0 (7→8) taken 1 times.
|
1 | manager.addTraitBackend<CppTraitGetter>(); |
| 386 |
1/1✓ Branch 0 (8→9) taken 1 times.
|
1 | manager.addTraitBackend<CppTraitTypeStream>(); |
| 387 |
1/1✓ Branch 0 (9→10) taken 1 times.
|
1 | manager.addTraitBackend<CppTraitDataStream>(); |
| 388 |
1/1✓ Branch 0 (10→11) taken 1 times.
|
1 | manager.addTraitBackend<CppTraitConfigStream>(); |
| 389 |
1/1✓ Branch 0 (11→12) taken 1 times.
|
1 | manager.addTraitBackend<CppTraitCheckStream>(); |
| 390 |
1/1✓ Branch 0 (12→13) taken 1 times.
|
1 | return generator_class_full(manager, projectParam); |
| 391 |
1/2✓ Branch 0 (16→17) taken 1 times.
✗ Branch 1 (16→25) not taken.
|
2 | }else if(projectParam.mode.type == ProjectType::WRAPPER){ |
| 392 |
1/1✓ Branch 0 (17→18) taken 1 times.
|
1 | PWrapperTraitBackendManager manager; |
| 393 |
1/1✓ Branch 0 (18→19) taken 1 times.
|
1 | manager.addTraitBackend<WrapperTraitGetterSetter>(); |
| 394 |
1/1✓ Branch 0 (19→20) taken 1 times.
|
1 | manager.addTraitBackend<WrapperTraitTypeStream>(); |
| 395 |
1/1✓ Branch 0 (20→21) taken 1 times.
|
1 | manager.addTraitBackend<WrapperTraitDataStream>(); |
| 396 |
1/1✓ Branch 0 (21→22) taken 1 times.
|
1 | return wrapper_generator_class_full(manager, projectParam); |
| 397 | 1 | } | |
| 398 | ✗ | return false; | |
| 399 | } | ||
| 400 | |||
| 401 | ///Create a simple project from a configuration | ||
| 402 | /** @param descriptionFile : description of the full project | ||
| 403 | * @param vecClassConfigFile : vector of class configuration files (.pdata files) | ||
| 404 | * @param projectType : type of the project (SimpleCpp) | ||
| 405 | * @param mode : all modes of the generator (data/check/type/config stream) | ||
| 406 | * @return true on success, false otherwise | ||
| 407 | */ | ||
| 408 | 3 | bool simple_project_generator(const PPath & descriptionFile, const PVecPath & vecClassConfigFile, const PString & projectType, | |
| 409 | const GeneratorMode & mode) | ||
| 410 | { | ||
| 411 | //First, let's read the toml config of the project | ||
| 412 |
1/1✓ Branch 0 (2→3) taken 3 times.
|
3 | ProjectConfig projectConfig; |
| 413 |
2/3✓ Branch 0 (3→4) taken 3 times.
✗ Branch 2 (4→5) not taken.
✓ Branch 3 (4→10) taken 3 times.
|
3 | if(!project_generator_loadConfig(projectConfig, descriptionFile)){ |
| 414 | ✗ | std::cerr << "simple_project_generator : cannot parse project description file '"<<descriptionFile<<"'" << std::endl; | |
| 415 | ✗ | return false; | |
| 416 | } | ||
| 417 | //Then look in the config files if the packages exists | ||
| 418 |
3/3✓ Branch 0 (10→11) taken 3 times.
✓ Branch 2 (11→12) taken 1 times.
✓ Branch 3 (11→17) taken 2 times.
|
3 | if(!project_generator_loadPackageInfo(projectConfig)){ |
| 419 |
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; |
| 420 | 1 | return false; | |
| 421 | } | ||
| 422 | // Generate replacement data | ||
| 423 |
1/1✓ Branch 0 (17→18) taken 2 times.
|
2 | PMapString mapReplace = generateAllReplacementData(projectConfig); |
| 424 |
15/15✓ Branch 0 (18→19) taken 2 times.
✓ Branch 2 (19→20) taken 2 times.
✓ Branch 4 (20→21) taken 2 times.
✓ Branch 6 (21→22) taken 2 times.
✓ Branch 8 (22→23) taken 2 times.
✓ Branch 10 (23→24) taken 2 times.
✓ Branch 12 (24→25) taken 2 times.
✓ Branch 14 (25→26) taken 2 times.
✓ Branch 16 (26→27) taken 2 times.
✓ Branch 18 (27→28) taken 2 times.
✓ Branch 20 (28→29) taken 2 times.
✓ Branch 22 (29→30) taken 2 times.
✓ Branch 24 (30→31) taken 2 times.
✓ Branch 26 (43→44) taken 2 times.
✓ Branch 28 (44→45) taken 2 times.
|
2 | PPath inputConfigPlaceholderDir = PPath(SYSTEM_INSTALL_DIR) / PPath("share") / PPath("PhoenixGenerator") / PPath("Projects") / PPath(projectType), outputPath("./"); |
| 425 |
2/3✓ Branch 0 (46→47) taken 2 times.
✗ Branch 2 (47→48) not taken.
✓ Branch 3 (47→53) taken 2 times.
|
2 | if(!directory_replace_placeholder(outputPath, inputConfigPlaceholderDir, mapReplace)){ |
| 426 | ✗ | std::cerr << "simple_project_generator : cannot replace placeholder in project generation '"<<projectConfig.name<<"'" << std::endl; | |
| 427 | ✗ | return false; | |
| 428 | } | ||
| 429 |
4/4✓ Branch 0 (53→54) taken 2 times.
✓ Branch 2 (54→55) taken 2 times.
✓ Branch 4 (55→56) taken 2 times.
✓ Branch 6 (56→57) taken 2 times.
|
2 | PPath mainPath = PPath(".") / PPath(projectConfig.name); |
| 430 |
6/6✓ Branch 0 (60→61) taken 2 times.
✓ Branch 2 (61→62) taken 2 times.
✓ Branch 4 (62→63) taken 2 times.
✓ Branch 6 (65→66) taken 2 times.
✓ Branch 8 (66→67) taken 2 times.
✓ Branch 10 (67→68) taken 2 times.
|
2 | PPath srcPath = mainPath / PPath("src"), pdataDir = mainPath / PPath("pdata"); |
| 431 |
2/3✓ Branch 0 (70→71) taken 2 times.
✗ Branch 2 (71→72) not taken.
✓ Branch 3 (71→77) taken 2 times.
|
2 | if(!pdataDir.createDirectory()){ |
| 432 | ✗ | std::cerr << "simple_project_generator : cannot create pdata directory '"<<pdataDir<<"'" << std::endl; | |
| 433 | ✗ | return false; | |
| 434 | } | ||
| 435 |
1/1✓ Branch 0 (77→78) taken 2 times.
|
2 | ProjectParam param; |
| 436 |
1/1✓ Branch 0 (78→79) taken 2 times.
|
2 | param.mode = mode; |
| 437 |
1/1✓ Branch 0 (79→80) taken 2 times.
|
2 | param.name = projectConfig.name; |
| 438 |
1/1✓ Branch 0 (80→81) taken 2 times.
|
2 | param.version = projectConfig.version; |
| 439 |
1/1✓ Branch 0 (81→82) taken 2 times.
|
2 | param.outputProjectDir = mainPath; |
| 440 |
1/1✓ Branch 0 (82→83) taken 2 times.
|
2 | param.outputSourceDir = srcPath; |
| 441 |
2/2✓ Branch 0 (83→84) taken 1 times.
✓ Branch 1 (83→92) taken 1 times.
|
2 | if(param.mode.type == ProjectType::CPP){ |
| 442 |
4/4✓ Branch 0 (84→85) taken 1 times.
✓ Branch 2 (85→86) taken 1 times.
✓ Branch 4 (86→87) taken 1 times.
✓ Branch 6 (87→88) taken 1 times.
|
1 | param.outputTestDir = mainPath / PPath("TESTS"); |
| 443 |
1/2✓ Branch 0 (92→93) taken 1 times.
✗ Branch 1 (92→101) not taken.
|
1 | }else if(param.mode.type == ProjectType::WRAPPER){ |
| 444 |
4/4✓ Branch 0 (93→94) taken 1 times.
✓ Branch 2 (94→95) taken 1 times.
✓ Branch 4 (95→96) taken 1 times.
✓ Branch 6 (96→97) taken 1 times.
|
1 | param.outputTestDir = mainPath / PPath("tests"); |
| 445 | } | ||
| 446 | |||
| 447 |
2/3✓ Branch 0 (101→102) taken 2 times.
✗ Branch 2 (102→103) not taken.
✓ Branch 3 (102→108) taken 2 times.
|
2 | if(!simple_project_load_config(param, pdataDir, vecClassConfigFile)){ |
| 448 | ✗ | std::cerr << "simple_project_generator : cannot load config to generate project in '"<<srcPath<<"'" << std::endl; | |
| 449 | ✗ | return false; | |
| 450 | } | ||
| 451 |
2/3✓ Branch 0 (108→109) taken 2 times.
✗ Branch 2 (109→110) not taken.
✓ Branch 3 (109→115) taken 2 times.
|
2 | if(!simple_project_generate_source(param)){ |
| 452 | ✗ | std::cerr << "simple_project_generator : cannot generate sources in '"<<srcPath<<"'" << std::endl; | |
| 453 | ✗ | return false; | |
| 454 | } | ||
| 455 | // Generate class generator script | ||
| 456 |
2/3✓ Branch 0 (115→116) taken 2 times.
✗ Branch 2 (116→117) not taken.
✓ Branch 3 (116→122) taken 2 times.
|
2 | if(!generateClassGeneratorScript(vecClassConfigFile, pdataDir, param.mode)){ |
| 457 | ✗ | std::cerr << "simple_project_generator : cannot generate class generator script in pdata directory '"<<pdataDir<<"'" << std::endl; | |
| 458 | ✗ | return false; | |
| 459 | } | ||
| 460 | 2 | return true; | |
| 461 | 3 | } | |
| 462 | |||
| 463 | |||
| 464 |