| 1306 | StringVector parseJsonDependencies(FILE* file) { |
| 1307 | StringVector deps; |
| 1308 | StringVector_init(&deps, 16); |
| 1309 | |
| 1310 | char line[2048]; |
| 1311 | int inIncludes = 0; |
| 1312 | int inArray = 0; |
| 1313 | while (fgets(line, sizeof(line), file)) { |
| 1314 | char* str = line; |
| 1315 | if (strstr(str, "\"Source\"")) { |
| 1316 | char* colon = strstr(str, ":"); |
| 1317 | char* start = colon ? strstr(colon, "\"") : NULL; |
| 1318 | char* end = start ? strstr(start + 1, "\"") : NULL; |
| 1319 | if (start && end) { |
| 1320 | *end = 0; |
| 1321 | String_unescapeJsonInPlace(start + 1); |
| 1322 | StringVector_add(&deps, start + 1); |
| 1323 | } |
| 1324 | } |
| 1325 | if (strstr(str, "\"Includes\"")) { |
| 1326 | inIncludes = 1; |
| 1327 | } |
| 1328 | if (inIncludes) { |
| 1329 | if (strstr(str, "[")) { |
| 1330 | inArray = 1; |
| 1331 | } |
| 1332 | if (strstr(str, "]")) { |
| 1333 | inArray = 0; |
| 1334 | break; // End of array |
| 1335 | } |
| 1336 | } |
| 1337 | if (inIncludes && inArray && strstr(str, "\"")) { |
| 1338 | char* start = strstr(str, "\""); |
| 1339 | while (start) { |
| 1340 | char* end = strstr(start + 1, "\""); |
| 1341 | if (end) { |
| 1342 | *end = 0; |
| 1343 | char* dep = start + 1; |
| 1344 | String_unescapeJsonInPlace(dep); |
| 1345 | if (strlen(dep) > 0 && strstr(dep, "windows kits") == NULL && |
| 1346 | strstr(dep, "microsoft visual studio") == NULL && strcmp(dep, "Includes") != 0 && |
| 1347 | strcmp(dep, "ImportedModules") != 0) { |
| 1348 | StringVector_add(&deps, dep); |
| 1349 | } |
| 1350 | start = strstr(end + 1, "\""); |
| 1351 | } else { |
| 1352 | break; |
| 1353 | } |
| 1354 | } |
| 1355 | } |
| 1356 | } |
| 1357 | return deps; |
| 1358 | } |
| 1359 | |
| 1360 | StringVector parseMakeDependencies(FILE* file, const char* baseDir) { |
| 1361 | StringVector deps; |
no test coverage detected