[builder] Add library queue to manage cloned environments

This commit is contained in:
Kuba Szczodrzyński
2023-02-28 21:14:23 +01:00
parent 26b393e059
commit 72ab64461c
10 changed files with 383 additions and 279 deletions

View File

@@ -12,7 +12,7 @@ platform: PlatformBase = env.PioPlatform()
@dataclass
class Library:
class ExternalLibrary:
package: str
sources: List[str]
includes: List[str]
@@ -28,13 +28,14 @@ class Library:
def env_add_external_library(
env: Environment,
queue,
name: str,
port: Optional[str] = None,
):
if port:
name += f"-{port}"
external_libs = env["EXTERNAL_LIBS"]
lib = Library(**external_libs[name])
lib = ExternalLibrary(**external_libs[name])
version = platform.versions.get(lib.package, None)
package: PackageItem = platform.pm.get_package(
@@ -45,7 +46,7 @@ def env_add_external_library(
f"Version '{version}' of library '{name}' ({lib.package}) is not installed"
)
env.AddLibrary(
queue.AddLibrary(
name=name.replace("-", "_"),
base_dir=package.path,
srcs=lib.sources,