5454from scanpipe .models import CodebaseRelation
5555from scanpipe .models import CodebaseResource
5656from scanpipe .models import convert_glob_to_django_regex
57+ from scanpipe .pipes import d2d_config
5758from scanpipe .pipes import flag
5859from scanpipe .pipes import get_resource_diff_ratio
5960from scanpipe .pipes import js
@@ -1939,7 +1940,10 @@ def map_rust_binaries_with_symbols(project, logger=None):
19391940 )
19401941
19411942 # Collect source symbols from rust source files
1942- rust_from_resources = from_resources .filter (extension = ".rs" )
1943+ rust_config = d2d_config .get_ecosystem_config (ecosystem = "Rust" )
1944+ rust_from_resources = from_resources .filter (
1945+ extension__in = rust_config .source_symbol_extensions
1946+ )
19431947
19441948 map_binaries_with_symbols (
19451949 project = project ,
@@ -1959,7 +1963,10 @@ def map_elfs_binaries_with_symbols(project, logger=None):
19591963 )
19601964
19611965 # Collect source symbols from elf related source files
1962- elf_from_resources = from_resources .filter (extension__in = [".c" , ".cpp" , ".h" ])
1966+ elf_config = d2d_config .get_ecosystem_config (ecosystem = "Elf" )
1967+ elf_from_resources = from_resources .filter (
1968+ extension__in = elf_config .source_symbol_extensions
1969+ )
19631970
19641971 map_binaries_with_symbols (
19651972 project = project ,
@@ -1982,8 +1989,9 @@ def map_macho_binaries_with_symbols(project, logger=None):
19821989 )
19831990
19841991 # Collect source symbols from macos related source files
1992+ macos_config = d2d_config .get_ecosystem_config (ecosystem = "MacOS" )
19851993 mac_from_resources = from_resources .filter (
1986- extension__in = [ ".c" , ".cpp" , ".h" , ".m" , ".swift" ]
1994+ extension__in = macos_config . source_symbol_extensions ,
19871995 )
19881996
19891997 map_binaries_with_symbols (
@@ -2004,8 +2012,9 @@ def map_winpe_binaries_with_symbols(project, logger=None):
20042012 )
20052013
20062014 # Collect source symbols from windows related source files
2015+ windows_config = d2d_config .get_ecosystem_config (ecosystem = "Windows" )
20072016 windows_from_resources = from_resources .filter (
2008- extension__in = [ ".c" , ".cpp" , ".h" , ".cs" ]
2017+ extension__in = windows_config . source_symbol_extensions ,
20092018 )
20102019
20112020 map_binaries_with_symbols (
@@ -2071,16 +2080,17 @@ def map_javascript_symbols(project, logger=None):
20712080 """Map deployed JavaScript, TypeScript to its sources using symbols."""
20722081 project_files = project .codebaseresources .files ()
20732082
2083+ js_config = d2d_config .get_ecosystem_config (ecosystem = "JavaScript" )
20742084 javascript_to_resources = (
20752085 project_files .to_codebase ()
20762086 .has_no_relation ()
2077- .filter (extension__in = [ ".ts" , ".js" ] )
2087+ .filter (extension__in = js_config . source_symbol_extensions )
20782088 )
20792089
20802090 javascript_from_resources = (
20812091 project_files .from_codebase ()
20822092 .exclude (path__contains = "/test/" )
2083- .filter (extension__in = [ ".ts" , ".js" ] )
2093+ .filter (extension__in = js_config . source_symbol_extensions )
20842094 )
20852095
20862096 if not (javascript_from_resources .exists () and javascript_to_resources .exists ()):
0 commit comments