fix: remove hardcoded wildcard and use the ones from the rules
This commit is contained in:
		
							parent
							
								
									9b1e01bd66
								
							
						
					
					
						commit
						2781990ff5
					
				
					 2 changed files with 9 additions and 8 deletions
				
			
		|  | @ -1,4 +1,5 @@ | |||
| from typing import cast, Protocol, Iterable | ||||
| from itertools import chain | ||||
| from pathlib import Path | ||||
| import os | ||||
| 
 | ||||
|  | @ -192,8 +193,9 @@ def resolveDeps(componentSpec: str, components: list[ComponentManifest], target: | |||
| 
 | ||||
| def instanciate(componentSpec: str, components: list[ComponentManifest], target: TargetManifest) -> ComponentInstance | None: | ||||
|     manifest = next(filter(lambda c: c.id == componentSpec, components)) | ||||
|     wildcards = set(chain(*map(lambda rule: rule.fileIn, rules.rules.values()))) | ||||
|     sources = shell.find( | ||||
|         manifest.dirname(), ["*.c", "*.cpp", "*.s", "*.asm"], recusive=False) | ||||
|         manifest.dirname(), list(wildcards), recusive=False) | ||||
|     enabled, unresolvedReason, resolved = resolveDeps( | ||||
|         componentSpec, components, target) | ||||
| 
 | ||||
|  |  | |||
|  | @ -14,21 +14,20 @@ class Rule: | |||
|         self.args = args | ||||
|         self.deps = deps | ||||
| 
 | ||||
| 
 | ||||
| rules: dict[str, Rule] = { | ||||
|     "cc": Rule("cc", ["c"], ["o"], "-c -o $out $in -MD -MF $out.d $flags $cincs $cdefs", ["-std=gnu2x", | ||||
|     "cc": Rule("cc", ["*.c"], ["*.o"], "-c -o $out $in -MD -MF $out.d $flags $cincs $cdefs", ["-std=gnu2x", | ||||
|                                                                                           "-Wall", | ||||
|                                                                                           "-Wextra", | ||||
|                                                                                           "-Werror"], "$out.d"), | ||||
|     "cxx": Rule("cxx", ["cpp", "cc", "cxx"], ["o"], "-c -o $out $in -MD -MF $out.d $flags $cincs $cdefs", ["-std=gnu++2b", | ||||
|     "cxx": Rule("cxx", ["*.cpp", "*.cc", "*.cxx"], ["*.o"], "-c -o $out $in -MD -MF $out.d $flags $cincs $cdefs", ["-std=gnu++2b", | ||||
|                                                                                                            "-Wall", | ||||
|                                                                                                            "-Wextra", | ||||
|                                                                                                            "-Werror", | ||||
|                                                                                                            "-fno-exceptions", | ||||
|                                                                                                            "-fno-rtti"], "$out.d"), | ||||
|     "as": Rule("as", ["s", "asm", "S"], ["o"], "-o $out $in $flags"), | ||||
|     "ar": Rule("ar", ["o"], ["a"], "$flags $out $in"), | ||||
|     "ld": Rule("ld", ["o", "a"], ["out"], "-o $out $in $flags"), | ||||
|     "as": Rule("as", ["*.s", "*.asm", "*.S"], ["*.o"], "-o $out $in $flags"), | ||||
|     "ar": Rule("ar", ["*.o"], ["*.a"], "$flags $out $in"), | ||||
|     "ld": Rule("ld", ["*.o", "*.a"], ["*.out"], "-o $out $in $flags"), | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  | @ -40,7 +39,7 @@ def byFileIn(fileIn: str) -> Rule | None: | |||
|     for key in rules: | ||||
|         rule = rules[key] | ||||
|         for ext in rule.fileIn: | ||||
|             if fileIn.endswith("." + ext): | ||||
|             if fileIn.endswith(ext[1:]): | ||||
|                 return rule | ||||
|     return None | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue