Coverage for /home/runner/work/coxbuild/coxbuild/src/coxbuild/extensions/builtin/__init__.py: 0%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1import coxbuild
2from coxbuild.configuration import Configuration
3from coxbuild.extensions import ProjectSettings, withProject
4from coxbuild.managers import Manager
5from coxbuild.pipelines import Pipeline
6from coxbuild.runtime import (ExecutionState, withExecutionState, withManager,
7 withPipeline, withService)
8from coxbuild.services import Service
9from coxbuild.tasks import depend, group, task
11grouped = group("")
14@grouped
15@withPipeline
16@task
17def list(*, pipeline: Pipeline):
18 """List all defined tasks."""
19 for item in pipeline.tasks.values():
20 print(f"📜 {item.name}")
21 if item.description:
22 print(f" 📖 {item.description}")
23 if item.deps:
24 print(f" 🔗 {', '.join([t.name for t in item.deps])}")
25 if item.extension:
26 print(f" ⚓ {item.extension.uri}")
29@grouped
30@withProject
31@task
32def project(*, project: ProjectSettings):
33 print(f"Name : {project.name}")
34 print(f"Description : {project.description}")
35 print(f"Version : {project.version}")
36 print(f"Author : {project.author}")
37 print(f"Source Code : {project.src}")
38 print(f"Test : {project.test}")
39 print(f"Document : {project.docs}")
40 print(f"Package : {project.package}")
43@grouped
44@withManager
45@task
46def ext(*, manager: "Manager"):
47 """List all registered extensions."""
48 for item in manager.extensions.values():
49 print(f"⚓ {item.name}")
50 if item.uri:
51 print(f" 🔗 {item.uri}")
52 if item.description:
53 print(f" 📖 {item.description}")
54 if item.version:
55 print(f" 📌 {item.version}")
56 if item.hashcode:
57 print(f" 🔑 {item.hashcode}")
60@grouped
61@withService
62@task
63async def serve(*, service: Service):
64 """Start event-based service."""
65 await service()