(env, project)
| 390 | |
| 391 | |
| 392 | def GenExcluding(env, project): |
| 393 | rtt_root = os.path.abspath(env['RTT_ROOT']) |
| 394 | bsp_root = os.path.abspath(env['BSP_ROOT']) |
| 395 | coll_dirs = CollectPaths(project['DIRS']) |
| 396 | all_paths_temp = [OSPath(path) for path in coll_dirs] |
| 397 | all_paths = [] |
| 398 | |
| 399 | # add used path |
| 400 | for path in all_paths_temp: |
| 401 | if path.startswith(rtt_root) or path.startswith(bsp_root): |
| 402 | all_paths.append(path) |
| 403 | |
| 404 | if bsp_root.startswith(rtt_root): |
| 405 | # bsp folder is in the RT-Thread root folder, such as the RT-Thread source code on GitHub |
| 406 | exclude_paths = ExcludePaths(rtt_root, all_paths) |
| 407 | elif rtt_root.startswith(bsp_root): |
| 408 | # RT-Thread root folder is in the bsp folder, such as project folder which generate by 'scons --dist' cmd |
| 409 | check_path = [] |
| 410 | exclude_paths = [] |
| 411 | # analyze the primary folder which relative to BSP_ROOT and in all_paths |
| 412 | for path in all_paths: |
| 413 | if path.startswith(bsp_root): |
| 414 | folders = RelativeProjectPath(env, path).split('\\') |
| 415 | if folders[0] != '.' and '\\' + folders[0] not in check_path: |
| 416 | check_path += ['\\' + folders[0]] |
| 417 | # exclue the folder which has managed by scons |
| 418 | for path in check_path: |
| 419 | exclude_paths += ExcludePaths(bsp_root + path, all_paths) |
| 420 | else: |
| 421 | exclude_paths = ExcludePaths(rtt_root, all_paths) |
| 422 | exclude_paths += ExcludePaths(bsp_root, all_paths) |
| 423 | |
| 424 | paths = exclude_paths |
| 425 | exclude_paths = [] |
| 426 | # remove the folder which not has source code by source_pattern |
| 427 | for path in paths: |
| 428 | # add bsp and libcpu folder and not collect source files (too more files) |
| 429 | if path.endswith('rt-thread\\bsp') or path.endswith('rt-thread\\libcpu'): |
| 430 | exclude_paths += [path] |
| 431 | continue |
| 432 | |
| 433 | set = CollectAllFilesinPath(path, source_pattern) |
| 434 | if len(set): |
| 435 | exclude_paths += [path] |
| 436 | |
| 437 | exclude_paths = [RelativeProjectPath(env, path).replace('\\', '/') for path in exclude_paths] |
| 438 | |
| 439 | all_files = CollectFiles(all_paths, source_pattern) |
| 440 | src_files = project['FILES'] |
| 441 | |
| 442 | exclude_files = ExcludeFiles(all_files, src_files) |
| 443 | exclude_files = [RelativeProjectPath(env, file).replace('\\', '/') for file in exclude_files] |
| 444 | |
| 445 | env['ExPaths'] = exclude_paths |
| 446 | env['ExFiles'] = exclude_files |
| 447 | |
| 448 | return exclude_paths + exclude_files |
| 449 |
no test coverage detected