MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / DefineGroup

Method DefineGroup

tools/ng/environment.py:49–104  ·  view source on GitHub ↗

Define a component group. This method maintains compatibility with the original DefineGroup function while using the new object-oriented implementation. Args: env: SCons Environment name: Group name src: Source fi

(env, name: str, src: List[str], depend: Any = None, **kwargs)

Source from the content-addressed store, hash-verified

47
48 @staticmethod
49 def DefineGroup(env, name: str, src: List[str], depend: Any = None, **kwargs) -> List:
50 """
51 Define a component group.
52
53 This method maintains compatibility with the original DefineGroup function
54 while using the new object-oriented implementation.
55
56 Args:
57 env: SCons Environment
58 name: Group name
59 src: Source file list
60 depend: Dependency conditions
61 **kwargs: Additional parameters (CPPPATH, CPPDEFINES, etc.)
62
63 Returns:
64 List of build objects
65 """
66 context = BuildContext.get_current()
67 if not context:
68 raise RuntimeError("BuildContext not initialized")
69
70 # Check dependencies
71 if depend and not env.GetDepend(depend):
72 return []
73
74 # Process source files
75 if isinstance(src, str):
76 src = [src]
77
78 # Create project group
79 group = ProjectGroup(
80 name=name,
81 sources=src,
82 dependencies=depend if isinstance(depend, list) else [depend] if depend else [],
83 environment=env
84 )
85
86 # Process parameters
87 group.include_paths = kwargs.get('CPPPATH', [])
88 group.defines = kwargs.get('CPPDEFINES', {})
89 group.cflags = kwargs.get('CFLAGS', '')
90 group.cxxflags = kwargs.get('CXXFLAGS', '')
91 group.local_cflags = kwargs.get('LOCAL_CFLAGS', '')
92 group.local_cxxflags = kwargs.get('LOCAL_CXXFLAGS', '')
93 group.local_include_paths = kwargs.get('LOCAL_CPPPATH', [])
94 group.local_defines = kwargs.get('LOCAL_CPPDEFINES', {})
95 group.libs = kwargs.get('LIBS', [])
96 group.lib_paths = kwargs.get('LIBPATH', [])
97
98 # Build objects
99 objects = group.build(env)
100
101 # Register group
102 context.register_project_group(group)
103
104 return objects
105
106 @staticmethod

Callers 2

DefineGroupFunction · 0.80
DefineGroupFunction · 0.80

Calls 6

buildMethod · 0.95
ProjectGroupClass · 0.85
GetDependMethod · 0.80
get_currentMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected